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

v4 = *a1;
v5 = (const char *)**a1;
v6 = 4LL;
v7 = "LINK";
do
{
if ( !v6 )
break;
v1 = *v5 < (unsigned int)*v7;
v2 = *v5++ == *v7++;
--v6;
}
while ( v2 );
if ( (!v1 && !v2) == v1 )
{
Warning("m3l_attach_data_to_List: Can not attach LINK type list", v5, v4, v6);
result = 0xFFFFFFFFLL;
}
else
{
v8 = m3l_get_data_pointer(v4);
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 **v4; // rdx
const char *v5; // rsi
__int64 v6; // rcx
const char *v7; // rdi
const void *v8; // rdx
__int64 result; // rax

v4 = *a1;
v5 = (const char *)**a1;
v6 = 4LL;
v7 = "LINK";
do
{
if ( !v6 )
break;
v1 = *v5 < (unsigned int)*v7;
v2 = *v5++ == *v7++;
--v6;
}
while ( v2 );
if ( (!v1 && !v2) == v1 )
{
Warning("m3l_attach_data_to_List: Can not attach LINK type list", v5, v4, v6);
result = 0xFFFFFFFFLL;
}
else
{
v8 = func4(v4);
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;
}


decompiled_code:
__int64 __fastcall m3l_RenameList(__int64 a1, const char *a2)
{
size_t v2; // rax
__int64 v3; // rdx
__int64 v4; // rcx
size_t v5; // rbp
__int64 result; // rax
_QWORD *v7; // rax

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

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, const char *a2)
{
size_t v2; // rax
__int64 v3; // rdx
__int64 v4; // rcx
size_t v5; // rbp
__int64 result; // rax
_QWORD *v7; // rax

v2 = strlen(a2);
if ( v2 > 0x30 )
goto LABEL_7;
v5 = v2;
result = 0LL;
if ( !a1 )
return result;
v7 = *(_QWORD **)(a1 + 8);
if ( !v7 )
{
LABEL_7:
Warning("m3l_RenameList: Node name not malloced", a2, v3, v4);
return 0xFFFFFFFFLL;
}
*v7 = 0LL;
v7[1] = 0LL;
v7[2] = 0LL;
v7[3] = 0LL;
v7[4] = 0LL;
v7[5] = 0LL;
if ( snprintf(*(char **)(a1 + 8), v5, "%s", a2) < 0 )
{
Perror("m3l_RenameList: snprintf");
result = 0xFFFFFFFFLL;
}
else
{
*(_BYTE *)(*(_QWORD *)(a1 + 8) + v5) = 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: 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:
newname
char *

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:
len
unsigned long

return_type: int

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; }


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

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

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

if ( !a1 )
return 0xFFFFFFFFLL;
if ( (int)a2 > 0 )
{
Warning("Wrong mode", a2, a3, a4);
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: ap int

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: 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:
__int64 __fastcall m3l_Mount(const char *a1)
{
__int64 v1; // rbx
char s[8]; // [rsp+0h] [rbp-58h] BYREF
__int64 v4; // [rsp+38h] [rbp-20h]

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

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1)
{
__int64 v1; // rbx
char s[8]; // [rsp+0h] [rbp-58h] BYREF
__int64 v4; // [rsp+38h] [rbp-20h]

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

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; }

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_server_openbindlistensocket(__int16 a1)
{
int v1; // ebx
int v3[2]; // [rsp+8h] [rbp-40h] BYREF
struct sockaddr addr; // [rsp+10h] [rbp-38h] BYREF
int optval[7]; // [rsp+2Ch] [rbp-1Ch] BYREF

v1 = socket(2, 1, 0);
if ( v1 < 0 )
Perror("socket()");
*(_DWORD *)&addr.sa_data[10] = 0;
addr.sa_family = 2;
*(_QWORD *)&addr.sa_data[2] = (unsigned int)_bswap_32(0);
*(_WORD *)addr.sa_data = _bswap_16(a1);
optval[0] = 1;
if ( setsockopt(v1, 1, 2, optval, 4u) == -1 )
Perror("setsockopt(...,SO_REUSEADDR,...)");
v3[0] = 1;
v3[1] = 30;
if ( setsockopt(v1, 1, 13, v3, 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(__int16 a1)
{
int v1; // ebx
int v3[2]; // [rsp+8h] [rbp-40h] BYREF
struct sockaddr addr; // [rsp+10h] [rbp-38h] BYREF
int optval[7]; // [rsp+2Ch] [rbp-1Ch] BYREF

v1 = socket(2, 1, 0);
if ( v1 < 0 )
Perror("socket()");
*(_DWORD *)&addr.sa_data[10] = 0;
addr.sa_family = 2;
*(_QWORD *)&addr.sa_data[2] = (unsigned int)func0(0);
*(_WORD *)addr.sa_data = func1(a1);
optval[0] = 1;
if ( setsockopt(v1, 1, 2, optval, 4u) == -1 )
Perror("setsockopt(...,SO_REUSEADDR,...)");
v3[0] = 1;
v3[1] = 30;
if ( setsockopt(v1, 1, 13, v3, 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; // rbp
unsigned int v4; // ebx
const char *v6; // rax
char s[15]; // [rsp+9h] [rbp-5Fh] BYREF
struct addrinfo *pai; // [rsp+18h] [rbp-50h] BYREF
struct addrinfo req; // [rsp+20h] [rbp-48h] BYREF

*(_QWORD *)&req.ai_flags = 0x200000000LL;
*(_QWORD *)&req.ai_socktype = 1LL;
*(_QWORD *)&req.ai_addrlen = 0LL;
req.ai_addr = 0LL;
req.ai_canonname = 0LL;
req.ai_next = 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; // rbp
unsigned int v4; // ebx
const char *v6; // rax
char s[15]; // [rsp+9h] [rbp-5Fh] BYREF
struct addrinfo *pai; // [rsp+18h] [rbp-50h] BYREF
struct addrinfo req; // [rsp+20h] [rbp-48h] BYREF

*(_QWORD *)&req.ai_flags = 0x200000000LL;
*(_QWORD *)&req.ai_socktype = 1LL;
*(_QWORD *)&req.ai_addrlen = 0LL;
req.ai_addr = 0LL;
req.ai_canonname = 0LL;
req.ai_next = 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; // rbx
size_t v5; // r13
size_t v6; // r14
int v7; // eax
size_t v9; // r13
size_t v10; // r14
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 ( v5 == v6 && !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; // rbx
size_t v5; // r13
size_t v6; // r14
int v7; // eax
size_t v9; // r13
size_t v10; // r14
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 ( v5 == v6 && !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, const void *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 ( memcmp("DIR", a3, 3uLL) )
result = 48LL;
}
else if ( a4[16] == 108 )
{
if ( !memcmp("LINK", a3, 4uLL) )
result = 48LL;
}
else if ( a4[10] == 102 && !memcmp("DIR", a3, 3uLL) )
{
result = 48LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(char *a1, char *a2, const void *a3, _BYTE *a4)
{
__int64 result; // rax

result = func0(a1, a2, (__int64)a4);
if ( (_BYTE)result != 49 )
return 48LL;
if ( a4 )
{
if ( a4[6] == 100 )
{
if ( memcmp("DIR", a3, 3uLL) )
result = 48LL;
}
else if ( a4[16] == 108 )
{
if ( !memcmp("LINK", a3, 4uLL) )
result = 48LL;
}
else if ( a4[10] == 102 && !memcmp("DIR", a3, 3uLL) )
{
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 *

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:
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, __int64 a2, char *a3, __int64 *a4, void **a5, _BYTE *a6)
{
__int64 i; // rbx
__int64 result; // rax
__int64 v12; // r15

if ( a2 )
{
if ( a6 && a6[24] == 114 )
{
v12 = *(_QWORD *)(a2 + 72);
if ( v12 )
{
if ( a1 == 1 )
goto LABEL_34;
if ( (unsigned __int8)m3l_CompStatement(a3, *(char **)(a2 + 8), *(const void **)a2, a6) == 49
&& (unsigned int)m3l_AddRecord(a2, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
v12 = *(_QWORD *)(a2 + 72);
if ( v12 )
{
LABEL_34:
do
{
if ( !memcmp(*(const void **)v12, "LINK", 4uLL) && a6[17] == 76 )
m3l_FindList(2LL, *(_QWORD *)(v12 + 72), a3, a4, a5, a6);
else
m3l_FindList(2LL, v12, a3, a4, a5, a6);
v12 = *(_QWORD *)(v12 + 48);
}
while ( v12 );
}
}
else if ( (unsigned __int8)m3l_CompStatement(a3, *(char **)(a2 + 8), *(const void **)a2, a6) == 49
&& (unsigned int)m3l_AddRecord(a2, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
result = *a4;
}
else
{
if ( a1 != 1
&& (unsigned __int8)m3l_CompStatement(a3, *(char **)(a2 + 8), *(const void **)a2, a6) == 49
&& (unsigned int)m3l_AddRecord(a2, a4, a5) != 1 )
{
Warning("Error adding record to the list");
}
for ( i = *(_QWORD *)(a2 + 72); i; i = *(_QWORD *)(i + 48) )
{
if ( (unsigned __int8)m3l_CompStatement(a3, *(char **)(i + 8), *(const void **)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, __int64 a2, char *a3, __int64 *a4, void **a5, _BYTE *a6)
{
__int64 i; // rbx
__int64 result; // rax
__int64 v12; // r15

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

return_type: unsigned long

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


decompiled_code:
_BOOL8 __fastcall m3l_match_single_test(const char **a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
size_t v7; // rbx
size_t v8; // rax
_BOOL4 v9; // edx
const char *v10; // rbp
size_t v11; // rbx
size_t v12; // rax
size_t v13; // rax

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

canonical_decompiled_code:
_BOOL8 __fastcall func0(const char **a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
size_t v7; // rbx
size_t v8; // rax
_BOOL4 v9; // edx
const char *v10; // rbp
size_t v11; // rbx
size_t v12; // rax
size_t v13; // rax

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

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; // rbp
_BOOL8 result; // rax
const char *v15; // r12
size_t v16; // rbx
__int64 v17; // rdx
__int64 v18; // rcx
__int64 v19; // r8
__int64 v20; // r9

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 )
{
v15 = *(const char **)(v13 + 8);
v16 = strlen(v15);
if ( v16 == strlen((const char *)&a13 + 2) && !strncmp(v15, (const char *)&a13 + 2, v16) )
{
result = m3l_match_single_test((const char **)v13, a2, v17, v18, v19, v20, 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; // rbp
_BOOL8 result; // rax
const char *v15; // r12
size_t v16; // rbx
__int64 v17; // rdx
__int64 v18; // rcx
__int64 v19; // r8
__int64 v20; // r9

if ( (a7 & 0xDF) != 83 )
return func0((const char **)a1, a2, a3, a4, a5, a6, a7);
v13 = *(_QWORD *)(a1 + 72);
if ( v13 )
{
while ( 1 )
{
v15 = *(const char **)(v13 + 8);
v16 = strlen(v15);
if ( v16 == strlen((const char *)&a13 + 2) && !strncmp(v15, (const char *)&a13 + 2, v16) )
{
result = func0((const char **)v13, a2, v17, v18, v19, v20, 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; }


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


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';
}


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';
}


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

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

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

*(_BYTE *)(*a1 + 31) = 0;
result = *a1;
*(_BYTE *)(*a1 + 32) = 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';
}


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';
}


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';
}


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';
}


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';
}


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 **

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_add(__int64 *a1, __int64 *a2, const char *a3, const char *a4, __int64 a5)
{
__int64 v5; // r15
size_t v11; // rdx
bool v12; // zf
__int64 v13; // rax
unsigned int v14; // ebx
size_t v16; // rdx
bool v17; // zf
__int64 v18[8]; // [rsp+8h] [rbp-40h] BYREF

v5 = *a2;
if ( *a1 == *a2 )
{
Warning("add_list: can not add node to itself");
v14 = -1;
}
else if ( *a1 )
{
if ( v5 )
{
v11 = strlen(a4);
v12 = memcmp(a4, "./", 2uLL) == 0;
if ( v11 == 2 && v12 )
{
if ( *(_QWORD *)(v5 + 48) && !*(_QWORD *)(v5 + 64) )
{
Warning("add_list: root DIR is not unique");
v14 = -1;
}
else
{
v16 = strlen(a3);
v17 = memcmp(a3, "./", 2uLL) == 0;
if ( v16 == 2 && v17 || !(unsigned int)comp_simle_path(*(char **)(v5 + 8), a3) )
{
if ( !memcmp(*(const void **)*a2, "DIR", 3uLL) )
{
v14 = m3l_add_list(a1, a2, a5);
}
else
{
Warning("add_list: List is not DIR");
v14 = -1;
}
}
else
{
Warning("add_list: List name is not valid");
v14 = -1;
}
}
}
else
{
v13 = m3l_locate(v5, a3, a4, a5);
v18[0] = v13;
if ( v13 )
{
if ( *(_QWORD *)(v13 + 8) == 1LL )
{
v14 = m3l_add_list(a1, **(__int64 ***)v13, a5);
m3l_DestroyFound(v18);
}
else
{
Warning("mv: multiple target nodes");
m3l_DestroyFound(v18);
v14 = -1;
}
}
else
{
Warning("add_list: no correct target specified");
v14 = -1;
}
}
}
else
{
Warning("ln: NULL target list");
v14 = -1;
}
}
else
{
Warning("ln: NULL source list");
v14 = -1;
}
return v14;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 *a1, __int64 *a2, const char *a3, const char *a4, __int64 a5)
{
__int64 v5; // r15
size_t v11; // rdx
bool v12; // zf
__int64 v13; // rax
unsigned int v14; // ebx
size_t v16; // rdx
bool v17; // zf
__int64 v18[8]; // [rsp+8h] [rbp-40h] BYREF

v5 = *a2;
if ( *a1 == *a2 )
{
Warning("add_list: can not add node to itself");
v14 = -1;
}
else if ( *a1 )
{
if ( v5 )
{
v11 = strlen(a4);
v12 = memcmp(a4, "./", 2uLL) == 0;
if ( v11 == 2 && v12 )
{
if ( *(_QWORD *)(v5 + 48) && !*(_QWORD *)(v5 + 64) )
{
Warning("add_list: root DIR is not unique");
v14 = -1;
}
else
{
v16 = strlen(a3);
v17 = memcmp(a3, "./", 2uLL) == 0;
if ( v16 == 2 && v17 || !(unsigned int)func0(*(char **)(v5 + 8), a3) )
{
if ( !memcmp(*(const void **)*a2, "DIR", 3uLL) )
{
v14 = func1(a1, a2, a5);
}
else
{
Warning("add_list: List is not DIR");
v14 = -1;
}
}
else
{
Warning("add_list: List name is not valid");
v14 = -1;
}
}
}
else
{
v13 = m3l_locate(v5, a3, a4, a5);
v18[0] = v13;
if ( v13 )
{
if ( *(_QWORD *)(v13 + 8) == 1LL )
{
v14 = func1(a1, **(__int64 ***)v13, a5);
m3l_DestroyFound(v18);
}
else
{
Warning("mv: multiple target nodes");
m3l_DestroyFound(v18);
v14 = -1;
}
}
else
{
Warning("add_list: no correct target specified");
v14 = -1;
}
}
}
else
{
Warning("ln: NULL target list");
v14 = -1;
}
}
else
{
Warning("ln: NULL source list");
v14 = -1;
}
return v14;
}

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:
k
unsigned long

variable_types:
l
unsigned long

variable_types:
path
char *

variable_types:
newname
char *

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_ACKN(char *s)
{
_QWORD *v1; // rbx
__int64 v2; // rbp
__int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

v4[0] = m3l_Mklist("ackn", &LC0, 0LL, 0LL, 0LL, 0LL, 0LL, 0LL);
if ( !v4[0] )
Perror("m3l_Mklist");
v1 = malloc(8uLL);
*v1 = strlen(s);
v2 = m3l_Mklist("ANSWER", "C", 1LL, v1, v4, "/ackn", "./", 0LL);
if ( !v2 )
Error("m3l_Mklist");
*(_QWORD *)(v2 + 32) = s;
free(v1);
return v4[0];
}

canonical_decompiled_code:
__int64 __fastcall func0(char *s)
{
_QWORD *v1; // rbx
__int64 v2; // rbp
__int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

v4[0] = m3l_Mklist("ackn", &LC0, 0LL, 0LL, 0LL, 0LL, 0LL, 0LL);
if ( !v4[0] )
Perror("m3l_Mklist");
v1 = malloc(8uLL);
*v1 = strlen(s);
v2 = m3l_Mklist("ANSWER", "C", 1LL, v1, v4, "/ackn", "./", 0LL);
if ( !v2 )
Error("m3l_Mklist");
*(_QWORD *)(v2 + 32) = s;
free(v1);
return v4[0];
}

original_code:
node_t *m3l_ACKN(char *answer)
{
 node_t *Gnode, *TmpNode;
 size_t *dim;
 if( (Gnode = m3l_Mklist("ackn", "DIR", 0, 0, (node_t **)((void *)0), (const char *)((void *)0), (const char *)((void *)0), (char *)((void *)0))) == 0)
  Perror("m3l_Mklist");
 dim = (size_t *) malloc( 1* sizeof(size_t));
 dim[0] = strlen(answer);
 if( (TmpNode = m3l_Mklist("ANSWER", "C", 1, dim, &Gnode, "/ackn", "./", (char *)((void *)0))) == 0)
  Error("m3l_Mklist");
 TmpNode->data.c = answer;
 free(dim);
  return Gnode;
}

canonical_original_code:
struct node *m3l_ACKN(char *answer)
{
 struct node *Gnode; struct node *TmpNode;
 unsigned long *dim;
 if( (Gnode = m3l_Mklist("ackn", "DIR", 0, 0, (struct node **)((void *)0), (char *)((void *)0), (char *)((void *)0), (char *)((void *)0))) == 0)
  Perror("m3l_Mklist");
 dim = (unsigned long *) malloc( 1* sizeof(unsigned long));
 dim[0] = strlen(answer);
 if( (TmpNode = m3l_Mklist("ANSWER", "C", 1, dim, &Gnode, "/ackn", "./", (char *)((void *)0))) == 0)
  Error("m3l_Mklist");
 TmpNode->data.c = answer;
 free(dim);
  return Gnode;
}

variable_types:
answer
char *

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:
dim
unsigned long *


MkTCPIPHeader

decompiled_code:
__int64 __fastcall MkTCPIPHeader(__int64 a1)
{
__int64 v1; // rbx
int v2; // eax
__int64 v4; // [rsp+0h] [rbp-B8h] BYREF
__int64 *v5; // [rsp+38h] [rbp-80h] BYREF
char v6[27]; // [rsp+40h] [rbp-78h] BYREF
__int64 v7; // [rsp+78h] [rbp-40h]
void *ptr; // [rsp+80h] [rbp-38h]
__int64 v9; // [rsp+90h] [rbp-28h] BYREF
__int64 v10[4]; // [rsp+98h] [rbp-20h] BYREF

v5 = &v4;
m3l_set_MkTCPIPHeader(&v5);
strcpy(&v6[5], "-libm3l_TCPIP_Header-");
strcpy(v6, "DIR");
v7 = 0LL;
ptr = 0LL;
v10[0] = m3l_AllocateNode(a1);
if ( v10[0] )
{
strcpy(&v6[5], "TCPIP_encoding");
strcpy(v6, "C");
v7 = 1LL;
ptr = malloc(8uLL);
if ( !ptr )
Perror("malloc");
*(_QWORD *)ptr = 2LL;
v1 = m3l_AllocateNode(v5);
v9 = v1;
if ( v1 )
{
free(ptr);
**(_BYTE **)(v9 + 32) = *(_BYTE *)(a1 + 33);
*(_BYTE *)(*(_QWORD *)(v9 + 32) + 1LL) = 0;
v2 = m3l_add_list(&v9, v10, v5);
v1 = v10[0];
if ( v2 < 0 )
{
Warning("problem in add_list");
m3l_rm_list(1LL, v10, v5);
m3l_rm_list(1LL, &v9, v5);
v1 = 0LL;
}
}
else
{
Error("Allocate");
free(ptr);
m3l_rm_list(1LL, v10, a1);
}
}
else
{
v1 = 0LL;
Error("Allocate");
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
__int64 v1; // rbx
int v2; // eax
__int64 v4; // [rsp+0h] [rbp-B8h] BYREF
__int64 *v5; // [rsp+38h] [rbp-80h] BYREF
char v6[27]; // [rsp+40h] [rbp-78h] BYREF
__int64 v7; // [rsp+78h] [rbp-40h]
void *ptr; // [rsp+80h] [rbp-38h]
__int64 v9; // [rsp+90h] [rbp-28h] BYREF
__int64 v10[4]; // [rsp+98h] [rbp-20h] BYREF

v5 = &v4;
m3l_set_MkTCPIPHeader(&v5);
strcpy(&v6[5], "-libm3l_TCPIP_Header-");
strcpy(v6, "DIR");
v7 = 0LL;
ptr = 0LL;
v10[0] = m3l_AllocateNode(a1);
if ( v10[0] )
{
strcpy(&v6[5], "TCPIP_encoding");
strcpy(v6, "C");
v7 = 1LL;
ptr = malloc(8uLL);
if ( !ptr )
Perror("malloc");
*(_QWORD *)ptr = 2LL;
v1 = m3l_AllocateNode(v5);
v9 = v1;
if ( v1 )
{
free(ptr);
**(_BYTE **)(v9 + 32) = *(_BYTE *)(a1 + 33);
*(_BYTE *)(*(_QWORD *)(v9 + 32) + 1LL) = 0;
v2 = m3l_add_list(&v9, v10, v5);
v1 = v10[0];
if ( v2 < 0 )
{
Warning("problem in add_list");
m3l_rm_list(1LL, v10, v5);
m3l_rm_list(1LL, &v9, v5);
v1 = 0LL;
}
}
else
{
Error("Allocate");
free(ptr);
m3l_rm_list(1LL, v10, a1);
}
}
else
{
v1 = 0LL;
Error("Allocate");
}
return v1;
}

original_code:
node_t *MkTCPIPHeader(opts_t *Popts)
{
 node_t *Tmpnode, *AddNode;
 tmpstruct_t TMPSTR;
 opts_t *Poptadd, opts;
 Poptadd = &opts;
 m3l_set_MkTCPIPHeader(&Poptadd);
 if( snprintf(TMPSTR.Name_Of_List, sizeof(TMPSTR.Name_Of_List), "%s", "-libm3l_TCPIP_Header-") < 0)
     Perror("snprintf");
 if( snprintf(TMPSTR.Type, sizeof(TMPSTR.Type),"%s", "DIR") < 0)
     Perror("snprintf");
 TMPSTR.ndim = 0;
 TMPSTR.dim=((void *)0);
 if( (Tmpnode = m3l_AllocateNode(TMPSTR, Popts)) == ((void *)0)){
  Error("Allocate");
  return (node_t *) ((void *)0);
 }
 if( snprintf(TMPSTR.Name_Of_List, sizeof(TMPSTR.Name_Of_List),"%s", "TCPIP_encoding") < 0)
     Perror("snprintf");
 if( snprintf(TMPSTR.Type, sizeof(TMPSTR.Type),"%s", "C") < 0)
     Perror("snprintf");
 TMPSTR.ndim = 1;
 if( (TMPSTR.dim=(size_t *)malloc(TMPSTR.ndim * sizeof(size_t))) == ((void *)0))
  Perror("malloc");
 TMPSTR.dim[0]=2;
 if( (AddNode = m3l_AllocateNode(TMPSTR, Poptadd)) == ((void *)0)){
  Error("Allocate");
  free(TMPSTR.dim);
  if( m3l_rm_list(1, &Tmpnode, Popts) < 0)
   Warning("problem in rm_list");
  return (node_t *) ((void *)0);
 }
 free(TMPSTR.dim);
 AddNode->data.c[0] = Popts->opt_tcpencoding;
 AddNode->data.c[1] = '\0';
 if( m3l_add_list(&AddNode, &Tmpnode, Poptadd) < 0){
  Warning("problem in add_list");
  if( m3l_rm_list(1, &Tmpnode, Poptadd) < 0)
   Warning("problem in rm_list");
  if( m3l_rm_list(1, &AddNode, Poptadd) < 0)
   Warning("problem in rm_list");
  return (node_t *)((void *)0);
 }
 return Tmpnode;
}

canonical_original_code:
struct node *MkTCPIPHeader(struct opts *Popts)
{
 struct node *Tmpnode; struct node *AddNode;
 struct tmpstruct TMPSTR;
 struct opts *Poptadd; struct opts opts;
 Poptadd = &opts;
 m3l_set_MkTCPIPHeader(&Poptadd);
 if( snprintf(TMPSTR.Name_Of_List, sizeof(TMPSTR.Name_Of_List), "%s", "-libm3l_TCPIP_Header-") < 0)
     Perror("snprintf");
 if( snprintf(TMPSTR.Type, sizeof(TMPSTR.Type),"%s", "DIR") < 0)
     Perror("snprintf");
 TMPSTR.ndim = 0;
 TMPSTR.dim=((void *)0);
 if( (Tmpnode = m3l_AllocateNode(TMPSTR, Popts)) == ((void *)0)){
  Error("Allocate");
  return (struct node *) ((void *)0);
 }
 if( snprintf(TMPSTR.Name_Of_List, sizeof(TMPSTR.Name_Of_List),"%s", "TCPIP_encoding") < 0)
     Perror("snprintf");
 if( snprintf(TMPSTR.Type, sizeof(TMPSTR.Type),"%s", "C") < 0)
     Perror("snprintf");
 TMPSTR.ndim = 1;
 if( (TMPSTR.dim=(unsigned long *)malloc(TMPSTR.ndim * sizeof(unsigned long))) == ((void *)0))
  Perror("malloc");
 TMPSTR.dim[0]=2;
 if( (AddNode = m3l_AllocateNode(TMPSTR, Poptadd)) == ((void *)0)){
  Error("Allocate");
  free(TMPSTR.dim);
  if( m3l_rm_list(1, &Tmpnode, Popts) < 0)
   Warning("problem in rm_list");
  return (struct node *) ((void *)0);
 }
 free(TMPSTR.dim);
 AddNode->data.c[0] = Popts->opt_tcpencoding;
 AddNode->data.c[1] = '\0';
 if( m3l_add_list(&AddNode, &Tmpnode, Poptadd) < 0){
  Warning("problem in add_list");
  if( m3l_rm_list(1, &Tmpnode, Poptadd) < 0)
   Warning("problem in rm_list");
  if( m3l_rm_list(1, &AddNode, Poptadd) < 0)
   Warning("problem in rm_list");
  return (struct node *)((void *)0);
 }
 return Tmpnode;
}

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


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

if ( *a1 )
{
m3l_rm_list(2LL, a1, 0LL);
*a1 = 0LL;
result = 1LL;
}
else
{
Warning("Umount: : NULL list");
result = 0xFFFFFFFFLL;
}
return result;
}

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

if ( *a1 )
{
m3l_rm_list(2LL, a1, 0LL);
*a1 = 0LL;
result = 1LL;
}
else
{
Warning("Umount: : NULL list");
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int m3l_Umount(node_t **List)
{
 if( (*List) == ((void *)0)){
  Warning("Umount: : NULL list");
  return -1;
 }
 if( m3l_rm_list(2, List, (opts_t *)((void *)0)) < 0){
  Error("Unable to unmount node \n");
  return -1;
 }
 *List = ((void *)0);
 return 1;
}

canonical_original_code:
int m3l_Umount(struct node **List)
{
 if( (*List) == ((void *)0)){
  Warning("Umount: : NULL list");
  return -1;
 }
 if( m3l_rm_list(2, List, (struct opts *)((void *)0)) < 0){
  Error("Unable to unmount node \n");
  return -1;
 }
 *List = ((void *)0);
 return 1;
}


original_code:
size_t m3l_detach_list(int call, node_t **List, opts_t *Popts)
{
 node_t *PAR, *CLD, *NEXT, *PREV, *CURR;
 if((*List) == ((void *)0)){
  Warning("detach_list: : NULL list");
  return -1;
 }
 if((*List)->parent == ((void *)0)){
  return 0;
 }
 PAR = (*List)->parent;
 CLD = (*List)->child;
 NEXT = (*List)->next;
 PREV = (*List)->prev;
 CURR = (*List);
 if(PREV == ((void *)0) && NEXT == ((void *)0)){
  ((*List)->parent)->child = ((void *)0);
 }
 else if (PREV == ((void *)0))
 {
  NEXT->prev = ((void *)0);
  ((*List)->parent)->child = NEXT;
 }
  else if(NEXT == ((void *)0)){
  PREV->next = ((void *)0);
 }
 else
 {
  PREV->next = NEXT;
  NEXT->prev = PREV;
 }
 (*List)->parent->ndim--;
 (*List)->parent = ((void *)0);
 (*List)->prev = ((void *)0);
 (*List)->next = ((void *)0);
 return 1;
}

canonical_original_code:
unsigned long m3l_detach_list(int call, struct node **List, struct opts *Popts)
{
 struct node *PAR; struct node *CLD; struct node *NEXT; struct node *PREV; struct node *CURR;
 if((*List) == ((void *)0)){
  Warning("detach_list: : NULL list");
  return -1;
 }
 if((*List)->parent == ((void *)0)){
  return 0;
 }
 PAR = (*List)->parent;
 CLD = (*List)->child;
 NEXT = (*List)->next;
 PREV = (*List)->prev;
 CURR = (*List);
 if(PREV == ((void *)0) && NEXT == ((void *)0)){
  ((*List)->parent)->child = ((void *)0);
 }
 else if (PREV == ((void *)0))
 {
  NEXT->prev = ((void *)0);
  ((*List)->parent)->child = NEXT;
 }
  else if(NEXT == ((void *)0)){
  PREV->next = ((void *)0);
 }
 else
 {
  PREV->next = NEXT;
  NEXT->prev = PREV;
 }
 (*List)->parent->ndim--;
 (*List)->parent = ((void *)0);
 (*List)->prev = ((void *)0);
 (*List)->next = ((void *)0);
 return 1;
}

variable_types: call int


original_code:
uint64_t pack754(long double f, unsigned bits, unsigned expbits)
{
 long double fnorm;
 int shift;
 long long int sign, exp, significand;
 unsigned significandbits = bits - expbits - 1;
 if (f == 0.0) return 0;
 if (f < 0) {
  sign = 1; fnorm = -f;
 }
 else {
  sign = 0; fnorm = f;
 }
 shift = 0;
 while(fnorm >= 2.0) { fnorm /= 2.0; shift++; }
 while(fnorm < 1.0) { fnorm *= 2.0; shift--; }
 fnorm = fnorm - 1.0;
 significand = fnorm * ((1LL<<significandbits) + 0.5f);
 exp = shift + ((1<<(expbits-1)) - 1);
 return (sign<<(bits-1)) | (exp<<(bits-expbits-1)) | significand;
}

canonical_original_code:
unsigned long pack754(long double f, unsigned int bits, unsigned int expbits)
{
 long double fnorm;
 int shift;
 long long sign; long long exp; long long significand;
 unsigned int significandbits = bits - expbits - 1;
 if (f == 0.0) return 0;
 if (f < 0) {
  sign = 1; fnorm = -f;
 }
 else {
  sign = 0; fnorm = f;
 }
 shift = 0;
 while(fnorm >= 2.0) { fnorm /= 2.0; shift++; }
 while(fnorm < 1.0) { fnorm *= 2.0; shift--; }
 fnorm = fnorm - 1.0;
 significand = fnorm * ((1LL<<significandbits) + 0.5f);
 exp = shift + ((1<<(expbits-1)) - 1);
 return (sign<<(bits-1)) | (exp<<(bits-expbits-1)) | significand;
}

variable_types:
f
long double

variable_types:
bits
unsigned int

variable_types:
expbits
unsigned int

variable_types:
fnorm
long double

variable_types: shift int

variable_types:
sign
long long

variable_types:
exp
long long

variable_types:
significand
long long

variable_types:
significandbits
unsigned int


decompiled_code:
long double __fastcall unpack754(unsigned __int64 a1, int a2, char a3)
{
long double v3; // fst7
__int64 v4; // rax
long double v5; // fst6

if ( !a1 )
return 0.0;
v3 = (long double)(a1 & ((1LL << ((unsigned __int8)a2 - a3 - 1)) - 1))
/ (long double)(1LL << ((unsigned __int8)a2 - a3 - 1))
+ 1.0;
v4 = ((a1 >> ((unsigned __int8)a2 - a3 - 1)) & ((1LL << a3) - 1)) - (unsigned int)((1 << (a3 - 1)) - 1);
if ( v4 > 0 )
{
do
{
v3 = v3 + v3;
--v4;
}
while ( v4 );
}
if ( v4 < 0 )
{
do
{
v3 = v3 * 0.5;
++v4;
}
while ( v4 );
}
if ( _bittest64((const __int64 *)&a1, (unsigned int)(a2 - 1)) )
v5 = -1.0;
else
v5 = 1.0;
return v3 * v5;
}

canonical_decompiled_code:
long double __fastcall func1(unsigned __int64 a1, int a2, char a3)
{
long double v3; // fst7
__int64 v4; // rax
long double v5; // fst6

if ( !a1 )
return 0.0;
v3 = (long double)(a1 & ((1LL << ((unsigned __int8)a2 - a3 - 1)) - 1))
/ (long double)(1LL << ((unsigned __int8)a2 - a3 - 1))
+ 1.0;
v4 = ((a1 >> ((unsigned __int8)a2 - a3 - 1)) & ((1LL << a3) - 1)) - (unsigned int)((1 << (a3 - 1)) - 1);
if ( v4 > 0 )
{
do
{
v3 = v3 + v3;
--v4;
}
while ( v4 );
}
if ( v4 < 0 )
{
do
{
v3 = v3 * 0.5;
++v4;
}
while ( v4 );
}
if ( _bittest64((const __int64 *)&a1, (unsigned int)(a2 - 1)) )
v5 = -1.0;
else
v5 = 1.0;
return v3 * v5;
}

original_code:
long double unpack754(uint64_t i, unsigned bits, unsigned expbits)
{
 long double result;
 long long int shift;
 unsigned bias;
 unsigned significandbits = bits - expbits - 1;
 if (i == 0) return 0.0;
 result = (i&((1LL<<significandbits)-1));
 result /= (1LL<<significandbits);
 result += 1.0f;
 bias = (1<<(expbits-1)) - 1;
 shift = ((i>>significandbits)&((1LL<<expbits)-1)) - bias;
 while(shift > 0) { result *= 2.0; shift--; }
 while(shift < 0) { result /= 2.0; shift++; }
 result *= (i>>(bits-1))&1? -1.0: 1.0;
 return result;
}

canonical_original_code:
long double unpack754(unsigned long i, unsigned int bits, unsigned int expbits)
{
 long double result;
 long long shift;
 unsigned int bias;
 unsigned int significandbits = bits - expbits - 1;
 if (i == 0) return 0.0;
 result = (i&((1LL<<significandbits)-1));
 result /= (1LL<<significandbits);
 result += 1.0f;
 bias = (1<<(expbits-1)) - 1;
 shift = ((i>>significandbits)&((1LL<<expbits)-1)) - bias;
 while(shift > 0) { result *= 2.0; shift--; }
 while(shift < 0) { result /= 2.0; shift++; }
 result *= (i>>(bits-1))&1? -1.0: 1.0;
 return result;
}

variable_types:
i
unsigned long

variable_types:
result
long double

variable_types:
shift
long long

variable_types:
bias
unsigned int

return_type: long double


decompiled_code:
char *__fastcall double_2_Hex(double a1)
{
char *v1; // rbp
char *v2; // rbx
double v4; // [rsp+8h] [rbp-40h] BYREF
char s[16]; // [rsp+10h] [rbp-38h] BYREF
char v6; // [rsp+20h] [rbp-28h] BYREF

v4 = a1;
v1 = s;
v2 = (char *)&v4;
do
{
sprintf(v1, "%02X", (unsigned int)*v2++);
v1 += 2;
}
while ( v2 != s );
return &v6;
}

canonical_decompiled_code:
char *__fastcall func2(double a1)
{
char *v1; // rbp
char *v2; // rbx
double v4; // [rsp+8h] [rbp-40h] BYREF
char s[16]; // [rsp+10h] [rbp-38h] BYREF
char v6; // [rsp+20h] [rbp-28h] BYREF

v4 = a1;
v1 = s;
v2 = (char *)&v4;
do
{
sprintf(v1, "%02X", (unsigned int)*v2++);
v1 += 2;
}
while ( v2 != s );
return &v6;
}

original_code:
char * double_2_Hex(double a)
{
 char buf[17];
 char *d2c;
 char *n = buf;
 int i;
 d2c = (char *) &a;
 for(i = 0; i < 8; i++){
  sprintf(n, "%02X", *d2c++);
  n += 2;
 }
 *(n) = '\0';
 return n;
}

canonical_original_code:
char *double_2_Hex(double a)
{
 char buf[17];
 char *d2c;
 char *n = buf;
 int i;
 d2c = (char *) &a;
 for(i = 0; i < 8; i++){
  sprintf(n, "%02X", *d2c++);
  n += 2;
 }
 *(n) = '\0';
 return n;
}

variable_types: a double

variable_types:
buf
char [17]

variable_types:
n
char *

variable_types: i int

return_type: char *


decompiled_code:
__int64 __fastcall hex2dec(const char *a1)
{
int v1; // er14
const char *v2; // r12
__int64 v3; // r13
int v4; // ebp
int v5; // ebx
char v6; // al

v1 = strlen(a1);
if ( v1 - 1 < 0 )
return 0LL;
v2 = &a1[v1 - 1];
LODWORD(v3) = 0;
v4 = 0;
while ( 1 )
{
v6 = *v2;
if ( (unsigned __int8)(*v2 - 48) <= 9u )
{
v5 = v6 - 48;
goto LABEL_5;
}
if ( (unsigned __int8)(v6 - 65) > 5u )
break;
v5 = v6 - 55;
LABEL_5:
v3 = (unsigned int)(int)((double)v5 * pow(16.0, (double)v4++) + (double)(int)v3);
--v2;
if ( v1 == v4 )
return v3;
}
printf("The Entered number is not hexadecimal number");
return -1LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(const char *a1)
{
int v1; // er14
const char *v2; // r12
__int64 v3; // r13
int v4; // ebp
int v5; // ebx
char v6; // al

v1 = strlen(a1);
if ( v1 - 1 < 0 )
return 0LL;
v2 = &a1[v1 - 1];
LODWORD(v3) = 0;
v4 = 0;
while ( 1 )
{
v6 = *v2;
if ( (unsigned __int8)(*v2 - 48) <= 9u )
{
v5 = v6 - 48;
goto LABEL_5;
}
if ( (unsigned __int8)(v6 - 65) > 5u )
break;
v5 = v6 - 55;
LABEL_5:
v3 = (unsigned int)(int)((double)v5 * pow(16.0, (double)v4++) + (double)(int)v3);
--v2;
if ( v1 == v4 )
return v3;
}
printf("The Entered number is not hexadecimal number");
return -1LL;
}

original_code:
long int hex2dec(char *hex)
{
 int i,num,len,counter;
 long int sum=0;
 len=strlen(hex);
 counter = 0;
 for(i=len-1;i>=0;i--){
  if(hex[i]>='0'&&hex[i]<='9')
   num=hex[i]-'0';
  else{
   if(hex[i]>='A'&&hex[i]<='F')
    num=hex[i]-55;
   else{
    printf("The Entered number is not hexadecimal number");
    return -1;
   }
  }
  sum=sum+pow(16,counter)*num;
  counter++;
 }
 return sum;
}

canonical_original_code:
long hex2dec(char *hex)
{
 int i; int num; int len; int counter;
 long sum = 0;
 len=strlen(hex);
 counter = 0;
 for(i=len-1;i>=0;i--){
  if(hex[i]>='0'&&hex[i]<='9')
   num=hex[i]-'0';
  else{
   if(hex[i]>='A'&&hex[i]<='F')
    num=hex[i]-55;
   else{
    printf("The Entered number is not hexadecimal number");
    return -1;
   }
  }
  sum=sum+pow(16,counter)*num;
  counter++;
 }
 return sum;
}

variable_types:
hex
char *

variable_types: num int

variable_types: len int

variable_types: counter int

variable_types: sum long

return_type: long


original_code:
size_t m3l_rm(node_t **List, const char *path, const char *path_loc, opts_t *Popts)
{
 size_t i, rm_tot_nodes, rm_nodes;
 find_t *Founds;
 int init_call;
 if( (*List) == ((void *)0)){
  Warning("rm_list: NULL list");
  return 0;
 }
 if ( (Founds = m3l_locate( *List, path, path_loc, Popts)) == ((void *)0)){
  return 0;
 }
 else
 {
  if(Popts->opt_k == 'k'){
   init_call = 1;
  }
  else{
   init_call = 2;
  }
  rm_tot_nodes = 0;
  for(i=0; i< Founds->founds; i++){
   if( (rm_nodes = m3l_rm_list(init_call, &Founds->Found_Nodes[i]->List, Popts)) < 0){
    Warning("problem in rm_list");
   }
   else{
    rm_tot_nodes += rm_nodes;
   }
  }
  if(Founds->founds == 1 && Founds->Found_Nodes[0]->List == (*List) && Popts->opt_k != 'k') (*List) = ((void *)0);
  m3l_DestroyFound(&Founds);
  return rm_tot_nodes;
 }
}

canonical_original_code:
unsigned long m3l_rm(struct node **List, char *path, char *path_loc, struct opts *Popts)
{
 unsigned long i; unsigned long rm_tot_nodes; unsigned long rm_nodes;
 struct find *Founds;
 int init_call;
 if( (*List) == ((void *)0)){
  Warning("rm_list: NULL list");
  return 0;
 }
 if ( (Founds = m3l_locate( *List, path, path_loc, Popts)) == ((void *)0)){
  return 0;
 }
 else
 {
  if(Popts->opt_k == 'k'){
   init_call = 1;
  }
  else{
   init_call = 2;
  }
  rm_tot_nodes = 0;
  for(i=0; i< Founds->founds; i++){
   if( (rm_nodes = m3l_rm_list(init_call, &Founds->Found_Nodes[i]->List, Popts)) < 0){
    Warning("problem in rm_list");
   }
   else{
    rm_tot_nodes += rm_nodes;
   }
  }
  if(Founds->founds == 1 && Founds->Found_Nodes[0]->List == (*List) && Popts->opt_k != 'k') (*List) = ((void *)0);
  m3l_DestroyFound(&Founds);
  return rm_tot_nodes;
 }
}

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:
path
char *

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: 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; } *


repo: libor-m/ngsClean

decompiled_code:
void __noreturn fatal_error(const char *a1, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a1);
fflush(stdout);
fwrite("[FLASH] ERROR: ", 1uLL, 0xFuLL, stderr);
vfprintf(stderr, a1, arg);
putc(10, stderr);
exit(1);
}

canonical_decompiled_code:
void __noreturn func0(const char *a1, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a1);
fflush(stdout);
fwrite("[FLASH] ERROR: ", 1uLL, 0xFuLL, stderr);
vfprintf(stderr, a1, arg);
putc(10, stderr);
exit(1);
}

original_code:
void fatal_error(const char *msg, ...)
{
 va_list va;
 __builtin_va_start(va,msg);
 fflush(stdout);
 fputs("[FLASH] " "ERROR: ", stderr);
 vfprintf(stderr, msg, va);
 putc('\n', stderr);
 __builtin_va_end(va);
 exit(1);
}

canonical_original_code:
void fatal_error(char *msg, ...)
{
 __builtin_va_list va;
 __builtin_va_start(va,msg);
 fflush(stdout);
 fputs("[FLASH] " "ERROR: ", stderr);
 vfprintf(stderr, msg, va);
 putc('\n', stderr);
 __builtin_va_end(va);
 exit(1);
}

variable_types:
msg
char *


decompiled_code:
void __noreturn fatal_error_with_errno(const char *a1, ...)
{
int *v1; // rax
char *v2; // rax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a1);
fflush(stdout);
fwrite("[FLASH] ERROR: ", 1uLL, 0xFuLL, stderr);
vfprintf(stderr, a1, arg);
v1 = _errno_location();
v2 = strerror(*v1);
fprintf(stderr, ": %s\n", v2);
exit(1);
}

canonical_decompiled_code:
void __noreturn func1(const char *a1, ...)
{
int *v1; // rax
char *v2; // rax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a1);
fflush(stdout);
fwrite("[FLASH] ERROR: ", 1uLL, 0xFuLL, stderr);
vfprintf(stderr, a1, arg);
v1 = _errno_location();
v2 = strerror(*v1);
fprintf(stderr, ": %s\n", v2);
exit(1);
}

original_code:
void fatal_error_with_errno(const char *msg, ...)
{
 va_list va;
 __builtin_va_start(va,msg);
 fflush(stdout);
 fputs("[FLASH] " "ERROR: ", stderr);
 vfprintf(stderr, msg, va);
 fprintf(stderr, ": %s\n", strerror((*__errno_location ())));
 __builtin_va_end(va);
 exit(1);
}

canonical_original_code:
void fatal_error_with_errno(char *msg, ...)
{
 __builtin_va_list va;
 __builtin_va_start(va,msg);
 fflush(stdout);
 fputs("[FLASH] " "ERROR: ", stderr);
 vfprintf(stderr, msg, va);
 fprintf(stderr, ": %s\n", strerror((*__errno_location ())));
 __builtin_va_end(va);
 exit(1);
}


warning

decompiled_code:
int warning(char *format, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, format);
fwrite("[FLASH] WARNING: ", 1uLL, 0x11uLL, stderr);
fprintf(stderr, format, va);
return putc(10, stderr);
}

canonical_decompiled_code:
int func2(char *format, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, format);
fwrite("[FLASH] WARNING: ", 1uLL, 0x11uLL, stderr);
fprintf(stderr, format, va);
return putc(10, stderr);
}

original_code:
void warning(const char *msg, ...)
{
 va_list va;
 __builtin_va_start(va,msg);
 fputs("[FLASH] " "WARNING: ", stderr);
 fprintf(stderr, msg, va);
 putc('\n', stderr);
 __builtin_va_end(va);
}

canonical_original_code:
void warning(char *msg, ...)
{
 __builtin_va_list va;
 __builtin_va_start(va,msg);
 fputs("[FLASH] " "WARNING: ", stderr);
 fprintf(stderr, msg, va);
 putc('\n', stderr);
 __builtin_va_end(va);
}


info

decompiled_code:
void info(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
flockfile(stdout);
fwrite("[FLASH] ", 1uLL, 8uLL, stdout);
vprintf(format, arg);
putchar(10);
fflush(stdout);
funlockfile(stdout);
}

canonical_decompiled_code:
void func3(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
flockfile(stdout);
fwrite("[FLASH] ", 1uLL, 8uLL, stdout);
vprintf(format, arg);
putchar(10);
fflush(stdout);
funlockfile(stdout);
}

original_code:
void info(const char *msg, ...)
{
 va_list va;
 __builtin_va_start(va,msg);
 flockfile(stdout);
 fputs("[FLASH] ", stdout);
 vprintf(msg, va);
 putchar('\n');
 fflush(stdout);
 __builtin_va_end(va);
 funlockfile(stdout);
}

canonical_original_code:
void info(char *msg, ...)
{
 __builtin_va_list va;
 __builtin_va_start(va,msg);
 flockfile(stdout);
 fputs("[FLASH] ", stdout);
 vprintf(msg, va);
 putchar('\n');
 fflush(stdout);
 __builtin_va_end(va);
 funlockfile(stdout);
}


decompiled_code:
__int64 __fastcall get_default_num_threads(__int64 a1, __int64 a2)
{
__int64 v2; // rax
unsigned int v3; // edx

v2 = sysconf(84);
v3 = v2;
if ( v2 == -1 )
{
warning("Could not deteremine number of processors! Assuming 1", a2, 0xFFFFFFFFLL);
v3 = 1;
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2)
{
__int64 v2; // rax
unsigned int v3; // edx

v2 = sysconf(84);
v3 = v2;
if ( v2 == -1 )
{
func2("Could not deteremine number of processors! Assuming 1", a2, 0xFFFFFFFFLL);
v3 = 1;
}
return v3;
}

original_code:
unsigned get_default_num_threads()
{
 long nthreads = sysconf(_SC_NPROCESSORS_ONLN);
 if (nthreads == -1) {
  warning("Could not deteremine number of processors! Assuming 1");
  return 1;
 } else {
  return (unsigned)nthreads;
 }
}

canonical_original_code:
unsigned int get_default_num_threads()
{
 long nthreads = sysconf(_SC_NPROCESSORS_ONLN);
 if (nthreads == -1) {
  warning("Could not deteremine number of processors! Assuming 1");
  return 1;
 } else {
  return (unsigned int)nthreads;
 }
}

variable_types: nthreads long

return_type: unsigned int


xmalloc

decompiled_code:
void *__fastcall xmalloc(size_t a1)
{
void *result; // rax

result = malloc(a1);
if ( !result )
fatal_error("Out of memory: tried to allocate %zu bytes", a1);
return result;
}

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

result = malloc(a1);
if ( !result )
func0("Out of memory: tried to allocate %zu bytes", a1);
return result;
}

original_code:
void *xmalloc(size_t size)
{
 void *p = malloc(size);
 if (!p)
  fatal_error("Out of memory: tried to allocate %zu bytes", size);
 return p;
}

canonical_original_code:
void *xmalloc(unsigned long size)
{
 void *p = malloc(size);
 if (!p)
  fatal_error("Out of memory: tried to allocate %zu bytes", size);
 return p;
}

variable_types:
size
unsigned long

variable_types:
p
void *

return_type: void *


xrealloc

decompiled_code:
void *__fastcall xrealloc(void *a1, size_t a2)
{
void *result; // rax

result = realloc(a1, a2);
if ( !result )
fatal_error("Out of memory: tried to reallocate %zu bytes", a2);
return result;
}

canonical_decompiled_code:
void *__fastcall func6(void *a1, size_t a2)
{
void *result; // rax

result = realloc(a1, a2);
if ( !result )
func0("Out of memory: tried to reallocate %zu bytes", a2);
return result;
}

original_code:
void *xrealloc(void *ptr, size_t size)
{
 void *p = realloc(ptr, size);
 if (!p)
  fatal_error("Out of memory: tried to reallocate %zu bytes", size);
 return p;
}

canonical_original_code:
void *xrealloc(void *ptr, unsigned long size)
{
 void *p = realloc(ptr, size);
 if (!p)
  fatal_error("Out of memory: tried to reallocate %zu bytes", size);
 return p;
}

variable_types:
ptr
void *


xgzopen

decompiled_code:
__int64 __fastcall xgzopen(const char *a1, const char *a2)
{
char *v2; // rax
__int64 result; // rax
const char *v4; // rdx
int v5[7]; // [rsp+Ch] [rbp-1Ch] BYREF

if ( !strcmp(a1, "-") )
{
v2 = strchr(a2, 119);
result = gzdopen(v2 != 0LL, a2);
}
else
{
result = gzopen64(a1, a2);
}
if ( !result )
{
v4 = (const char *)gzerror(0LL, v5);
if ( v5[0] == -1 )
fatal_error_with_errno("Failed to open the file \"%s\"", a1);
fatal_error("zlib error opening \"%s\": %s", a1, v4);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1, const char *a2)
{
char *v2; // rax
__int64 result; // rax
const char *v4; // rdx
int v5[7]; // [rsp+Ch] [rbp-1Ch] BYREF

if ( !strcmp(a1, "-") )
{
v2 = strchr(a2, 119);
result = gzdopen(v2 != 0LL, a2);
}
else
{
result = gzopen64(a1, a2);
}
if ( !result )
{
v4 = (const char *)gzerror(0LL, v5);
if ( v5[0] == -1 )
func1("Failed to open the file \"%s\"", a1);
func0("zlib error opening \"%s\": %s", a1, v4);
}
return result;
}

original_code:
void *xgzopen(const char *filename, const char *mode)
{
 gzFile f;
 if (strcmp(filename, "-") == 0) {
  int fd;
  if (strchr(mode, 'w'))
   fd = 1;
  else
   fd = 0;
  f = gzdopen(fd, mode);
 } else {
  f = gzopen64(filename, mode);
 }
 if (!f) {
  const char *err_str;
  int errnum;
  err_str = gzerror(f, &errnum);
  if (errnum == (-1))
   fatal_error_with_errno("Failed to open the file \"%s\"",
            filename);
  else
   fatal_error("zlib error opening \"%s\": %s",
        filename, err_str);
 }
 return f;
}

canonical_original_code:
void *xgzopen(char *filename, char *mode)
{
 struct gzFile_s *f;
 if (strcmp(filename, "-") == 0) {
  int fd;
  if (strchr(mode, 'w'))
   fd = 1;
  else
   fd = 0;
  f = gzdopen(fd, mode);
 } else {
  f = gzopen64(filename, mode);
 }
 if (!f) {
  char *err_str;
  int errnum;
  err_str = gzerror(f, &errnum);
  if (errnum == (-1))
   fatal_error_with_errno("Failed to open the file \"%s\"",
            filename);
  else
   fatal_error("zlib error opening \"%s\": %s",
        filename, err_str);
 }
 return f;
}

variable_types:
filename
char *

variable_types:
mode
char *

variable_types: struct gzFile_s { unsigned int have; unsigned char *next; long pos; } *

variable_types: fd int

variable_types: errnum int


xgzclose

decompiled_code:
void __fastcall xgzclose(__int64 a1)
{
if ( a1 )
{
if ( (unsigned int)gzclose() )
fatal_error_with_errno("Failed to close output file");
}
}

canonical_decompiled_code:
void __fastcall func10(__int64 a1)
{
if ( a1 )
{
if ( (unsigned int)gzclose() )
func1("Failed to close output file");
}
}

original_code:
void xgzclose(void *fp)
{
 if (fp && gzclose((gzFile)fp) != 0)
  fatal_error_with_errno("Failed to close output file");
}

canonical_original_code:
void xgzclose(void *fp)
{
 if (fp && gzclose((struct gzFile_s *)fp) != 0)
  fatal_error_with_errno("Failed to close output file");
}

variable_types:
fp
void *

user_defined_types: struct gzFile_s { unsigned int have; unsigned char *next; long pos; }