decompiled_code:
void *__fastcall mount3_mnt_3(__int64 a1, __int64 a2)
{
bool v2; // zf
void *result; // rax

memset(&clnt_res_4, 0, 0x60uLL);
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, void *, void *, __int64, _QWORD))(a2 + 8))(
a2,
1LL,
&xdr_dirpath,
a1,
&xdr_mountres3,
&clnt_res_4,
TIMEOUT,
0LL) == 0;
result = 0LL;
if ( v2 )
result = &clnt_res_4;
return result;
}

canonical_decompiled_code:
void *__fastcall func4(__int64 a1, __int64 a2)
{
bool v2; // zf
void *result; // rax

memset(&clnt_res_4, 0, 0x60uLL);
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, void *, void *, __int64, _QWORD))(a2 + 8))(
a2,
1LL,
&xdr_dirpath,
a1,
&xdr_mountres3,
&clnt_res_4,
TIMEOUT,
0LL) == 0;
result = 0LL;
if ( v2 )
result = &clnt_res_4;
return result;
}

original_code:
mountres3 *
mount3_mnt_3(dirpath *argp, CLIENT *clnt)
{
 static mountres3 clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 1, (xdrproc_t) xdr_dirpath, (caddr_t) argp, (xdrproc_t) xdr_mountres3, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return (&clnt_res);
}

canonical_original_code:
struct mountres3 *mount3_mnt_3(char **argp, struct CLIENT *clnt)
{
 static struct mountres3 clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 1, (int (*)(struct XDR *, void *, ...)) xdr_dirpath, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_mountres3, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return (&clnt_res);
}

return_type: struct mountres3 { enum mountstat3 { MNT3_OK=0, MNT3ERR_PERM=1, MNT3ERR_NOENT=2, MNT3ERR_IO=5, MNT3ERR_ACCES=13, MNT3ERR_NOTDIR=20, MNT3ERR_INVAL=22, MNT3ERR_NAMETOOLONG=63, MNT3ERR_NOTSUPP=10004, MNT3ERR_SERVERFAULT=10006 } fhs_status; union { struct mountres3_ok { struct fhandle3 { unsigned int fhandle3_len; char fhandle3_val[64]; } fhandle; struct { unsigned int auth_flavors_len; int *auth_flavors_val; } auth_flavors; } mountinfo; } mountres3_u; } *

user_defined_types: struct mountres3 { enum mountstat3 fhs_status; union { struct mountres3_ok mountinfo; } mountres3_u; }

user_defined_types: struct mountres3_ok { struct fhandle3 fhandle; struct { unsigned int auth_flavors_len; int *auth_flavors_val; } auth_flavors; }


repo: NetDirect/nfsshell

decompiled_code:
char *__fastcall mount3_umnt_3(__int64 a1, __int64 a2)
{
unsigned int (__fastcall **v2)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, bool_t (**)(void), char *, __int64, _QWORD); // rax
bool v3; // zf
char *result; // rax

v2 = *(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8);
clnt_res_2 = 0;
v3 = (*v2)(a2, 3LL, &xdr_dirpath, a1, &xdr_void, &clnt_res_2, TIMEOUT, 0LL) == 0;
result = &clnt_res_2;
if ( !v3 )
result = 0LL;
return result;
}

canonical_decompiled_code:
char *__fastcall func5(__int64 a1, __int64 a2)
{
unsigned int (__fastcall **v2)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, bool_t (**)(void), char *, __int64, _QWORD); // rax
bool v3; // zf
char *result; // rax

v2 = *(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8);
clnt_res_2 = 0;
v3 = (*v2)(a2, 3LL, &xdr_dirpath, a1, &xdr_void, &clnt_res_2, TIMEOUT, 0LL) == 0;
result = &clnt_res_2;
if ( !v3 )
result = 0LL;
return result;
}

original_code:
void *
mount3_umnt_3(dirpath *argp, CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 3, (xdrproc_t) xdr_dirpath, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

canonical_original_code:
void *mount3_umnt_3(char **argp, struct CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 3, (int (*)(struct XDR *, void *, ...)) xdr_dirpath, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

variable_types:
argp
char **

variable_types: struct CLIENT { struct AUTH { struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; } ah_cred; struct opaque_auth ah_verf; union des_block { struct { unsigned int high; unsigned int low; } key; char c[8]; } ah_key; struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); } *ah_ops; char *ah_private; } *cl_auth; struct clnt_ops { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval { long tv_sec; long tv_usec; }); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } re_status; union { int RE_errno; enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 } RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; } *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); } *cl_ops; char *cl_private; } *

return_type: void *

user_defined_types: struct CLIENT { struct AUTH *cl_auth; struct clnt_ops *cl_ops; char *cl_private; }

user_defined_types: struct AUTH { struct opaque_auth ah_cred; struct opaque_auth ah_verf; union des_block ah_key; struct auth_ops *ah_ops; char *ah_private; }

user_defined_types: struct clnt_ops { enum clnt_stat (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); }

user_defined_types: struct XDR { enum xdr_op x_op; struct xdr_ops *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; }

user_defined_types: struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); }

user_defined_types: struct rpc_err { enum clnt_stat re_status; union { int RE_errno; enum auth_stat RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; }


decompiled_code:
char *__fastcall mount3_umntall_3(__int64 a1, __int64 a2)
{
unsigned int (__fastcall **v2)(__int64, __int64, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD); // rax
bool v3; // zf
char *result; // rax

v2 = *(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8);
clnt_res_1 = 0;
v3 = (*v2)(a2, 4LL, &xdr_void, a1, &xdr_void, &clnt_res_1, TIMEOUT, 0LL) == 0;
result = &clnt_res_1;
if ( !v3 )
result = 0LL;
return result;
}

canonical_decompiled_code:
char *__fastcall func6(__int64 a1, __int64 a2)
{
unsigned int (__fastcall **v2)(__int64, __int64, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD); // rax
bool v3; // zf
char *result; // rax

v2 = *(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8);
clnt_res_1 = 0;
v3 = (*v2)(a2, 4LL, &xdr_void, a1, &xdr_void, &clnt_res_1, TIMEOUT, 0LL) == 0;
result = &clnt_res_1;
if ( !v3 )
result = 0LL;
return result;
}

original_code:
void *
mount3_umntall_3(void *argp, CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 4, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

canonical_original_code:
void *mount3_umntall_3(void *argp, struct CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 4, (int (*)(struct XDR *, void *, ...)) xdr_void, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

variable_types:
argp
void *

user_defined_types: struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; }

user_defined_types: union des_block { struct { unsigned int high; unsigned int low; } key; char c[8]; }

user_defined_types: enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 }

user_defined_types: struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); }

user_defined_types: enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 }

user_defined_types: struct timeval { long tv_sec; long tv_usec; }

user_defined_types: enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 }


decompiled_code:
_BOOL8 __fastcall xdr_fhandle3(XDR *a1, __int64 a2)
{
return xdr_bytes(a1, (char **)(a2 + 4), (u_int *)a2, 0x40u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(XDR *a1, __int64 a2)
{
return xdr_bytes(a1, (char **)(a2 + 4), (u_int *)a2, 0x40u) != 0;
}

original_code:
bool_t
xdr_fhandle3 (XDR *xdrs, fhandle3 *objp)
{
 register int32_t *buf;
  if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, 64))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_fhandle3(struct XDR *xdrs, struct fhandle3 *objp)
{
 register int *buf;
  if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (unsigned int *) &objp->fhandle3_len, 64))
   return (0);
 return (1);
}

variable_types: struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *

variable_types: struct fhandle3 { unsigned int fhandle3_len; char fhandle3_val[64]; } *

variable_types:
buf
int *

return_type: int


decompiled_code:
_BOOL8 __fastcall xdr_dirpath(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

original_code:
bool_t
xdr_dirpath (XDR *xdrs, dirpath *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, objp, 1024))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_dirpath(struct XDR *xdrs, char **objp)
{
 register int *buf;
  if (!xdr_string (xdrs, objp, 1024))
   return (0);
 return (1);
}

variable_types:
objp
char **


decompiled_code:
_BOOL8 __fastcall xdr_name(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0xFFu) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0xFFu) != 0;
}

original_code:
bool_t
xdr_name (XDR *xdrs, name *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, objp, 255))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_name(struct XDR *xdrs, char **objp)
{
 register int *buf;
  if (!xdr_string (xdrs, objp, 255))
   return (0);
 return (1);
}


decompiled_code:
_BOOL8 __fastcall xdr_mountstat3(XDR *a1, enum_t *a2)
{
return xdr_enum(a1, a2) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(XDR *a1, enum_t *a2)
{
return xdr_enum(a1, a2) != 0;
}

original_code:
bool_t
xdr_mountstat3 (XDR *xdrs, mountstat3 *objp)
{
 register int32_t *buf;
  if (!xdr_enum (xdrs, (enum_t *) objp))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountstat3(struct XDR *xdrs, enum mountstat3 *objp)
{
 register int *buf;
  if (!xdr_enum (xdrs, (int *) objp))
   return (0);
 return (1);
}

variable_types: enum mountstat3 { MNT3_OK=0, MNT3ERR_PERM=1, MNT3ERR_NOENT=2, MNT3ERR_IO=5, MNT3ERR_ACCES=13, MNT3ERR_NOTDIR=20, MNT3ERR_INVAL=22, MNT3ERR_NAMETOOLONG=63, MNT3ERR_NOTSUPP=10004, MNT3ERR_SERVERFAULT=10006 } *


decompiled_code:
_BOOL8 __fastcall xdr_mountlist(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x18u, xdr_mountbody) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func4(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x18u, xdr_mountbody) != 0;
}

original_code:
bool_t
xdr_mountlist (XDR *xdrs, mountlist *objp)
{
 register int32_t *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountlist(struct XDR *xdrs, struct mountbody **objp)
{
 register int *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct mountbody), (int (*)(struct XDR *, void *, ...)) xdr_mountbody))
   return (0);
 return (1);
}

variable_types: struct mountbody { char *ml_hostname; char *ml_directory; struct mountbody *ml_next; } **


decompiled_code:
_BOOL8 __fastcall xdr_mountbody(XDR *a1, void *a2)
{
_BOOL8 result; // rax

if ( xdr_name(a1, (char **)a2) && xdr_dirpath(a1, (char **)a2 + 1) )
result = xdr_mountlist(a1, (char **)a2 + 2);
else
result = 0LL;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func5(XDR *a1, void *a2)
{
_BOOL8 result; // rax

if ( func2(a1, (char **)a2) && func1(a1, (char **)a2 + 1) )
result = func4(a1, (char **)a2 + 2);
else
result = 0LL;
return result;
}

original_code:
bool_t
xdr_mountbody (XDR *xdrs, mountbody *objp)
{
 register int32_t *buf;
  if (!xdr_name (xdrs, &objp->ml_hostname))
   return (0);
  if (!xdr_dirpath (xdrs, &objp->ml_directory))
   return (0);
  if (!xdr_mountlist (xdrs, &objp->ml_next))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountbody(struct XDR *xdrs, struct mountbody *objp)
{
 register int *buf;
  if (!xdr_name (xdrs, &objp->ml_hostname))
   return (0);
  if (!xdr_dirpath (xdrs, &objp->ml_directory))
   return (0);
  if (!xdr_mountlist (xdrs, &objp->ml_next))
   return (0);
 return (1);
}

variable_types: struct mountbody { char *ml_hostname; char *ml_directory; struct mountbody *ml_next; } *


decompiled_code:
_BOOL8 __fastcall xdr_groups(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x10u, xdr_groupnode) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func6(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x10u, xdr_groupnode) != 0;
}

original_code:
bool_t
xdr_groups (XDR *xdrs, groups *objp)
{
 register int32_t *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_groups(struct XDR *xdrs, struct groupnode **objp)
{
 register int *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct groupnode), (int (*)(struct XDR *, void *, ...)) xdr_groupnode))
   return (0);
 return (1);
}

variable_types: struct groupnode { char *gr_name; struct groupnode *gr_next; } **


decompiled_code:
_BOOL8 __fastcall xdr_groupnode(XDR *a1, void *a2)
{
_BOOL8 result; // rax

result = xdr_name(a1, (char **)a2);
if ( result )
result = xdr_groups(a1, (char **)a2 + 1);
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func7(XDR *a1, void *a2)
{
_BOOL8 result; // rax

result = func2(a1, (char **)a2);
if ( result )
result = func6(a1, (char **)a2 + 1);
return result;
}

original_code:
bool_t
xdr_groupnode (XDR *xdrs, groupnode *objp)
{
 register int32_t *buf;
  if (!xdr_name (xdrs, &objp->gr_name))
   return (0);
  if (!xdr_groups (xdrs, &objp->gr_next))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_groupnode(struct XDR *xdrs, struct groupnode *objp)
{
 register int *buf;
  if (!xdr_name (xdrs, &objp->gr_name))
   return (0);
  if (!xdr_groups (xdrs, &objp->gr_next))
   return (0);
 return (1);
}

variable_types: struct groupnode { char *gr_name; struct groupnode *gr_next; } *


decompiled_code:
_BOOL8 __fastcall xdr_exports(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x18u, xdr_exportnode) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func8(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x18u, xdr_exportnode) != 0;
}

original_code:
bool_t
xdr_exports (XDR *xdrs, exports *objp)
{
 register int32_t *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_exports(struct XDR *xdrs, struct exportnode **objp)
{
 register int *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct exportnode), (int (*)(struct XDR *, void *, ...)) xdr_exportnode))
   return (0);
 return (1);
}

