original_code:
int m3l_AllocateNodeData(node_t **Lnode, tmpstruct_t TMPSTR, opts_t *Popt)
{
 size_t i, tot_dim;
 if(strncmp(TMPSTR.Type,"DIR",3) != 0 && strncmp(TMPSTR.Type,"LINK",4) != 0 ){
  if ( ( (*Lnode)->fdim = (size_t *)malloc(TMPSTR.ndim* sizeof(size_t))) == ((void *)0))
   Perror("malloc");
 }
 if( ( (*Lnode)->ndim = TMPSTR.ndim) < 1 )
  Error("udf_rm: too low value of number of dimensions");
 tot_dim = 1;
    if( strncmp(TMPSTR.Type,"UC",2) == 0 || strncmp(TMPSTR.Type,"SC",2) == 0 || TMPSTR.Type[0] == 'C' || strncmp(TMPSTR.Type,"DISKFILE",8) == 0){
        for(i=0; i<TMPSTR.ndim; i++){
            if ( ( (*Lnode)->fdim[i] = TMPSTR.dim[i] + 1 ) < 1 )
                Error("udf_rm: too low value of dimensions");
            tot_dim = tot_dim * TMPSTR.dim[i];
        }
    }
    else{
        for(i=0; i<TMPSTR.ndim; i++){
            if ( ( (*Lnode)->fdim[i] = TMPSTR.dim[i] ) < 1 )
                Error("udf_rm: too low value of dimensions");
            tot_dim = tot_dim * TMPSTR.dim[i];
        }
    }
 if(Popt != ((void *)0) && Popt->opt_nomalloc == 'm'){
  (*Lnode)->no_malloc = 'n';
  return 0;
 }
 if (strncmp((*Lnode)->type,"LD",2) == 0){
  if ( ( (*Lnode)->data.ldf = (long double *)malloc(tot_dim*sizeof(long double))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"D",1) == 0){
  if ( ( (*Lnode)->data.df = (double *)malloc(tot_dim*sizeof(double))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"F",1) == 0){
  if ( ( (*Lnode)->data.f = (float *)malloc(tot_dim*sizeof(float))) == ((void *)0))
   Perror("malloc");
 }
 else if (strncmp((*Lnode)->type,"SC",2) == 0){
  if ( ( (*Lnode)->data.sc = (signed char *)malloc((tot_dim+1)*sizeof(signed char))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"UC",2) == 0){
  if ( ( (*Lnode)->data.uc = (unsigned char *)malloc((tot_dim+1)*sizeof(unsigned char))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"C",1) == 0){
  if ( ( (*Lnode)->data.c = (char *)malloc((tot_dim+1)*sizeof(char))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"ULLI",4) == 0){
  if ( ( (*Lnode)->data.ulli = (unsigned long long *)malloc(tot_dim*sizeof(unsigned long long))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"SLLI",4) == 0){
  if ( ( (*Lnode)->data.slli = (signed long long int *)malloc(tot_dim*sizeof(signed long long int))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"LLI",3) == 0){
  if ( ( (*Lnode)->data.lli = (long long int *)malloc(tot_dim*sizeof(long long int))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"ULI",3) == 0){
  if ( ( (*Lnode)->data.uli = (unsigned long int *)malloc(tot_dim*sizeof(unsigned long int))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"USI",3) == 0){
  if ( ( (*Lnode)->data.usi = (unsigned short int *)malloc(tot_dim*sizeof(unsigned short int))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"SI",2) == 0){
  if ( ( (*Lnode)->data.si = (short int *)malloc(tot_dim*sizeof(short int))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"UI",2) == 0){
  if ( ( (*Lnode)->data.ui = (unsigned int *)malloc(tot_dim*sizeof(unsigned int))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"LI",2) == 0){
  if ( ( (*Lnode)->data.li = (long int *)malloc(tot_dim*sizeof(long int))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"I",1) == 0){
  if ( ( (*Lnode)->data.i = (int *)malloc(tot_dim *sizeof(int))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"ST",2) == 0){
  if ( ( (*Lnode)->data.st = (size_t *)malloc(tot_dim*sizeof(size_t))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"PTRDF",1) == 0){
  if ( ( (*Lnode)->data.ptrdf = (ptrdiff_t *)malloc(tot_dim*sizeof(ptrdiff_t))) == ((void *)0))
   Perror("malloc");
 }
 return 0;
}

canonical_original_code:
int m3l_AllocateNodeData(struct node **Lnode, struct tmpstruct TMPSTR, struct opts *Popt)
{
 unsigned long i; unsigned long tot_dim;
 if(strncmp(TMPSTR.Type,"DIR",3) != 0 && strncmp(TMPSTR.Type,"LINK",4) != 0 ){
  if ( ( (*Lnode)->fdim = (unsigned long *)malloc(TMPSTR.ndim* sizeof(unsigned long))) == ((void *)0))
   Perror("malloc");
 }
 if( ( (*Lnode)->ndim = TMPSTR.ndim) < 1 )
  Error("udf_rm: too low value of number of dimensions");
 tot_dim = 1;
    if( strncmp(TMPSTR.Type,"UC",2) == 0 || strncmp(TMPSTR.Type,"SC",2) == 0 || TMPSTR.Type[0] == 'C' || strncmp(TMPSTR.Type,"DISKFILE",8) == 0){
        for(i=0; i<TMPSTR.ndim; i++){
            if ( ( (*Lnode)->fdim[i] = TMPSTR.dim[i] + 1 ) < 1 )
                Error("udf_rm: too low value of dimensions");
            tot_dim = tot_dim * TMPSTR.dim[i];
        }
    }
    else{
        for(i=0; i<TMPSTR.ndim; i++){
            if ( ( (*Lnode)->fdim[i] = TMPSTR.dim[i] ) < 1 )
                Error("udf_rm: too low value of dimensions");
            tot_dim = tot_dim * TMPSTR.dim[i];
        }
    }
 if(Popt != ((void *)0) && Popt->opt_nomalloc == 'm'){
  (*Lnode)->no_malloc = 'n';
  return 0;
 }
 if (strncmp((*Lnode)->type,"LD",2) == 0){
  if ( ( (*Lnode)->data.ldf = (long double *)malloc(tot_dim*sizeof(long double))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"D",1) == 0){
  if ( ( (*Lnode)->data.df = (double *)malloc(tot_dim*sizeof(double))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"F",1) == 0){
  if ( ( (*Lnode)->data.f = (float *)malloc(tot_dim*sizeof(float))) == ((void *)0))
   Perror("malloc");
 }
 else if (strncmp((*Lnode)->type,"SC",2) == 0){
  if ( ( (*Lnode)->data.sc = (char *)malloc((tot_dim+1)*sizeof(char))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"UC",2) == 0){
  if ( ( (*Lnode)->data.uc = (unsigned char *)malloc((tot_dim+1)*sizeof(unsigned char))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"C",1) == 0){
  if ( ( (*Lnode)->data.c = (char *)malloc((tot_dim+1)*sizeof(char))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"ULLI",4) == 0){
  if ( ( (*Lnode)->data.ulli = (unsigned long long *)malloc(tot_dim*sizeof(unsigned long long))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"SLLI",4) == 0){
  if ( ( (*Lnode)->data.slli = (long long *)malloc(tot_dim*sizeof(long long))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"LLI",3) == 0){
  if ( ( (*Lnode)->data.lli = (long long *)malloc(tot_dim*sizeof(long long))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"ULI",3) == 0){
  if ( ( (*Lnode)->data.uli = (unsigned long *)malloc(tot_dim*sizeof(unsigned long))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"USI",3) == 0){
  if ( ( (*Lnode)->data.usi = (unsigned short *)malloc(tot_dim*sizeof(unsigned short))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"SI",2) == 0){
  if ( ( (*Lnode)->data.si = (short *)malloc(tot_dim*sizeof(short))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"UI",2) == 0){
  if ( ( (*Lnode)->data.ui = (unsigned int *)malloc(tot_dim*sizeof(unsigned int))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"LI",2) == 0){
  if ( ( (*Lnode)->data.li = (long *)malloc(tot_dim*sizeof(long))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"I",1) == 0){
  if ( ( (*Lnode)->data.i = (int *)malloc(tot_dim *sizeof(int))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"ST",2) == 0){
  if ( ( (*Lnode)->data.st = (unsigned long *)malloc(tot_dim*sizeof(unsigned long))) == ((void *)0))
   Perror("malloc");
 }
 else if(strncmp((*Lnode)->type,"PTRDF",1) == 0){
  if ( ( (*Lnode)->data.ptrdf = (long *)malloc(tot_dim*sizeof(long))) == ((void *)0))
   Perror("malloc");
 }
 return 0;
}

variable_types: struct tmpstruct { char Type[5]; unsigned long ndim; }

variable_types: struct opts { char opt_a; char opt_b; char opt_c; char opt_d; char opt_e; char opt_f; char opt_i; char opt_k; char opt_l; char opt_m; char opt_n; char opt_p; char opt_r; char opt_s; char opt_u; char opt_linkscleanemptrefs; char opt_nomalloc; char opt_tcpencoding; char opt_tcpheader; char opt_shutdown; char opt_add; char opt_MEMCP; char opt_EOBseq; char opt_REOBseq; char opt_format; char opt_xformat; } *


original_code:
node_t *m3l_AllocateNode(tmpstruct_t TMPSTR, opts_t *Popt){
 node_t *Lnode=((void *)0);
 if ( (Lnode = (node_t *)malloc(sizeof(node_t))) == ((void *)0))
  Perror("malloc");
 Lnode->next=((void *)0); Lnode->prev=((void *)0); Lnode->parent=((void *)0); Lnode->child=((void *)0); Lnode->fdim=((void *)0);
 Lnode->type=((void *)0); Lnode->name=((void *)0);
 Lnode->linknode = ((void *)0);
 Lnode->lcounter = 0;
 Lnode->no_malloc = '\0';
 Lnode->ap = 0;
 Lnode->create_time = time(0);
 if ( ( Lnode->type = (char *)malloc(5* sizeof(char))) == ((void *)0))
  Perror("malloc");
 if ( ( Lnode->name = (char *)malloc(48* sizeof(char))) == ((void *)0))
  Perror("malloc");
 if( snprintf(Lnode->type, 5,"%s",TMPSTR.Type) < 0)
  Perror("snprintf");
 if( snprintf(Lnode->name, 48 ,"%s",TMPSTR.Name_Of_List) < 0)
  Perror("snprintf");
 Lnode->ndim = TMPSTR.ndim;
 if(strncmp(TMPSTR.Type,"DIR",3) != 0 && strncmp(TMPSTR.Type,"LINK",4) != 0 ){
  if( m3l_AllocateNodeData(&Lnode, TMPSTR, Popt) != 0)
   Error("AllocateNodeData");
 }
 return Lnode;
}

canonical_original_code:
struct node *m3l_AllocateNode(struct tmpstruct TMPSTR, struct opts *Popt){
 struct node *Lnode = ((void *)0);
 if ( (Lnode = (struct node *)malloc(sizeof(node_t))) == ((void *)0))
  Perror("malloc");
 Lnode->next=((void *)0); Lnode->prev=((void *)0); Lnode->parent=((void *)0); Lnode->child=((void *)0); Lnode->fdim=((void *)0);
 Lnode->type=((void *)0); Lnode->name=((void *)0);
 Lnode->linknode = ((void *)0);
 Lnode->lcounter = 0;
 Lnode->no_malloc = '\0';
 Lnode->ap = 0;
 Lnode->create_time = time(0);
 if ( ( Lnode->type = (char *)malloc(5* sizeof(char))) == ((void *)0))
  Perror("malloc");
 if ( ( Lnode->name = (char *)malloc(48* sizeof(char))) == ((void *)0))
  Perror("malloc");
 if( snprintf(Lnode->type, 5,"%s",TMPSTR.Type) < 0)
  Perror("snprintf");
 if( snprintf(Lnode->name, 48 ,"%s",TMPSTR.Name_Of_List) < 0)
  Perror("snprintf");
 Lnode->ndim = TMPSTR.ndim;
 if(strncmp(TMPSTR.Type,"DIR",3) != 0 && strncmp(TMPSTR.Type,"LINK",4) != 0 ){
  if( m3l_AllocateNodeData(&Lnode, TMPSTR, Popt) != 0)
   Error("AllocateNodeData");
 }
 return Lnode;
}

variable_types: struct node { char *type; char *name; unsigned long *fdim; unsigned long ndim; union data_t { void *v; float *f; double *df; long double *ldf; char *c; char *sc; unsigned char *uc; short *si; unsigned short *usi; int *i; unsigned int *ui; long *li; unsigned long *uli; long long *lli; long long *slli; unsigned long long *ulli; unsigned long *st; long *ptrdf; } data; long create_time; struct node *next; struct find_str { struct node *List; } **linknode; unsigned long lcounter; char no_malloc; int ap; } *

user_defined_types: struct tmpstruct { char Type[5]; unsigned long ndim; }

user_defined_types: struct opts { char opt_a; char opt_b; char opt_c; char opt_d; char opt_e; char opt_f; char opt_i; char opt_k; char opt_l; char opt_m; char opt_n; char opt_p; char opt_r; char opt_s; char opt_u; char opt_linkscleanemptrefs; char opt_nomalloc; char opt_tcpencoding; char opt_tcpheader; char opt_shutdown; char opt_add; char opt_MEMCP; char opt_EOBseq; char opt_REOBseq; char opt_format; char opt_xformat; }

user_defined_types: struct node { char *type; char *name; unsigned long *fdim; unsigned long ndim; union data_t data; long create_time; struct node *next; struct find_str **linknode; unsigned long lcounter; char no_malloc; int ap; }


original_code:
size_t m3l_get_ind(size_t ndim, size_t *ind, size_t *dim)
{
 size_t ret_ind, tmp,k,l;
 ret_ind = 0;
 for (k=0; k<ndim-1; k++){
  tmp = 1;
  for (l=k+1; l<ndim; l++)
   tmp = tmp*dim[l];
  ret_ind = ret_ind + ind[k]*tmp;
 }
 ret_ind = ret_ind + ind[ndim-1];
 return ret_ind;
}

canonical_original_code:
unsigned long m3l_get_ind(unsigned long ndim, unsigned long *ind, unsigned long *dim)
{
 unsigned long ret_ind; unsigned long tmp; unsigned long k; unsigned long l;
 ret_ind = 0;
 for (k=0; k<ndim-1; k++){
  tmp = 1;
  for (l=k+1; l<ndim; l++)
   tmp = tmp*dim[l];
  ret_ind = ret_ind + ind[k]*tmp;
 }
 ret_ind = ret_ind + ind[ndim-1];
 return ret_ind;
}

variable_types:
ndim
unsigned long

variable_types:
ind
unsigned long *

variable_types:
dim
unsigned long *

variable_types:
tmp
unsigned long

variable_types:
k
unsigned long

variable_types:
l
unsigned long

return_type: unsigned long


original_code:
size_t m3l_get_4nd(size_t i, size_t j, size_t k, size_t l, size_t jm, size_t km, size_t lm)
{
 size_t ret_ind;
  ret_ind = i*jm*km*lm+j*km*lm+k*lm+l;
 return ret_ind;
}

canonical_original_code:
unsigned long m3l_get_4nd(unsigned long i, unsigned long j, unsigned long k, unsigned long l, unsigned long jm, unsigned long km, unsigned long lm)
{
 unsigned long ret_ind;
  ret_ind = i*jm*km*lm+j*km*lm+k*lm+l;
 return ret_ind;
}

variable_types:
i
unsigned long

variable_types:
j
unsigned long

variable_types:
jm
unsigned long

variable_types:
km
unsigned long

variable_types:
lm
unsigned long


original_code:
size_t m3l_get_3ind(size_t i, size_t j, size_t k, size_t jm, size_t km)
{
 size_t ret_ind;
  ret_ind = i*jm*km+j*km+k;
 return ret_ind;
}

canonical_original_code:
unsigned long m3l_get_3ind(unsigned long i, unsigned long j, unsigned long k, unsigned long jm, unsigned long km)
{
 unsigned long ret_ind;
  ret_ind = i*jm*km+j*km+k;
 return ret_ind;
}


decompiled_code:
__int64 __fastcall m3l_get_2ind(__int64 a1, __int64 a2, __int64 a3)
{
return a3 * a1 + a2;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3)
{
return a3 * a1 + a2;
}

original_code:
size_t m3l_get_2ind(size_t i, size_t j, size_t jm)
{
 size_t ret_ind;
  ret_ind = i*jm+j;
 return ret_ind;
}

canonical_original_code:
unsigned long m3l_get_2ind(unsigned long i, unsigned long j, unsigned long jm)
{
 unsigned long ret_ind;
  ret_ind = i*jm+j;
 return ret_ind;
}


original_code:
void *m3l_get_data_pointer(node_t *Lnode)
{
 node_t *TmpNode;
 TmpNode = Lnode;
 if(strncmp(Lnode->type, "LINK",4) == 0)
  TmpNode = Lnode->child;
 if(strncmp( TmpNode->type,"DIR",3) == 0)
  return ((void *)0);
 if (strncmp(TmpNode->type,"LD",2) == 0){
  return (void *)TmpNode->data.ldf;
 }
 else if(strncmp(TmpNode->type,"D",1) == 0){
  return (void *)TmpNode->data.df;
 }
 else if(strncmp(TmpNode->type,"F",1) == 0){
  return (void *)TmpNode->data.f;
 }
 else if (strncmp(TmpNode->type,"SC",2) == 0){
  return (void *)TmpNode->data.sc;
 }
 else if(strncmp(TmpNode->type,"UC",2) == 0){
  return (void *)TmpNode->data.uc;
 }
 else if(strncmp(TmpNode->type,"C",1) == 0){
  return (void *)TmpNode->data.c;
 }
 else if(strncmp(TmpNode->type,"ULLI",4) == 0){
  return (void *)TmpNode->data.ulli;
 }
 else if(strncmp(TmpNode->type,"SLLI",4) == 0){
  return (void *)TmpNode->data.slli;
 }
 else if(strncmp(TmpNode->type,"LLI",3) == 0){
  return (void *)TmpNode->data.lli;
 }
 else if(strncmp(TmpNode->type,"ULI",3) == 0){
  return (void *)TmpNode->data.uli;
 }
 else if(strncmp(TmpNode->type,"USI",3) == 0){
  return (void *)TmpNode->data.usi;
 }
 else if(strncmp(TmpNode->type,"SI",2) == 0){
  return (void *)TmpNode->data.si;
 }
 else if(strncmp(TmpNode->type,"UI",2) == 0){
  return (void *)TmpNode->data.ui;
 }
 else if(strncmp(TmpNode->type,"LI",2) == 0){
  return (void *)TmpNode->data.li;
 }
 else if(strncmp(TmpNode->type,"I",1) == 0){
  return (void *)TmpNode->data.i;
 }
 else if(strncmp(TmpNode->type,"ST",2) == 0){
  return (void *)TmpNode->data.st;
 }
 else if(strncmp(TmpNode->type,"PTRDF",1) == 0){
  return (void *)TmpNode->data.ptrdf;
 }
 return ((void *)0);
}

canonical_original_code:
void *m3l_get_data_pointer(struct node *Lnode)
{
 struct node *TmpNode;
 TmpNode = Lnode;
 if(strncmp(Lnode->type, "LINK",4) == 0)
  TmpNode = Lnode->child;
 if(strncmp( TmpNode->type,"DIR",3) == 0)
  return ((void *)0);
 if (strncmp(TmpNode->type,"LD",2) == 0){
  return (void *)TmpNode->data.ldf;
 }
 else if(strncmp(TmpNode->type,"D",1) == 0){
  return (void *)TmpNode->data.df;
 }
 else if(strncmp(TmpNode->type,"F",1) == 0){
  return (void *)TmpNode->data.f;
 }
 else if (strncmp(TmpNode->type,"SC",2) == 0){
  return (void *)TmpNode->data.sc;
 }
 else if(strncmp(TmpNode->type,"UC",2) == 0){
  return (void *)TmpNode->data.uc;
 }
 else if(strncmp(TmpNode->type,"C",1) == 0){
  return (void *)TmpNode->data.c;
 }
 else if(strncmp(TmpNode->type,"ULLI",4) == 0){
  return (void *)TmpNode->data.ulli;
 }
 else if(strncmp(TmpNode->type,"SLLI",4) == 0){
  return (void *)TmpNode->data.slli;
 }
 else if(strncmp(TmpNode->type,"LLI",3) == 0){
  return (void *)TmpNode->data.lli;
 }
 else if(strncmp(TmpNode->type,"ULI",3) == 0){
  return (void *)TmpNode->data.uli;
 }
 else if(strncmp(TmpNode->type,"USI",3) == 0){
  return (void *)TmpNode->data.usi;
 }
 else if(strncmp(TmpNode->type,"SI",2) == 0){
  return (void *)TmpNode->data.si;
 }
 else if(strncmp(TmpNode->type,"UI",2) == 0){
  return (void *)TmpNode->data.ui;
 }
 else if(strncmp(TmpNode->type,"LI",2) == 0){
  return (void *)TmpNode->data.li;
 }
 else if(strncmp(TmpNode->type,"I",1) == 0){
  return (void *)TmpNode->data.i;
 }
 else if(strncmp(TmpNode->type,"ST",2) == 0){
  return (void *)TmpNode->data.st;
 }
 else if(strncmp(TmpNode->type,"PTRDF",1) == 0){
  return (void *)TmpNode->data.ptrdf;
 }
 return ((void *)0);
}

return_type: void *

user_defined_types: union data_t { void *v; float *f; double *df; long double *ldf; char *c; char *sc; unsigned char *uc; short *si; unsigned short *usi; int *i; unsigned int *ui; long *li; unsigned long *uli; long long *lli; long long *slli; unsigned long long *ulli; unsigned long *st; long *ptrdf; }


decompiled_code:
const void *__fastcall m3l_get_List_dim(const void **a1)
{
const void **v1; // rax

v1 = a1;
if ( !memcmp(*a1, "LINK", 4uLL) )
v1 = (const void **)v1[9];
return v1[2];
}

canonical_decompiled_code:
const void *__fastcall func5(const void **a1)
{
const void **v1; // rax

v1 = a1;
if ( !memcmp(*a1, "LINK", 4uLL) )
v1 = (const void **)v1[9];
return v1[2];
}

original_code:
size_t *m3l_get_List_dim(node_t *List){
 node_t *TmpNode;
 TmpNode = List;
 if(strncmp(TmpNode->type, "LINK",4) == 0)
  TmpNode = List->child;
 return TmpNode->fdim;
}

canonical_original_code:
unsigned long *m3l_get_List_dim(struct node *List){
 struct node *TmpNode;
 TmpNode = List;
 if(strncmp(TmpNode->type, "LINK",4) == 0)
  TmpNode = List->child;
 return TmpNode->fdim;
}

return_type: unsigned long *


decompiled_code:
__int64 __fastcall m3l_get_List_totdim(const void **a1)
{
_BYTE *v1; // rdx
const void **v2; // rax
const void *v3; // rdx
__int64 v4; // r8
_QWORD *v5; // rax
_QWORD *v6; // rdx

v1 = *a1;
v2 = a1;
if ( !memcmp(*a1, "LINK", 4uLL) )
{
v2 = (const void **)v2[9];
v1 = *v2;
}
if ( *v1 == 68 && v1[1] == 73 && v1[2] == 82 )
return -1LL;
v3 = v2[3];
if ( v3 == (char *)m3l_get_ind + 1 )
return *(_QWORD *)v2[2];
v4 = 1LL;
if ( v3 )
{
v5 = v2[2];
v4 = 1LL;
v6 = &v5[(_QWORD)v3];
do
v4 *= *v5++;
while ( v5 != v6 );
}
return v4;
}

original_code:
size_t m3l_get_List_totdim(node_t *List){
 size_t tot_dim, i;
 node_t *TmpNode;
 TmpNode = List;
 if(strncmp(TmpNode->type, "LINK",4) == 0)
  TmpNode = List->child;
 if(strncmp( TmpNode->type,"DIR",3) == 0)
  return -1;
 tot_dim = 1;
 if(TmpNode->ndim == 1)
  return TmpNode->fdim[0];
 else{
  for(i=0; i<TmpNode->ndim; i++)
   tot_dim = tot_dim*TmpNode->fdim[i];
  return tot_dim;
 }
}

canonical_original_code:
unsigned long m3l_get_List_totdim(struct node *List){
 unsigned long tot_dim; unsigned long i;
 struct node *TmpNode;
 TmpNode = List;
 if(strncmp(TmpNode->type, "LINK",4) == 0)
  TmpNode = List->child;
 if(strncmp( TmpNode->type,"DIR",3) == 0)
  return -1;
 tot_dim = 1;
 if(TmpNode->ndim == 1)
  return TmpNode->fdim[0];
 else{
  for(i=0; i<TmpNode->ndim; i++)
   tot_dim = tot_dim*TmpNode->fdim[i];
  return tot_dim;
 }
}


decompiled_code:
__int64 __fastcall m3l_get_List_ndim(__int64 a1)
{
return *(_QWORD *)(a1 + 24);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1)
{
return *(_QWORD *)(a1 + 24);
}

original_code:
size_t m3l_get_List_ndim(node_t *List){
 return List->ndim;
}

canonical_original_code:
unsigned long m3l_get_List_ndim(struct node *List){
 return List->ndim;
}


decompiled_code:
__int64 __fastcall m3l_get_List_type(__int64 a1)
{
return *(_QWORD *)a1;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
return *(_QWORD *)a1;
}

original_code:
char *m3l_get_List_type(node_t *List){
 return List->type;
}

canonical_original_code:
char *m3l_get_List_type(struct node *List){
 return List->type;
}

return_type: char *


decompiled_code:
__int64 __fastcall m3l_get_List_name(__int64 a1)
{
return *(_QWORD *)(a1 + 8);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1)
{
return *(_QWORD *)(a1 + 8);
}

original_code:
char *m3l_get_List_name(node_t *List){
 return List->name;
}

canonical_original_code:
char *m3l_get_List_name(struct node *List){
 return List->name;
}


decompiled_code:
__int64 __fastcall m3l_get_Found_number(__int64 a1)
{
return *(_QWORD *)(a1 + 8);
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1)
{
return *(_QWORD *)(a1 + 8);
}

original_code:
size_t m3l_get_Found_number(find_t *Founds){
 return Founds->founds;
}

canonical_original_code:
unsigned long m3l_get_Found_number(struct find *Founds){
 return Founds->founds;
}

variable_types: struct find { struct find_str { struct node { char *type; char *name; unsigned long *fdim; unsigned long ndim; union data_t { void *v; float *f; double *df; long double *ldf; char *c; char *sc; unsigned char *uc; short *si; unsigned short *usi; int *i; unsigned int *ui; long *li; unsigned long *uli; long long *lli; long long *slli; unsigned long long *ulli; unsigned long *st; long *ptrdf; } data; long create_time; struct node *next; struct find_str **linknode; unsigned long lcounter; char no_malloc; int ap; } *List; } **Found_Nodes; unsigned long founds; struct node *Home_Node; } *

user_defined_types: struct find { struct find_str **Found_Nodes; unsigned long founds; struct node *Home_Node; }


decompiled_code:
__int64 __fastcall m3l_get_Found_node(_QWORD *a1, __int64 a2)
{
return **(_QWORD **)(*a1 + 8 * a2);
}

canonical_decompiled_code:
__int64 __fastcall func11(_QWORD *a1, __int64 a2)
{
return **(_QWORD **)(*a1 + 8 * a2);
}

original_code:
node_t *m3l_get_Found_node(find_t *Founds, size_t i){
 return Founds->Found_Nodes[i]->List;
}

canonical_original_code:
struct node *m3l_get_Found_node(struct find *Founds, unsigned long i){
 return Founds->Found_Nodes[i]->List;
}

variable_types: struct find { struct find_str **Found_Nodes; unsigned long founds; struct node *Home_Node; } *

return_type: struct node { char *type; char *name; unsigned long *fdim; unsigned long ndim; union data_t { void *v; float *f; double *df; long double *ldf; char *c; char *sc; unsigned char *uc; short *si; unsigned short *usi; int *i; unsigned int *ui; long *li; unsigned long *uli; long long *lli; long long *slli; unsigned long long *ulli; unsigned long *st; long *ptrdf; } data; long create_time; struct node *next; struct find_str { struct node *List; } **linknode; unsigned long lcounter; char no_malloc; int ap; } *


decompiled_code:
__int64 __fastcall m3l_get_List_no_malloc(const void **a1)
{
_BYTE *v1; // rdx
const void **v2; // rax
__int64 result; // rax

v1 = *a1;
v2 = a1;
if ( !memcmp(*a1, "LINK", 4uLL) )
{
v2 = (const void **)v2[9];
v1 = *v2;
}
if ( *v1 == 68 && v1[1] == 73 && v1[2] == 82 )
result = 101LL;
else
result = *((unsigned __int8 *)v2 + 96);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(const void **a1)
{
_BYTE *v1; // rdx
const void **v2; // rax
__int64 result; // rax

v1 = *a1;
v2 = a1;
if ( !memcmp(*a1, "LINK", 4uLL) )
{
v2 = (const void **)v2[9];
v1 = *v2;
}
if ( *v1 == 68 && v1[1] == 73 && v1[2] == 82 )
result = 101LL;
else
result = *((unsigned __int8 *)v2 + 96);
return result;
}

original_code:
char m3l_get_List_no_malloc(node_t *List){
 node_t *TmpNode;
 TmpNode = List;
 if(strncmp(TmpNode->type, "LINK",4) == 0)
  TmpNode = TmpNode->child;
 if(strncmp( TmpNode->type,"DIR",3) == 0)
  return 'e';
 return TmpNode->no_malloc;
}

canonical_original_code:
char m3l_get_List_no_malloc(struct node *List){
 struct node *TmpNode;
 TmpNode = List;
 if(strncmp(TmpNode->type, "LINK",4) == 0)
  TmpNode = TmpNode->child;
 if(strncmp( TmpNode->type,"DIR",3) == 0)
  return 'e';
 return TmpNode->no_malloc;
}

return_type: char


decompiled_code:
const void *__fastcall m3l_detach_data_from_List(const void ***a1)
{
bool v1; // cf
bool v2; // zf
const void **v3; // r8
__int64 v5; // rcx
const char *v6; // rdi
const char *v7; // rsi
const void *result; // rax

v3 = *a1;
v5 = 4LL;
v6 = "LINK";
v7 = (const char *)*v3;
do
{
if ( !v5 )
break;
v1 = *v7 < (unsigned int)*v6;
v2 = *v7++ == *v6++;
--v5;
}
while ( v2 );
if ( (!v1 && !v2) == v1 )
{
Warning("m3l_detach_data_from_List: Can not detach LINK type list", v7);
result = 0LL;
}
else
{
result = m3l_get_data_pointer(v3);
if ( result )
*((_BYTE *)*a1 + 96) = 110;
}
return result;
}

canonical_decompiled_code:
const void *__fastcall func13(const void ***a1)
{
bool v1; // cf
bool v2; // zf
const void **v3; // r8
__int64 v5; // rcx
const char *v6; // rdi
const char *v7; // rsi
const void *result; // rax

v3 = *a1;
v5 = 4LL;
v6 = "LINK";
v7 = (const char *)*v3;
do
{
if ( !v5 )
break;
v1 = *v7 < (unsigned int)*v6;
v2 = *v7++ == *v6++;
--v5;
}
while ( v2 );
if ( (!v1 && !v2) == v1 )
{
Warning("m3l_detach_data_from_List: Can not detach LINK type list", v7);
result = 0LL;
}
else
{
result = func4(v3);
if ( result )
*((_BYTE *)*a1 + 96) = 110;
}
return result;
}

original_code:
void *m3l_detach_data_from_List(node_t **List, opts_t *Popts)
{
 node_t *RetNode=((void *)0);
 if(strncmp((*List)->type, "LINK",4) == 0){
  Warning("m3l_detach_data_from_List: Can not detach LINK type list");
  return ((void *)0);
 }
 if( (RetNode = m3l_get_data_pointer( *List )) != ((void *)0)){
  (*List)->no_malloc = 'n';
  return RetNode;
 }
 else{
  return ((void *)0);
 }
}

canonical_original_code:
void *m3l_detach_data_from_List(struct node **List, struct opts *Popts)
{
 struct node *RetNode = ((void *)0);
 if(strncmp((*List)->type, "LINK",4) == 0){
  Warning("m3l_detach_data_from_List: Can not detach LINK type list");
  return ((void *)0);
 }
 if( (RetNode = m3l_get_data_pointer( *List )) != ((void *)0)){
  (*List)->no_malloc = 'n';
  return RetNode;
 }
 else{
  return ((void *)0);
 }
}

variable_types: struct node { char *type; char *name; unsigned long *fdim; unsigned long ndim; union data_t { void *v; float *f; double *df; long double *ldf; char *c; char *sc; unsigned char *uc; short *si; unsigned short *usi; int *i; unsigned int *ui; long *li; unsigned long *uli; long long *lli; long long *slli; unsigned long long *ulli; unsigned long *st; long *ptrdf; } data; long create_time; struct node *next; struct find_str { struct node *List; } **linknode; unsigned long lcounter; char no_malloc; int ap; } **


decompiled_code:
__int64 __fastcall m3l_attach_data_to_List(const void ***a1)
{
bool v1; // cf
bool v2; // zf
const void **v3; // r8
__int64 v5; // rcx
const char *v6; // rdi
const char *v7; // rsi
const void *v8; // r8
__int64 result; // rax

v3 = *a1;
v5 = 4LL;
v6 = "LINK";
v7 = (const char *)*v3;
do
{
if ( !v5 )
break;
v1 = *v7 < (unsigned int)*v6;
v2 = *v7++ == *v6++;
--v5;
}
while ( v2 );
if ( (!v1 && !v2) == v1 )
{
Warning("m3l_attach_data_to_List: Can not attach LINK type list", v7);
result = 0xFFFFFFFFLL;
}
else
{
v8 = m3l_get_data_pointer(v3);
result = 0LL;
if ( v8 )
{
*((_BYTE *)*a1 + 96) = 0;
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(const void ***a1)
{
bool v1; // cf
bool v2; // zf
const void **v3; // r8
__int64 v5; // rcx
const char *v6; // rdi
const char *v7; // rsi
const void *v8; // r8
__int64 result; // rax

v3 = *a1;
v5 = 4LL;
v6 = "LINK";
v7 = (const char *)*v3;
do
{
if ( !v5 )
break;
v1 = *v7 < (unsigned int)*v6;
v2 = *v7++ == *v6++;
--v5;
}
while ( v2 );
if ( (!v1 && !v2) == v1 )
{
Warning("m3l_attach_data_to_List: Can not attach LINK type list", v7);
result = 0xFFFFFFFFLL;
}
else
{
v8 = func4(v3);
result = 0LL;
if ( v8 )
{
*((_BYTE *)*a1 + 96) = 0;
result = 1LL;
}
}
return result;
}

original_code:
int m3l_attach_data_to_List(node_t **Lnode, opts_t *Popts){
 if(strncmp((*Lnode)->type, "LINK",4) == 0){
  Warning("m3l_attach_data_to_List: Can not attach LINK type list");
  return -1;
 }
 if( m3l_get_data_pointer( *Lnode ) != ((void *)0)){
  (*Lnode)->no_malloc = '\0';
  return 1;
 }
 else
  return 0;
}

canonical_original_code:
int m3l_attach_data_to_List(struct node **Lnode, struct opts *Popts){
 if(strncmp((*Lnode)->type, "LINK",4) == 0){
  Warning("m3l_attach_data_to_List: Can not attach LINK type list");
  return -1;
 }
 if( m3l_get_data_pointer( *Lnode ) != ((void *)0)){
  (*Lnode)->no_malloc = '\0';
  return 1;
 }
 else
  return 0;
}

return_type: int


decompiled_code:
__int64 __fastcall m3l_RenameList(__int64 a1, const char *a2)
{
size_t v2; // rax
size_t v3; // rbp
__int64 result; // rax
_OWORD *v5; // rax

v2 = strlen(a2);
if ( v2 > 0x30 )
goto LABEL_7;
v3 = v2;
result = 0LL;
if ( !a1 )
return result;
v5 = *(_OWORD **)(a1 + 8);
if ( !v5 )
{
LABEL_7:
Warning("m3l_RenameList: Node name not malloced", a2);
return 0xFFFFFFFFLL;
}
*v5 = 0LL;
v5[1] = 0LL;
v5[2] = 0LL;
if ( snprintf(*(char **)(a1 + 8), v3, "%s", a2) < 0 )
{
Perror("m3l_RenameList: snprintf");
result = 0xFFFFFFFFLL;
}
else
{
*(_BYTE *)(*(_QWORD *)(a1 + 8) + v3) = 0;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, const char *a2)
{
size_t v2; // rax
size_t v3; // rbp
__int64 result; // rax
_OWORD *v5; // rax

v2 = strlen(a2);
if ( v2 > 0x30 )
goto LABEL_7;
v3 = v2;
result = 0LL;
if ( !a1 )
return result;
v5 = *(_OWORD **)(a1 + 8);
if ( !v5 )
{
LABEL_7:
Warning("m3l_RenameList: Node name not malloced", a2);
return 0xFFFFFFFFLL;
}
*v5 = 0LL;
v5[1] = 0LL;
v5[2] = 0LL;
if ( snprintf(*(char **)(a1 + 8), v3, "%s", a2) < 0 )
{
Perror("m3l_RenameList: snprintf");
result = 0xFFFFFFFFLL;
}
else
{
*(_BYTE *)(*(_QWORD *)(a1 + 8) + v3) = 0;
result = 1LL;
}
return result;
}

original_code:
int m3l_RenameList(node_t *Lnode, char *newname, opts_t *Popts){
 size_t len;
 len = strlen(newname);
 if(len > 48){
  Warning("m3l_RenameList: Node name not malloced");
  return -1;
 }
 if(Lnode != ((void *)0)){
  if(Lnode->name == ((void *)0)){
   Warning("m3l_RenameList: Node name not malloced");
   return -1;
  }
  bzero(Lnode->name, 48);
  if( snprintf( Lnode->name, len,"%s", newname) < 0){
   Perror("m3l_RenameList: snprintf");
   return -1;
  }
  Lnode->name[len] = '\0';
  return 1;
 }
 return 0;
}

canonical_original_code:
int m3l_RenameList(struct node *Lnode, char *newname, struct opts *Popts){
 unsigned long len;
 len = strlen(newname);
 if(len > 48){
  Warning("m3l_RenameList: Node name not malloced");
  return -1;
 }
 if(Lnode != ((void *)0)){
  if(Lnode->name == ((void *)0)){
   Warning("m3l_RenameList: Node name not malloced");
   return -1;
  }
  bzero(Lnode->name, 48);
  if( snprintf( Lnode->name, len,"%s", newname) < 0){
   Perror("m3l_RenameList: snprintf");
   return -1;
  }
  Lnode->name[len] = '\0';
  return 1;
 }
 return 0;
}

variable_types:
newname
char *

variable_types:
len
unsigned long


decompiled_code:
__int64 __fastcall m3l_chmod(__int64 a1, __int64 a2)
{
__int64 result; // rax

if ( !a1 )
return 0xFFFFFFFFLL;
if ( (int)a2 > 0 )
{
Warning("Wrong mode", a2);
result = 4294967294LL;
}
else
{
*(_DWORD *)(a1 + 100) = a2;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1, __int64 a2)
{
__int64 result; // rax

if ( !a1 )
return 0xFFFFFFFFLL;
if ( (int)a2 > 0 )
{
Warning("Wrong mode", a2);
result = 4294967294LL;
}
else
{
*(_DWORD *)(a1 + 100) = a2;
}
return result;
}

original_code:
int m3l_chmod(node_t *Lnode, int ap, opts_t *Popts){
 if(Lnode != ((void *)0)){
  if(ap > 0){
   Warning("Wrong mode");
   return -2;
  }
  Lnode->ap = ap;
 }
 else
  return -1;
}

canonical_original_code:
int m3l_chmod(struct node *Lnode, int ap, struct opts *Popts){
 if(Lnode != ((void *)0)){
  if(ap > 0){
   Warning("Wrong mode");
   return -2;
  }
  Lnode->ap = ap;
 }
 else
  return -1;
}

variable_types: struct node { char *type; char *name; unsigned long *fdim; unsigned long ndim; union data_t { void *v; float *f; double *df; long double *ldf; char *c; char *sc; unsigned char *uc; short *si; unsigned short *usi; int *i; unsigned int *ui; long *li; unsigned long *uli; long long *lli; long long *slli; unsigned long long *ulli; unsigned long *st; long *ptrdf; } data; long create_time; struct node *next; struct find_str { struct node *List; } **linknode; unsigned long lcounter; char no_malloc; int ap; } *

variable_types: ap int

variable_types: struct opts { char opt_a; char opt_b; char opt_c; char opt_d; char opt_e; char opt_f; char opt_i; char opt_k; char opt_l; char opt_m; char opt_n; char opt_p; char opt_r; char opt_s; char opt_u; char opt_linkscleanemptrefs; char opt_nomalloc; char opt_tcpencoding; char opt_tcpheader; char opt_shutdown; char opt_add; char opt_MEMCP; char opt_EOBseq; char opt_REOBseq; char opt_format; char opt_xformat; } *


decompiled_code:
__int64 __fastcall m3l_Mount(const char *a1)
{
__int64 result; // rax
char s[8]; // [rsp+10h] [rbp-58h] BYREF
__int64 v3; // [rsp+48h] [rbp-20h]

if ( snprintf(&s[5], 0x30uLL, "%s", a1) < 0 )
Perror("snprintf");
v3 = 0LL;
result = m3l_AllocateNode(0LL);
if ( !result )
{
Error("Allocate");
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1)
{
__int64 result; // rax
char s[8]; // [rsp+10h] [rbp-58h] BYREF
__int64 v3; // [rsp+48h] [rbp-20h]

if ( snprintf(&s[5], 0x30uLL, "%s", a1) < 0 )
Perror("snprintf");
v3 = 0LL;
result = m3l_AllocateNode(0LL);
if ( !result )
{
Error("Allocate");
result = 0LL;
}
return result;
}

original_code:
node_t *m3l_Mount(const char *name)
{
 tmpstruct_t TMPSTR;
 node_t *Dnode;
 if( snprintf(TMPSTR.Name_Of_List, sizeof(TMPSTR.Name_Of_List),"%s", name) < 0)
  Perror("snprintf");
 if( snprintf(TMPSTR.Type, sizeof(TMPSTR.Type),"%s", "DIR") < 0)
  Perror("snprintf");
 TMPSTR.ndim = 0;
 if( (Dnode = m3l_AllocateNode(TMPSTR, ((void *)0))) == ((void *)0)){
  Error("Allocate");
  return ((void *)0);
 }
 return Dnode;
}

canonical_original_code:
struct node *m3l_Mount(char *name)
{
 struct tmpstruct TMPSTR;
 struct node *Dnode;
 if( snprintf(TMPSTR.Name_Of_List, sizeof(TMPSTR.Name_Of_List),"%s", name) < 0)
  Perror("snprintf");
 if( snprintf(TMPSTR.Type, sizeof(TMPSTR.Type),"%s", "DIR") < 0)
  Perror("snprintf");
 TMPSTR.ndim = 0;
 if( (Dnode = m3l_AllocateNode(TMPSTR, ((void *)0))) == ((void *)0)){
  Error("Allocate");
  return ((void *)0);
 }
 return Dnode;
}

variable_types:
name
char *

variable_types: struct tmpstruct { char Type[5]; unsigned long ndim; }


decompiled_code:
__int64 __fastcall m3l_server_openbindlistensocket(unsigned __int16 a1)
{
int v1; // er12
__int16 v2; // ax
int v3; // edx
const void *v4; // rcx
socklen_t v5; // er8
int v7; // [rsp+4h] [rbp-34h] BYREF
__int64 optval; // [rsp+8h] [rbp-30h] BYREF
struct sockaddr addr; // [rsp+10h] [rbp-28h] BYREF

v1 = socket(2, 1, 0);
if ( v1 < 0 )
Perror("socket()");
*(_QWORD *)&addr.sa_data[6] = 0LL;
addr.sa_family = 2;
*(_QWORD *)&addr.sa_data[2] = (unsigned int)_bswap_32_constprop_0(a1, 1LL, 2LL, &v7, 4LL);
v2 = _bswap_16(a1);
v7 = 1;
*(_WORD *)addr.sa_data = v2;
if ( setsockopt(v1, 1, v3, v4, v5) == -1 )
Perror("setsockopt(...,SO_REUSEADDR,...)");
optval = 0x1E00000001LL;
if ( setsockopt(v1, 1, 13, &optval, 8u) == -1 )
Perror("setsockopt(...,SO_LINGER,...)");
if ( bind(v1, &addr, 0x10u) < 0 )
Perror("bind()");
if ( listen(v1, 10) )
{
Perror("Can't configure listening port");
abort();
}
return (unsigned int)v1;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int16 a1)
{
int v1; // er12
__int16 v2; // ax
int v3; // edx
const void *v4; // rcx
socklen_t v5; // er8
int v7; // [rsp+4h] [rbp-34h] BYREF
__int64 optval; // [rsp+8h] [rbp-30h] BYREF
struct sockaddr addr; // [rsp+10h] [rbp-28h] BYREF

v1 = socket(2, 1, 0);
if ( v1 < 0 )
Perror("socket()");
*(_QWORD *)&addr.sa_data[6] = 0LL;
addr.sa_family = 2;
*(_QWORD *)&addr.sa_data[2] = (unsigned int)func1(a1, 1LL, 2LL, &v7, 4LL);
v2 = func0(a1);
v7 = 1;
*(_WORD *)addr.sa_data = v2;
if ( setsockopt(v1, 1, v3, v4, v5) == -1 )
Perror("setsockopt(...,SO_REUSEADDR,...)");
optval = 0x1E00000001LL;
if ( setsockopt(v1, 1, 13, &optval, 8u) == -1 )
Perror("setsockopt(...,SO_LINGER,...)");
if ( bind(v1, &addr, 0x10u) < 0 )
Perror("bind()");
if ( listen(v1, 10) )
{
Perror("Can't configure listening port");
abort();
}
return (unsigned int)v1;
}

original_code:
int m3l_server_openbindlistensocket(int portno, char* Options, ...)
{
 int sockfd, on, status;
 struct sockaddr_in serv_addr, cli_addr;
 struct hostent *hostPtr = ((void *)0);
 if ( (sockfd = socket(2, SOCK_STREAM, 0)) < 0)
  Perror("socket()");
 bzero((char *) &serv_addr, sizeof(serv_addr));
 serv_addr.sin_family = 2;
 serv_addr.sin_addr.s_addr = htonl(((in_addr_t) 0x00000000));
 serv_addr.sin_port = htons(portno);
 on = 1;
 if ( (status = setsockopt(sockfd, 1, 2, (const char *) &on, sizeof(on))) == -1)
  Perror("setsockopt(...,SO_REUSEADDR,...)");
 struct linger linger = { 0 };
 linger.l_onoff = 1;
 linger.l_linger = 30;
 if ( (status = setsockopt(sockfd, 1, 13, (const char *) &linger, sizeof(linger)) ) == -1)
  Perror("setsockopt(...,SO_LINGER,...)");
 if (bind(sockfd, (struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0)
  Perror("bind()");
 if ( listen(sockfd, 10) != 0 )
 {
  Perror("Can't configure listening port");
  abort();
 }
 return sockfd;
}

canonical_original_code:
int m3l_server_openbindlistensocket(int portno, char *Options, ...)
{
 int sockfd; int on; int status;
 struct sockaddr_in serv_addr; struct sockaddr_in cli_addr;
 struct hostent *hostPtr = ((void *)0);
 if ( (sockfd = socket(2, SOCK_STREAM, 0)) < 0)
  Perror("socket()");
 bzero((char *) &serv_addr, sizeof(serv_addr));
 serv_addr.sin_family = 2;
 serv_addr.sin_addr.s_addr = htonl(((unsigned int) 0x00000000));
 serv_addr.sin_port = htons(portno);
 on = 1;
 if ( (status = setsockopt(sockfd, 1, 2, (char *) &on, sizeof(on))) == -1)
  Perror("setsockopt(...,SO_REUSEADDR,...)");
 struct linger linger = { 0 };
 linger.l_onoff = 1;
 linger.l_linger = 30;
 if ( (status = setsockopt(sockfd, 1, 13, (char *) &linger, sizeof(linger)) ) == -1)
  Perror("setsockopt(...,SO_LINGER,...)");
 if (bind(sockfd, (struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0)
  Perror("bind()");
 if ( listen(sockfd, 10) != 0 )
 {
  Perror("Can't configure listening port");
  abort();
 }
 return sockfd;
}

variable_types: portno int

variable_types:
Options
char *

variable_types: sockfd int

variable_types: on int

variable_types: status int

variable_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }

variable_types: struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; char **h_addr_list; } *

variable_types: struct linger { int l_onoff; int l_linger; }

user_defined_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }

user_defined_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; }


decompiled_code:
__int64 __fastcall m3l_cli_open_socket(char *name, unsigned int a2)
{
int v2; // eax
struct addrinfo *v3; // rbx
unsigned int v4; // er12
const char *v6; // rax
struct addrinfo *pai; // [rsp+0h] [rbp-70h] BYREF
char s[15]; // [rsp+9h] [rbp-67h] BYREF
struct addrinfo req; // [rsp+18h] [rbp-58h] BYREF

*(_OWORD *)&req.ai_flags = 0LL;
*(_QWORD *)&req.ai_family = 0x100000002LL;
*(_OWORD *)&req.ai_addrlen = 0LL;
*(_OWORD *)&req.ai_canonname = 0LL;
snprintf(s, 0xFuLL, "%d", a2);
v2 = getaddrinfo(name, s, &req, &pai);
if ( v2 )
{
v6 = gai_strerror(v2);
fprintf(stderr, "getaddrinfo: %s\n", v6);
exit(1);
}
v3 = pai;
v4 = socket(pai->ai_family, pai->ai_socktype, pai->ai_protocol);
if ( v4 == -1 )
Perror("socket");
if ( connect(v4, v3->ai_addr, v3->ai_addrlen) == -1 )
{
Perror("connect");
close(v4);
}
freeaddrinfo(pai);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func3(char *name, unsigned int a2)
{
int v2; // eax
struct addrinfo *v3; // rbx
unsigned int v4; // er12
const char *v6; // rax
struct addrinfo *pai; // [rsp+0h] [rbp-70h] BYREF
char s[15]; // [rsp+9h] [rbp-67h] BYREF
struct addrinfo req; // [rsp+18h] [rbp-58h] BYREF

*(_OWORD *)&req.ai_flags = 0LL;
*(_QWORD *)&req.ai_family = 0x100000002LL;
*(_OWORD *)&req.ai_addrlen = 0LL;
*(_OWORD *)&req.ai_canonname = 0LL;
snprintf(s, 0xFuLL, "%d", a2);
v2 = getaddrinfo(name, s, &req, &pai);
if ( v2 )
{
v6 = gai_strerror(v2);
fprintf(stderr, "getaddrinfo: %s\n", v6);
exit(1);
}
v3 = pai;
v4 = socket(pai->ai_family, pai->ai_socktype, pai->ai_protocol);
if ( v4 == -1 )
Perror("socket");
if ( connect(v4, v3->ai_addr, v3->ai_addrlen) == -1 )
{
Perror("connect");
close(v4);
}
freeaddrinfo(pai);
return v4;
}

original_code:
int m3l_cli_open_socket(const char * server_addr, int portno, char* Options, ...)
{
 int sockfd, rv;
 struct sockaddr_in serv_addr;
 struct hostent *server;
    struct addrinfo hints, *servinfo, *p;
    char sport[15];
 memset(&hints, 0, sizeof hints);
    hints.ai_family = 2;
    hints.ai_socktype = SOCK_STREAM;
    snprintf(sport, 15, "%d", portno);
 if ((rv = getaddrinfo(server_addr, sport, &hints, &servinfo)) != 0) {
         fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
         exit(1);
     }
     p = servinfo;
     if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
        Perror("socket");
     }
     if (connect(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
        Perror("connect");
        close(sockfd);
     }
     freeaddrinfo(servinfo);
 return sockfd;
}

canonical_original_code:
int m3l_cli_open_socket(char *server_addr, int portno, char *Options, ...)
{
 int sockfd; int rv;
 struct sockaddr_in serv_addr;
 struct hostent *server;
    struct addrinfo hints; struct addrinfo *servinfo; struct addrinfo *p;
    char sport[15];
 memset(&hints, 0, sizeof hints);
    hints.ai_family = 2;
    hints.ai_socktype = SOCK_STREAM;
    snprintf(sport, 15, "%d", portno);
 if ((rv = getaddrinfo(server_addr, sport, &hints, &servinfo)) != 0) {
         fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv));
         exit(1);
     }
     p = servinfo;
     if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) {
        Perror("socket");
     }
     if (connect(sockfd, p->ai_addr, p->ai_addrlen) == -1) {
        Perror("connect");
        close(sockfd);
     }
     freeaddrinfo(servinfo);
 return sockfd;
}

variable_types: rv int

variable_types: struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; unsigned int ai_addrlen; struct sockaddr { unsigned short sa_family; char sa_data[14]; } *ai_addr; char *ai_canonname; struct addrinfo *ai_next; } *

variable_types:
sport
char [15]

user_defined_types: struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; unsigned int ai_addrlen; struct sockaddr *ai_addr; char *ai_canonname; struct addrinfo *ai_next; }

user_defined_types: struct hostent { char *h_name; char **h_aliases; int h_addrtype; int h_length; char **h_addr_list; }


decompiled_code:
__int64 __fastcall m3l_EvalSearchPatt(char *s1, char *s, __int64 a3)
{
char *v4; // rbp
size_t v5; // r13
size_t v6; // r14
int v7; // eax
size_t v9; // r12
size_t v10; // r13
int v11; // eax

v4 = strdup(s);
if ( !v4 )
Perror("strdup");
if ( a3 )
{
if ( *(_BYTE *)(a3 + 12) == 105 )
v4 = (char *)StrToLower(v4);
v5 = strlen(v4);
v6 = strlen(s1);
v7 = strncmp(s1, v4, v5);
if ( v6 == v5 && !v7 || *s1 == 42 )
{
if ( *(_BYTE *)(a3 + 13) == 73 )
goto LABEL_10;
}
else if ( *(_BYTE *)(a3 + 13) != 73 )
{
LABEL_10:
free(v4);
return 48LL;
}
}
else
{
v9 = strlen(v4);
v10 = strlen(s1);
v11 = strncmp(s1, v4, v9);
if ( (v9 != v10 || v11) && *s1 != 42 )
goto LABEL_10;
}
free(v4);
return 49LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *s1, char *s, __int64 a3)
{
char *v4; // rbp
size_t v5; // r13
size_t v6; // r14
int v7; // eax
size_t v9; // r12
size_t v10; // r13
int v11; // eax

v4 = strdup(s);
if ( !v4 )
Perror("strdup");
if ( a3 )
{
if ( *(_BYTE *)(a3 + 12) == 105 )
v4 = (char *)StrToLower(v4);
v5 = strlen(v4);
v6 = strlen(s1);
v7 = strncmp(s1, v4, v5);
if ( v6 == v5 && !v7 || *s1 == 42 )
{
if ( *(_BYTE *)(a3 + 13) == 73 )
goto LABEL_10;
}
else if ( *(_BYTE *)(a3 + 13) != 73 )
{
LABEL_10:
free(v4);
return 48LL;
}
}
else
{
v9 = strlen(v4);
v10 = strlen(s1);
v11 = strncmp(s1, v4, v9);
if ( (v9 != v10 || v11) && *s1 != 42 )
goto LABEL_10;
}
free(v4);
return 49LL;
}

original_code:
unsigned char m3l_EvalSearchPatt(char *search_term, char *pattern, opts_t *Popts)
{
 char *Ppattern;
 size_t len1, len2;
 if ( (Ppattern = strdup(pattern)) == ((void *)0))
  Perror("strdup");
 if(Popts != ((void *)0) && Popts->opt_i == 'i')
        Ppattern = StrToLower(Ppattern);
 len1 = strlen(Ppattern);
 len2 = strlen(search_term);
 if( (strncmp(search_term, Ppattern, strlen(Ppattern)) == 0 && len1 == len2) || *search_term == '*'){
  if(Popts != ((void *)0) && Popts->opt_I == 'I'){
   free(Ppattern);
   return '0';
  }
  else
  {
   free(Ppattern);
   return '1';
  }
 }
 else
 {
  if(Popts != ((void *)0) && Popts->opt_I == 'I'){
   free(Ppattern);
   return '1';
  }
  else
  {
   free(Ppattern);
   return '0';
  }
 }
}

canonical_original_code:
unsigned char m3l_EvalSearchPatt(char *search_term, char *pattern, struct opts *Popts)
{
 char *Ppattern;
 unsigned long len1; unsigned long len2;
 if ( (Ppattern = strdup(pattern)) == ((void *)0))
  Perror("strdup");
 if(Popts != ((void *)0) && Popts->opt_i == 'i')
        Ppattern = StrToLower(Ppattern);
 len1 = strlen(Ppattern);
 len2 = strlen(search_term);
 if( (strncmp(search_term, Ppattern, strlen(Ppattern)) == 0 && len1 == len2) || *search_term == '*'){
  if(Popts != ((void *)0) && Popts->opt_I == 'I'){
   free(Ppattern);
   return '0';
  }
  else
  {
   free(Ppattern);
   return '1';
  }
 }
 else
 {
  if(Popts != ((void *)0) && Popts->opt_I == 'I'){
   free(Ppattern);
   return '1';
  }
  else
  {
   free(Ppattern);
   return '0';
  }
 }
}

variable_types:
pattern
char *

variable_types:
Ppattern
char *

return_type: unsigned char


decompiled_code:
__int64 __fastcall m3l_CompStatement(char *a1, char *a2, _BYTE *a3, _BYTE *a4)
{
__int64 result; // rax

result = m3l_EvalSearchPatt(a1, a2, (__int64)a4);
if ( (_BYTE)result != 49 )
return 48LL;
if ( a4 )
{
if ( a4[6] == 100 )
{
if ( *a3 != 68 || a3[1] != 73 || a3[2] != 82 )
return 48LL;
}
else if ( a4[16] == 108 )
{
if ( !memcmp("LINK", a3, 4uLL) )
result = 48LL;
}
else if ( a4[10] == 102 && *a3 == 68 && a3[1] == 73 && a3[2] == 82 )
{
result = 48LL;
}
}
return result;
}

original_code:
unsigned char m3l_CompStatement(char *search_term, char *pattern, char *type, opts_t *Popts)
{
 if ( m3l_EvalSearchPatt(search_term, pattern, Popts) == '1'){
  if(Popts != ((void *)0) && Popts->opt_d == 'd'){
   if( strncmp("DIR",type, 3) == 0 ){
    return '1';
   }
   else
   {
    return '0';
   }
  }
  else if (Popts != ((void *)0) && Popts->opt_l == 'l'){
   if( strncmp("LINK",type, 4) == 0 ){
    return '0';
   }
   else
   {
    return '1';
   }
  }
  else if (Popts != ((void *)0) && Popts->opt_f == 'f'){
   if( strncmp("DIR",type, 3) == 0 ){
    return '0';
   }
   else
   {
    return '1';
   }
  }
 return '1';
 }
 return '0';
}

canonical_original_code:
unsigned char m3l_CompStatement(char *search_term, char *pattern, char *type, struct opts *Popts)
{
 if ( m3l_EvalSearchPatt(search_term, pattern, Popts) == '1'){
  if(Popts != ((void *)0) && Popts->opt_d == 'd'){
   if( strncmp("DIR",type, 3) == 0 ){
    return '1';
   }
   else
   {
    return '0';
   }
  }
  else if (Popts != ((void *)0) && Popts->opt_l == 'l'){
   if( strncmp("LINK",type, 4) == 0 ){
    return '0';
   }
   else
   {
    return '1';
   }
  }
  else if (Popts != ((void *)0) && Popts->opt_f == 'f'){
   if( strncmp("DIR",type, 3) == 0 ){
    return '0';
   }
   else
   {
    return '1';
   }
  }
 return '1';
 }
 return '0';
}

variable_types:
type
char *


original_code:
int m3l_AddRecord(node_t *Tmpnode, size_t *nalloc, find_t *Founds)
{
 find_str_t **realloc_find;
 if(*nalloc == 0){
  Founds->Found_Nodes[0]->List = Tmpnode;
   (*nalloc)++;
 }
 else
 {
  (*nalloc)++;
  realloc_find = ((void *)0);
  if ( (realloc_find =(find_str_t **)realloc(Founds->Found_Nodes, *nalloc * sizeof(find_str_t *))) == ((void *)0)){
   Perror("realloc");
  }
  else{
   Founds->Found_Nodes = realloc_find;
  }
  if ( (Founds->Found_Nodes[*nalloc-1] =(find_str_t *)malloc( sizeof(find_str_t))) == ((void *)0))
   Perror("malloc");
  Founds->Found_Nodes[*nalloc-1]->List = Tmpnode;
 }
 return 1;
}

canonical_original_code:
int m3l_AddRecord(struct node *Tmpnode, unsigned long *nalloc, struct find *Founds)
{
 struct find_str **realloc_find;
 if(*nalloc == 0){
  Founds->Found_Nodes[0]->List = Tmpnode;
   (*nalloc)++;
 }
 else
 {
  (*nalloc)++;
  realloc_find = ((void *)0);
  if ( (realloc_find =(struct find_str **)realloc(Founds->Found_Nodes, *nalloc * sizeof(struct find_str *))) == ((void *)0)){
   Perror("realloc");
  }
  else{
   Founds->Found_Nodes = realloc_find;
  }
  if ( (Founds->Found_Nodes[*nalloc-1] =(struct find_str *)malloc( sizeof(find_str_t))) == ((void *)0))
   Perror("malloc");
  Founds->Found_Nodes[*nalloc-1]->List = Tmpnode;
 }
 return 1;
}

variable_types: struct node { char *type; char *name; unsigned long *fdim; unsigned long ndim; union data_t { void *v; float *f; double *df; long double *ldf; char *c; char *sc; unsigned char *uc; short *si; unsigned short *usi; int *i; unsigned int *ui; long *li; unsigned long *uli; long long *lli; long long *slli; unsigned long long *ulli; unsigned long *st; long *ptrdf; } data; long create_time; struct node *next; struct find_str { struct node *List; } **linknode; unsigned long lcounter; char no_malloc; int ap; } *

variable_types:
nalloc
unsigned long *

variable_types: struct find { struct find_str **Found_Nodes; unsigned long founds; struct node *Home_Node; } *

variable_types: struct find_str { struct node { char *type; char *name; unsigned long *fdim; unsigned long ndim; union data_t { void *v; float *f; double *df; long double *ldf; char *c; char *sc; unsigned char *uc; short *si; unsigned short *usi; int *i; unsigned int *ui; long *li; unsigned long *uli; long long *lli; long long *slli; unsigned long long *ulli; unsigned long *st; long *ptrdf; } data; long create_time; struct node *next; struct find_str **linknode; unsigned long lcounter; char no_malloc; int ap; } *List; } **


decompiled_code:
__int64 __fastcall m3l_FindList(int a1, _BYTE **a2, char *a3, __int64 *a4, _QWORD ***a5, _BYTE *a6)
{
__int64 i; // rbx
__int64 result; // rax
_BYTE *v12; // rbx

if ( a2 )
{
if ( a6 && a6[24] == 114 )
{
v12 = a2[9];
if ( v12 )
{
if ( a1 == 1 )
goto LABEL_34;
if ( (unsigned __int8)m3l_CompStatement(a3, a2[1], *a2, a6) == 49
&& (unsigned int)m3l_AddRecord((__int64)a2, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
v12 = a2[9];
if ( v12 )
{
LABEL_34:
do
{
if ( !memcmp(*(const void **)v12, "LINK", 4uLL) && a6[17] == 76 )
m3l_FindList(2LL, *((_QWORD *)v12 + 9), a3, a4, a5, a6);
else
m3l_FindList(2LL, v12, a3, a4, a5, a6);
v12 = (_BYTE *)*((_QWORD *)v12 + 6);
}
while ( v12 );
}
}
else if ( (unsigned __int8)m3l_CompStatement(a3, a2[1], *a2, a6) == 49
&& (unsigned int)m3l_AddRecord((__int64)a2, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
}
else
{
if ( a1 != 1
&& (unsigned __int8)m3l_CompStatement(a3, a2[1], *a2, a6) == 49
&& (unsigned int)m3l_AddRecord((__int64)a2, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
for ( i = (__int64)a2[9]; i; i = *(_QWORD *)(i + 48) )
{
if ( (unsigned __int8)m3l_CompStatement(a3, *(char **)(i + 8), *(_BYTE **)i, a6) == 49
&& (unsigned int)m3l_AddRecord(i, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
}
}
result = *a4;
}
else
{
Warning("WriteData: NULL list");
result = -1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(int a1, _BYTE **a2, char *a3, __int64 *a4, _QWORD ***a5, _BYTE *a6)
{
__int64 i; // rbx
__int64 result; // rax
_BYTE *v12; // rbx

if ( a2 )
{
if ( a6 && a6[24] == 114 )
{
v12 = a2[9];
if ( v12 )
{
if ( a1 == 1 )
goto LABEL_34;
if ( (unsigned __int8)func1(a3, a2[1], *a2, a6) == 49
&& (unsigned int)func2((__int64)a2, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
v12 = a2[9];
if ( v12 )
{
LABEL_34:
do
{
if ( !memcmp(*(const void **)v12, "LINK", 4uLL) && a6[17] == 76 )
func3(2LL, *((_QWORD *)v12 + 9), a3, a4, a5, a6);
else
func3(2LL, v12, a3, a4, a5, a6);
v12 = (_BYTE *)*((_QWORD *)v12 + 6);
}
while ( v12 );
}
}
else if ( (unsigned __int8)func1(a3, a2[1], *a2, a6) == 49
&& (unsigned int)func2((__int64)a2, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
}
else
{
if ( a1 != 1
&& (unsigned __int8)func1(a3, a2[1], *a2, a6) == 49
&& (unsigned int)func2((__int64)a2, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
for ( i = (__int64)a2[9]; i; i = *(_QWORD *)(i + 48) )
{
if ( (unsigned __int8)func1(a3, *(char **)(i + 8), *(_BYTE **)i, a6) == 49
&& (unsigned int)func2(i, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
}
}
result = *a4;
}
else
{
Warning("WriteData: NULL list");
result = -1LL;
}
return result;
}

original_code:
size_t m3l_FindList(int call, node_t *List, char *search_term, size_t *nalloc, find_t *Founds, opts_t *Popt)
{
 node_t *Tmpnode;
 if(List == ((void *)0)){
  Warning("WriteData: NULL list");
   return -1;
 }
 if(Popt != ((void *)0) && Popt->opt_r == 'r'){
  if(List->child == ((void *)0)){
   Tmpnode = List;
   if ( m3l_CompStatement(search_term, Tmpnode->name, Tmpnode->type, Popt) == '1'){
    if ( m3l_AddRecord(Tmpnode, nalloc,Founds) != 1)
    Warning("Error adding record to the list");
   }
  }
  else
  {
   if( call != 1){
    if ( m3l_CompStatement(search_term, List->name, List->type, Popt) == '1'){
     if ( m3l_AddRecord(List, nalloc,Founds) != 1)
      Warning("Error adding record to the list");
    }
   }
   Tmpnode = List->child;
   while(Tmpnode != ((void *)0)){
    if( strncmp(Tmpnode->type, "LINK", 4 ) == 0 && Popt->opt_L == 'L'){
     m3l_FindList(2, Tmpnode->child, search_term, nalloc, Founds,Popt);
    }
    else{
     m3l_FindList(2, Tmpnode, search_term, nalloc, Founds,Popt);
    }
    Tmpnode = Tmpnode->next;
   }
  }
  return *nalloc;
 }
 else
 {
  if( call != 1){
   if ( m3l_CompStatement(search_term, List->name, List->type, Popt) == '1'){
    if ( m3l_AddRecord(List, nalloc,Founds) != 1)
     Warning("Error adding record to the list");
   }
  }
  if(List->child != ((void *)0)){
   Tmpnode = List->child ;
   while(Tmpnode != ((void *)0)){
    if ( m3l_CompStatement(search_term, Tmpnode->name, Tmpnode->type, Popt) == '1'){
     if ( m3l_AddRecord(Tmpnode, nalloc,Founds) != 1)
      Warning("Error adding record to the list");
    }
    Tmpnode = Tmpnode->next;
   }
  }
 return *nalloc;
 }
}

canonical_original_code:
unsigned long m3l_FindList(int call, struct node *List, char *search_term, unsigned long *nalloc, struct find *Founds, struct opts *Popt)
{
 struct node *Tmpnode;
 if(List == ((void *)0)){
  Warning("WriteData: NULL list");
   return -1;
 }
 if(Popt != ((void *)0) && Popt->opt_r == 'r'){
  if(List->child == ((void *)0)){
   Tmpnode = List;
   if ( m3l_CompStatement(search_term, Tmpnode->name, Tmpnode->type, Popt) == '1'){
    if ( m3l_AddRecord(Tmpnode, nalloc,Founds) != 1)
    Warning("Error adding record to the list");
   }
  }
  else
  {
   if( call != 1){
    if ( m3l_CompStatement(search_term, List->name, List->type, Popt) == '1'){
     if ( m3l_AddRecord(List, nalloc,Founds) != 1)
      Warning("Error adding record to the list");
    }
   }
   Tmpnode = List->child;
   while(Tmpnode != ((void *)0)){
    if( strncmp(Tmpnode->type, "LINK", 4 ) == 0 && Popt->opt_L == 'L'){
     m3l_FindList(2, Tmpnode->child, search_term, nalloc, Founds,Popt);
    }
    else{
     m3l_FindList(2, Tmpnode, search_term, nalloc, Founds,Popt);
    }
    Tmpnode = Tmpnode->next;
   }
  }
  return *nalloc;
 }
 else
 {
  if( call != 1){
   if ( m3l_CompStatement(search_term, List->name, List->type, Popt) == '1'){
    if ( m3l_AddRecord(List, nalloc,Founds) != 1)
     Warning("Error adding record to the list");
   }
  }
  if(List->child != ((void *)0)){
   Tmpnode = List->child ;
   while(Tmpnode != ((void *)0)){
    if ( m3l_CompStatement(search_term, Tmpnode->name, Tmpnode->type, Popt) == '1'){
     if ( m3l_AddRecord(Tmpnode, nalloc,Founds) != 1)
      Warning("Error adding record to the list");
    }
    Tmpnode = Tmpnode->next;
   }
  }
 return *nalloc;
 }
}

variable_types: call int

variable_types: struct opts { char opt_a; char opt_b; char opt_c; char opt_d; char opt_e; char opt_f; char opt_i; char opt_k; char opt_l; char opt_m; char opt_n; char opt_p; char opt_r; char opt_s; char opt_u; char opt_linkscleanemptrefs; char opt_nomalloc; char opt_tcpencoding; char opt_tcpheader; char opt_shutdown; char opt_add; char opt_MEMCP; char opt_EOBseq; char opt_REOBseq; char opt_format; char opt_xformat; } *


decompiled_code:
_BOOL8 __fastcall m3l_match_single_test(const char **a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
_BOOL4 v7; // er12
size_t v8; // r13
const char *v10; // rbp
size_t v11; // r13

if ( BYTE1(a7) == 86 )
{
v7 = 0;
if ( **a1 != 67 )
return v7;
v10 = a1[4];
v11 = strlen(v10);
if ( v11 != strlen((const char *)&a7 + 2) )
return v7;
return strncmp(v10, (const char *)&a7 + 2, v11) == 0;
}
if ( SBYTE1(a7) <= 86 )
{
v7 = 1;
if ( BYTE1(a7) == 42 )
return v7;
if ( BYTE1(a7) != 78 )
return 0;
v10 = a1[1];
v7 = 0;
v11 = strlen(v10);
if ( v11 != strlen((const char *)&a7 + 2) )
return v7;
return strncmp(v10, (const char *)&a7 + 2, v11) == 0;
}
if ( BYTE1(a7) != 110 )
{
if ( BYTE1(a7) == 116 )
{
v7 = 0;
v8 = strlen(*a1);
if ( v8 == strlen((const char *)&a7 + 2) )
v7 = strncmp(a1[1], (const char *)&a7 + 2, v8) == 0;
return v7;
}
return 0;
}
return Strol((char *)&a7 + 2) == a2;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(const char **a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
_BOOL4 v7; // er12
size_t v8; // r13
const char *v10; // rbp
size_t v11; // r13

if ( BYTE1(a7) == 86 )
{
v7 = 0;
if ( **a1 != 67 )
return v7;
v10 = a1[4];
v11 = strlen(v10);
if ( v11 != strlen((const char *)&a7 + 2) )
return v7;
return strncmp(v10, (const char *)&a7 + 2, v11) == 0;
}
if ( SBYTE1(a7) <= 86 )
{
v7 = 1;
if ( BYTE1(a7) == 42 )
return v7;
if ( BYTE1(a7) != 78 )
return 0;
v10 = a1[1];
v7 = 0;
v11 = strlen(v10);
if ( v11 != strlen((const char *)&a7 + 2) )
return v7;
return strncmp(v10, (const char *)&a7 + 2, v11) == 0;
}
if ( BYTE1(a7) != 110 )
{
if ( BYTE1(a7) == 116 )
{
v7 = 0;
v8 = strlen(*a1);
if ( v8 == strlen((const char *)&a7 + 2) )
v7 = strncmp(a1[1], (const char *)&a7 + 2, v8) == 0;
return v7;
}
return 0;
}
return Strol((char *)&a7 + 2) == a2;
}

original_code:
int m3l_match_single_test(node_t *List, get_arg_t argsstr, size_t counter)
{
 char c;
 size_t len1, len2;
 c = (int)argsstr.arg;
 switch ( c ){
  case '*':
   return 1;
  break;
  case 'V':
   if(strncmp(List->type,"C",1) == 0){
    len1 = strlen(List->data.c);
    len2 = strlen(argsstr.args);
    if(len1 == len2 && strncmp(List->data.c, argsstr.args, len1) == 0 ){
     return 1;
    }
    else{
     return 0;
    }
   }
   else{
    return 0;
   }
  break;
  case 'N':
   len1 = strlen(List->name);
   len2 = strlen(argsstr.args);
   if(len1 == len2 && strncmp(List->name, argsstr.args, len1) == 0){
    return 1;
   }
   else{
    return 0;
   }
  break;
  case 't':
   len1 = strlen(List->type);
   len2 = strlen(argsstr.args);
   if(len1 == len2 && strncmp(List->name, argsstr.args, len1) == 0){
    return 1;
   }
   else{
    return 0;
   }
  break;
  case 'n':
   len1 = Strol(argsstr.args);
   if( counter == len1){
    return 1;
   }
   else{
    return 0;
   }
  break;
 }
 return 0;
}

canonical_original_code:
int m3l_match_single_test(struct node *List, struct get_arg argsstr, unsigned long counter)
{
 char c;
 unsigned long len1; unsigned long len2;
 c = (int)argsstr.arg;
 switch ( c ){
  case '*':
   return 1;
  break;
  case 'V':
   if(strncmp(List->type,"C",1) == 0){
    len1 = strlen(List->data.c);
    len2 = strlen(argsstr.args);
    if(len1 == len2 && strncmp(List->data.c, argsstr.args, len1) == 0 ){
     return 1;
    }
    else{
     return 0;
    }
   }
   else{
    return 0;
   }
  break;
  case 'N':
   len1 = strlen(List->name);
   len2 = strlen(argsstr.args);
   if(len1 == len2 && strncmp(List->name, argsstr.args, len1) == 0){
    return 1;
   }
   else{
    return 0;
   }
  break;
  case 't':
   len1 = strlen(List->type);
   len2 = strlen(argsstr.args);
   if(len1 == len2 && strncmp(List->name, argsstr.args, len1) == 0){
    return 1;
   }
   else{
    return 0;
   }
  break;
  case 'n':
   len1 = Strol(argsstr.args);
   if( counter == len1){
    return 1;
   }
   else{
    return 0;
   }
  break;
 }
 return 0;
}

variable_types: struct get_arg { char first; char arg; char args[48]; char s_name[48]; int retval; }

variable_types:
counter
unsigned long

variable_types: c char


decompiled_code:
_BOOL8 __fastcall m3l_match_test(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, __int64 a9, __int64 a10, __int64 a11, __int64 a12, int a13)
{
__int64 v13; // rbx
const char *v14; // rbp
size_t v15; // r12
__int64 v16; // rdx
__int64 v17; // rcx
__int64 v18; // r8
__int64 v19; // r9
_BOOL8 result; // rax

if ( (a7 & 0xDF) != 83 )
return m3l_match_single_test((const char **)a1, a2, a3, a4, a5, a6, a7);
v13 = *(_QWORD *)(a1 + 72);
if ( v13 )
{
while ( 1 )
{
v14 = *(const char **)(v13 + 8);
v15 = strlen(v14);
if ( v15 == strlen((const char *)&a13 + 2) && !strncmp(v14, (const char *)&a13 + 2, v15) )
{
result = m3l_match_single_test((const char **)v13, a2, v16, v17, v18, v19, a7);
if ( result )
break;
}
v13 = *(_QWORD *)(v13 + 48);
if ( !v13 )
return 0LL;
}
}
else
{
Error("Wrong location - node is FILE type");
result = 0LL;
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, __int64 a8, __int64 a9, __int64 a10, __int64 a11, __int64 a12, int a13)
{
__int64 v13; // rbx
const char *v14; // rbp
size_t v15; // r12
__int64 v16; // rdx
__int64 v17; // rcx
__int64 v18; // r8
__int64 v19; // r9
_BOOL8 result; // rax

if ( (a7 & 0xDF) != 83 )
return func0((const char **)a1, a2, a3, a4, a5, a6, a7);
v13 = *(_QWORD *)(a1 + 72);
if ( v13 )
{
while ( 1 )
{
v14 = *(const char **)(v13 + 8);
v15 = strlen(v14);
if ( v15 == strlen((const char *)&a13 + 2) && !strncmp(v14, (const char *)&a13 + 2, v15) )
{
result = func0((const char **)v13, a2, v16, v17, v18, v19, a7);
if ( result )
break;
}
v13 = *(_QWORD *)(v13 + 48);
if ( !v13 )
return 0LL;
}
}
else
{
Error("Wrong location - node is FILE type");
result = 0LL;
}
return result;
}

original_code:
int m3l_match_test(node_t *List, get_arg_t argsstr, size_t counter)
{
 node_t *Tmpnode;
 int retval;
 size_t len1, len2;
 if( argsstr.first == 'S' || argsstr.first == 's' ){
  if ( (Tmpnode = List->child) == ((void *)0)){
   Error("Wrong location - node is FILE type");
   return 0;
  }
  else{
   while(Tmpnode != ((void *)0)){
    len1 = strlen(Tmpnode->name);
    len2 = strlen(argsstr.s_name);
    if(len1 == len2 && strncmp(Tmpnode->name, argsstr.s_name, len1) == 0 ){
     if( (retval = m3l_match_single_test(Tmpnode, argsstr, counter)) == 1)
      return 1;
    }
    Tmpnode = Tmpnode->next;
   }
   return 0;
  }
 }
 else{
  retval = m3l_match_single_test(List, argsstr, counter);
  return retval;
 }
 return 0;
}

canonical_original_code:
int m3l_match_test(struct node *List, struct get_arg argsstr, unsigned long counter)
{
 struct node *Tmpnode;
 int retval;
 unsigned long len1; unsigned long len2;
 if( argsstr.first == 'S' || argsstr.first == 's' ){
  if ( (Tmpnode = List->child) == ((void *)0)){
   Error("Wrong location - node is FILE type");
   return 0;
  }
  else{
   while(Tmpnode != ((void *)0)){
    len1 = strlen(Tmpnode->name);
    len2 = strlen(argsstr.s_name);
    if(len1 == len2 && strncmp(Tmpnode->name, argsstr.s_name, len1) == 0 ){
     if( (retval = m3l_match_single_test(Tmpnode, argsstr, counter)) == 1)
      return 1;
    }
    Tmpnode = Tmpnode->next;
   }
   return 0;
  }
 }
 else{
  retval = m3l_match_single_test(List, argsstr, counter);
  return retval;
 }
 return 0;
}

variable_types: retval int

user_defined_types: struct get_arg { char first; char arg; char args[48]; char s_name[48]; int retval; }


decompiled_code:
__int64 __fastcall m3l_set_Add(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_BYTE *)(result + 6) = 0;
*(_BYTE *)(result + 10) = 0;
*(_BYTE *)(result + 24) = 114;
*(_WORD *)(result + 12) = 0;
*(_BYTE *)(result + 14) = 0;
*(_BYTE *)(result + 2) = 0;
*(_BYTE *)(result + 16) = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_BYTE *)(result + 6) = 0;
*(_BYTE *)(result + 10) = 0;
*(_BYTE *)(result + 24) = 114;
*(_WORD *)(result + 12) = 0;
*(_BYTE *)(result + 14) = 0;
*(_BYTE *)(result + 2) = 0;
*(_BYTE *)(result + 16) = 0;
return result;
}

variable_types: struct opts { char opt_a; char opt_b; char opt_c; char opt_d; char opt_e; char opt_f; char opt_i; char opt_k; char opt_l; char opt_m; char opt_n; char opt_p; char opt_r; char opt_s; char opt_u; char opt_linkscleanemptrefs; char opt_nomalloc; char opt_tcpencoding; char opt_tcpheader; char opt_shutdown; char opt_add; char opt_MEMCP; char opt_EOBseq; char opt_REOBseq; char opt_format; char opt_xformat; } **

return_type: void


decompiled_code:
__int64 __fastcall m3l_set_Cat(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_BYTE *)(result + 26) = 48;
*(_BYTE *)(result + 22) = 48;
*(_BYTE *)(result + 6) = 48;
*(_BYTE *)(result + 10) = 48;
*(_WORD *)(result + 16) = 12336;
return result;
}

original_code:
void m3l_set_Cat(opts_t **Popts){
 (*Popts)->opt_s = '0';
 (*Popts)->opt_p = '0';
 (*Popts)->opt_d = '0';
 (*Popts)->opt_f = '0';
 (*Popts)->opt_l = '0';
 (*Popts)->opt_L = '0';
}

canonical_original_code:
void m3l_set_Cat(struct opts **Popts){
 (*Popts)->opt_s = '0';
 (*Popts)->opt_p = '0';
 (*Popts)->opt_d = '0';
 (*Popts)->opt_f = '0';
 (*Popts)->opt_l = '0';
 (*Popts)->opt_L = '0';
}


decompiled_code:
__int64 __fastcall m3l_set_Detach_List(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_BYTE *)(result + 6) = 0;
*(_BYTE *)(result + 10) = 0;
*(_BYTE *)(result + 24) = 114;
*(_WORD *)(result + 12) = 0;
*(_WORD *)(result + 16) = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_BYTE *)(result + 6) = 0;
*(_BYTE *)(result + 10) = 0;
*(_BYTE *)(result + 24) = 114;
*(_WORD *)(result + 12) = 0;
*(_WORD *)(result + 16) = 0;
return result;
}

original_code:
void m3l_set_Detach_List(opts_t **Popts){
 (*Popts)->opt_i = '\0';
 (*Popts)->opt_d = '\0';
 (*Popts)->opt_f = '\0';
 (*Popts)->opt_r = 'r';
 (*Popts)->opt_I = '\0';
 (*Popts)->opt_L = '\0';
 (*Popts)->opt_l = '\0';
}

canonical_original_code:
void m3l_set_Detach_List(struct opts **Popts){
 (*Popts)->opt_i = '\0';
 (*Popts)->opt_d = '\0';
 (*Popts)->opt_f = '\0';
 (*Popts)->opt_r = 'r';
 (*Popts)->opt_I = '\0';
 (*Popts)->opt_L = '\0';
 (*Popts)->opt_l = '\0';
}


decompiled_code:
__int64 __fastcall m3l_set_Find(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_BYTE *)(result + 6) = 0;
*(_BYTE *)(result + 10) = 0;
*(_BYTE *)(result + 24) = 114;
*(_WORD *)(result + 12) = 0;
*(_BYTE *)(result + 16) = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_BYTE *)(result + 6) = 0;
*(_BYTE *)(result + 10) = 0;
*(_BYTE *)(result + 24) = 114;
*(_WORD *)(result + 12) = 0;
*(_BYTE *)(result + 16) = 0;
return result;
}


decompiled_code:
__int64 __fastcall m3l_set_Fread(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_WORD *)(result + 30) = 0;
*(_BYTE *)(result + 32) = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_WORD *)(result + 30) = 0;
*(_BYTE *)(result + 32) = 0;
return result;
}

original_code:
void m3l_set_Fread(opts_t **Popts){
 (*Popts)->opt_linkscleanemptlinks = '\0';
 (*Popts)->opt_nomalloc = '\0';
 (*Popts)->opt_linkscleanemptrefs = '\0';
}

canonical_original_code:
void m3l_set_Fread(struct opts **Popts){
 (*Popts)->opt_linkscleanemptlinks = '\0';
 (*Popts)->opt_nomalloc = '\0';
 (*Popts)->opt_linkscleanemptrefs = '\0';
}


decompiled_code:
__int64 __fastcall m3l_set_Fwrite(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_WORD *)(*a1 + 31) = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_WORD *)(*a1 + 31) = 0;
return result;
}

original_code:
void m3l_set_Fwrite(opts_t **Popts){
 (*Popts)->opt_linkscleanemptlinks = '\0';
 (*Popts)->opt_nomalloc = '\0';
}

canonical_original_code:
void m3l_set_Fwrite(struct opts **Popts){
 (*Popts)->opt_linkscleanemptlinks = '\0';
 (*Popts)->opt_nomalloc = '\0';
}


decompiled_code:
__int64 __fastcall m3l_set_Send_to_tcpipsocket(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_DWORD *)(result + 30) = 1224736768;
*(_WORD *)(result + 37) = 83;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_DWORD *)(result + 30) = 1224736768;
*(_WORD *)(result + 37) = 83;
return result;
}

original_code:
void m3l_set_Send_to_tcpipsocket(opts_t **Popts){
 (*Popts)->opt_linkscleanemptlinks = '\0';
 (*Popts)->opt_nomalloc = '\0';
 (*Popts)->opt_linkscleanemptrefs = '\0';
 (*Popts)->opt_tcpencoding = 'I';
 (*Popts)->opt_MEMCP = 'S';
 (*Popts)->opt_EOBseq = '\0';
}

canonical_original_code:
void m3l_set_Send_to_tcpipsocket(struct opts **Popts){
 (*Popts)->opt_linkscleanemptlinks = '\0';
 (*Popts)->opt_nomalloc = '\0';
 (*Popts)->opt_linkscleanemptrefs = '\0';
 (*Popts)->opt_tcpencoding = 'I';
 (*Popts)->opt_MEMCP = 'S';
 (*Popts)->opt_EOBseq = '\0';
}


decompiled_code:
// attributes: thunk
__int64 __fastcall m3l_set_Receive_send_tcpipsocket(__int64 *a1)
{
return m3l_set_Send_receive_tcpipsocket_localalias(a1);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 *a1)
{
return func8(a1);
}

original_code:
void m3l_set_Receive_send_tcpipsocket(opts_t **Popts){
  (*Popts)->opt_linkscleanemptlinks = '\0';
 (*Popts)->opt_nomalloc = '\0';
 (*Popts)->opt_linkscleanemptrefs = '\0';
 (*Popts)->opt_tcpencoding = 'I';
 (*Popts)->opt_shutdown = '\0';
 (*Popts)->opt_MEMCP = 'S';
 (*Popts)->opt_EOBseq = '\0';
 (*Popts)->opt_REOBseq = '\0';
}

canonical_original_code:
void m3l_set_Receive_send_tcpipsocket(struct opts **Popts){
  (*Popts)->opt_linkscleanemptlinks = '\0';
 (*Popts)->opt_nomalloc = '\0';
 (*Popts)->opt_linkscleanemptrefs = '\0';
 (*Popts)->opt_tcpencoding = 'I';
 (*Popts)->opt_shutdown = '\0';
 (*Popts)->opt_MEMCP = 'S';
 (*Popts)->opt_EOBseq = '\0';
 (*Popts)->opt_REOBseq = '\0';
}


decompiled_code:
__int64 __fastcall m3l_set_Receive_tcpipsocket(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_WORD *)(result + 31) = 0;
*(_BYTE *)(result + 33) = 73;
*(_BYTE *)(result + 37) = 83;
*(_BYTE *)(result + 39) = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_WORD *)(result + 31) = 0;
*(_BYTE *)(result + 33) = 73;
*(_BYTE *)(result + 37) = 83;
*(_BYTE *)(result + 39) = 0;
return result;
}

original_code:
void m3l_set_Receive_tcpipsocket(opts_t **Popts){
 (*Popts)->opt_linkscleanemptlinks = '\0';
 (*Popts)->opt_nomalloc = '\0';
 (*Popts)->opt_tcpencoding = 'I';
 (*Popts)->opt_MEMCP = 'S';
 (*Popts)->opt_REOBseq = '\0';
}

canonical_original_code:
void m3l_set_Receive_tcpipsocket(struct opts **Popts){
 (*Popts)->opt_linkscleanemptlinks = '\0';
 (*Popts)->opt_nomalloc = '\0';
 (*Popts)->opt_tcpencoding = 'I';
 (*Popts)->opt_MEMCP = 'S';
 (*Popts)->opt_REOBseq = '\0';
}


decompiled_code:
__int64 __fastcall m3l_set_MkTCPIPHeader(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_BYTE *)(result + 6) = 0;
*(_BYTE *)(result + 10) = 0;
*(_BYTE *)(result + 24) = 114;
*(_WORD *)(result + 12) = 0;
*(_BYTE *)(result + 14) = 0;
*(_BYTE *)(result + 2) = 0;
*(_BYTE *)(result + 16) = 0;
*(_BYTE *)(result + 20) = 0;
*(_BYTE *)(result + 32) = 0;
return result;
}

canonical_original_code:
void m3l_set_MkTCPIPHeader(struct opts **Popts){
 (*Popts)->opt_i = '\0';
 (*Popts)->opt_d = '\0';
 (*Popts)->opt_f = '\0';
 (*Popts)->opt_r = 'r';
 (*Popts)->opt_I = '\0';
 (*Popts)->opt_k = '\0';
 (*Popts)->opt_b = '\0';
 (*Popts)->opt_l = '\0';
 (*Popts)->opt_n = '\0';
 (*Popts)->opt_b = '\0';
 (*Popts)->opt_nomalloc = '\0';
}


decompiled_code:
__int64 __fastcall comp_simle_path(unsigned __int8 *a1, const char *a2)
{
const char *v2; // rbp
size_t v4; // rax
unsigned int v5; // er9
size_t v6; // r8
const char *v7; // rdx
unsigned __int64 v8; // rsi
char v9; // cl
char v11; // di
unsigned __int64 v12; // rcx
__int64 v13; // rax
const char *v14; // rax
const char *v15; // r10
__int64 v16; // r12
unsigned __int64 v17; // r8
unsigned __int64 v18; // rcx

v2 = a2;
v4 = strlen(a2);
v5 = -1;
if ( v4 )
{
v6 = v4;
v7 = &a2[v4];
v8 = 1LL;
while ( 1 )
{
v9 = *v2;
LOBYTE(v4) = *v2 == 126;
if ( *v2 <= 0x2Fu )
LODWORD(v4) = (0xC00100000600uLL >> v9) & 1 | v4;
if ( !(_BYTE)v4 )
break;
if ( !v9 )
{
if ( v6 == v8 )
goto LABEL_9;
return 1LL;
}
++v2;
++v8;
if ( v2 == v7 )
goto LABEL_23;
}
v7 = v2;
LABEL_23:
if ( v6 == v8 )
{
LABEL_9:
puts(" returning ");
return 1;
}
v11 = *v7;
if ( v11 == 32 || v11 == 47 || v11 == 0 || (unsigned __int8)(v11 - 9) <= 1u )
return 1LL;
v14 = v7;
v15 = &v7[v6];
v16 = 0x800100000601LL;
do
{
do
{
v17 = (unsigned __int64)&v14[v8 - (_QWORD)v7];
v18 = *(unsigned __int8 *)++v14;
}
while ( (unsigned __int8)v18 > 0x2Fu );
}
while ( !_bittest64(&v16, v18) );
v5 = 1;
if ( v8 <= v17 )
{
if ( v17 < v15 - v14 )
{
while ( (_BYTE)v18 )
{
if ( (unsigned __int8)(v18 - 9) > 1u )
{
puts(" returning1 ");
return 1;
}
LOBYTE(v18) = *++v14;
}
v12 = *a1;
LOBYTE(v14) = (_BYTE)v12 == 126;
if ( (unsigned __int8)v12 > 0x2Fu )
goto LABEL_32;
}
else
{
v12 = *a1;
LOBYTE(v14) = (_BYTE)v12 == 126;
if ( (unsigned __int8)v12 > 0x2Fu )
goto LABEL_32;
}
LODWORD(v14) = (0xC00100000600uLL >> v12) & 1 | (unsigned int)v14;
LABEL_32:
if ( !(_BYTE)v14 )
goto LABEL_15;
do
{
if ( !(_BYTE)v12 )
{
v12 = *a1;
goto LABEL_15;
}
v12 = *++a1;
LOBYTE(v14) = (_BYTE)v12 == 126;
if ( (unsigned __int8)v12 <= 0x2Fu )
LODWORD(v14) = (0xC00100000600uLL >> v12) & 1 | (unsigned int)v14;
}
while ( (_BYTE)v14 );
do
{
LABEL_15:
if ( (_BYTE)v12 == 47 )
break;
if ( !(_BYTE)v12 )
return 0;
if ( v11 != (_BYTE)v12 )
return (unsigned int)-1;
v11 = *++v7;
v12 = *++a1;
if ( !v11 )
break;
}
while ( v11 != 47 );
if ( !(_BYTE)v12 )
return 0;
v13 = 0x800100000600LL;
while ( (unsigned __int8)v12 <= 0x2Fu && _bittest64(&v13, v12) )
{
v12 = *++a1;
if ( !(_BYTE)v12 )
return 0;
}
return 1LL;
}
}
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned __int8 *a1, const char *a2)
{
const char *v2; // rbp
size_t v4; // rax
unsigned int v5; // er9
size_t v6; // r8
const char *v7; // rdx
unsigned __int64 v8; // rsi
char v9; // cl
char v11; // di
unsigned __int64 v12; // rcx
__int64 v13; // rax
const char *v14; // rax
const char *v15; // r10
__int64 v16; // r12
unsigned __int64 v17; // r8
unsigned __int64 v18; // rcx

v2 = a2;
v4 = strlen(a2);
v5 = -1;
if ( v4 )
{
v6 = v4;
v7 = &a2[v4];
v8 = 1LL;
while ( 1 )
{
v9 = *v2;
LOBYTE(v4) = *v2 == 126;
if ( *v2 <= 0x2Fu )
LODWORD(v4) = (0xC00100000600uLL >> v9) & 1 | v4;
if ( !(_BYTE)v4 )
break;
if ( !v9 )
{
if ( v6 == v8 )
goto LABEL_9;
return 1LL;
}
++v2;
++v8;
if ( v2 == v7 )
goto LABEL_23;
}
v7 = v2;
LABEL_23:
if ( v6 == v8 )
{
LABEL_9:
puts(" returning ");
return 1;
}
v11 = *v7;
if ( v11 == 32 || v11 == 47 || v11 == 0 || (unsigned __int8)(v11 - 9) <= 1u )
return 1LL;
v14 = v7;
v15 = &v7[v6];
v16 = 0x800100000601LL;
do
{
do
{
v17 = (unsigned __int64)&v14[v8 - (_QWORD)v7];
v18 = *(unsigned __int8 *)++v14;
}
while ( (unsigned __int8)v18 > 0x2Fu );
}
while ( !_bittest64(&v16, v18) );
v5 = 1;
if ( v8 <= v17 )
{
if ( v17 < v15 - v14 )
{
while ( (_BYTE)v18 )
{
if ( (unsigned __int8)(v18 - 9) > 1u )
{
puts(" returning1 ");
return 1;
}
LOBYTE(v18) = *++v14;
}
v12 = *a1;
LOBYTE(v14) = (_BYTE)v12 == 126;
if ( (unsigned __int8)v12 > 0x2Fu )
goto LABEL_32;
}
else
{
v12 = *a1;
LOBYTE(v14) = (_BYTE)v12 == 126;
if ( (unsigned __int8)v12 > 0x2Fu )
goto LABEL_32;
}
LODWORD(v14) = (0xC00100000600uLL >> v12) & 1 | (unsigned int)v14;
LABEL_32:
if ( !(_BYTE)v14 )
goto LABEL_15;
do
{
if ( !(_BYTE)v12 )
{
v12 = *a1;
goto LABEL_15;
}
v12 = *++a1;
LOBYTE(v14) = (_BYTE)v12 == 126;
if ( (unsigned __int8)v12 <= 0x2Fu )
LODWORD(v14) = (0xC00100000600uLL >> v12) & 1 | (unsigned int)v14;
}
while ( (_BYTE)v14 );
do
{
LABEL_15:
if ( (_BYTE)v12 == 47 )
break;
if ( !(_BYTE)v12 )
return 0;
if ( v11 != (_BYTE)v12 )
return (unsigned int)-1;
v11 = *++v7;
v12 = *++a1;
if ( !v11 )
break;
}
while ( v11 != 47 );
if ( !(_BYTE)v12 )
return 0;
v13 = 0x800100000600LL;
while ( (unsigned __int8)v12 <= 0x2Fu && _bittest64(&v13, v12) )
{
v12 = *++a1;
if ( !(_BYTE)v12 )
return 0;
}
return 1LL;
}
}
return v5;
}

variable_types:
listname
char *

variable_types:
name
char *

variable_types:
len
unsigned long

variable_types:
i
unsigned long

variable_types:
j
unsigned long

variable_types:
pc
char *


original_code:
int m3l_add_list(node_t **List, node_t **WTAList, opts_t *Popt)
{
 node_t *WTAChild;
 if((*List) == ((void *)0)){
  Warning("add_list: : NULL list");
  return -1;
 }
 if((*WTAList) == ((void *)0)){
  Warning("add_list: : NULL list");
  return -2;
 }
 if(*List == *WTAList){
  Warning("add_list: : list can not be added to itself position");
  return -2;
 }
 if(strncmp( (*WTAList)->type, "DIR", 3) != 0){
  if(Popt != ((void *)0) && Popt->opt_b == 'b'){
   (*List)->parent = (*WTAList)->parent;
            (*List)->prev = (*WTAList)->prev;
   (*List)->next = (*WTAList);
   (*WTAList)->prev = (*List);
   ((*WTAList)->parent)->ndim++;
   return 1;
  }
  else
  {
   (*List)->parent = (*WTAList)->parent;
   (*List)->prev = (*WTAList);
   (*List)->next = (*WTAList)->next;
   (*WTAList)->next = (*List);
   ((*WTAList)->parent)->ndim++;
   return 1;
  }
 }
 else
 {
  WTAChild = (*WTAList)->child;
  if(Popt != ((void *)0) && Popt->opt_b == 'b'){
   (*List)->parent = (*WTAList);
   (*List)->prev = ((void *)0);
   (*List)->next = WTAChild;
   if(WTAChild != ((void *)0))WTAChild->prev = (*List);
   (*WTAList)->child = (*List);
   (*WTAList)->child = (*List);
   (*WTAList)->ndim++;
   return 1;
  }
  else
  {
   if(WTAChild != ((void *)0)){
    while(WTAChild->next != ((void *)0))
     WTAChild = WTAChild->next;
    WTAChild->next = (*List);
   }
   else{
    (*WTAList)->child = (*List);
   }
   (*List)->prev = WTAChild;
   (*List)->next = ((void *)0);
   (*List)->parent = (*WTAList);
   (*WTAList)->ndim++;
   return 1;
  }
 }
return -3;
}

canonical_original_code:
int m3l_add_list(struct node **List, struct node **WTAList, struct opts *Popt)
{
 struct node *WTAChild;
 if((*List) == ((void *)0)){
  Warning("add_list: : NULL list");
  return -1;
 }
 if((*WTAList) == ((void *)0)){
  Warning("add_list: : NULL list");
  return -2;
 }
 if(*List == *WTAList){
  Warning("add_list: : list can not be added to itself position");
  return -2;
 }
 if(strncmp( (*WTAList)->type, "DIR", 3) != 0){
  if(Popt != ((void *)0) && Popt->opt_b == 'b'){
   (*List)->parent = (*WTAList)->parent;
            (*List)->prev = (*WTAList)->prev;
   (*List)->next = (*WTAList);
   (*WTAList)->prev = (*List);
   ((*WTAList)->parent)->ndim++;
   return 1;
  }
  else
  {
   (*List)->parent = (*WTAList)->parent;
   (*List)->prev = (*WTAList);
   (*List)->next = (*WTAList)->next;
   (*WTAList)->next = (*List);
   ((*WTAList)->parent)->ndim++;
   return 1;
  }
 }
 else
 {
  WTAChild = (*WTAList)->child;
  if(Popt != ((void *)0) && Popt->opt_b == 'b'){
   (*List)->parent = (*WTAList);
   (*List)->prev = ((void *)0);
   (*List)->next = WTAChild;
   if(WTAChild != ((void *)0))WTAChild->prev = (*List);
   (*WTAList)->child = (*List);
   (*WTAList)->child = (*List);
   (*WTAList)->ndim++;
   return 1;
  }
  else
  {
   if(WTAChild != ((void *)0)){
    while(WTAChild->next != ((void *)0))
     WTAChild = WTAChild->next;
    WTAChild->next = (*List);
   }
   else{
    (*WTAList)->child = (*List);
   }
   (*List)->prev = WTAChild;
   (*List)->next = ((void *)0);
   (*List)->parent = (*WTAList);
   (*WTAList)->ndim++;
   return 1;
  }
 }
return -3;
}

variable_types: struct node { char *type; char *name; unsigned long *fdim; unsigned long ndim; union data_t { void *v; float *f; double *df; long double *ldf; char *c; char *sc; unsigned char *uc; short *si; unsigned short *usi; int *i; unsigned int *ui; long *li; unsigned long *uli; long long *lli; long long *slli; unsigned long long *ulli; unsigned long *st; long *ptrdf; } data; long create_time; struct node *next; struct find_str { struct node *List; } **linknode; unsigned long lcounter; char no_malloc; int ap; } **

variable_types:
WTAList
struct node **


decompiled_code:
__int64 __fastcall m3l_add(__int64 *a1, __int64 *a2, __int64 a3, const char *a4, __int64 a5)
{
__int64 v5; // r15
size_t v9; // rdx
int v10; // eax
__int64 v11; // rax
unsigned int v12; // er12
size_t v14; // rdx
_BYTE *v15; // rax
__int64 v16[8]; // [rsp+8h] [rbp-40h] BYREF

v5 = *a2;
if ( *a1 == *a2 )
{
v12 = -1;
Warning("add_list: can not add node to itself");
return v12;
}
if ( !*a1 )
{
v12 = -1;
Warning("ln: NULL source list");
return v12;
}
if ( !v5 )
{
v12 = -1;
Warning("ln: NULL target list");
return v12;
}
v9 = strlen(a4);
v10 = *(unsigned __int8 *)a4 - 46;
if ( *a4 == 46 )
v10 = *((unsigned __int8 *)a4 + 1) - 47;
if ( v9 != 2 || v10 )
{
v11 = m3l_locate(v5, a3, a4, a5);
v16[0] = v11;
if ( v11 )
{
if ( *(_QWORD *)(v11 + 8) == 1LL )
{
v12 = m3l_add_list(a1, **(__int64 ***)v11, a5);
}
else
{
v12 = -1;
Warning("mv: multiple target nodes");
}
m3l_DestroyFound(v16);
}
else
{
v12 = -1;
Warning("add_list: no correct target specified");
}
return v12;
}
if ( *(_QWORD *)(v5 + 48) && !*(_QWORD *)(v5 + 64) )
{
v12 = -1;
Warning("add_list: root DIR is not unique");
return v12;
}
v14 = strlen((const char *)a3);
if ( *(_BYTE *)a3 != 46 || *(_BYTE *)(a3 + 1) != 47 || v14 != 2 )
{
if ( (unsigned int)comp_simle_path(*(unsigned __int8 **)(v5 + 8), (const char *)a3) )
{
v12 = -1;
Warning("add_list: List name is not valid");
return v12;
}
v5 = *a2;
}
v15 = *(_BYTE **)v5;
if ( **(_BYTE **)v5 != 68 || v15[1] != 73 || v15[2] != 82 )
{
v12 = -1;
Warning("add_list: List is not DIR");
return v12;
}
return m3l_add_list(a1, a2, a5);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 *a1, __int64 *a2, __int64 a3, const char *a4, __int64 a5)
{
__int64 v5; // r15
size_t v9; // rdx
int v10; // eax
__int64 v11; // rax
unsigned int v12; // er12
size_t v14; // rdx
_BYTE *v15; // rax
__int64 v16[8]; // [rsp+8h] [rbp-40h] BYREF

v5 = *a2;
if ( *a1 == *a2 )
{
v12 = -1;
Warning("add_list: can not add node to itself");
return v12;
}
if ( !*a1 )
{
v12 = -1;
Warning("ln: NULL source list");
return v12;
}
if ( !v5 )
{
v12 = -1;
Warning("ln: NULL target list");
return v12;
}
v9 = strlen(a4);
v10 = *(unsigned __int8 *)a4 - 46;
if ( *a4 == 46 )
v10 = *((unsigned __int8 *)a4 + 1) - 47;
if ( v9 != 2 || v10 )
{
v11 = m3l_locate(v5, a3, a4, a5);
v16[0] = v11;
if ( v11 )
{
if ( *(_QWORD *)(v11 + 8) == 1LL )
{
v12 = func1(a1, **(__int64 ***)v11, a5);
}
else
{
v12 = -1;
Warning("mv: multiple target nodes");
}
m3l_DestroyFound(v16);
}
else
{
v12 = -1;
Warning("add_list: no correct target specified");
}
return v12;
}
if ( *(_QWORD *)(v5 + 48) && !*(_QWORD *)(v5 + 64) )
{
v12 = -1;
Warning("add_list: root DIR is not unique");
return v12;
}
v14 = strlen((const char *)a3);
if ( *(_BYTE *)a3 != 46 || *(_BYTE *)(a3 + 1) != 47 || v14 != 2 )
{
if ( (unsigned int)func0(*(unsigned __int8 **)(v5 + 8), (const char *)a3) )
{
v12 = -1;
Warning("add_list: List name is not valid");
return v12;
}
v5 = *a2;
}
v15 = *(_BYTE **)v5;
if ( **(_BYTE **)v5 != 68 || v15[1] != 73 || v15[2] != 82 )
{
v12 = -1;
Warning("add_list: List is not DIR");
return v12;
}
return func1(a1, a2, a5);
}

original_code:
int m3l_add(node_t **SList, node_t **TList, const char *t_path, const char *t_path_loc, opts_t *Popts)
{
 if(*SList == *TList){
  Warning("add_list: can not add node to itself");
  return -1;
 }
 size_t addlist, len, len1;
 find_t *TFounds;
 if(*SList == ((void *)0)){
  Warning("ln: NULL source list");
  return -1;
 }
 if(*TList == ((void *)0)){
  Warning("ln: NULL target list");
  return -1;
 }
 len = strlen(t_path_loc);;
 if( (strncmp(t_path_loc, "./", 2) == 0 && len == 2)){
  if( (*TList)->next != ((void *)0) && (*TList)->parent == ((void *)0)){
   Warning("add_list: root DIR is not unique");
   return -1;
  }
  len1 = strlen(t_path);
  if( ( strncmp(t_path, "./", 2) != 0 || len1 != 2)){
   if( comp_simle_path((*TList)->name, t_path) != 0){
    Warning("add_list: List name is not valid");
    return -1;
   }
  }
  if( strncmp( (*TList)->type, "DIR", 3) == 0){
   addlist = m3l_add_list(SList, TList,Popts);
   return addlist;
  }
  else{
   Warning("add_list: List is not DIR");
   return -1;
  }
 }
 else{
  if ( (TFounds = m3l_locate( *TList, t_path, t_path_loc, Popts)) == ((void *)0)){
   Warning("add_list: no correct target specified");
   return -1;
  }
  else{
   if(TFounds->founds != 1){
    Warning("mv: multiple target nodes");
    m3l_DestroyFound(&TFounds);
    return -1;
   }
   if( (addlist = m3l_add_list(SList, &TFounds->Found_Nodes[0]->List, Popts )) < 0){
    Warning("problem in ladd_list");
   }
   m3l_DestroyFound(&TFounds);
   return addlist;
  }
 }
}

canonical_original_code:
int m3l_add(struct node **SList, struct node **TList, char *t_path, char *t_path_loc, struct opts *Popts)
{
 if(*SList == *TList){
  Warning("add_list: can not add node to itself");
  return -1;
 }
 unsigned long addlist; unsigned long len; unsigned long len1;
 struct find *TFounds;
 if(*SList == ((void *)0)){
  Warning("ln: NULL source list");
  return -1;
 }
 if(*TList == ((void *)0)){
  Warning("ln: NULL target list");
  return -1;
 }
 len = strlen(t_path_loc);;
 if( (strncmp(t_path_loc, "./", 2) == 0 && len == 2)){
  if( (*TList)->next != ((void *)0) && (*TList)->parent == ((void *)0)){
   Warning("add_list: root DIR is not unique");
   return -1;
  }
  len1 = strlen(t_path);
  if( ( strncmp(t_path, "./", 2) != 0 || len1 != 2)){
   if( comp_simle_path((*TList)->name, t_path) != 0){
    Warning("add_list: List name is not valid");
    return -1;
   }
  }
  if( strncmp( (*TList)->type, "DIR", 3) == 0){
   addlist = m3l_add_list(SList, TList,Popts);
   return addlist;
  }
  else{
   Warning("add_list: List is not DIR");
   return -1;
  }
 }
 else{
  if ( (TFounds = m3l_locate( *TList, t_path, t_path_loc, Popts)) == ((void *)0)){
   Warning("add_list: no correct target specified");
   return -1;
  }
  else{
   if(TFounds->founds != 1){
    Warning("mv: multiple target nodes");
    m3l_DestroyFound(&TFounds);
    return -1;
   }
   if( (addlist = m3l_add_list(SList, &TFounds->Found_Nodes[0]->List, Popts )) < 0){
    Warning("problem in ladd_list");
   }
   m3l_DestroyFound(&TFounds);
   return addlist;
  }
 }
}

variable_types:
TList
struct node **

variable_types:
addlist
unsigned long

variable_types: struct find { struct find_str { struct node { char *type; char *name; unsigned long *fdim; unsigned long ndim; union data_t { void *v; float *f; double *df; long double *ldf; char *c; char *sc; unsigned char *uc; short *si; unsigned short *usi; int *i; unsigned int *ui; long *li; unsigned long *uli; long long *lli; long long *slli; unsigned long long *ulli; unsigned long *st; long *ptrdf; } data; long create_time; struct node *next; struct find_str **linknode; unsigned long lcounter; char no_malloc; int ap; } *List; } **Found_Nodes; unsigned long founds; struct node *Home_Node; } *


original_code:
size_t m3l_mv(node_t **SList, const char *s_path, const char *s_path_loc, node_t **TList, const char *t_path, const char *t_path_loc, opts_t *Popts)
{
 size_t i, j,k,l,mv_tot_nodes, mv_nodes,len;
 find_t *SFounds, *TFounds;
 int init_call;
  char *name, *path, *path_loc, *newname;
 const char *pc;
 opts_t *Popts_Tlist, opts;
 init_call = 1;
 if(*SList == ((void *)0)){
  Warning("mv: NULL source list");
  return -1;
 }
 if(*TList == ((void *)0)){
  Warning("mv: NULL target list");
  return -1;
 }
 if ( (SFounds = m3l_locate( *SList, s_path, s_path_loc, Popts)) == ((void *)0)){
  Warning("mv: NULL SFounds");
  return 0;
 }
 opts.opt_i = '\0'; opts.opt_d = '\0'; opts.opt_f = '\0'; opts.opt_r = 'r'; opts.opt_I = '\0'; opts.opt_k = '\0'; opts.opt_b = '\0';opts.opt_l = '\0';
 Popts_Tlist = &opts;
 len = strlen(t_path_loc);
 if(strncmp(t_path_loc, "./", 2) == 0 && len == 2){
  for(i=0; i< SFounds->founds; i++){
   name = SFounds->Found_Nodes[i]->List->name;
   bzero(name, 48);
   if( snprintf(name,48,"%s",t_path) < 0)
    Perror("snprintf");
  }
  i = SFounds->founds;
  m3l_DestroyFound(&SFounds);
  return i;
 }
 else{
  if ( Popts->opt_add == 'a' || (TFounds = m3l_locate( *TList, t_path, t_path_loc, Popts_Tlist)) == ((void *)0)){
  pc = t_path;
  i = 0;
  k = 0;
   while(*pc != '\0'){
    if(*pc++ == '/')i++;
    k++;
   }
   if(i > 1){
    pc = t_path;
    if( ( path = (char *)malloc( (k+1)*sizeof(char))) == ((void *)0)){
     Perror("malloc");
     return -1;
    }
    if( (newname = (char *)malloc( (k+1)*sizeof(char))) == ((void *)0)){
     Perror("malloc");
     return -1;
    }
    j = 0;
    l = 0;
    while(*pc != '\0'){
     if(*pc == '/')j++;
     if(j == i )break;
     path[l++] = *pc++;
    }
    path[l] = '\0';
    l = 0;
    pc++;
    while(*pc != '\0'){
     newname[l++] = *pc++;}
    newname[l] = '\0';
    pc = t_path_loc;
    while(*pc++ != '\0')k++;
    if( ( path_loc= (char *)malloc( (k+1)*sizeof(char))) == ((void *)0)){
     Perror("malloc");
     free(path);
     free(path_loc);
     free(newname);
     m3l_DestroyFound(&SFounds);
     return -1;
    }
    j = 0;
    l = 0;
    pc = t_path_loc;
    while(*pc != '\0'){
     if(*pc == '/')j++;
     if(j == i )break;
     path_loc[l++] = *pc++;
    }
    path_loc[l] = '\0';
    if ( (TFounds = m3l_locate( *TList, path, path_loc, Popts_Tlist)) == ((void *)0)){
     free(path);
     free(path_loc);
     free(newname);
     m3l_DestroyFound(&SFounds);
     return -1;
    }
    pc = TFounds->Found_Nodes[0]->List->type;
    if(strncmp(pc, "DIR", 3) != 0 || TFounds->founds > 1){
     Warning("Wrong or not existing target");
     free(path);
     free(path_loc);
     free(newname);
     m3l_DestroyFound(&SFounds);
     m3l_DestroyFound(&TFounds);
     return -1;
    }
    mv_tot_nodes = 0;
    for(i=0; i< SFounds->founds; i++){
     name = SFounds->Found_Nodes[i]->List->name;
     bzero(name, 48);
     if( snprintf(name,48,"%s",newname) < 0)
      Perror("snprintf");
     if( SFounds->Found_Nodes[i]->List->parent != TFounds->Found_Nodes[0]->List){
      if(SFounds->Found_Nodes[i]->List == TFounds->Found_Nodes[0]->List){
       Warning("mv_list: can not move node to itself");
      }
      else{
       if( (mv_nodes = (size_t) m3l_mv_list(init_call, &SFounds->Found_Nodes[i]->List, &TFounds->Found_Nodes[0]->List, Popts )) < 0){
        Warning("problem in mv_list");
       }
       else{
        mv_tot_nodes += mv_nodes;
       }
      }
     }
     else{
      mv_tot_nodes++;
     }
    }
    free(path);
    free(path_loc);
    free(newname);
    m3l_DestroyFound(&SFounds);
    m3l_DestroyFound(&TFounds);
    return mv_tot_nodes;
   }
   else{
    m3l_DestroyFound(&SFounds);
    return -1;
   }
  }
  else{
   if(TFounds->founds != 1){
    Warning("mv: multiple target nodes");
    m3l_DestroyFound(&TFounds);
    return -1;
   }
   if( SFounds->founds > 1 && strncmp(TFounds->Found_Nodes[0]->List->type, "DIR", 3) != 0){
    Warning("cp: target node is not DIR");
    m3l_DestroyFound(&TFounds);
    m3l_DestroyFound(&SFounds);
    return -1;
   }
   mv_tot_nodes = 0;
   for(i=0; i< SFounds->founds; i++){
    if(SFounds->Found_Nodes[i]->List == TFounds->Found_Nodes[0]->List){
     Warning("mv_list: can not move node to itself");
    }
    else{
     if( (mv_nodes = (size_t) m3l_mv_list(init_call, &SFounds->Found_Nodes[i]->List, &TFounds->Found_Nodes[0]->List, Popts )) < 0){
      Warning("problem in mv_list");
     }
     else{
      mv_tot_nodes += mv_nodes;
     }
    }
   }
   m3l_DestroyFound(&TFounds);
   m3l_DestroyFound(&SFounds);
   return mv_tot_nodes;
  }
 }
}

canonical_original_code:
unsigned long m3l_mv(struct node **SList, char *s_path, char *s_path_loc, struct node **TList, char *t_path, char *t_path_loc, struct opts *Popts)
{
 unsigned long i; unsigned long j; unsigned long k; unsigned long l; unsigned long mv_tot_nodes; unsigned long mv_nodes; unsigned long len;
 struct find *SFounds; struct find *TFounds;
 int init_call;
  char *name; char *path; char *path_loc; char *newname;
 char *pc;
 struct opts *Popts_Tlist; struct opts opts;
 init_call = 1;
 if(*SList == ((void *)0)){
  Warning("mv: NULL source list");
  return -1;
 }
 if(*TList == ((void *)0)){
  Warning("mv: NULL target list");
  return -1;
 }
 if ( (SFounds = m3l_locate( *SList, s_path, s_path_loc, Popts)) == ((void *)0)){
  Warning("mv: NULL SFounds");
  return 0;
 }
 opts.opt_i = '\0'; opts.opt_d = '\0'; opts.opt_f = '\0'; opts.opt_r = 'r'; opts.opt_I = '\0'; opts.opt_k = '\0'; opts.opt_b = '\0';opts.opt_l = '\0';
 Popts_Tlist = &opts;
 len = strlen(t_path_loc);
 if(strncmp(t_path_loc, "./", 2) == 0 && len == 2){
  for(i=0; i< SFounds->founds; i++){
   name = SFounds->Found_Nodes[i]->List->name;
   bzero(name, 48);
   if( snprintf(name,48,"%s",t_path) < 0)
    Perror("snprintf");
  }
  i = SFounds->founds;
  m3l_DestroyFound(&SFounds);
  return i;
 }
 else{
  if ( Popts->opt_add == 'a' || (TFounds = m3l_locate( *TList, t_path, t_path_loc, Popts_Tlist)) == ((void *)0)){
  pc = t_path;
  i = 0;
  k = 0;
   while(*pc != '\0'){
    if(*pc++ == '/')i++;
    k++;
   }
   if(i > 1){
    pc = t_path;
    if( ( path = (char *)malloc( (k+1)*sizeof(char))) == ((void *)0)){
     Perror("malloc");
     return -1;
    }
    if( (newname = (char *)malloc( (k+1)*sizeof(char))) == ((void *)0)){
     Perror("malloc");
     return -1;
    }
    j = 0;
    l = 0;
    while(*pc != '\0'){
     if(*pc == '/')j++;
     if(j == i )break;
     path[l++] = *pc++;
    }
    path[l] = '\0';
    l = 0;
    pc++;
    while(*pc != '\0'){
     newname[l++] = *pc++;}
    newname[l] = '\0';
    pc = t_path_loc;
    while(*pc++ != '\0')k++;
    if( ( path_loc= (char *)malloc( (k+1)*sizeof(char))) == ((void *)0)){
     Perror("malloc");
     free(path);
     free(path_loc);
     free(newname);
     m3l_DestroyFound(&SFounds);
     return -1;
    }
    j = 0;
    l = 0;
    pc = t_path_loc;
    while(*pc != '\0'){
     if(*pc == '/')j++;
     if(j == i )break;
     path_loc[l++] = *pc++;
    }
    path_loc[l] = '\0';
    if ( (TFounds = m3l_locate( *TList, path, path_loc, Popts_Tlist)) == ((void *)0)){
     free(path);
     free(path_loc);
     free(newname);
     m3l_DestroyFound(&SFounds);
     return -1;
    }
    pc = TFounds->Found_Nodes[0]->List->type;
    if(strncmp(pc, "DIR", 3) != 0 || TFounds->founds > 1){
     Warning("Wrong or not existing target");
     free(path);
     free(path_loc);
     free(newname);
     m3l_DestroyFound(&SFounds);
     m3l_DestroyFound(&TFounds);
     return -1;
    }
    mv_tot_nodes = 0;
    for(i=0; i< SFounds->founds; i++){
     name = SFounds->Found_Nodes[i]->List->name;
     bzero(name, 48);
     if( snprintf(name,48,"%s",newname) < 0)
      Perror("snprintf");
     if( SFounds->Found_Nodes[i]->List->parent != TFounds->Found_Nodes[0]->List){
      if(SFounds->Found_Nodes[i]->List == TFounds->Found_Nodes[0]->List){
       Warning("mv_list: can not move node to itself");
      }
      else{
       if( (mv_nodes = (unsigned long) m3l_mv_list(init_call, &SFounds->Found_Nodes[i]->List, &TFounds->Found_Nodes[0]->List, Popts )) < 0){
        Warning("problem in mv_list");
       }
       else{
        mv_tot_nodes += mv_nodes;
       }
      }
     }
     else{
      mv_tot_nodes++;
     }
    }
    free(path);
    free(path_loc);
    free(newname);
    m3l_DestroyFound(&SFounds);
    m3l_DestroyFound(&TFounds);
    return mv_tot_nodes;
   }
   else{
    m3l_DestroyFound(&SFounds);
    return -1;
   }
  }
  else{
   if(TFounds->founds != 1){
    Warning("mv: multiple target nodes");
    m3l_DestroyFound(&TFounds);
    return -1;
   }
   if( SFounds->founds > 1 && strncmp(TFounds->Found_Nodes[0]->List->type, "DIR", 3) != 0){
    Warning("cp: target node is not DIR");
    m3l_DestroyFound(&TFounds);
    m3l_DestroyFound(&SFounds);
    return -1;
   }
   mv_tot_nodes = 0;
   for(i=0; i< SFounds->founds; i++){
    if(SFounds->Found_Nodes[i]->List == TFounds->Found_Nodes[0]->List){
     Warning("mv_list: can not move node to itself");
    }
    else{
     if( (mv_nodes = (unsigned long) m3l_mv_list(init_call, &SFounds->Found_Nodes[i]->List, &TFounds->Found_Nodes[0]->List, Popts )) < 0){
      Warning("problem in mv_list");
     }
     else{
      mv_tot_nodes += mv_nodes;
     }
    }
   }
   m3l_DestroyFound(&TFounds);
   m3l_DestroyFound(&SFounds);
   return mv_tot_nodes;
  }
 }
}

variable_types: struct opts { char opt_a; char opt_b; char opt_c; char opt_d; char opt_e; char opt_f; char opt_i; char opt_k; char opt_l; char opt_m; char opt_n; char opt_p; char opt_r; char opt_s; char opt_u; char opt_linkscleanemptrefs; char opt_nomalloc; char opt_tcpencoding; char opt_tcpheader; char opt_shutdown; char opt_add; char opt_MEMCP; char opt_EOBseq; char opt_REOBseq; char opt_format; char opt_xformat; } *

variable_types:
k
unsigned long

variable_types:
l
unsigned long

variable_types:
path
char *

variable_types:
newname
char *