c – How to count the elements in a binary search tree?

I'm trying to complete this function which looks for all the elements that point to a given class. How can I fix my code?

                int log_obter_class_class (Log ** l, int class) {
int cont = 0;
Journal * current = * l;

if (* l == NULL) {
return cont = 0;
}

while (current! = NULL) {
if (class == (current-> class)) {
cont ++;
}
log_obter_class_class (& (current-> esq), class);
log_obter_class_class (& (current-> dir), class);
}
back cont;
}

That's the embed code:

void log_register (Log ** l, int account, int class, int timer, int box) {

if (* l == NULL) {
* l = create_log (account, class, timer, box);
}
Log * aux, au2;
at = * 1;

if (account < conta){
         if(aux->esq == NULL) {
aux-> esq = create_log (account, class, timer, box);
}
if not {
log_register (aux-> esq, account, class, timer, box);
}
}
if not {
if (aux-> esq == NULL) {
aux-> dir = create_log (account, class, timer, box);
}
if not {
log_register (aux-> dir, account, class, timer, box);
}
}
}

Journal * create_log (int account, int class, int timer, int box) {
Journal * new = (Journal *) malloc (sizeof (Journal));
if (new == NULL) {
output (1); // if a malloc error occurs
}
new-> account = account;
new-> class = class;
new-> timer = timer;
new-> box = box;
new-> dir = NULL; // create a direct root
new-> esq = NULL; // create the left root
return again;
}