variable_types: struct exportnode { char *ex_dir; struct groupnode { char *gr_name; struct groupnode *gr_next; } *ex_groups; struct exportnode *ex_next; } **

user_defined_types: struct exportnode { char *ex_dir; struct groupnode *ex_groups; struct exportnode *ex_next; }


decompiled_code:
_BOOL8 __fastcall xdr_exportnode(XDR *a1, void *a2)
{
_BOOL8 result; // rax

if ( xdr_dirpath(a1, (char **)a2) && xdr_groups(a1, (char **)a2 + 1) )
result = xdr_exports(a1, (char **)a2 + 2);
else
result = 0LL;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func9(XDR *a1, void *a2)
{
_BOOL8 result; // rax

if ( func1(a1, (char **)a2) && func6(a1, (char **)a2 + 1) )
result = func8(a1, (char **)a2 + 2);
else
result = 0LL;
return result;
}

original_code:
bool_t
xdr_exportnode (XDR *xdrs, exportnode *objp)
{
 register int32_t *buf;
  if (!xdr_dirpath (xdrs, &objp->ex_dir))
   return (0);
  if (!xdr_groups (xdrs, &objp->ex_groups))
   return (0);
  if (!xdr_exports (xdrs, &objp->ex_next))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_exportnode(struct XDR *xdrs, struct exportnode *objp)
{
 register int *buf;
  if (!xdr_dirpath (xdrs, &objp->ex_dir))
   return (0);
  if (!xdr_groups (xdrs, &objp->ex_groups))
   return (0);
  if (!xdr_exports (xdrs, &objp->ex_next))
   return (0);
 return (1);
}

variable_types: struct exportnode { char *ex_dir; struct groupnode { char *gr_name; struct groupnode *gr_next; } *ex_groups; struct exportnode *ex_next; } *


decompiled_code:
__int64 __fastcall xdr_mountres3_ok(XDR *xdrs, __int64 a2)
{
__int64 result; // rax

result = xdr_fhandle3(xdrs, a2);
if ( (_DWORD)result )
result = xdr_array(xdrs, (caddr_t *)(a2 + 80), (u_int *)(a2 + 72), 0xFFFFFFFF, 4u, (xdrproc_t)&xdr_int) != 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(XDR *xdrs, __int64 a2)
{
__int64 result; // rax

result = func0(xdrs, a2);
if ( (_DWORD)result )
result = xdr_array(xdrs, (caddr_t *)(a2 + 80), (u_int *)(a2 + 72), 0xFFFFFFFF, 4u, (xdrproc_t)&xdr_int) != 0;
return result;
}

original_code:
bool_t
xdr_mountres3_ok (XDR *xdrs, mountres3_ok *objp)
{
 register int32_t *buf;
  if (!xdr_fhandle3 (xdrs, &objp->fhandle))
   return (0);
  if (!xdr_array (xdrs, (char **)&objp->auth_flavors.auth_flavors_val, (u_int *) &objp->auth_flavors.auth_flavors_len, ~0,
  sizeof (int), (xdrproc_t) xdr_int))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountres3_ok(struct XDR *xdrs, struct mountres3_ok *objp)
{
 register int *buf;
  if (!xdr_fhandle3 (xdrs, &objp->fhandle))
   return (0);
  if (!xdr_array (xdrs, (char **)&objp->auth_flavors.auth_flavors_val, (unsigned int *) &objp->auth_flavors.auth_flavors_len, ~0,
  sizeof (int), (int (*)(struct XDR *, void *, ...)) xdr_int))
   return (0);
 return (1);
}

variable_types: struct mountres3_ok { struct fhandle3 { unsigned int fhandle3_len; char fhandle3_val[64]; } fhandle; struct { unsigned int auth_flavors_len; int *auth_flavors_val; } auth_flavors; } *


decompiled_code:
__int64 __fastcall xdr_mountres3(XDR *xdrs, enum_t *a2)
{
__int64 result; // rax

result = xdr_mountstat3(xdrs, a2);
if ( (_DWORD)result )
{
result = 1LL;
if ( !*a2 )
result = (unsigned int)xdr_mountres3_ok(xdrs, (__int64)(a2 + 2)) != 0;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(XDR *xdrs, enum_t *a2)
{
__int64 result; // rax

result = func3(xdrs, a2);
if ( (_DWORD)result )
{
result = 1LL;
if ( !*a2 )
result = (unsigned int)func10(xdrs, (__int64)(a2 + 2)) != 0;
}
return result;
}

original_code:
bool_t
xdr_mountres3 (XDR *xdrs, mountres3 *objp)
{
 register int32_t *buf;
  if (!xdr_mountstat3 (xdrs, &objp->fhs_status))
   return (0);
 switch (objp->fhs_status) {
 case MNT3_OK:
   if (!xdr_mountres3_ok (xdrs, &objp->mountres3_u.mountinfo))
    return (0);
  break;
 default:
  break;
 }
 return (1);
}

canonical_original_code:
int xdr_mountres3(struct XDR *xdrs, struct mountres3 *objp)
{
 register int *buf;
  if (!xdr_mountstat3 (xdrs, &objp->fhs_status))
   return (0);
 switch (objp->fhs_status) {
 case MNT3_OK:
   if (!xdr_mountres3_ok (xdrs, &objp->mountres3_u.mountinfo))
    return (0);
  break;
 default:
  break;
 }
 return (1);
}

variable_types: struct mountres3 { enum mountstat3 { MNT3_OK=0, MNT3ERR_PERM=1, MNT3ERR_NOENT=2, MNT3ERR_IO=5, MNT3ERR_ACCES=13, MNT3ERR_NOTDIR=20, MNT3ERR_INVAL=22, MNT3ERR_NAMETOOLONG=63, MNT3ERR_NOTSUPP=10004, MNT3ERR_SERVERFAULT=10006 } fhs_status; union { struct mountres3_ok { struct fhandle3 { unsigned int fhandle3_len; char fhandle3_val[64]; } fhandle; struct { unsigned int auth_flavors_len; int *auth_flavors_val; } auth_flavors; } mountinfo; } mountres3_u; } *


decompiled_code:
// attributes: thunk
_BOOL8 __fastcall xdr_mountstat1(XDR *a1, enum_t *a2)
{
return xdr_mountstat3(a1, a2);
}

canonical_decompiled_code:
_BOOL8 __fastcall func12(XDR *a1, enum_t *a2)
{
return func3(a1, a2);
}

original_code:
bool_t
xdr_mountstat1 (XDR *xdrs, mountstat1 *objp)
{
 register int32_t *buf;
  if (!xdr_enum (xdrs, (enum_t *) objp))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountstat1(struct XDR *xdrs, enum mountstat1 *objp)
{
 register int *buf;
  if (!xdr_enum (xdrs, (int *) objp))
   return (0);
 return (1);
}

variable_types: enum mountstat1 { MNT1_OK=0, MNT1ERR_PERM=1, MNT1ERR_NOENT=2, MNT1ERR_IO=5, MNT1ERR_ACCES=13, MNT1ERR_NOTDIR=20, MNT1ERR_INVAL=22, MNT1ERR_NAMETOOLONG=63, MNT1ERR_NOTSUPP=10004, MNT1ERR_SERVERFAULT=10006 } *


decompiled_code:
_BOOL8 __fastcall xdr_fhandle1(XDR *a1, char *a2)
{
return xdr_opaque(a1, a2, 0x20u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func13(XDR *a1, char *a2)
{
return xdr_opaque(a1, a2, 0x20u) != 0;
}

original_code:
bool_t
xdr_fhandle1 (XDR *xdrs, fhandle1 objp)
{
 register int32_t *buf;
  if (!xdr_opaque (xdrs, objp, 32))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_fhandle1(struct XDR *xdrs, char objp[32])
{
 register int *buf;
  if (!xdr_opaque (xdrs, objp, 32))
   return (0);
 return (1);
}

variable_types:
objp
char [32]


decompiled_code:
_BOOL8 __fastcall xdr_mountres1_ok(XDR *a1, char *a2)
{
return xdr_fhandle1(a1, a2);
}

canonical_decompiled_code:
_BOOL8 __fastcall func14(XDR *a1, char *a2)
{
return func13(a1, a2);
}

original_code:
bool_t
xdr_mountres1_ok (XDR *xdrs, mountres1_ok *objp)
{
 register int32_t *buf;
  if (!xdr_fhandle1 (xdrs, objp->fhandle))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountres1_ok(struct XDR *xdrs, struct mountres1_ok *objp)
{
 register int *buf;
  if (!xdr_fhandle1 (xdrs, objp->fhandle))
   return (0);
 return (1);
}

variable_types: struct mountres1_ok { char fhandle[32]; } *


decompiled_code:
_BOOL8 __fastcall xdr_mountres1(XDR *a1, __int64 a2)
{
_BOOL8 result; // rax

result = xdr_mountstat3(a1, (enum_t *)a2);
if ( result )
{
result = 1LL;
if ( !*(_DWORD *)a2 )
result = xdr_mountres1_ok(a1, (char *)(a2 + 4));
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func15(XDR *a1, __int64 a2)
{
_BOOL8 result; // rax

result = func3(a1, (enum_t *)a2);
if ( result )
{
result = 1LL;
if ( !*(_DWORD *)a2 )
result = func14(a1, (char *)(a2 + 4));
}
return result;
}

original_code:
bool_t
xdr_mountres1 (XDR *xdrs, mountres1 *objp)
{
 register int32_t *buf;
  if (!xdr_mountstat1 (xdrs, &objp->fhs_status))
   return (0);
 switch (objp->fhs_status) {
 case MNT1_OK:
   if (!xdr_mountres1_ok (xdrs, &objp->mountres1_u.mountinfo))
    return (0);
  break;
 default:
  break;
 }
 return (1);
}

canonical_original_code:
int xdr_mountres1(struct XDR *xdrs, struct mountres1 *objp)
{
 register int *buf;
  if (!xdr_mountstat1 (xdrs, &objp->fhs_status))
   return (0);
 switch (objp->fhs_status) {
 case MNT1_OK:
   if (!xdr_mountres1_ok (xdrs, &objp->mountres1_u.mountinfo))
    return (0);
  break;
 default:
  break;
 }
 return (1);
}

variable_types: struct mountres1 { enum mountstat1 { MNT1_OK=0, MNT1ERR_PERM=1, MNT1ERR_NOENT=2, MNT1ERR_IO=5, MNT1ERR_ACCES=13, MNT1ERR_NOTDIR=20, MNT1ERR_INVAL=22, MNT1ERR_NAMETOOLONG=63, MNT1ERR_NOTSUPP=10004, MNT1ERR_SERVERFAULT=10006 } fhs_status; union { struct mountres1_ok { char fhandle[32]; } mountinfo; } mountres1_u; } *

user_defined_types: struct mountres1 { enum mountstat1 fhs_status; union { struct mountres1_ok mountinfo; } mountres1_u; }


main

canonical_name: main

repo: Nexfer/Stegano

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char v3; // al

if ( (unsigned int)(argc - 4) > 1 )
goto LABEL_7;
v3 = *argv[1];
if ( v3 != 100 )
{
if ( v3 != 101 || argc == 5 )
goto LABEL_5;
LABEL_7:
puts("ERROR: Wrong parameters!");
puts("Usage:");
puts("For encryption: ./stegano [e] [source file] [destination file] [text file]");
puts("For decryption: ./stegano [d] [source file] [text file]");
return 0;
}
if ( argc != 4 )
goto LABEL_7;
LABEL_5:
stegano(argv);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char v3; // al

if ( (unsigned int)(argc - 4) > 1 )
goto LABEL_7;
v3 = *argv[1];
if ( v3 != 100 )
{
if ( v3 != 101 || argc == 5 )
goto LABEL_5;
LABEL_7:
puts("ERROR: Wrong parameters!");
puts("Usage:");
puts("For encryption: ./stegano [e] [source file] [destination file] [text file]");
puts("For decryption: ./stegano [d] [source file] [text file]");
return 0;
}
if ( argc != 4 )
goto LABEL_7;
LABEL_5:
func7(argv);
return 0;
}

original_code:
int main(int argc, char *argv[])
{
 if(argc < 4 || argc > 5 || (argv[1][0] == 'd' && argc != 4) || (argv[1][0] == 'e' && argc != 5))
 {
  printf("ERROR: Wrong parameters!\n");
  printf("Usage:\n");
  printf("For encryption: ./stegano [e] [source file] [destination file] [text file]\n");
  printf("For decryption: ./stegano [d] [source file] [text file]\n");
  return 0;
 }
 stegano(argv);
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]


repo: Nexfer/cifers

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
if ( argc <= 1 )
{
puts("ERROR: Need to type a name of file which will be encrypted");
goto LABEL_9;
}
switch ( argc )
{
case 2:
LABEL_9:
puts("ERROR: Need to type a name of file where the result will be written");
goto LABEL_10;
case 3:
LABEL_10:
puts("ERROR: Need to type a name of file where the key will be");
goto LABEL_11;
case 4:
LABEL_11:
puts("ERROR: Need to type mode (e - enc, d - dec)");
return 0;
case 5:
vigenere(argv);
break;
}
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
if ( argc <= 1 )
{
puts("ERROR: Need to type a name of file which will be encrypted");
goto LABEL_9;
}
switch ( argc )
{
case 2:
LABEL_9:
puts("ERROR: Need to type a name of file where the result will be written");
goto LABEL_10;
case 3:
LABEL_10:
puts("ERROR: Need to type a name of file where the key will be");
goto LABEL_11;
case 4:
LABEL_11:
puts("ERROR: Need to type mode (e - enc, d - dec)");
return 0;
case 5:
func10(argv);
break;
}
return 0;
}

original_code:
int main(int argc, char *argv[])
{
 if(argc < 2)
  printf("ERROR: Need to type a name of file which will be encrypted\n");
 if(argc <= 2)
  printf("ERROR: Need to type a name of file where the result will be written\n");
 if(argc <= 3)
  printf("ERROR: Need to type a name of file where the key will be\n");
 if(argc <= 4)
  printf("ERROR: Need to type mode (e - enc, d - dec)\n");
 if(argc == 5)
 {
  vigenere(argv);
 }
 return 0;
}


innum

decompiled_code:
__int64 __fastcall innum(char a1)
{
char v1; // al
unsigned __int8 v3; // dl
char v4; // di

v1 = a1;
if ( (unsigned __int8)(a1 - 65) <= 0x19u )
return (unsigned int)(char)(a1 - 65);
v3 = a1 - 97;
v4 = a1 - 71;
if ( v3 < 0x1Au )
v1 = v4;
return (unsigned int)v1;
}

canonical_decompiled_code:
__int64 __fastcall func8(char a1)
{
char v1; // al
unsigned __int8 v3; // dl
char v4; // di

v1 = a1;
if ( (unsigned __int8)(a1 - 65) <= 0x19u )
return (unsigned int)(char)(a1 - 65);
v3 = a1 - 97;
v4 = a1 - 71;
if ( v3 < 0x1Au )
v1 = v4;
return (unsigned int)v1;
}

variable_types: a char


inchar

decompiled_code:
__int64 __fastcall inchar(unsigned __int8 a1)
{
unsigned __int8 v1; // al
unsigned __int8 v3; // dl
unsigned __int8 v4; // di

v1 = a1;
if ( a1 <= 0x19u )
return (unsigned int)(char)(a1 + 65);
v3 = a1 - 26;
v4 = a1 + 71;
if ( v3 < 0x1Au )
v1 = v4;
return (unsigned int)(char)v1;
}

canonical_decompiled_code:
__int64 __fastcall func9(unsigned __int8 a1)
{
unsigned __int8 v1; // al
unsigned __int8 v3; // dl
unsigned __int8 v4; // di

v1 = a1;
if ( a1 <= 0x19u )
return (unsigned int)(char)(a1 + 65);
v3 = a1 - 26;
v4 = a1 + 71;
if ( v3 < 0x1Au )
v1 = v4;
return (unsigned int)(char)v1;
}


constr

repo: Neymello/slabAllocator

decompiled_code:
void __fastcall constr(__int64 a1)
{
*(_DWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 0LL;
}

canonical_decompiled_code:
void __fastcall func0(__int64 a1)
{
*(_DWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 0LL;
}

original_code:
void constr(void *buf, int size){
 int s = size;
 s++;
 testBuf_t buffer = (testBuf_t) buf;
 buffer->id=0;
 buffer->value = ((void *)0);
}

canonical_original_code:
void constr(void *buf, int size){
 int s = size;
 s++;
 struct testBuf *buffer = (testBuf_t) buf;
 buffer->id=0;
 buffer->value = ((void *)0);
}

variable_types:
buf
void *

variable_types: size int

variable_types: s int

variable_types: struct testBuf { int id; char *value; int pad[1000]; } *

return_type: void


destruct

decompiled_code:
// attributes: thunk
void __fastcall destruct(__int64 a1)
{
constr(a1);
}

canonical_decompiled_code:
void __fastcall func1(__int64 a1)
{
func0(a1);
}

original_code:
void destruct(void *buf, int size){
 int s = size;
 s++;
 testBuf_t buffer = (testBuf_t) buf;
 buffer->id=0;
 buffer->value = ((void *)0);
}

canonical_original_code:
void destruct(void *buf, int size){
 int s = size;
 s++;
 struct testBuf *buffer = (testBuf_t) buf;
 buffer->id=0;
 buffer->value = ((void *)0);
}

user_defined_types: struct testBuf { int id; char *value; int pad[1000]; }


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned __int64 v3; // rax
__int64 v4; // r12
__int64 v5; // r13
unsigned __int64 v6; // rax
__int64 *v7; // rbx
unsigned __int64 v8; // rax
__int64 *v9; // r12
__int64 *v10; // r15
unsigned __int64 v11; // rax
unsigned __int64 v12; // rax
__int64 v13; // rsi
unsigned __int64 v14; // rax
unsigned __int64 v15; // rax
__int64 v16; // r15
unsigned __int64 v17; // rax
__int64 v18; // rsi
unsigned __int64 v19; // rax
__int64 v20; // rbx
unsigned __int64 v21; // rax
__int64 v22; // rsi
unsigned __int64 v23; // rax
__int64 v24; // rbx
unsigned __int64 v25; // rax
_BYTE v27[400]; // [rsp+0h] [rbp-360h] BYREF
__int64 v28; // [rsp+190h] [rbp-1D0h] BYREF
__int64 v29; // [rsp+320h] [rbp-40h] BYREF
__int64 v30; // [rsp+328h] [rbp-38h]

puts("##########################\nThe result will be showed in number of cycles\n##########################");
printf("------------\n\tObjects Size:%d\n\tIterations %d\n------------\n", 1000LL, 100LL);
v3 = __rdtsc();
v4 = (unsigned int)v3;
v5 = kmem_cache_create("first", 4016LL, 0LL, constr, destruct);
v6 = __rdtsc();
printf("Overhead for CACHE_CREATE %lld\n", (unsigned int)v6 - v4);
if ( *(_DWORD *)(v5 + 56) )
_assert_fail(
"cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0",
"main.c",
0x2Du,
"main");
v7 = (__int64 *)v27;
v8 = __rdtsc();
v30 = (unsigned int)v8;
v9 = (__int64 *)v27;
v10 = (__int64 *)v27;
do
*v10++ = kmem_cache_alloc(v5, 1LL);
while ( v10 != &v29 );
v11 = __rdtsc();
printf("Overhead for CACHE_ALLOC %lld\n", ((unsigned __int64)HIDWORD(v11) - v30) / 0x64);
v12 = __rdtsc();
v30 = (unsigned int)v12;
do
{
v13 = *v7++;
kmem_cache_free(v5, v13);
}
while ( v7 != &v28 );
v14 = __rdtsc();
printf("Overhead for CACHE_FREE %lld\n", ((unsigned __int64)HIDWORD(v14) - v30) / 0x32);
v15 = __rdtsc();
v16 = (unsigned int)v15;
do
*v7++ = kmem_cache_alloc(v5, 1LL);
while ( v7 != &v29 );
v17 = __rdtsc();
printf("Overhead for CACHE_ALLOC (pre loaded) %lld\n", ((unsigned __int64)HIDWORD(v17) - v16) / 0x32);
do
{
v18 = *v9++;
kmem_cache_free(v5, v18);
}
while ( v9 != &v29 );
v19 = __rdtsc();
v20 = (unsigned int)v19;
kmem_cache_reap(v5, v18, HIDWORD(v19));
v21 = __rdtsc();
v22 = (unsigned int)v21 - v20;
printf("Overhead for CACHE_REAP %lld\n", v22);
v23 = __rdtsc();
v24 = (unsigned int)v23;
kmem_cache_destroy(v5, v22, HIDWORD(v23));
v25 = __rdtsc();
printf("Overhead for CACHE_DESTROY %lld\n", (unsigned int)v25 - v24);
return 0;
}

original_code:
int main(void) {
 int count;
 int num_loop = 100;
 void *items[num_loop];
 int num_buf;
 unsigned long long start, end;
 printf("##########################\nThe result will be showed in number of cycles\n##########################\n");
 printf("------------\n\tObjects Size:%d\n\tIterations %d\n------------\n",1000, num_loop);
 __asm__ __volatile__("rdtsc" : "=A" (start));
 kmem_cache_t cache_test = kmem_cache_create("first", sizeof(struct testBuf), 0, &constr, &destruct );
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_CREATE %lld\n", (end-start));
 ((void) sizeof ((cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0) ? 1 : 0), __extension__ ({ if (cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0) ; else __assert_fail ("cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0", "main.c", 45, __extension__ __PRETTY_FUNCTION__); }));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=0;count<num_loop;count++){
  items[count] = kmem_cache_alloc(cache_test,KM_SLEEP);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_ALLOC %lld\n", (end-start)/num_loop);
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=0;count<num_loop/2;count++){
  kmem_cache_free(cache_test,items[count]);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_FREE %lld\n", (end-start)/(num_loop/2));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=num_loop/2;count<num_loop;count++){
  items[count] = kmem_cache_alloc(cache_test,KM_SLEEP);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_ALLOC (pre loaded) %lld\n", (end-start)/(num_loop/2));
 for(count=0;count<num_loop;count++){
  kmem_cache_free(cache_test,items[count]);
 }
 __asm__ __volatile__("rdtsc" : "=A" (start));
 kmem_cache_reap(cache_test);
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_REAP %lld\n", (end-start));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 kmem_cache_destroy(cache_test);
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_DESTROY %lld\n", (end-start));
 return 0;
}

canonical_original_code:
int main() {
 int count;
 int num_loop = 100;
 void *items[-1];
 int num_buf;
 unsigned long long start; unsigned long long end;
 printf("##########################\nThe result will be showed in number of cycles\n##########################\n");
 printf("------------\n\tObjects Size:%d\n\tIterations %d\n------------\n",1000, num_loop);
 __asm__ __volatile__("rdtsc" : "=A" (start));
 struct kmem_cache *cache_test = kmem_cache_create("first", sizeof(struct testBuf), 0, &constr, &destruct );
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_CREATE %lld\n", (end-start));
 ((void) sizeof ((cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0) ? 1 : 0), __extension__ ({ if (cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0) ; else __assert_fail ("cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0", "main.c", 45, __extension__ __PRETTY_FUNCTION__); }));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=0;count<num_loop;count++){
  items[count] = kmem_cache_alloc(cache_test,KM_SLEEP);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_ALLOC %lld\n", (end-start)/num_loop);
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=0;count<num_loop/2;count++){
  kmem_cache_free(cache_test,items[count]);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_FREE %lld\n", (end-start)/(num_loop/2));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=num_loop/2;count<num_loop;count++){
  items[count] = kmem_cache_alloc(cache_test,KM_SLEEP);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_ALLOC (pre loaded) %lld\n", (end-start)/(num_loop/2));
 for(count=0;count<num_loop;count++){
  kmem_cache_free(cache_test,items[count]);
 }
 __asm__ __volatile__("rdtsc" : "=A" (start));
 kmem_cache_reap(cache_test);
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_REAP %lld\n", (end-start));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 kmem_cache_destroy(cache_test);
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_DESTROY %lld\n", (end-start));
 return 0;
}

variable_types: count int

variable_types:
items
void *[-1]

variable_types:
start
unsigned long long

variable_types:
end
unsigned long long

variable_types: struct kmem_cache { char *name; int size; int align; void (*constructor)(void *, int); void (*destructor)(void *, int); struct kmem_slab { int buf_free_count; int buf_used_count; void *buffer; struct kmem_slab *next; struct kmem_slab *previous; struct kmem_bufctl { void *buffer; struct kmem_bufctl *next_free; struct kmem_slab *slab; } *buf_free; } *slab_free; struct kmem_slab *slab_used; struct kmem_slab *slab_full; int slab_free_count; int slab_used_count; int slab_full_count; } *

user_defined_types: struct kmem_cache { char *name; int size; int align; void (*constructor)(void *, int); void (*destructor)(void *, int); struct kmem_slab *slab_free; struct kmem_slab *slab_used; struct kmem_slab *slab_full; int slab_free_count; int slab_used_count; int slab_full_count; }

user_defined_types: struct kmem_slab { int buf_free_count; int buf_used_count; void *buffer; struct kmem_slab *next; struct kmem_slab *previous; struct kmem_bufctl *buf_free; }


decompiled_code:
void __fastcall kmem_cache_destroy(__int64 a1)
{
_QWORD *v1; // rbp
int v2; // ebx
void *v4; // rdi

v1 = *(_QWORD **)(a1 + 32);
if ( *(_DWORD *)(a1 + 60) )
_assert_fail("cache->slab_used_count == 0", "kmem.c", 0x54u, "kmem_cache_destroy");
v2 = *(_DWORD *)(a1 + 64);
if ( v2 )
_assert_fail("cache->slab_full_count == 0", "kmem.c", 0x55u, "kmem_cache_destroy");
if ( *(int *)(a1 + 56) > 0 )
{
do
{
v4 = v1;
++v2;
v1 = (_QWORD *)v1[2];
free(v4);
}
while ( *(_DWORD *)(a1 + 56) > v2 );
}
}

canonical_decompiled_code:
void __fastcall func1(__int64 a1)
{
_QWORD *v1; // rbp
int v2; // ebx
void *v4; // rdi

v1 = *(_QWORD **)(a1 + 32);
if ( *(_DWORD *)(a1 + 60) )
_assert_fail("cache->slab_used_count == 0", "kmem.c", 0x54u, "kmem_cache_destroy");
v2 = *(_DWORD *)(a1 + 64);
if ( v2 )
_assert_fail("cache->slab_full_count == 0", "kmem.c", 0x55u, "kmem_cache_destroy");
if ( *(int *)(a1 + 56) > 0 )
{
do
{
v4 = v1;
++v2;
v1 = (_QWORD *)v1[2];
free(v4);
}
while ( *(_DWORD *)(a1 + 56) > v2 );
}
}

original_code:
void kmem_cache_destroy(kmem_cache_t cache){
 if(0)printf("===>Destroying cache\n");
 kmem_slab_t slab = cache->slab_free;
 kmem_slab_t aux;
 int count;
 ((void) sizeof ((cache->slab_used_count == 0) ? 1 : 0), __extension__ ({ if (cache->slab_used_count == 0) ; else __assert_fail ("cache->slab_used_count == 0", "kmem.c", 84, __extension__ __PRETTY_FUNCTION__); }));
 ((void) sizeof ((cache->slab_full_count == 0) ? 1 : 0), __extension__ ({ if (cache->slab_full_count == 0) ; else __assert_fail ("cache->slab_full_count == 0", "kmem.c", 85, __extension__ __PRETTY_FUNCTION__); }));
 for (count = 0; count < cache->slab_free_count; ++count) {
  aux = slab;
  slab = slab->next;
  free(aux);
 }
}

canonical_original_code:
void kmem_cache_destroy(struct kmem_cache *cache){
 if(0)printf("===>Destroying cache\n");
 struct kmem_slab *slab = cache->slab_free;
 struct kmem_slab *aux;
 int count;
 ((void) sizeof ((cache->slab_used_count == 0) ? 1 : 0), __extension__ ({ if (cache->slab_used_count == 0) ; else __assert_fail ("cache->slab_used_count == 0", "kmem.c", 84, __extension__ __PRETTY_FUNCTION__); }));
 ((void) sizeof ((cache->slab_full_count == 0) ? 1 : 0), __extension__ ({ if (cache->slab_full_count == 0) ; else __assert_fail ("cache->slab_full_count == 0", "kmem.c", 85, __extension__ __PRETTY_FUNCTION__); }));
 for (count = 0; count < cache->slab_free_count; ++count) {
  aux = slab;
  slab = slab->next;
  free(aux);
 }
}

variable_types: struct kmem_slab { int buf_free_count; int buf_used_count; void *buffer; struct kmem_slab *next; struct kmem_slab *previous; struct kmem_bufctl { void *buffer; struct kmem_bufctl *next_free; struct kmem_slab *slab; } *buf_free; } *


decompiled_code:
void __fastcall kmem_cache_reap(__int64 a1)
{
int v1; // eax
void *v2; // r8
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

v1 = *(_DWORD *)(a1 + 56);
v3 = a1;
if ( v1 > 0 )
{
_remove_from_slab_list(&v3, 0);
free(v2);
}
}

original_code:
void kmem_cache_reap(kmem_cache_t cache){
 if(0)printf("===>Reaping the cache");
 kmem_slab_t slab;
 if(cache->slab_free_count > 0){
  slab = cache->slab_free;
  __remove_from_slab_list(&cache,KM_FREE_LIST);
  free(slab);
 }
}

canonical_original_code:
void kmem_cache_reap(struct kmem_cache *cache){
 if(0)printf("===>Reaping the cache");
 struct kmem_slab *slab;
 if(cache->slab_free_count > 0){
  slab = cache->slab_free;
  __remove_from_slab_list(&cache,KM_FREE_LIST);
  free(slab);
 }
}

user_defined_types: struct kmem_bufctl { void *buffer; struct kmem_bufctl *next_free; struct kmem_slab *slab; }


original_code:
void *kmem_cache_alloc(kmem_cache_t cache, int flag){
 if(0)printf("===>Allocating cache: ");
 km_slab_list type;
 kmem_slab_t slab;
 kmem_bufctrl_t bufctrl;
 if( cache->slab_used_count != 0 && cache->slab_used->buf_free_count !=0){
  if(0)printf("One used found");
  type = KM_USED_LIST;
  slab = cache->slab_used;
 }else if(cache->slab_free_count != 0){
  if(0)printf("One free found");
  type = KM_FREE_LIST;
  slab = cache->slab_free;
 }
 else{
  if(0)printf("No more free slabs.....");
  __kmem_cache_grow(cache, cache->size, flag);
  type = KM_FREE_LIST;
  slab = cache->slab_free;
 }
 bufctrl = __kmem_pull_buffer(&slab, cache->size);
 if(0)printf("\n");
 if(type == KM_FREE_LIST){
  __remove_from_slab_list(&cache,KM_FREE_LIST);
  if(slab->buf_free_count == 0){
   __insert_into_slab_list(&cache, &slab, KM_FULL_LIST);
  }else{
   __insert_into_slab_list(&cache, &slab, KM_USED_LIST);
  }
 }
 else if(type== KM_USED_LIST && slab){
  if(slab->buf_free_count == 0){
   __remove_from_slab_list(&cache,KM_USED_LIST);
   __insert_into_slab_list(&cache, &slab, KM_FULL_LIST);
  }
 }
 void *buffer = bufctrl;
 cache->constructor(buffer,cache->size);
 return buffer;
}

canonical_original_code:
void *kmem_cache_alloc(struct kmem_cache *cache, int flag){
 if(0)printf("===>Allocating cache: ");
 enum km_slab_list type;
 struct kmem_slab *slab;
 struct kmem_bufctl *bufctrl;
 if( cache->slab_used_count != 0 && cache->slab_used->buf_free_count !=0){
  if(0)printf("One used found");
  type = KM_USED_LIST;
  slab = cache->slab_used;
 }else if(cache->slab_free_count != 0){
  if(0)printf("One free found");
  type = KM_FREE_LIST;
  slab = cache->slab_free;
 }
 else{
  if(0)printf("No more free slabs.....");
  __kmem_cache_grow(cache, cache->size, flag);
  type = KM_FREE_LIST;
  slab = cache->slab_free;
 }
 bufctrl = __kmem_pull_buffer(&slab, cache->size);
 if(0)printf("\n");
 if(type == KM_FREE_LIST){
  __remove_from_slab_list(&cache,KM_FREE_LIST);
  if(slab->buf_free_count == 0){
   __insert_into_slab_list(&cache, &slab, KM_FULL_LIST);
  }else{
   __insert_into_slab_list(&cache, &slab, KM_USED_LIST);
  }
 }
 else if(type== KM_USED_LIST && slab){
  if(slab->buf_free_count == 0){
   __remove_from_slab_list(&cache,KM_USED_LIST);
   __insert_into_slab_list(&cache, &slab, KM_FULL_LIST);
  }
 }
 void *buffer = bufctrl;
 cache->constructor(buffer,cache->size);
 return buffer;
}

variable_types: flag int

variable_types: enum km_slab_list { KM_FREE_LIST=0, KM_USED_LIST=1, KM_FULL_LIST=2 }

variable_types: struct kmem_bufctl { void *buffer; struct kmem_bufctl *next_free; struct kmem_slab { int buf_free_count; int buf_used_count; void *buffer; struct kmem_slab *next; struct kmem_slab *previous; struct kmem_bufctl *buf_free; } *slab; } *

variable_types:
buffer
void *


decompiled_code:
__int64 __fastcall kmem_cache_free(__int64 a1, __int64 a2)
{
int v2; // edx
__int64 result; // rax
int v4; // edx
__int64 v5; // [rsp+8h] [rbp-20h] BYREF
__int64 v6; // [rsp+10h] [rbp-18h] BYREF
__int64 v7[2]; // [rsp+18h] [rbp-10h] BYREF

v5 = a1;
v6 = a2;
(*(void (__fastcall **)(__int64, _QWORD))(a1 + 24))(a2, *(unsigned int *)(a1 + 8));
if ( *(_DWORD *)(a1 + 60) )
{
v2 = *(_DWORD *)(v5 + 8);
v7[0] = *(_QWORD *)(v5 + 40);
_kmem_push_buffer((int **)(v5 + 40), &v6, v2);
result = *(_QWORD *)(v5 + 40);
if ( !*(_DWORD *)(result + 4) )
{
_remove_from_slab_list(&v5, 1);
result = _insert_into_slab_list(&v5, v7, 0);
}
}
else
{
v4 = *(_DWORD *)(v5 + 8);
v7[0] = *(_QWORD *)(v5 + 48);
_kmem_push_buffer((int **)(v5 + 48), &v6, v4);
if ( *(_DWORD *)(*(_QWORD *)(v5 + 48) + 4LL) )
{
_remove_from_slab_list(&v5, 2);
result = _insert_into_slab_list(&v5, v7, 1);
}
else
{
_remove_from_slab_list(&v5, 2);
result = _insert_into_slab_list(&v5, v7, 0);
}
}
return result;
}

original_code:
void kmem_cache_free(kmem_cache_t cache, void *buf){
 kmem_bufctrl_t bufctrl = buf;
 kmem_slab_t slab;
 cache->destructor(buf, cache->size);
 if(cache->slab_used_count != 0){
  slab = cache->slab_used;
  __kmem_push_buffer(&cache->slab_used, &bufctrl, cache->size);
  if(cache->slab_used->buf_used_count == 0){
   __remove_from_slab_list(&cache, KM_USED_LIST);
   __insert_into_slab_list(&cache,&slab, KM_FREE_LIST);
  }
 }else{
  slab = cache->slab_full;
  __kmem_push_buffer(&cache->slab_full, &bufctrl, cache->size);
  if(cache->slab_full->buf_used_count == 0){
   __remove_from_slab_list(&cache, KM_FULL_LIST);
   __insert_into_slab_list(&cache,&slab, KM_FREE_LIST);
  }else{
   __remove_from_slab_list(&cache, KM_FULL_LIST);
   __insert_into_slab_list(&cache,&slab, KM_USED_LIST);
  }
 }
}

canonical_original_code:
void kmem_cache_free(struct kmem_cache *cache, void *buf){
 struct kmem_bufctl *bufctrl = buf;
 struct kmem_slab *slab;
 cache->destructor(buf, cache->size);
 if(cache->slab_used_count != 0){
  slab = cache->slab_used;
  __kmem_push_buffer(&cache->slab_used, &bufctrl, cache->size);
  if(cache->slab_used->buf_used_count == 0){
   __remove_from_slab_list(&cache, KM_USED_LIST);
   __insert_into_slab_list(&cache,&slab, KM_FREE_LIST);
  }
 }else{
  slab = cache->slab_full;
  __kmem_push_buffer(&cache->slab_full, &bufctrl, cache->size);
  if(cache->slab_full->buf_used_count == 0){
   __remove_from_slab_list(&cache, KM_FULL_LIST);
   __insert_into_slab_list(&cache,&slab, KM_FREE_LIST);
  }else{
   __remove_from_slab_list(&cache, KM_FULL_LIST);
   __insert_into_slab_list(&cache,&slab, KM_USED_LIST);
  }
 }
}


decompiled_code:
void __fastcall free_log_line(void *ptr)
{
void **v1; // rbx
void **v2; // rbp

if ( ptr )
{
v1 = (void **)ptr;
do
{
v2 = v1;
v1 = (void **)v1[4];
free(v2[1]);
free(v2[2]);
free(v2);
}
while ( v1 );
}
}

canonical_decompiled_code:
void __fastcall func0(void *ptr)
{
void **v1; // rbx
void **v2; // rbp

if ( ptr )
{
v1 = (void **)ptr;
do
{
v2 = v1;
v1 = (void **)v1[4];
free(v2[1]);
free(v2[2]);
free(v2);
}
while ( v1 );
}
}

original_code:
void free_log_line(struct logline *last_line) {
 struct logline *temp = ((void *)0);
 while(last_line != ((void *)0)) {
  temp = last_line->next;
  free(last_line->counter);
  free(last_line->thread);
  free(last_line);
  last_line = temp;
 }
}

variable_types: struct logline { int run; int uptime; char *counter; char *thread; long long packet_count; struct logline *next; } *


decompiled_code:
time_t __fastcall get_timestamp(int a1, int a2, int a3, int a4, int a5, int a6)
{
struct tm v7; // [rsp+0h] [rbp-48h] BYREF

v7.tm_mon = a1 - 1;
v7.tm_sec = a6;
v7.tm_min = a5;
v7.tm_hour = a4;
v7.tm_mday = a2;
v7.tm_year = a3 - 1900;
return mktime(&v7);
}

canonical_decompiled_code:
time_t __fastcall func0(int a1, int a2, int a3, int a4, int a5, int a6)
{
struct tm v7; // [rsp+0h] [rbp-48h] BYREF

v7.tm_mon = a1 - 1;
v7.tm_sec = a6;
v7.tm_min = a5;
v7.tm_hour = a4;
v7.tm_mday = a2;
v7.tm_year = a3 - 1900;
return mktime(&v7);
}

original_code:
time_t get_timestamp(int month, int day, int year, int hour, int min, int sec) {
 struct tm date;
 date.tm_sec = sec;
 date.tm_min = min;
 date.tm_hour = hour;
 date.tm_mday = day;
 date.tm_mon = month-1;
 date.tm_year = year - 1900;
   return mktime(&date);
}

canonical_original_code:
long get_timestamp(int month, int day, int year, int hour, int min, int sec) {
 struct tm date;
 date.tm_sec = sec;
 date.tm_min = min;
 date.tm_hour = hour;
 date.tm_mday = day;
 date.tm_mon = month-1;
 date.tm_year = year - 1900;
   return mktime(&date);
}

variable_types: month int

variable_types: day int

variable_types: year int

variable_types: hour int

variable_types: min int

variable_types: sec int

variable_types: struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long tm_gmtoff; char *tm_zone; }

return_type: long


repo: Nicals/wakemeup

decompiled_code:
void __fastcall termination_handler(int a1)
{
if ( a1 == 2 )
{
free(pid_filepath);
exit(0);
}
}

canonical_decompiled_code:
void __fastcall func7(int a1)
{
if ( a1 == 2 )
{
free(pid_filepath);
exit(0);
}
}

original_code:
void termination_handler(int sig_num) {
  if (sig_num == 2) {
    free(pid_filepath);
    exit(0);
  }
}


challenge

decompiled_code:
__int64 challenge()
{
unsigned int v0; // eax
unsigned int v1; // ebp
unsigned int v2; // ebx
char v4[88]; // [rsp+0h] [rbp-58h] BYREF

v0 = time(0LL);
srand(v0);
v1 = rand() % 9000 + 1000;
v2 = rand() % 9000 + 1000;
do
{
fprintf(_bss_start, "%u + %u ?\n", v1, v2);
fgets(v4, 49, stdin);
}
while ( atoi(v4) != v1 + v2 );
return 0LL;
}

canonical_decompiled_code:
__int64 func8()
{
unsigned int v0; // eax
unsigned int v1; // ebp
unsigned int v2; // ebx
char v4[88]; // [rsp+0h] [rbp-58h] BYREF

v0 = time(0LL);
srand(v0);
v1 = rand() % 9000 + 1000;
v2 = rand() % 9000 + 1000;
do
{
fprintf(_bss_start, "%u + %u ?\n", v1, v2);
fgets(v4, 49, stdin);
}
while ( atoi(v4) != v1 + v2 );
return 0LL;
}

original_code:
int challenge() {
  unsigned int seed = (unsigned int)(time(((void *)0)));
  unsigned int a, b, result;
  char user_input[49];
  srand(seed);
  a = ((rand() % (9999 - 1000 + 1)) + 1000);
  b = ((rand() % (9999 - 1000 + 1)) + 1000);
  result = a + b;
  do {
    fprintf(stdout, "%u + %u ?\n", a, b);
    fgets(user_input, 49, stdin);
  } while (atoi(user_input) != result);
  return atoi(user_input) == result ? 0 : -1;
}

canonical_original_code:
int challenge() {
  unsigned int seed = (unsigned int)(time(((void *)0)));
  unsigned int a; unsigned int b; unsigned int result;
  char user_input[49];
  srand(seed);
  a = ((rand() % (9999 - 1000 + 1)) + 1000);
  b = ((rand() % (9999 - 1000 + 1)) + 1000);
  result = a + b;
  do {
    fprintf(stdout, "%u + %u ?\n", a, b);
    fgets(user_input, 49, stdin);
  } while (atoi(user_input) != result);
  return atoi(user_input) == result ? 0 : -1;
}

variable_types:
seed
unsigned int

variable_types:
a
unsigned int

variable_types:
b
unsigned int

variable_types:
result
unsigned int


decompiled_code:
int __fastcall stop_alarm(unsigned int a1)
{
if ( kill(a1, 15) )
fprintf(_bss_start, "INFO: Cannot kill process [%u]\n", a1);
else
fprintf(_bss_start, "INFO: Process [%u] killed.\n", a1);
return unlink(pid_filepath);
}

canonical_decompiled_code:
int __fastcall func10(unsigned int a1)
{
if ( kill(a1, 15) )
fprintf(_bss_start, "INFO: Cannot kill process [%u]\n", a1);
else
fprintf(_bss_start, "INFO: Process [%u] killed.\n", a1);
return unlink(pid_filepath);
}

original_code:
void stop_alarm(pid_t beep_pid) {
  if (kill(beep_pid, 15) == 0) {
    fprintf(stdout, "INFO: Process [%u] killed.\n", beep_pid);
  }
  else {
    fprintf(stdout, "INFO: Cannot kill process [%u]\n", beep_pid);
  }
  unlink(pid_filepath);
}

canonical_original_code:
void stop_alarm(int beep_pid) {
  if (kill(beep_pid, 15) == 0) {
    fprintf(stdout, "INFO: Process [%u] killed.\n", beep_pid);
  }
  else {
    fprintf(stdout, "INFO: Cannot kill process [%u]\n", beep_pid);
  }
  unlink(pid_filepath);
}


usage

decompiled_code:
int __fastcall usage(const char *a1)
{
return printf(
"\n"
"Usage: %s [-r] [-c] [-h] [-v]\n"
"\n"
"Launch an alarm on your computer to wake up early on the morning.\n"
"\n"
"optional arguments:\n"
"\t -c --challenge switch challenge off. Only with god mod enabled ad compile time\n"
"\t -r --robot don't launch the challenge, don't stop the current alarm\n"
"\t -h --help print this help\n"
"\t -v --version get version and compile option\n"
"\n",
a1);
}

canonical_decompiled_code:
int __fastcall func11(const char *a1)
{
return printf(
"\n"
"Usage: %s [-r] [-c] [-h] [-v]\n"
"\n"
"Launch an alarm on your computer to wake up early on the morning.\n"
"\n"
"optional arguments:\n"
"\t -c --challenge switch challenge off. Only with god mod enabled ad compile time\n"
"\t -r --robot don't launch the challenge, don't stop the current alarm\n"
"\t -h --help print this help\n"
"\t -v --version get version and compile option\n"
"\n",
a1);
}

original_code:
void usage(const char* prg_name) {
  printf("\nUsage: %s [-r] [-c] [-h] [-v]"
      "\n\n"
      "Launch an alarm on your computer to wake up early on the morning.\n\n"
      "optional arguments:\n"
      "\t   -c   --challenge   switch challenge off. Only with god mod enabled ad compile time\n"
      "\t   -r   --robot       don't launch the challenge, don't stop the current alarm\n"
      "\t   -h   --help        print this help\n"
      "\t   -v   --version     get version and compile option\n"
      "\n"
      ,
      prg_name);
}

canonical_original_code:
void usage(char *prg_name) {
  printf("\nUsage: %s [-r] [-c] [-h] [-v]"
      "\n\n"
      "Launch an alarm on your computer to wake up early on the morning.\n\n"
      "optional arguments:\n"
      "\t   -c   --challenge   switch challenge off. Only with god mod enabled ad compile time\n"
      "\t   -r   --robot       don't launch the challenge, don't stop the current alarm\n"
      "\t   -h   --help        print this help\n"
      "\t   -v   --version     get version and compile option\n"
      "\n"
      ,
      prg_name);
}


decompiled_code:
int __fastcall read_param(int argc, char **argv, __int64 a3)
{
int result; // eax
struct option v5; // [rsp+0h] [rbp-B8h] BYREF
const char *v6; // [rsp+20h] [rbp-98h]
int v7; // [rsp+28h] [rbp-90h]
__int64 v8; // [rsp+30h] [rbp-88h]
int v9; // [rsp+38h] [rbp-80h]
const char *v10; // [rsp+40h] [rbp-78h]
int v11; // [rsp+48h] [rbp-70h]
__int64 v12; // [rsp+50h] [rbp-68h]
int v13; // [rsp+58h] [rbp-60h]
const char *v14; // [rsp+60h] [rbp-58h]
int v15; // [rsp+68h] [rbp-50h]
__int64 v16; // [rsp+70h] [rbp-48h]
int v17; // [rsp+78h] [rbp-40h]
__int64 v18; // [rsp+80h] [rbp-38h]
int v19; // [rsp+88h] [rbp-30h]
__int64 v20; // [rsp+90h] [rbp-28h]
int v21; // [rsp+98h] [rbp-20h]

v5.name = "robot";
v5.has_arg = 0;
v5.flag = 0LL;
v5.val = 114;
v6 = "challenge";
v7 = 0;
v8 = 0LL;
v9 = 99;
v10 = "help";
v11 = 0;
v12 = 0LL;
v13 = 104;
v14 = "version";
v15 = 0;
v16 = 0LL;
v17 = 118;
v18 = 0LL;
v19 = 0;
v20 = 0LL;
v21 = 0;
do
{
while ( 1 )
{
while ( 1 )
{
result = getopt_long(argc, argv, "chrv", &v5, 0LL);
if ( result != 114 )
break;
*(_DWORD *)(a3 + 4) = 0;
}
if ( result <= 114 )
break;
if ( result == 118 )
{
puts("wakemeup 1.0");
printf("god mod: %s\n", "disabled");
exit(0);
}
}
if ( result == 63 )
{
fprintf(stderr, "Unknown option -%c\nUse %s for more informations.\n\n", 63LL, *argv);
exit(1);
}
if ( result == 104 )
{
usage(*argv);
exit(0);
}
}
while ( result != -1 );
return result;
}

canonical_decompiled_code:
int __fastcall func12(int argc, char **argv, __int64 a3)
{
int result; // eax
struct option v5; // [rsp+0h] [rbp-B8h] BYREF
const char *v6; // [rsp+20h] [rbp-98h]
int v7; // [rsp+28h] [rbp-90h]
__int64 v8; // [rsp+30h] [rbp-88h]
int v9; // [rsp+38h] [rbp-80h]
const char *v10; // [rsp+40h] [rbp-78h]
int v11; // [rsp+48h] [rbp-70h]
__int64 v12; // [rsp+50h] [rbp-68h]
int v13; // [rsp+58h] [rbp-60h]
const char *v14; // [rsp+60h] [rbp-58h]
int v15; // [rsp+68h] [rbp-50h]
__int64 v16; // [rsp+70h] [rbp-48h]
int v17; // [rsp+78h] [rbp-40h]
__int64 v18; // [rsp+80h] [rbp-38h]
int v19; // [rsp+88h] [rbp-30h]
__int64 v20; // [rsp+90h] [rbp-28h]
int v21; // [rsp+98h] [rbp-20h]

v5.name = "robot";
v5.has_arg = 0;
v5.flag = 0LL;
v5.val = 114;
v6 = "challenge";
v7 = 0;
v8 = 0LL;
v9 = 99;
v10 = "help";
v11 = 0;
v12 = 0LL;
v13 = 104;
v14 = "version";
v15 = 0;
v16 = 0LL;
v17 = 118;
v18 = 0LL;
v19 = 0;
v20 = 0LL;
v21 = 0;
do
{
while ( 1 )
{
while ( 1 )
{
result = getopt_long(argc, argv, "chrv", &v5, 0LL);
if ( result != 114 )
break;
*(_DWORD *)(a3 + 4) = 0;
}
if ( result <= 114 )
break;
if ( result == 118 )
{
puts("wakemeup 1.0");
printf("god mod: %s\n", "disabled");
exit(0);
}
}
if ( result == 63 )
{
fprintf(stderr, "Unknown option -%c\nUse %s for more informations.\n\n", 63LL, *argv);
exit(1);
}
if ( result == 104 )
{
func11(*argv);
exit(0);
}
}
while ( result != -1 );
return result;
}

original_code:
void read_param(int argc, char* argv[], struct _params* params) {
  int next_option;
  const char* const short_options = "chrv";
  const struct option long_options[] = {
    {"robot", 0, ((void *)0), 'r'},
    {"challenge", 0, ((void *)0), 'c'},
    {"help", 0, ((void *)0), 'h'},
    {"version", 0, ((void *)0), 'v'},
    {0, 0, 0, 0}
  };
  do {
    next_option = getopt_long(argc, argv, short_options, long_options, ((void *)0));
    switch (next_option) {
      case 'c':
        break;
      case 'r':
        params->im_a_robot = ENABLED;
        break;
      case 'h':
        usage(argv[0]);
        exit(0);
        break;
      case 'v':
        printf("%s\n", "wakemeup 1.0");
        printf("god mod: %s\n",
            "disabled"
        );
        exit(0);
        break;
      case '?':
        fprintf(stderr, "Unknown option -%c\nUse %s for more informations.\n\n", next_option, argv[0]);
        exit(1);
        break;
      default:
        break;
    }
  } while (next_option != -1);
}

canonical_original_code:
void read_param(int argc, char *argv[], struct _params *params) {
  int next_option;
  char *short_options = "chrv";
  struct option long_options[] = {
    {"robot", 0, ((void *)0), 'r'},
    {"challenge", 0, ((void *)0), 'c'},
    {"help", 0, ((void *)0), 'h'},
    {"version", 0, ((void *)0), 'v'},
    {0, 0, 0, 0}
  };
  do {
    next_option = getopt_long(argc, argv, short_options, long_options, ((void *)0));
    switch (next_option) {
      case 'c':
        break;
      case 'r':
        params->im_a_robot = ENABLED;
        break;
      case 'h':
        usage(argv[0]);
        exit(0);
        break;
      case 'v':
        printf("%s\n", "wakemeup 1.0");
        printf("god mod: %s\n",
            "disabled"
        );
        exit(0);
        break;
      case '?':
        fprintf(stderr, "Unknown option -%c\nUse %s for more informations.\n\n", next_option, argv[0]);
        exit(1);
        break;
      default:
        break;
    }
  } while (next_option != -1);
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: struct _params { enum _switch { ENABLED=0, DISABLED=1 } skip_challenge; enum _switch { ENABLED=0, DISABLED=1 } im_a_robot; } *

variable_types: struct option { char *name; int has_arg; int *flag; int val; } []

user_defined_types: struct _params { enum _switch skip_challenge; enum _switch im_a_robot; }


decompiled_code:
__int64 get_dni()
{
unsigned int i; // er12
char v1; // al

for ( i = 0; ; i = v1 + 10 * i - 48 )
{
v1 = getchar();
if ( v1 == 10 )
return i;
if ( (unsigned int)(v1 - 48) > 9 )
break;
}
while ( getchar() != 10 )
;
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
unsigned int i; // er12
char v1; // al

for ( i = 0; ; i = v1 + 10 * i - 48 )
{
v1 = getchar();
if ( v1 == 10 )
return i;
if ( (unsigned int)(v1 - 48) > 9 )
break;
}
while ( getchar() != 10 )
;
return 0LL;
}

original_code:
unsigned int get_dni(){
 unsigned int dni = 0;
 char c;
 while((c = getchar()) != '\n'){
  switch(c){
   case '0':
   case '1':
   case '2':
   case '3':
   case '4':
   case '5':
   case '6':
   case '7':
   case '8':
   case '9':
    dni = dni * 10 + c - '0';
    break;
   default:
    while( getchar() != '\n'){}
    return 0;
  }
 }
 return dni;
}

variable_types:
dni
unsigned int

variable_types: c char

return_type: unsigned int


decompiled_code:
int __fastcall read_str(__int64 a1, unsigned __int64 a2)
{
unsigned __int64 v2; // rbx
int result; // eax

*(_BYTE *)(a1 + a2) = 0;
v2 = 0LL;
while ( 1 )
{
result = getchar();
if ( (_BYTE)result == 10 )
break;
while ( a2 > v2 )
{
*(_BYTE *)(a1 + v2) = result;
*(_BYTE *)(a1 + v2++ + 1) = 0;
result = getchar();
if ( (_BYTE)result == 10 )
return result;
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1, unsigned __int64 a2)
{
unsigned __int64 v2; // rbx
int result; // eax

*(_BYTE *)(a1 + a2) = 0;
v2 = 0LL;
while ( 1 )
{
result = getchar();
if ( (_BYTE)result == 10 )
break;
while ( a2 > v2 )
{
*(_BYTE *)(a1 + v2) = result;
*(_BYTE *)(a1 + v2++ + 1) = 0;
result = getchar();
if ( (_BYTE)result == 10 )
return result;
}
}
return result;
}

original_code:
void read_str(char *str, size_t max_len){
 char c;
 int i = 0;
 str[max_len] = 0;
 while((c = getchar()) != '\n'){
  if(i >= max_len)
   continue;
  str[i++] = c;
  str[i] = 0;
 }
}

canonical_original_code:
void read_str(char *str, unsigned long max_len){
 char c;
 int i = 0;
 str[max_len] = 0;
 while((c = getchar()) != '\n'){
  if(i >= max_len)
   continue;
  str[i++] = c;
  str[i] = 0;
 }
}

variable_types:
str
char *

variable_types: i int


decompiled_code:
__int64 read_opt()
{
unsigned int v0; // ebx

v0 = getchar();
if ( (_BYTE)v0 != 10 )
{
while ( getchar() != 10 )
;
}
return v0;
}

canonical_decompiled_code:
__int64 func2()
{
unsigned int v0; // ebx

v0 = getchar();
if ( (_BYTE)v0 != 10 )
{
while ( getchar() != 10 )
;
}
return v0;
}

original_code:
char read_opt(){
 char c = getchar();
 if(c != '\n'){
  while( getchar() != '\n');
 }
 return c;
}

return_type: char


decompiled_code:
__int64 __fastcall sort_helper_cmp(__int64 a1, _QWORD *a2)
{
return (unsigned int)-(*(__int64 (__fastcall **)(_QWORD, _QWORD, _QWORD, _QWORD))(a1 + 16))(
*(_QWORD *)a1,
*(_QWORD *)(a1 + 8),
*a2,
a2[1]);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, _QWORD *a2)
{
return (unsigned int)-(*(__int64 (__fastcall **)(_QWORD, _QWORD, _QWORD, _QWORD))(a1 + 16))(
*(_QWORD *)a1,
*(_QWORD *)(a1 + 8),
*a2,
a2[1]);
}

original_code:
int sort_helper_cmp(void *hlp1, void* hlp2){
 TSortHelper *h1 = hlp1, *h2 = hlp2;
 return -1 * (h1->cmp((void*) h1->buf, h1->size, (void*) h2->buf, h2->size));
}

canonical_original_code:
int sort_helper_cmp(void *hlp1, void *hlp2){
 struct TSortHelper *h1 = hlp1; struct TSortHelper *h2 = hlp2;
 return -1 * (h1->cmp((void *) h1->buf, h1->size, (void *) h2->buf, h2->size));
}

variable_types: struct TSortHelper { unsigned char *buf; unsigned long size; int (*cmp)(void *, unsigned long, void *, unsigned long); } *


decompiled_code:
int __fastcall sort_externo(__int64 a1, __int64 a2, char *a3, __int64 (__fastcall *a4)(_QWORD, _QWORD, __int64, __int64))
{
int v6; // eax
__int128 v8; // [rsp+0h] [rbp-118h] BYREF
char v9[232]; // [rsp+10h] [rbp-108h] BYREF
int v10; // [rsp+F8h] [rbp-20h]
__int16 v11; // [rsp+FCh] [rbp-1Ch]
char v12; // [rsp+FEh] [rbp-1Ah]

if ( a3 == 0LL || a2 == 0 || !a1 )
return 1;
v6 = replacememt_selection(a2, "sort_externo.tmp.%d.dat", a1, 0x32uLL, a4);
if ( v6 )
return merge_externo(a3, "sort_externo.tmp.%d.dat", a1, 0x32uLL, 0LL, v6, (__int64)a4);
memset(v9, 0, sizeof(v9));
v8 = 0LL;
v11 = 0;
v10 = 0;
v12 = 0;
sprintf((char *)&v8, "sort_externo.tmp.%d.dat", 0LL);
return rename((const char *)&v8, a3);
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1, __int64 a2, char *a3, __int64 (__fastcall *a4)(_QWORD, _QWORD, __int64, __int64))
{
int v6; // eax
__int128 v8; // [rsp+0h] [rbp-118h] BYREF
char v9[232]; // [rsp+10h] [rbp-108h] BYREF
int v10; // [rsp+F8h] [rbp-20h]
__int16 v11; // [rsp+FCh] [rbp-1Ch]
char v12; // [rsp+FEh] [rbp-1Ah]

if ( a3 == 0LL || a2 == 0 || !a1 )
return 1;
v6 = func2(a2, "sort_externo.tmp.%d.dat", a1, 0x32uLL, a4);
if ( v6 )
return func3(a3, "sort_externo.tmp.%d.dat", a1, 0x32uLL, 0LL, v6, (__int64)a4);
memset(v9, 0, sizeof(v9));
v8 = 0LL;
v11 = 0;
v10 = 0;
v12 = 0;
sprintf((char *)&v8, "sort_externo.tmp.%d.dat", 0LL);
return rename((const char *)&v8, a3);
}

original_code:
int sort_externo(size_t size, char* in_file, char* out_file, TSortExternFunction cmp){
 int pasada =0;
 if(!size || !in_file || !out_file)
  return 1;
 if( ! (pasada = replacememt_selection(in_file, "sort_externo.tmp.%d.dat", size, (50), cmp)) ){
  char path[255] = {0};
  sprintf(path, "sort_externo.tmp.%d.dat", pasada);
  return rename(path, out_file);
 }
 return merge_externo(out_file, "sort_externo.tmp.%d.dat", size, (50), 0, pasada, cmp);
}

canonical_original_code:
int sort_externo(unsigned long size, char *in_file, char *out_file, int (*cmp)(void *, unsigned long, void *, unsigned long)){
 int pasada = 0;
 if(!size || !in_file || !out_file)
  return 1;
 if( ! (pasada = replacememt_selection(in_file, "sort_externo.tmp.%d.dat", size, (50), cmp)) ){
  char path[255] = {0};
  sprintf(path, "sort_externo.tmp.%d.dat", pasada);
  return rename(path, out_file);
 }
 return merge_externo(out_file, "sort_externo.tmp.%d.dat", size, (50), 0, pasada, cmp);
}

variable_types:
size
unsigned long

variable_types: int (*)(void *, unsigned long, void *, unsigned long)

variable_types: pasada int

variable_types:
path
char [255]


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rdx
unsigned int v4; // ebp
__int64 v5; // rdx
int v6; // eax
int v7; // er13
__int64 v8; // r12
__int64 v9; // rbx
__int64 v10; // rdi
const char *v11; // rdx
int v12; // er12
__int64 v13; // rbx
const char *v14; // rdx
__int64 v15; // rsi
__int64 v16; // rdx
__int64 v18; // rdi
__int64 v19; // rdx
__int64 v20; // [rsp-8h] [rbp-5A0h]
__int64 v21[4]; // [rsp+0h] [rbp-598h] BYREF
__int128 v22[2]; // [rsp+20h] [rbp-578h] BYREF
char v23; // [rsp+40h] [rbp-558h]
__int128 v24[2]; // [rsp+50h] [rbp-548h] BYREF
char v25; // [rsp+70h] [rbp-528h]
char v26[112]; // [rsp+80h] [rbp-518h] BYREF
char v27[112]; // [rsp+F0h] [rbp-4A8h] BYREF
char v28[112]; // [rsp+160h] [rbp-438h] BYREF
char v29; // [rsp+1D0h] [rbp-3C8h] BYREF
char v30; // [rsp+300h] [rbp-298h] BYREF
char v31; // [rsp+430h] [rbp-168h] BYREF

Usuarios_init(argc, argv, envp);
v21[0] = (__int64)&v29;
v21[1] = (__int64)&v30;
v21[2] = (__int64)&v31;
v23 = 0;
v25 = 0;
v22[0] = 0LL;
v22[1] = 0LL;
v24[0] = 0LL;
v24[1] = 0LL;
puts("Crear administrador del sistema");
puts("Ingrese dni:");
while ( 1 )
{
v4 = get_dni("Ingrese dni:", argv, v3);
if ( v4 )
break;
puts("Dni invalido");
puts("Ingrese dni:");
}
puts("Ingrese nombre:");
read_str(v26, "?-)");
puts("Ingrese apellido:");
read_str(v27, "?-)");
puts("Ingrese cantidad de mails:");
v6 = get_dni("Ingrese cantidad de mails:", 100LL, v5);
v7 = v6;
if ( v6 > 0 )
{
v8 = (unsigned int)(v6 + 1);
v9 = 1LL;
do
{
printf("Ingrese mail n %d:\n", (unsigned int)v9);
v10 = *(&v20 + v9++);
read_str(v10, "Nombre: '%s'\n", v11);
}
while ( v9 != v8 );
}
do
{
puts("Ingrese contrase~na: (9 caracteres, mayusculas, numeros, _,.?-)");
read_str(v22, "sistema");
v12 = validar_clave(v22);
}
while ( v12 );
puts("Ingrese provincia:");
read_str(v28, "?-)");
puts("Se creara usuario:");
printf("\t* Dni: '%d'\n", v4);
printf("\t* Nombre: '%s'\n", v26);
printf("\t* Apellido: '%s'\n", v27);
printf("\t* Cantidad de mails: '%d'\n", (unsigned int)v7);
if ( v7 > 0 )
{
v13 = 1LL;
do
{
v14 = (const char *)*(&v20 + v13);
v15 = (unsigned int)v13++;
printf("\t* Mail %d: '%s'\n", v15, v14);
}
while ( v7 + 1 != v13 );
}
normalizar(v22, v24);
printf("\t* Contrase~na: '%s'\n", (const char *)v24);
printf("\t* Provincia: '%s'\n", v28);
puts("Esta seguro?(s/n)");
if ( (unsigned __int8)read_opt("Esta seguro?(s/n)", v28, v16) == 115 )
{
v18 = ((__int64 (__fastcall *)(_QWORD, char *, char *, _QWORD, __int64 *, __int128 *, char *, __int64))Usuario_new)(
v4,
v26,
v27,
(unsigned int)v7,
v21,
v22,
v28,
115LL);
if ( v18 )
{
Usuario_free(v18, v26, v20);
puts("Usuario creado Satisfactoriamente");
Usuarios_end("Usuario creado Satisfactoriamente", v26, v19);
}
else
{
v12 = 1;
puts("Error");
}
}
else
{
v12 = 1;
puts("Abortando...");
}
return v12;
}

original_code:
int main(int argc, char* argv[]){
 Usuarios_init();
 Servicios_init();
 Consultas_init();
 Cotizaciones_init();
 Categorias_init();
 printf(" Paginas Doradas ** \n");
 while(1){
  printf("Que desea hacer?\n");
  printf("1 - Conectarse\n");
  printf("2 - Crear usuario\n");
  printf("s - Salir\n");
  printf("Seleccione opcion\n");
  char opt = read_opt();
  if(opt == 's')
   break;
  switch(opt){
   case '1':
    conectarse();
    break;
   case '2':
    crear_usuario('u');
    break;
   default:
    break;
  }
 }
 Usuarios_end();
 Servicios_end();
 Consultas_end();
 Cotizaciones_end();
 Categorias_end();
}

canonical_original_code:
int main(int argc, char *argv[]){
 Usuarios_init();
 Servicios_init();
 Consultas_init();
 Cotizaciones_init();
 Categorias_init();
 printf(" Paginas Doradas ** \n");
 while(1){
  printf("Que desea hacer?\n");
  printf("1 - Conectarse\n");
  printf("2 - Crear usuario\n");
  printf("s - Salir\n");
  printf("Seleccione opcion\n");
  char opt = read_opt();
  if(opt == 's')
   break;
  switch(opt){
   case '1':
    conectarse();
    break;
   case '2':
    crear_usuario('u');
    break;
   default:
    break;
  }
 }
 Usuarios_end();
 Servicios_end();
 Consultas_end();
 Cotizaciones_end();
 Categorias_end();
}

variable_types: opt char


decompiled_code:
__int64 __fastcall Categorias_get_id(unsigned int *a1)
{
return *a1;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int *a1)
{
return *a1;
}

original_code:
unsigned int Categorias_get_id(uint8_t* ele, size_t size){
 unsigned int id = * ( (unsigned int*) ele);
 return id;
}

canonical_original_code:
unsigned int Categorias_get_id(unsigned char *ele, unsigned long size){
 unsigned int id = * ( (unsigned int*) ele);
 return id;
}

variable_types:
ele
unsigned char *

variable_types:
id
unsigned int


decompiled_code:
__int64 Categorias_init()
{
__int64 v0; // rax
__int64 v1; // rdx
__int64 v2; // rcx
unsigned int v3; // er8
int v4; // eax

v0 = HashExtensible_crear(
"./cat_hash_block.dat",
"./cat_hash_table.dat",
"./cat_hash_baja.dat",
512LL,
&HashDispersionModulo,
Categorias_get_id);
v3 = 1;
hash_categorias = v0;
if ( v0 )
{
v4 = getLastId("./cat_last_id.dat", "./cat_hash_table.dat", v1, v2, 1LL);
v3 = 0;
categorias_last_id = v4;
}
return v3;
}

canonical_decompiled_code:
__int64 func3()
{
__int64 v0; // rax
__int64 v1; // rdx
__int64 v2; // rcx
unsigned int v3; // er8
int v4; // eax

v0 = HashExtensible_crear(
"./cat_hash_block.dat",
"./cat_hash_table.dat",
"./cat_hash_baja.dat",
512LL,
&HashDispersionModulo,
Categorias_get_id);
v3 = 1;
hash_categorias = v0;
if ( v0 )
{
v4 = getLastId("./cat_last_id.dat", "./cat_hash_table.dat", v1, v2, 1LL);
v3 = 0;
categorias_last_id = v4;
}
return v3;
}

original_code:
int Categorias_init(){
 hash_categorias = HashExtensible_crear(
  "./cat_hash_block.dat",
  "./cat_hash_table.dat",
  "./cat_hash_baja.dat",
  (512),
  &HashDispersionModulo,
  &Categorias_get_id
 );
 if(!hash_categorias)
  return 1;
 categorias_last_id = getLastId("./cat_last_id.dat");
 return 0;
}


decompiled_code:
__int64 Categorias_end()
{
__int64 result; // rax

HashExtensible_destruir(hash_categorias);
writeLastId("./cat_last_id.dat", (unsigned int)categorias_last_id);
result = 0LL;
hash_categorias = 0LL;
categorias_last_id = 0;
return result;
}

canonical_decompiled_code:
__int64 func4()
{
__int64 result; // rax

HashExtensible_destruir(hash_categorias);
writeLastId("./cat_last_id.dat", (unsigned int)categorias_last_id);
result = 0LL;
hash_categorias = 0LL;
categorias_last_id = 0;
return result;
}

original_code:
int Categorias_end(){
 HashExtensible_destruir(hash_categorias);
 writeLastId("./cat_last_id.dat", categorias_last_id);
 hash_categorias = ((void *)0);
 categorias_last_id = 0;
 return 0;
}


decompiled_code:
__int64 __fastcall Categoria_free(void *ptr)
{
if ( !ptr )
return 1LL;
free(*((void **)ptr + 1));
free(*((void **)ptr + 2));
free(ptr);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func5(void *ptr)
{
if ( !ptr )
return 1LL;
free(*((void **)ptr + 1));
free(*((void **)ptr + 2));
free(ptr);
return 0LL;
}

original_code:
int Categoria_free(TCategoria* this){
 if(!this)
  return 1;
 free(this->nombre);
 free(this->descripcion);
 free(this);
 return 0;
}

canonical_original_code:
int Categoria_free(struct TCategoria *this){
 if(!this)
  return 1;
 free(this->nombre);
 free(this->descripcion);
 free(this);
 return 0;
}

variable_types: struct TCategoria { unsigned int id; char *nombre; char *descripcion; } *


decompiled_code:
__int64 __fastcall Categoria_get_id(unsigned int *a1)
{
__int64 result; // rax

if ( a1 )
result = *a1;
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *a1;
else
result = 0LL;
return result;
}

original_code:
unsigned int Categoria_get_id(TCategoria* this){
 if(!this)
  return 0;
 return this->id;
}

canonical_original_code:
unsigned int Categoria_get_id(struct TCategoria *this){
 if(!this)
  return 0;
 return this->id;
}

user_defined_types: struct TCategoria { unsigned int id; char *nombre; char *descripcion; }


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

if ( a1 )
result = *(_QWORD *)(a1 + 8);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(_QWORD *)(a1 + 8);
else
result = 0LL;
return result;
}

original_code:
const char* Categoria_get_nombre(TCategoria* this){
 if(!this)
  return ((void *)0);
 return this->nombre;
}

canonical_original_code:
char *Categoria_get_nombre(struct TCategoria *this){
 if(!this)
  return ((void *)0);
 return this->nombre;
}

return_type: char *


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

if ( a1 )
result = *(_QWORD *)(a1 + 16);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(_QWORD *)(a1 + 16);
else
result = 0LL;
return result;
}

original_code:
const char* Categoria_get_descripcion(TCategoria* this){
 if(!this)
  return ((void *)0);
 return this->descripcion;
}

canonical_original_code:
char *Categoria_get_descripcion(struct TCategoria *this){
 if(!this)
  return ((void *)0);
 return this->descripcion;
}


decompiled_code:
__int64 __fastcall Servicios_get_id(unsigned int *a1)
{
return *a1;
}

original_code:
unsigned int Servicios_get_id(uint8_t* ele, size_t size){
 unsigned int id = * ( (unsigned int*) ele);
 return id;
}

canonical_original_code:
unsigned int Servicios_get_id(unsigned char *ele, unsigned long size){
 unsigned int id = * ( (unsigned int*) ele);
 return id;
}


decompiled_code:
__int64 Servicios_init()
{
__int64 v0; // rax
__int64 v1; // rdx
__int64 v2; // rcx
unsigned int v3; // er8
__int64 v4; // rax

v0 = HashExtensible_crear(
"./serv_hash_block.dat",
"./serv_hash_table.dat",
"./serv_hash_baja.dat",
512LL,
&HashDispersionModulo,
Servicios_get_id);
v3 = 1;
hash_servicios = v0;
if ( v0 )
{
servicios_last_id = getLastId("./serv_last_id.dat", "./serv_hash_table.dat", v1, v2, 1LL);
v4 = Arbol_crear("./serv_arbm_cat.dat", 64LL);
v3 = 0;
indice_cat = v4;
}
return v3;
}

canonical_decompiled_code:
__int64 func4()
{
__int64 v0; // rax
__int64 v1; // rdx
__int64 v2; // rcx
unsigned int v3; // er8
__int64 v4; // rax

v0 = HashExtensible_crear(
"./serv_hash_block.dat",
"./serv_hash_table.dat",
"./serv_hash_baja.dat",
512LL,
&HashDispersionModulo,
Servicios_get_id);
v3 = 1;
hash_servicios = v0;
if ( v0 )
{
servicios_last_id = getLastId("./serv_last_id.dat", "./serv_hash_table.dat", v1, v2, 1LL);
v4 = Arbol_crear("./serv_arbm_cat.dat", 64LL);
v3 = 0;
indice_cat = v4;
}
return v3;
}

original_code:
int Servicios_init(){
 hash_servicios = HashExtensible_crear(
  "./serv_hash_block.dat",
  "./serv_hash_table.dat",
  "./serv_hash_baja.dat",
  (512),
  &HashDispersionModulo,
  &Servicios_get_id
 );
 if(!hash_servicios)
  return 1;
 servicios_last_id = getLastId("./serv_last_id.dat");
 indice_cat = Arbol_crear("./serv_arbm_cat.dat", (64));
 return 0;
}


decompiled_code:
__int64 Servicios_end()
{
__int64 result; // rax

HashExtensible_destruir(hash_servicios);
writeLastId("./serv_last_id.dat", (unsigned int)servicios_last_id);
hash_servicios = 0LL;
servicios_last_id = 0;
Arbol_destruir(indice_cat);
result = 0LL;
indice_cat = 0LL;
return result;
}

canonical_decompiled_code:
__int64 func5()
{
__int64 result; // rax

HashExtensible_destruir(hash_servicios);
writeLastId("./serv_last_id.dat", (unsigned int)servicios_last_id);
hash_servicios = 0LL;
servicios_last_id = 0;
Arbol_destruir(indice_cat);
result = 0LL;
indice_cat = 0LL;
return result;
}

original_code:
int Servicios_end(){
 HashExtensible_destruir(hash_servicios);
 writeLastId("./serv_last_id.dat", servicios_last_id);
 hash_servicios = ((void *)0);
 servicios_last_id = 0;
 Arbol_destruir(indice_cat);
 indice_cat = ((void *)0);
 return 0;
}


decompiled_code:
__int64 __fastcall Servicio_free(void *ptr)
{
if ( !ptr )
return 1LL;
free(*((void **)ptr + 1));
free(*((void **)ptr + 2));
free(ptr);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func6(void *ptr)
{
if ( !ptr )
return 1LL;
free(*((void **)ptr + 1));
free(*((void **)ptr + 2));
free(ptr);
return 0LL;
}

original_code:
int Servicio_free(TServicio* this){
 if(!this)
  return 1;
 free(this->nombre);
 free(this->descripcion);
 free(this);
 return 0;
}

canonical_original_code:
int Servicio_free(struct TServicio *this){
 if(!this)
  return 1;
 free(this->nombre);
 free(this->descripcion);
 free(this);
 return 0;
}

variable_types: struct TServicio { unsigned int id; unsigned int dni_p; char *nombre; char *descripcion; char tipo; } *


decompiled_code:
__int64 __fastcall Servicio_get_id(unsigned int *a1)
{
__int64 result; // rax

if ( a1 )
result = *a1;
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *a1;
else
result = 0LL;
return result;
}

original_code:
unsigned int Servicio_get_id(TServicio* this){
 if(!this)
  return 0;
 return this->id;
}

canonical_original_code:
unsigned int Servicio_get_id(struct TServicio *this){
 if(!this)
  return 0;
 return this->id;
}

user_defined_types: struct TServicio { unsigned int id; unsigned int dni_p; char *nombre; char *descripcion; char tipo; }


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

if ( a1 )
result = *(unsigned int *)(a1 + 4);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(unsigned int *)(a1 + 4);
else
result = 0LL;
return result;
}

original_code:
unsigned int Servicio_get_dni_p(TServicio* this){
 if(!this)
  return 0;
 return this->dni_p;
}

canonical_original_code:
unsigned int Servicio_get_dni_p(struct TServicio *this){
 if(!this)
  return 0;
 return this->dni_p;
}


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

if ( a1 )
result = *(_QWORD *)(a1 + 8);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(_QWORD *)(a1 + 8);
else
result = 0LL;
return result;
}

original_code:
const char* Servicio_get_nombre(TServicio* this){
 if(!this)
  return ((void *)0);
 return this->nombre;
}

canonical_original_code:
char *Servicio_get_nombre(struct TServicio *this){
 if(!this)
  return ((void *)0);
 return this->nombre;
}


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

if ( a1 )
result = *(_QWORD *)(a1 + 16);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(_QWORD *)(a1 + 16);
else
result = 0LL;
return result;
}

original_code:
const char* Servicio_get_descripcion(TServicio* this){
 if(!this)
  return ((void *)0);
 return this->descripcion;
}

canonical_original_code:
char *Servicio_get_descripcion(struct TServicio *this){
 if(!this)
  return ((void *)0);
 return this->descripcion;
}


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

if ( a1 )
result = *(unsigned __int8 *)(a1 + 24);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(unsigned __int8 *)(a1 + 24);
else
result = 0LL;
return result;
}

original_code:
char Servicio_get_tipo(TServicio* this){
 if(!this)
  return 0;
 return this->tipo;
}

canonical_original_code:
char Servicio_get_tipo(struct TServicio *this){
 if(!this)
  return 0;
 return this->tipo;
}


decompiled_code:
__int64 __fastcall Servicio_agregar_categoria(int a1, unsigned int a2)
{
insertarIdIndiceCant(a1, a2);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func12(int a1, unsigned int a2)
{
func2(a1, a2);
return 0LL;
}

original_code:
int Servicio_agregar_categoria(unsigned int id, unsigned int id_cat){
 _insertarIdIndiceCant(id, id_cat);
 return 0;
}


decompiled_code:
__int64 __fastcall Cotizaciones_get_id(unsigned int *a1)
{
return *a1;
}

original_code:
unsigned int Cotizaciones_get_id(uint8_t* ele, size_t size){
 unsigned int id = * ( (unsigned int*) ele);
 return id;
}

canonical_original_code:
unsigned int Cotizaciones_get_id(unsigned char *ele, unsigned long size){
 unsigned int id = * ( (unsigned int*) ele);
 return id;
}


decompiled_code:
__int64 Cotizaciones_init()
{
__int64 v0; // rax
__int64 v1; // rdx
__int64 v2; // rcx
unsigned int v3; // er8
__int64 v4; // rax

v0 = HashExtensible_crear(
"./cot_hash_block.dat",
"./cot_hash_table.dat",
"./cot_hash_baja.dat",
512LL,
&HashDispersionModulo,
Cotizaciones_get_id);
v3 = 1;
hash_cotizaciones = v0;
if ( v0 )
{
cotizaciones_last_id = getLastId("./cot_last_id.dat", "./cot_hash_table.dat", v1, v2, 1LL);
indice_id_serv = Arbol_crear("./cot_arbm_serv.dat", 64LL);
v4 = Arbol_crear("./cot_arbm_dni.dat", 64LL);
v3 = 0;
indice_id_usu = v4;
}
return v3;
}

canonical_decompiled_code:
__int64 func5()
{
__int64 v0; // rax
__int64 v1; // rdx
__int64 v2; // rcx
unsigned int v3; // er8
__int64 v4; // rax

v0 = HashExtensible_crear(
"./cot_hash_block.dat",
"./cot_hash_table.dat",
"./cot_hash_baja.dat",
512LL,
&HashDispersionModulo,
Cotizaciones_get_id);
v3 = 1;
hash_cotizaciones = v0;
if ( v0 )
{
cotizaciones_last_id = getLastId("./cot_last_id.dat", "./cot_hash_table.dat", v1, v2, 1LL);
indice_id_serv = Arbol_crear("./cot_arbm_serv.dat", 64LL);
v4 = Arbol_crear("./cot_arbm_dni.dat", 64LL);
v3 = 0;
indice_id_usu = v4;
}
return v3;
}

original_code:
int Cotizaciones_init(){
 hash_cotizaciones = HashExtensible_crear(
  "./cot_hash_block.dat",
  "./cot_hash_table.dat",
  "./cot_hash_baja.dat",
  (512),
  &HashDispersionModulo,
  &Cotizaciones_get_id
 );
 if(!hash_cotizaciones)
  return 1;
 cotizaciones_last_id = getLastId("./cot_last_id.dat");
 indice_id_serv = Arbol_crear("./cot_arbm_serv.dat", (64));
 indice_id_usu = Arbol_crear("./cot_arbm_dni.dat", (64));
 return 0;
}


decompiled_code:
__int64 Cotizaciones_end()
{
__int64 result; // rax

HashExtensible_destruir(hash_cotizaciones);
writeLastId("./cot_last_id.dat", (unsigned int)cotizaciones_last_id);
hash_cotizaciones = 0LL;
cotizaciones_last_id = 0;
Arbol_destruir(indice_id_serv);
indice_id_serv = 0LL;
Arbol_destruir(indice_id_usu);
result = 0LL;
indice_id_usu = 0LL;
return result;
}

canonical_decompiled_code:
__int64 func6()
{
__int64 result; // rax

HashExtensible_destruir(hash_cotizaciones);
writeLastId("./cot_last_id.dat", (unsigned int)cotizaciones_last_id);
hash_cotizaciones = 0LL;
cotizaciones_last_id = 0;
Arbol_destruir(indice_id_serv);
indice_id_serv = 0LL;
Arbol_destruir(indice_id_usu);
result = 0LL;
indice_id_usu = 0LL;
return result;
}

original_code:
int Cotizaciones_end(){
 HashExtensible_destruir(hash_cotizaciones);
 writeLastId("./cot_last_id.dat", cotizaciones_last_id);
 hash_cotizaciones = ((void *)0);
 cotizaciones_last_id = 0;
 Arbol_destruir(indice_id_serv);
 indice_id_serv = ((void *)0);
 Arbol_destruir(indice_id_usu);
 indice_id_usu = ((void *)0);
 return 0;
}


decompiled_code:
unsigned int *__fastcall Cotizacion_new(unsigned int a1, unsigned int a2, const char *a3, __int64 a4, __int64 a5)
{
int v5; // er12
void *v6; // rbp
unsigned int *v7; // r15
__int64 v9[6]; // [rsp+10h] [rbp-30h] BYREF

v9[0] = 0LL;
v5 = cotizaciones_last_id + 1;
v6 = (void *)cotBufDesdeData_constprop_0(cotizaciones_last_id + 1, a1, a2, a3, a4, a5, v9);
if ( (unsigned int)HashExtensible_insertar(hash_cotizaciones, v6, v9[0]) )
{
v7 = 0LL;
free(v6);
}
else
{
v7 = cotizacionDesdeBuf((__int64)v6, v9[0]);
free(v6);
insertarIdIndiceIdServ(v5, a1);
insertarIdIndiceIdDni(v5, a2);
++cotizaciones_last_id;
}
return v7;
}

canonical_decompiled_code:
unsigned int *__fastcall func7(unsigned int a1, unsigned int a2, const char *a3, __int64 a4, __int64 a5)
{
int v5; // er12
void *v6; // rbp
unsigned int *v7; // r15
__int64 v9[6]; // [rsp+10h] [rbp-30h] BYREF

v9[0] = 0LL;
v5 = cotizaciones_last_id + 1;
v6 = (void *)func4(cotizaciones_last_id + 1, a1, a2, a3, a4, a5, v9);
if ( (unsigned int)HashExtensible_insertar(hash_cotizaciones, v6, v9[0]) )
{
v7 = 0LL;
free(v6);
}
else
{
v7 = func1((__int64)v6, v9[0]);
free(v6);
func2(v5, a1);
func3(v5, a2);
++cotizaciones_last_id;
}
return v7;
}

original_code:
TCotizacion* Cotizacion_new(
 unsigned int id_serv,
 unsigned int dni,
 char* pedido,
 char* fecha,
 char* hora
){
 unsigned int last_id = cotizaciones_last_id;
 size_t size = 0;
 uint8_t* buf = _cotBufDesdeData(
  last_id+1,
  id_serv,
  dni,
  pedido,
  fecha,
  hora,
  &size
 );
 if(HashExtensible_insertar(hash_cotizaciones, buf, size)){
  free(buf);
  return ((void *)0);
 }
 TCotizacion* cot = _cotizacionDesdeBuf(buf, size);
 free(buf);
 _insertarIdIndiceIdServ(last_id+1, id_serv);
 _insertarIdIndiceIdDni(last_id+1, dni);
 cotizaciones_last_id++;
 return cot;
}

canonical_original_code:
struct TCotizacion *Cotizacion_new(unsigned int id_serv, unsigned int dni, char *pedido, char *fecha, char *hora){
 unsigned int last_id = cotizaciones_last_id;
 unsigned long size = 0;
 unsigned char *buf = _cotBufDesdeData(
  last_id+1,
  id_serv,
  dni,
  pedido,
  fecha,
  hora,
  &size
 );
 if(HashExtensible_insertar(hash_cotizaciones, buf, size)){
  free(buf);
  return ((void *)0);
 }
 struct TCotizacion *cot = _cotizacionDesdeBuf(buf, size);
 free(buf);
 _insertarIdIndiceIdServ(last_id+1, id_serv);
 _insertarIdIndiceIdDni(last_id+1, dni);
 cotizaciones_last_id++;
 return cot;
}

variable_types:
pedido
char *

variable_types:
fecha
char *

variable_types:
hora
char *

variable_types:
buf
unsigned char *

variable_types: struct TCotizacion { unsigned int id; unsigned int id_serv; unsigned int dni; char *pedido; char *fecha; char *hora; } *


decompiled_code:
__int64 __fastcall Cotizacion_free(void *ptr)
{
if ( !ptr )
return 1LL;
free(*((void **)ptr + 2));
free(*((void **)ptr + 3));
free(*((void **)ptr + 4));
free(ptr);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func8(void *ptr)
{
if ( !ptr )
return 1LL;
free(*((void **)ptr + 2));
free(*((void **)ptr + 3));
free(*((void **)ptr + 4));
free(ptr);
return 0LL;
}

original_code:
int Cotizacion_free(TCotizacion* this){
 if(!this)
  return 1;
 free(this->pedido);
 free(this->fecha);
 free(this->hora);
 free(this);
 return 0;
}

canonical_original_code:
int Cotizacion_free(struct TCotizacion *this){
 if(!this)
  return 1;
 free(this->pedido);
 free(this->fecha);
 free(this->hora);
 free(this);
 return 0;
}

user_defined_types: struct TCotizacion { unsigned int id; unsigned int id_serv; unsigned int dni; char *pedido; char *fecha; char *hora; }


decompiled_code:
unsigned int *__fastcall Cotizacion_from_id(unsigned int a1)
{
__int64 v1; // rax
void *v2; // rbp
unsigned int *v3; // r12
__int64 v5[4]; // [rsp+8h] [rbp-20h] BYREF

v1 = HashExtensible_get(hash_cotizaciones, a1, v5);
if ( !v1 )
return 0LL;
v2 = (void *)v1;
v3 = cotizacionDesdeBuf(v1, v5[0]);
free(v2);
return v3;
}

canonical_decompiled_code:
unsigned int *__fastcall func9(unsigned int a1)
{
__int64 v1; // rax
void *v2; // rbp
unsigned int *v3; // r12
__int64 v5[4]; // [rsp+8h] [rbp-20h] BYREF

v1 = HashExtensible_get(hash_cotizaciones, a1, v5);
if ( !v1 )
return 0LL;
v2 = (void *)v1;
v3 = func1(v1, v5[0]);
free(v2);
return v3;
}

original_code:
TCotizacion* Cotizacion_from_id(unsigned int id){
 uint8_t* buf;
 size_t size;
 if( ! (buf = HashExtensible_get(hash_cotizaciones, id, &size))){
  return ((void *)0);
 }
 TCotizacion* cot = _cotizacionDesdeBuf(buf, size);
 free(buf);
 return cot;
}

canonical_original_code:
struct TCotizacion *Cotizacion_from_id(unsigned int id){
 unsigned char *buf;
 unsigned long size;
 if( ! (buf = HashExtensible_get(hash_cotizaciones, id, &size))){
  return ((void *)0);
 }
 struct TCotizacion *cot = _cotizacionDesdeBuf(buf, size);
 free(buf);
 return cot;
}

return_type: struct TCotizacion { unsigned int id; unsigned int id_serv; unsigned int dni; char *pedido; char *fecha; char *hora; } *


decompiled_code:
__int64 __fastcall Cotizacion_get_id(unsigned int *a1)
{
__int64 result; // rax

if ( a1 )
result = *a1;
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *a1;
else
result = 0LL;
return result;
}

original_code:
unsigned int Cotizacion_get_id(TCotizacion* this){
 if(!this)
  return 0;
 return this->id;
}

canonical_original_code:
unsigned int Cotizacion_get_id(struct TCotizacion *this){
 if(!this)
  return 0;
 return this->id;
}


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

if ( a1 )
result = *(unsigned int *)(a1 + 4);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(unsigned int *)(a1 + 4);
else
result = 0LL;
return result;
}

original_code:
unsigned int Cotizacion_get_id_serv(TCotizacion* this){
 if(!this)
  return 0;
 return this->id_serv;
}

canonical_original_code:
unsigned int Cotizacion_get_id_serv(struct TCotizacion *this){
 if(!this)
  return 0;
 return this->id_serv;
}


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

if ( a1 )
result = *(unsigned int *)(a1 + 8);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(unsigned int *)(a1 + 8);
else
result = 0LL;
return result;
}

original_code:
unsigned int Cotizacion_get_dni(TCotizacion* this){
 if(!this)
  return 0;
 return this->dni;
}

canonical_original_code:
unsigned int Cotizacion_get_dni(struct TCotizacion *this){
 if(!this)
  return 0;
 return this->dni;
}


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

if ( a1 )
result = *(_QWORD *)(a1 + 16);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(_QWORD *)(a1 + 16);
else
result = 0LL;
return result;
}

original_code:
const char* Cotizacion_get_pedido(TCotizacion* this){
 if(!this)
  return ((void *)0);
 return this->pedido;
}

canonical_original_code:
char *Cotizacion_get_pedido(struct TCotizacion *this){
 if(!this)
  return ((void *)0);
 return this->pedido;
}


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

if ( a1 )
result = *(_QWORD *)(a1 + 24);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(_QWORD *)(a1 + 24);
else
result = 0LL;
return result;
}

original_code:
const char* Cotizacion_get_fecha(TCotizacion* this){
 if(!this)
  return ((void *)0);
 return this->fecha;
}

canonical_original_code:
char *Cotizacion_get_fecha(struct TCotizacion *this){
 if(!this)
  return ((void *)0);
 return this->fecha;
}


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

if ( a1 )
result = *(_QWORD *)(a1 + 32);
else
result = 0LL;
return result;
}

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

if ( a1 )
result = *(_QWORD *)(a1 + 32);
else
result = 0LL;
return result;
}

original_code:
const char* Cotizacion_get_hora(TCotizacion* this){
 if(!this)
  return ((void *)0);
 return this->hora;
}

canonical_original_code:
char *Cotizacion_get_hora(struct TCotizacion *this){
 if(!this)
  return ((void *)0);
 return this->hora;
}


decompiled_code:
unsigned int *__fastcall Cotizacion_del(unsigned int a1)
{
void *v1; // rbp
unsigned int *v2; // r12
__int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

v1 = (void *)HashExtensible_del(hash_cotizaciones, a1, v4);
v2 = cotizacionDesdeBuf((__int64)v1, v4[0]);
free(v1);
return v2;
}

canonical_decompiled_code:
unsigned int *__fastcall func16(unsigned int a1)
{
void *v1; // rbp
unsigned int *v2; // r12
__int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

v1 = (void *)HashExtensible_del(hash_cotizaciones, a1, v4);
v2 = func1((__int64)v1, v4[0]);
free(v1);
return v2;
}

original_code:
TCotizacion* Cotizacion_del(unsigned int id){
 size_t size;
 uint8_t* buf = HashExtensible_del(hash_cotizaciones, id, &size);
 TCotizacion* cot = _cotizacionDesdeBuf(buf, size);
 free(buf);
 return cot;
}

canonical_original_code:
struct TCotizacion *Cotizacion_del(unsigned int id){
 unsigned long size;
 unsigned char *buf = HashExtensible_del(hash_cotizaciones, id, &size);
 struct TCotizacion *cot = _cotizacionDesdeBuf(buf, size);
 free(buf);
 return cot;
}