decompiled_code:
void __fastcall free_block(void *ptr, __int64 a2)
{
if ( !ptr )
err(0, "Attempting to free null block");
free(ptr);
free_bytes += a2;
current_bytes -= a2;
++free_cnt;
}

canonical_decompiled_code:
void __fastcall func15(void *ptr, __int64 a2)
{
if ( !ptr )
func4(0, "Attempting to free null block");
free(ptr);
free_bytes += a2;
current_bytes -= a2;
++free_cnt;
}

original_code:
void free_block(void *b, size_t bytes) {
    if (b == ((void *)0)) {
 err(0, "Attempting to free null block");
    }
    free(b);
    free_cnt++;
    free_bytes += bytes;
    current_bytes -= bytes;
}

canonical_original_code:
void free_block(void *b, unsigned long bytes) {
    if (b == ((void *)0)) {
 err(0, "Attempting to free null block");
    }
    free(b);
    free_cnt++;
    free_bytes += bytes;
    current_bytes -= bytes;
}

variable_types:
b
void *


repo: rebryant/Cloud-BDD

decompiled_code:
void __fastcall free_array(void *ptr, __int64 a2, __int64 a3)
{
__int64 v3; // rbx

if ( !ptr )
err(0, "Attempting to free null block");
v3 = a3 * a2;
free(ptr);
free_bytes += v3;
current_bytes -= v3;
++free_cnt;
}

canonical_decompiled_code:
void __fastcall func16(void *ptr, __int64 a2, __int64 a3)
{
__int64 v3; // rbx

if ( !ptr )
func4(0, "Attempting to free null block");
v3 = a3 * a2;
free(ptr);
free_bytes += v3;
current_bytes -= v3;
++free_cnt;
}

original_code:
void free_array(void *b, size_t cnt, size_t bytes) {
    if (b == ((void *)0)) {
 err(0, "Attempting to free null block");
    }
    free(b);
    free_cnt++;
    free_bytes += cnt * bytes;
    current_bytes -= cnt * bytes;
}

canonical_original_code:
void free_array(void *b, unsigned long cnt, unsigned long bytes) {
    if (b == ((void *)0)) {
 err(0, "Attempting to free null block");
    }
    free(b);
    free_cnt++;
    free_bytes += cnt * bytes;
    current_bytes -= cnt * bytes;
}

variable_types:
cnt
unsigned long

variable_types:
bytes
unsigned long

return_type: void


decompiled_code:
void __fastcall free_string(void *ptr)
{
size_t v1; // rax

if ( !ptr )
err(0, "Attempting to free null block");
v1 = strlen((const char *)ptr);
free_block(ptr, v1 + 1);
}

canonical_decompiled_code:
void __fastcall func17(void *ptr)
{
size_t v1; // rax

if ( !ptr )
func4(0, "Attempting to free null block");
v1 = strlen((const char *)ptr);
func15(ptr, v1 + 1);
}

original_code:
void free_string(char *s) {
    if (s == ((void *)0)) {
 err(0, "Attempting to free null block");
    }
    free_block((void *) s, strlen(s)+1);
}

variable_types:
s
char *


decompiled_code:
double __fastcall delta_time(double *a1)
{
double v1; // xmm0_8
double v2; // xmm1_8
struct timeval v4; // [rsp+0h] [rbp-18h] BYREF

gettimeofday(&v4, 0LL);
v1 = (double)SLODWORD(v4.tv_usec) * 0.000001 + (double)SLODWORD(v4.tv_sec);
v2 = v1 - *a1;
*a1 = v1;
return v2;
}

canonical_decompiled_code:
double __fastcall func19(double *a1)
{
double v1; // xmm0_8
double v2; // xmm1_8
struct timeval v4; // [rsp+0h] [rbp-18h] BYREF

gettimeofday(&v4, 0LL);
v1 = (double)SLODWORD(v4.tv_usec) * 0.000001 + (double)SLODWORD(v4.tv_sec);
v2 = v1 - *a1;
*a1 = v1;
return v2;
}

original_code:
double delta_time(double *timep) {
    struct timeval tv;
    gettimeofday(&tv, ((void *)0));
    double current_time = tv.tv_sec + 1.0E-6 * tv.tv_usec;
    double delta = current_time - *timep;
    *timep = current_time;
    return delta;
}

variable_types:
timep
double *

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

variable_types: delta double

return_type: double


decompiled_code:
// attributes: thunk
double __fastcall init_time(double *a1)
{
return delta_time(a1);
}

canonical_decompiled_code:
double __fastcall func20(double *a1)
{
return func19(a1);
}

original_code:
void init_time(double *timep) {
    (void) delta_time(timep);
}


decompiled_code:
__int64 resident_bytes()
{
struct rusage v1; // [rsp+0h] [rbp-98h] BYREF

if ( getrusage(RUSAGE_SELF, &v1) < 0 )
err(0, "Call to getrusage failed");
return v1.ru_maxrss << 10;
}

canonical_decompiled_code:
__int64 func21()
{
struct rusage v1; // [rsp+0h] [rbp-98h] BYREF

if ( getrusage(RUSAGE_SELF, &v1) < 0 )
func4(0, "Call to getrusage failed");
return v1.ru_maxrss << 10;
}

original_code:
size_t resident_bytes() {
    struct rusage r;
    size_t mem = 0;
    int code = getrusage(RUSAGE_SELF, &r);
    if (code < 0) {
 err(0, "Call to getrusage failed");
    } else {
 mem = r.ru_maxrss * 1024;
    }
    return mem;
}

canonical_original_code:
unsigned long resident_bytes() {
    struct rusage r;
    unsigned long mem = 0;
    int code = getrusage(RUSAGE_SELF, &r);
    if (code < 0) {
 err(0, "Call to getrusage failed");
    } else {
 mem = r.ru_maxrss * 1024;
    }
    return mem;
}

variable_types: struct rusage { struct timeval { long tv_sec; long tv_usec; } ru_utime; struct timeval ru_stime; union { long ru_maxrss; long __ru_maxrss_word; }; union { long ru_ixrss; long __ru_ixrss_word; }; union { long ru_idrss; long __ru_idrss_word; }; union { long ru_isrss; long __ru_isrss_word; }; union { long ru_minflt; long __ru_minflt_word; }; union { long ru_majflt; long __ru_majflt_word; }; union { long ru_nswap; long __ru_nswap_word; }; union { long ru_inblock; long __ru_inblock_word; }; union { long ru_oublock; long __ru_oublock_word; }; union { long ru_msgsnd; long __ru_msgsnd_word; }; union { long ru_msgrcv; long __ru_msgrcv_word; }; union { long ru_nsignals; long __ru_nsignals_word; }; union { long ru_nvcsw; long __ru_nvcsw_word; }; union { long ru_nivcsw; long __ru_nivcsw_word; }; }

variable_types:
mem
unsigned long

variable_types: code int

return_type: unsigned long

user_defined_types: struct rusage { struct timeval ru_utime; struct timeval ru_stime; union { long ru_maxrss; long __ru_maxrss_word; }; union { long ru_ixrss; long __ru_ixrss_word; }; union { long ru_idrss; long __ru_idrss_word; }; union { long ru_isrss; long __ru_isrss_word; }; union { long ru_minflt; long __ru_minflt_word; }; union { long ru_majflt; long __ru_majflt_word; }; union { long ru_nswap; long __ru_nswap_word; }; union { long ru_inblock; long __ru_inblock_word; }; union { long ru_oublock; long __ru_oublock_word; }; union { long ru_msgsnd; long __ru_msgsnd_word; }; union { long ru_msgrcv; long __ru_msgrcv_word; }; union { long ru_nsignals; long __ru_nsignals_word; }; union { long ru_nvcsw; long __ru_nvcsw_word; }; union { long ru_nivcsw; long __ru_nivcsw_word; }; }


gigabytes

decompiled_code:
double __fastcall gigabytes(__int64 a1)
{
double result; // xmm0_8

if ( a1 < 0 )
result = ((double)(int)(a1 & 1 | ((unsigned __int64)a1 >> 1)) + (double)(int)(a1 & 1 | ((unsigned __int64)a1 >> 1)))
* 9.313225746154785e-10;
else
result = (double)(int)a1 * 9.313225746154785e-10;
return result;
}

canonical_decompiled_code:
double __fastcall func22(__int64 a1)
{
double result; // xmm0_8

if ( a1 < 0 )
result = ((double)(int)(a1 & 1 | ((unsigned __int64)a1 >> 1)) + (double)(int)(a1 & 1 | ((unsigned __int64)a1 >> 1)))
* 9.313225746154785e-10;
else
result = (double)(int)a1 * 9.313225746154785e-10;
return result;
}

original_code:
double gigabytes(size_t n) {
    return (double) n / (1UL << 30);
}

canonical_original_code:
double gigabytes(unsigned long n) {
    return (double) n / (1UL << 30);
}

variable_types:
n
unsigned long


decompiled_code:
int default_fatal_fun()
{
__int64 v0; // rax
double v1; // xmm1_8
double v2; // xmm0_8
size_t v3; // rax
int result; // eax

v0 = resident_bytes();
v1 = gigabytes(v0);
v2 = gigabytes(current_bytes);
sprintf(fail_buf, "FATAL. Memory: allocated = %.3f GB, resident = %.3f GB\n", v2, v1);
v3 = strlen(fail_buf);
result = write(1, fail_buf, v3 + 1);
rval = result;
if ( logfile )
result = fputs(fail_buf, logfile);
return result;
}

canonical_decompiled_code:
int func23()
{
__int64 v0; // rax
double v1; // xmm1_8
double v2; // xmm0_8
size_t v3; // rax
int result; // eax

v0 = func21();
v1 = func22(v0);
v2 = func22(current_bytes);
sprintf(fail_buf, "FATAL. Memory: allocated = %.3f GB, resident = %.3f GB\n", v2, v1);
v3 = strlen(fail_buf);
result = write(1, fail_buf, v3 + 1);
rval = result;
if ( logfile )
result = fputs(fail_buf, logfile);
return result;
}

original_code:
void default_fatal_fun() {
    sprintf(fail_buf, "FATAL.  Memory: allocated = %.3f GB, resident = %.3f GB\n",
    gigabytes(current_bytes), gigabytes(resident_bytes()));
    rval = write(1, fail_buf, strlen(fail_buf)+1);
    if (logfile)
 fputs(fail_buf, logfile);
}


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

result = current_bytes;
last_peak_bytes = current_bytes;
return result;
}

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

result = current_bytes;
last_peak_bytes = current_bytes;
return result;
}

original_code:
void reset_peak_bytes() {
    last_peak_bytes = current_bytes;
}


decompiled_code:
unsigned int change_timeout()
{
signal(14, (__sighandler_t)sigalrmhandler);
return alarm(timelimit);
}

canonical_decompiled_code:
unsigned int func25()
{
signal(14, (__sighandler_t)sigalrmhandler);
return alarm(timelimit);
}

original_code:
void change_timeout(int oldval) {
    signal(14, sigalrmhandler);
    alarm(timelimit);
}

variable_types: oldval int


decompiled_code:
void __noreturn sigterm_handler()
{
err(1, "SIGTERM signal received");
}

canonical_decompiled_code:
void __noreturn func26()
{
func4(1, "SIGTERM signal received");
}

original_code:
void sigterm_handler(int sig) {
    err(1, "SIGTERM signal received");
}

variable_types: sig int


repo: recuraki/CJunkTest

decompiled_code:
void __fastcall lq_set_creat_func(__int64 a1, __int64 a2)
{
*(_QWORD *)(a1 + 24) = a2;
}

original_code:
void lq_set_creat_func(struct llist_queue *ptr, int (*creat_func)(struct llist_queue *ptr))
{
  ptr->creat_func = creat_func;
}

variable_types: struct llist_queue { struct llist_queue *prev; struct llist_queue *next; void *data; int (*creat_func)(struct llist_queue *ptr); int (*set_func)(struct llist_queue *ptr, __builtin_va_list ap); int (*dump_func)(struct llist_queue *ptr); int (*destroy_func)(struct llist_queue *ptr); } *


decompiled_code:
void __fastcall lq_set_set_func(__int64 a1, __int64 a2)
{
*(_QWORD *)(a1 + 32) = a2;
}

original_code:
void lq_set_set_func(struct llist_queue *ptr, int (*set_func)(struct llist_queue *ptr, va_list ap))
{
  ptr->set_func = set_func;
}

canonical_original_code:
void lq_set_set_func(struct llist_queue *ptr, int (*set_func)(struct llist_queue *ptr, __builtin_va_list ap))
{
  ptr->set_func = set_func;
}

variable_types: int (*)(struct llist_queue *ptr, __builtin_va_list ap)

user_defined_types: struct llist_queue { struct llist_queue *prev; struct llist_queue *next; void *data; int (*creat_func)(struct llist_queue *ptr); int (*set_func)(struct llist_queue *ptr, __builtin_va_list ap); int (*dump_func)(struct llist_queue *ptr); int (*destroy_func)(struct llist_queue *ptr); }


decompiled_code:
void __fastcall lq_set_dump_func(__int64 a1, __int64 a2)
{
*(_QWORD *)(a1 + 40) = a2;
}

original_code:
void lq_set_dump_func(struct llist_queue *ptr, int (*dump_func)(struct llist_queue *ptr))
{
  ptr->dump_func = dump_func;
}


decompiled_code:
void __fastcall lq_set_destroy_func(__int64 a1, __int64 a2)
{
*(_QWORD *)(a1 + 48) = a2;
}

original_code:
void lq_set_destroy_func(struct llist_queue *ptr, int (*destroy_func)(struct llist_queue *ptr))
{
  ptr->destroy_func = destroy_func;
}


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

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

original_code:
int (*lq_get_creat_func(struct llist_queue *ptr))()
{
  return ptr->creat_func;
}


decompiled_code:
__int64 __fastcall lq_get_set_func(__int64 a1)
{
return *(_QWORD *)(a1 + 32);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
return *(_QWORD *)(a1 + 32);
}

original_code:
int (*lq_get_set_func(struct llist_queue *ptr))()
{
  return ptr->set_func;
}


decompiled_code:
__int64 __fastcall lq_get_dump_func(__int64 a1)
{
return *(_QWORD *)(a1 + 40);
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
return *(_QWORD *)(a1 + 40);
}

original_code:
int (*lq_get_dump_func(struct llist_queue *ptr))()
{
  return ptr->dump_func;
}


decompiled_code:
__int64 __fastcall lq_get_destroy_func(__int64 a1)
{
return *(_QWORD *)(a1 + 48);
}

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

original_code:
int (*lq_get_destroy_func(struct llist_queue *ptr))()
{
  return ptr->destroy_func;
}


decompiled_code:
__int64 lq_do_set_func(__int64 a1, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a1);
return (*(__int64 (__fastcall **)(__int64, __va_list_tag *))(a1 + 32))(a1, va);
}

canonical_decompiled_code:
__int64 func8(__int64 a1, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a1);
return (*(__int64 (__fastcall **)(__int64, __va_list_tag *))(a1 + 32))(a1, va);
}

original_code:
int lq_do_set_func(struct llist_queue *ptr, ...)
{
  int ret;
  va_list ap;
  __builtin_va_start(ap,ptr);
  ret = ptr->set_func(ptr, ap);
  __builtin_va_end(ap);
  return ret;
}

canonical_original_code:
int lq_do_set_func(struct llist_queue *ptr, ...)
{
  int ret;
  __builtin_va_list ap;
  __builtin_va_start(ap,ptr);
  ret = ptr->set_func(ptr, ap);
  __builtin_va_end(ap);
  return ret;
}

variable_types: ret int

return_type: int


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

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

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

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

original_code:
int lq_do_func(int (*func)(), struct llist_queue *ptr)
{
  if(func == 0)
  {
    return 0;
  }
  return func(ptr);
}

variable_types:
func
int (*)()


decompiled_code:
__int64 __fastcall lq_do_creat_func(__int64 a1)
{
return lq_do_func(*(__int64 (__fastcall **)(__int64))(a1 + 24), a1);
}

original_code:
int lq_do_creat_func(struct llist_queue *ptr)
{
  return lq_do_func(ptr->creat_func, ptr);
}


decompiled_code:
__int64 __fastcall lq_do_dump_func(__int64 a1)
{
return lq_do_func(*(__int64 (__fastcall **)(__int64))(a1 + 40), a1);
}

original_code:
int lq_do_dump_func(struct llist_queue *ptr)
{
  return lq_do_func(ptr->dump_func, ptr);
}


decompiled_code:
__int64 __fastcall lq_do_destroy_func(__int64 a1)
{
return lq_do_func(*(__int64 (__fastcall **)(__int64))(a1 + 48), a1);
}

original_code:
int lq_do_destroy_func(struct llist_queue *ptr)
{
  return lq_do_func(ptr->destroy_func, ptr);
}


decompiled_code:
void __fastcall lq_set_data(__int64 a1, __int64 a2)
{
*(_QWORD *)(a1 + 16) = a2;
}

original_code:
void lq_set_data(struct llist_queue *ptr, void *data)
{
  ptr->data = data;
}

variable_types:
data
void *


decompiled_code:
__int64 __fastcall lq_get_data(__int64 a1)
{
return *(_QWORD *)(a1 + 16);
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1)
{
return *(_QWORD *)(a1 + 16);
}

original_code:
void *lq_get_data(struct llist_queue *ptr)
{
  return ptr->data;
}

return_type: void *


original_code:
void lq_init(struct llist_queue *root)
{
 memset(root, 0, sizeof(struct llist_queue));
}


decompiled_code:
void __fastcall lq_set_next(__int64 a1, __int64 a2)
{
*(_QWORD *)(a1 + 8) = a2;
}

original_code:
void lq_set_next(struct llist_queue *ptr, struct llist_queue *next)
{
  ptr->next = next;
}

variable_types:
next
struct llist_queue *


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

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

original_code:
struct llist_queue *lq_get_next(struct llist_queue *ptr)
{
  return ptr->next;
}

variable_types:
ptr
struct llist_queue *

return_type: struct llist_queue { struct llist_queue *prev; struct llist_queue *next; void *data; int (*creat_func)(struct llist_queue *ptr); int (*set_func)(struct llist_queue *ptr, __builtin_va_list ap); int (*dump_func)(struct llist_queue *ptr); int (*destroy_func)(struct llist_queue *ptr); } *


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

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

original_code:
struct llist_queue *lq_get_prev(struct llist_queue *ptr)
{
  return ptr->prev;
}


decompiled_code:
_BOOL8 __fastcall lq_is_null(__int64 a1)
{
return a1 == 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func20(__int64 a1)
{
return a1 == 0;
}

original_code:
int lq_is_null(struct llist_queue *ptr)
{
  return(ptr == 0);
}


decompiled_code:
_BOOL8 __fastcall lq_cmp(__int64 a1, __int64 a2)
{
return a2 == a1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func21(__int64 a1, __int64 a2)
{
return a2 == a1;
}

original_code:
int lq_cmp(struct llist_queue *ptr1, struct llist_queue *ptr2)
{
  return(ptr1 == ptr2);
}


decompiled_code:
size_t __fastcall lq_delete_ptr(__int64 a1, __int64 *a2)
{
__int64 v2; // r8
__int64 v3; // rdi
__int64 v4; // rax
__int64 v5; // r9
__int64 v6; // r10
__int64 v7; // r11
_QWORD *v8; // r8
__int64 v9; // r9

if ( lq_cmp((__int64)a2, a1) )
return fwrite("ROOTNOOOOOOD\n", 1uLL, 0xDuLL, stderr);
v3 = v2;
lq_get_prev(v2);
lq_get_next(v3);
lq_get_prev((__int64)a2);
v4 = lq_get_next((__int64)a2);
lq_set_next(v5, v4);
if ( lq_cmp((__int64)a2, v6) )
{
if ( lq_cmp((__int64)a2, v7) )
lq_set_prev(v8, 0LL);
else
lq_set_prev(v8, v9);
}
else
{
lq_set_next(*a2, a2[1]);
lq_set_prev((_QWORD *)a2[1], *a2);
}
lq_do_destroy_func((__int64)a2);
return xfree(a2);
}

original_code:
void lq_delete_ptr(struct llist_queue *root, struct llist_queue *ptr)
{
 struct llist_queue *root_prev;
 struct llist_queue *root_next;
 struct llist_queue *ptr_prev;
 struct llist_queue *ptr_next;
  root_prev = lq_get_prev(root);
  root_next = lq_get_next(root);
  ptr_prev = lq_get_prev(ptr);
  ptr_next = lq_get_next(ptr);
  if(lq_cmp(ptr, root))
  {
    fprintf(stderr, "ROOTNOOOOOOD\n");
    return;
  }
  lq_set_next(ptr_prev, ptr_next);
  if(lq_cmp(ptr, root_prev))
  {
    if(lq_cmp(ptr, root_next))
    {
      lq_set_prev(root, 0);
    }
    else
    {
      lq_set_prev(root, ptr_prev);
    }
  }
  else
  {
    lq_set_next(ptr->prev, ptr->next);
    lq_set_prev(ptr->next, ptr->prev);
  }
 lq_do_destroy_func(ptr);
  xfree(ptr);
}


decompiled_code:
size_t __fastcall lq_dump(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rbp
__int64 v3; // rax
__int64 v4; // rdx

fwrite("LLIST_QUEUE_INT_DUMP:BEGIN\n", 1uLL, 0x1BuLL, stderr);
v1 = lq_get_next(a1);
if ( v1 )
{
v2 = v1;
do
{
v3 = lq_get_next(v2);
fprintf(stderr, "LLIST_QUEUE_INT_DUMP[%x]-next:%x\n", v4, v3);
lq_do_dump_func(v2);
v2 = lq_get_next(v2);
}
while ( v2 );
}
return fwrite("LLIST_QUEUE_INT_DUMP:END\n", 1uLL, 0x19uLL, stderr);
}

canonical_decompiled_code:
size_t __fastcall func26(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rbp
__int64 v3; // rax
__int64 v4; // rdx

fwrite("LLIST_QUEUE_INT_DUMP:BEGIN\n", 1uLL, 0x1BuLL, stderr);
v1 = func18(a1);
if ( v1 )
{
v2 = v1;
do
{
v3 = func18(v2);
fprintf(stderr, "LLIST_QUEUE_INT_DUMP[%x]-next:%x\n", v4, v3);
func11(v2);
v2 = func18(v2);
}
while ( v2 );
}
return fwrite("LLIST_QUEUE_INT_DUMP:END\n", 1uLL, 0x19uLL, stderr);
}

original_code:
void lq_dump(struct llist_queue *root)
{
 struct llist_queue *ptr;
 fprintf(stderr, "LLIST_QUEUE_INT_DUMP:BEGIN\n");
 ptr = lq_get_next(root);
 for(;ptr != 0; ptr = lq_get_next(ptr))
  {
  fprintf(stderr, "LLIST_QUEUE_INT_DUMP[%x]-next:%x\n",
        (int)ptr, (int)lq_get_next(ptr));
    lq_do_dump_func(ptr);
 }
 fprintf(stderr, "LLIST_QUEUE_INT_DUMP:END\n");
}


decompiled_code:
__int64 __fastcall show_version(int a1)
{
write(a1, "Version\n", 8uLL);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1)
{
write(a1, "Version\n", 8uLL);
return 0LL;
}

original_code:
int show_version(int sd, int argc, char **argv)
{
  write(sd, "Version\n", 8);
  return(0);
}

variable_types: sd int

variable_types: argc int

variable_types:
argv
char **


decompiled_code:
__int64 show_memory()
{
xdump();
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
xdump();
return 0LL;
}

original_code:
int show_memory(int sd, int argc, char **argv)
{
  xdump();
  return(0);
}


decompiled_code:
void __noreturn exit_cmd()
{
exit(1);
}

canonical_decompiled_code:
void __noreturn func3()
{
exit(1);
}

original_code:
int exit_cmd(int sd, int argc, char **argv)
{
  exit(1);
}


decompiled_code:
int __fastcall xconsole_init_term(int a1)
{
int v1; // esi
__int64 v3; // rbx
__int64 *v4; // rdi
__m128i v5; // xmm0
__m128i v6; // xmm1
__m128i v7; // xmm2
speed_t v8; // eax
struct termios v10; // [rsp+0h] [rbp-58h] BYREF

v1 = a1;
v3 = 60LL * a1;
v4 = &xconsole_ti[129 * a1];
memset(v4, 0, 0x408uLL);
*(_DWORD *)v4 = v1;
tcgetattr(a1, (struct termios *)((char *)&orig_term + v3));
v5 = _mm_loadu_si128((const __m128i *)((char *)&orig_term + v3));
v6 = _mm_loadu_si128((const __m128i *)((char *)&orig_term + v3 + 16));
*(_QWORD *)&v10.c_cc[31] = *(_QWORD *)((char *)&orig_term + v3 + 48);
v7 = _mm_loadu_si128((const __m128i *)((char *)&orig_term + v3 + 32));
v8 = *(_DWORD *)((char *)&orig_term + v3 + 56);
*(__m128i *)&v10.c_iflag = v5;
*(__m128i *)&v10.c_line = v6;
v10.c_ospeed = v8;
v10.c_lflag = 0;
*(__m128i *)&v10.c_cc[15] = v7;
return tcsetattr(a1, 0, &v10);
}

canonical_decompiled_code:
int __fastcall func0(int a1)
{
int v1; // esi
__int64 v3; // rbx
__int64 *v4; // rdi
__m128i v5; // xmm0
__m128i v6; // xmm1
__m128i v7; // xmm2
speed_t v8; // eax
struct termios v10; // [rsp+0h] [rbp-58h] BYREF

v1 = a1;
v3 = 60LL * a1;
v4 = &xconsole_ti[129 * a1];
memset(v4, 0, 0x408uLL);
*(_DWORD *)v4 = v1;
tcgetattr(a1, (struct termios *)((char *)&orig_term + v3));
v5 = _mm_loadu_si128((const __m128i *)((char *)&orig_term + v3));
v6 = _mm_loadu_si128((const __m128i *)((char *)&orig_term + v3 + 16));
*(_QWORD *)&v10.c_cc[31] = *(_QWORD *)((char *)&orig_term + v3 + 48);
v7 = _mm_loadu_si128((const __m128i *)((char *)&orig_term + v3 + 32));
v8 = *(_DWORD *)((char *)&orig_term + v3 + 56);
*(__m128i *)&v10.c_iflag = v5;
*(__m128i *)&v10.c_line = v6;
v10.c_ospeed = v8;
v10.c_lflag = 0;
*(__m128i *)&v10.c_cc[15] = v7;
return tcsetattr(a1, 0, &v10);
}

original_code:
void xconsole_init_term(int sd)
{
  struct termios term;
  memset(&xconsole_ti[sd], 0, sizeof(struct terminal_info));
  xconsole_ti[sd].sd = sd;
  tcgetattr(sd, &orig_term[sd]);
  memcpy(&term, &orig_term[sd], sizeof(term));
  term.c_lflag &= !(0000002);
  term.c_lflag &= !(0000010);
  term.c_lflag &= !(0001000);
  tcsetattr(sd, 0, &term);
}

variable_types: struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }

user_defined_types: struct terminal_info { int sd; char cmd_buffer[1024]; int cmd_cursor; }


decompiled_code:
__int64 __fastcall xconsole_clear_cmd_line_cur(int a1)
{
__int64 result; // rax
__int64 v2; // rdi

result = 0LL;
v2 = 129LL * a1;
HIDWORD(xconsole_ti[v2 + 128]) = 0;
*(__int64 *)((char *)&xconsole_ti[v2] + 4) = 0LL;
*(__int64 *)((char *)&xconsole_ti[v2 + 127] + 4) = 0LL;
memset(
(void *)(((unsigned __int64)&xconsole_ti[v2 + 1] + 4) & 0xFFFFFFFFFFFFFFF8LL),
0,
8LL
* (((unsigned int)xconsole_ti
+ 4
+ (_DWORD)(v2 * 8)
- (((unsigned int)&xconsole_ti[1] + 4 + (_DWORD)(v2 * 8)) & 0xFFFFFFF8)
+ 1024) >> 3));
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1)
{
__int64 result; // rax
__int64 v2; // rdi

result = 0LL;
v2 = 129LL * a1;
HIDWORD(xconsole_ti[v2 + 128]) = 0;
*(__int64 *)((char *)&xconsole_ti[v2] + 4) = 0LL;
*(__int64 *)((char *)&xconsole_ti[v2 + 127] + 4) = 0LL;
memset(
(void *)(((unsigned __int64)&xconsole_ti[v2 + 1] + 4) & 0xFFFFFFFFFFFFFFF8LL),
0,
8LL
* (((unsigned int)xconsole_ti
+ 4
+ (_DWORD)(v2 * 8)
- (((unsigned int)&xconsole_ti[1] + 4 + (_DWORD)(v2 * 8)) & 0xFFFFFFF8)
+ 1024) >> 3));
return result;
}

original_code:
void xconsole_clear_cmd_line_cur(int sd)
{
  xconsole_ti[sd].cmd_cursor = 0;
  memset(xconsole_ti[sd].cmd_buffer, 0, 1024);
}


decompiled_code:
__int64 xconsole_init_shell()
{
int i; // edx
__int64 result; // rax

for ( i = 0; i != 1024; xconsole_clear_cmd_line_cur(i) )
;
result = lq_creat(
&xconsole_cmd_creat_func,
&xconsole_cmd_set_func,
&xconsole_cmd_dump_func,
&xconsole_cmd_destroy_func);
cmd_root = result;
return result;
}

canonical_decompiled_code:
__int64 func2()
{
int i; // edx
__int64 result; // rax

for ( i = 0; i != 1024; func1(i) )
;
result = lq_creat(
&xconsole_cmd_creat_func,
&xconsole_cmd_set_func,
&xconsole_cmd_dump_func,
&xconsole_cmd_destroy_func);
cmd_root = result;
return result;
}

original_code:
void xconsole_init_shell(void)
{
  int i;
  for(i = 0; i < 1024; i++)
  {
    xconsole_clear_cmd_line_cur(i);
  }
  cmd_root = lq_creat(xconsole_cmd_creat_func,
        xconsole_cmd_set_func,
        xconsole_cmd_dump_func,
        xconsole_cmd_destroy_func);
}

canonical_original_code:
void xconsole_init_shell()
{
  int i;
  for(i = 0; i < 1024; i++)
  {
    xconsole_clear_cmd_line_cur(i);
  }
  cmd_root = lq_creat(xconsole_cmd_creat_func,
        xconsole_cmd_set_func,
        xconsole_cmd_dump_func,
        xconsole_cmd_destroy_func);
}

variable_types: i int


decompiled_code:
_BOOL8 __fastcall xconsole_is_last_command(char *src, int a2)
{
size_t v2; // rax
char v4[1048]; // [rsp+0h] [rbp-418h] BYREF

v2 = strlen(src);
strncpy(v4, src, v2);
return xconsole_get_cmd_name_by_level(v4, a2) != 0LL;
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(char *src, int a2)
{
size_t v2; // rax
char v4[1048]; // [rsp+0h] [rbp-418h] BYREF

v2 = strlen(src);
strncpy(v4, src, v2);
return xconsole_get_cmd_name_by_level(v4, a2) != 0LL;
}

original_code:
int xconsole_is_last_command(struct command_set *command_info, int level)
{
  char cur_name[1024];
  strncpy(cur_name, command_info->name, strlen(command_info->name));
  if(xconsole_get_cmd_name_by_level(cur_name, level) == 0)
    {
      return(0);
    }
  return(1);
}

variable_types: struct command_set { char name[1024]; char desc[1024]; int (*cmd)(); struct llist_queue { struct llist_queue *prev; struct llist_queue *next; void *data; int (*creat_func)(struct llist_queue *ptr); int (*set_func)(struct llist_queue *ptr, __builtin_va_list ap); int (*dump_func)(struct llist_queue *ptr); int (*destroy_func)(struct llist_queue *ptr); } *next_arg; } *

variable_types: level int

user_defined_types: struct command_set { char name[1024]; char desc[1024]; int (*cmd)(); struct llist_queue *next_arg; }


decompiled_code:
__int64 __fastcall xconsole_do_command(unsigned int a1, __int64 a2, const char *a3, int a4)
{
unsigned int v4; // er14
size_t v7; // rax
const char *v8; // rax
const char *v9; // rbp
__int64 v10; // rax
__int64 v11; // rbp
void (__fastcall *v12)(_QWORD); // rdx
char dest[1080]; // [rsp+10h] [rbp-438h] BYREF

v4 = 0;
memset(dest, 0, 0x400uLL);
v7 = strlen(a3);
strncpy(dest, a3, v7);
v8 = xconsole_get_cmd_name_by_level(dest, a4);
if ( v8 )
{
v9 = v8;
*xconsole_parse_command(dest) = 0;
printf("Do[%s]\n", v9);
if ( (int)xconsole_cmd_count(a2, v9) > 1 )
{
v4 = -1;
puts("Over 2 Commands Muched");
}
else
{
v10 = xconsole_cmd_find(a2, v9);
if ( v10 )
{
v11 = *(_QWORD *)(v10 + 16);
v4 = 1;
if ( !(unsigned int)xconsole_do_command(a1, *(_QWORD *)(v11 + 2056), a3, (unsigned int)(a4 + 1)) )
{
v12 = *(void (__fastcall **)(_QWORD))(v11 + 2048);
if ( v12 )
v12(a1);
}
}
else
{
puts("No Such As Command");
}
}
}
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int a1, __int64 a2, const char *a3, int a4)
{
unsigned int v4; // er14
size_t v7; // rax
const char *v8; // rax
const char *v9; // rbp
__int64 v10; // rax
__int64 v11; // rbp
void (__fastcall *v12)(_QWORD); // rdx
char dest[1080]; // [rsp+10h] [rbp-438h] BYREF

v4 = 0;
memset(dest, 0, 0x400uLL);
v7 = strlen(a3);
strncpy(dest, a3, v7);
v8 = xconsole_get_cmd_name_by_level(dest, a4);
if ( v8 )
{
v9 = v8;
*xconsole_parse_command(dest) = 0;
printf("Do[%s]\n", v9);
if ( (int)xconsole_cmd_count(a2, v9) > 1 )
{
v4 = -1;
puts("Over 2 Commands Muched");
}
else
{
v10 = xconsole_cmd_find(a2, v9);
if ( v10 )
{
v11 = *(_QWORD *)(v10 + 16);
v4 = 1;
if ( !(unsigned int)func4(a1, *(_QWORD *)(v11 + 2056), a3, (unsigned int)(a4 + 1)) )
{
v12 = *(void (__fastcall **)(_QWORD))(v11 + 2048);
if ( v12 )
v12(a1);
}
}
else
{
puts("No Such As Command");
}
}
}
return v4;
}

original_code:
int xconsole_do_command(int sd, struct llist_queue *cmd_root, char *cmd, int level)
{
  char *c, *cp;
  char cur_name[1024];
  struct llist_queue *cmd_node;
  struct command_set *cmd_ptr;
  int cmd_count;
  memset(cur_name, 0x00, 1024);
  strncpy(cur_name, cmd, strlen(cmd));
  if( (c = xconsole_get_cmd_name_by_level(cur_name, level) ) == 0)
    {
      return(0);
    }
  cp = xconsole_parse_command(cur_name);
  *cp = 0x00;
  printf("Do[%s]\n", c);
  cmd_count = xconsole_cmd_count(cmd_root, c);
  if(cmd_count > 1)
    {
      printf("Over 2 Commands Muched\n");
      return(-1);
    }
  if( (cmd_node = xconsole_cmd_find(cmd_root, c)) != 0)
    {
      cmd_ptr = cmd_node->data;
      if( xconsole_do_command(sd, cmd_ptr->next_arg, cmd, level + 1) == 0)
 {
   if(cmd_ptr->cmd != 0)
     {
       cmd_ptr->cmd(sd);
     }
 }
      return(1);
    }
  else
    {
      printf("No Such As Command\n");
      return(0);
    }
}

canonical_original_code:
int xconsole_do_command(int sd, struct llist_queue *cmd_root, char *cmd, int level)
{
  char *c; char *cp;
  char cur_name[1024];
  struct llist_queue *cmd_node;
  struct command_set *cmd_ptr;
  int cmd_count;
  memset(cur_name, 0x00, 1024);
  strncpy(cur_name, cmd, strlen(cmd));
  if( (c = xconsole_get_cmd_name_by_level(cur_name, level) ) == 0)
    {
      return(0);
    }
  cp = xconsole_parse_command(cur_name);
  *cp = 0x00;
  printf("Do[%s]\n", c);
  cmd_count = xconsole_cmd_count(cmd_root, c);
  if(cmd_count > 1)
    {
      printf("Over 2 Commands Muched\n");
      return(-1);
    }
  if( (cmd_node = xconsole_cmd_find(cmd_root, c)) != 0)
    {
      cmd_ptr = cmd_node->data;
      if( xconsole_do_command(sd, cmd_ptr->next_arg, cmd, level + 1) == 0)
 {
   if(cmd_ptr->cmd != 0)
     {
       cmd_ptr->cmd(sd);
     }
 }
      return(1);
    }
  else
    {
      printf("No Such As Command\n");
      return(0);
    }
}

variable_types:
cmd
char *

variable_types:
c
char *

variable_types:
cp
char *


decompiled_code:
__int64 __fastcall xconsole_add_command(__int64 a1, __int64 a2, int a3)
{
__int64 v3; // r14
size_t v5; // rax
const char *v6; // r12
__int64 result; // rax
__int64 v8; // r15
unsigned int v9; // er12
__int64 v10; // rbx
size_t v11; // rax
__int64 v12; // rax
_BYTE v13[2064]; // [rsp-810h] [rbp-1458h] BYREF
char v14[1024]; // [rsp+0h] [rbp-C48h] BYREF
char dest[2120]; // [rsp+400h] [rbp-848h] BYREF

printf("add func proc[%s] To [%x]\n", (const char *)a2, (unsigned int)a1);
v5 = strlen((const char *)a2);
strncpy(v14, (const char *)a2, v5);
v6 = xconsole_get_cmd_name_by_level(v14, a3);
result = 0LL;
if ( v6 )
{
*xconsole_parse_command(v14) = 0;
v8 = xconsole_cmd_find(a1, v6);
if ( !v8 )
{
v8 = lq_add_last(a1);
qmemcpy(dest, (const void *)a2, 0x810uLL);
*(_QWORD *)&dest[2056] = 0LL;
*(_QWORD *)&dest[2048] = 0LL;
memset(dest, 0, 0x400uLL);
v11 = strlen(v6);
qmemcpy(v13, strncpy(dest, v6, v11), sizeof(v13));
lq_do_set_func(v8);
printf("Create to %x\n", (unsigned int)a1);
}
v9 = a3 + 1;
if ( xconsole_is_last_command((char *)a2, a3 + 1) )
{
v10 = *(_QWORD *)(v8 + 16);
if ( !*(_QWORD *)(v10 + 2056) )
{
v12 = lq_creat(
&xconsole_cmd_creat_func,
&xconsole_cmd_set_func,
&xconsole_cmd_dump_func,
&xconsole_cmd_destroy_func);
*(_QWORD *)(v10 + 2056) = v12;
v3 = v12;
}
xconsole_add_command(v3, a2, v9);
result = 1LL;
}
else
{
*(_QWORD *)(*(_QWORD *)(v8 + 16) + 2048LL) = *(_QWORD *)(a2 + 2048);
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2, int a3)
{
__int64 v3; // r14
size_t v5; // rax
const char *v6; // r12
__int64 result; // rax
__int64 v8; // r15
unsigned int v9; // er12
__int64 v10; // rbx
size_t v11; // rax
__int64 v12; // rax
_BYTE v13[2064]; // [rsp-810h] [rbp-1458h] BYREF
char v14[1024]; // [rsp+0h] [rbp-C48h] BYREF
char dest[2120]; // [rsp+400h] [rbp-848h] BYREF

printf("add func proc[%s] To [%x]\n", (const char *)a2, (unsigned int)a1);
v5 = strlen((const char *)a2);
strncpy(v14, (const char *)a2, v5);
v6 = xconsole_get_cmd_name_by_level(v14, a3);
result = 0LL;
if ( v6 )
{
*xconsole_parse_command(v14) = 0;
v8 = xconsole_cmd_find(a1, v6);
if ( !v8 )
{
v8 = lq_add_last(a1);
qmemcpy(dest, (const void *)a2, 0x810uLL);
*(_QWORD *)&dest[2056] = 0LL;
*(_QWORD *)&dest[2048] = 0LL;
memset(dest, 0, 0x400uLL);
v11 = strlen(v6);
qmemcpy(v13, strncpy(dest, v6, v11), sizeof(v13));
lq_do_set_func(v8);
printf("Create to %x\n", (unsigned int)a1);
}
v9 = a3 + 1;
if ( func3((char *)a2, a3 + 1) )
{
v10 = *(_QWORD *)(v8 + 16);
if ( !*(_QWORD *)(v10 + 2056) )
{
v12 = lq_creat(
&xconsole_cmd_creat_func,
&xconsole_cmd_set_func,
&xconsole_cmd_dump_func,
&xconsole_cmd_destroy_func);
*(_QWORD *)(v10 + 2056) = v12;
v3 = v12;
}
func5(v3, a2, v9);
result = 1LL;
}
else
{
*(_QWORD *)(*(_QWORD *)(v8 + 16) + 2048LL) = *(_QWORD *)(a2 + 2048);
result = 1LL;
}
}
return result;
}

original_code:
int xconsole_add_command(struct llist_queue *cmd_root, struct command_set *command_info, int level)
{
  char *c;
  char *cp;
  char cur_name[1024];
  struct command_set new_cmd;
  struct llist_queue *cmd_node;
  struct llist_queue *new_cmd_root;
  struct command_set *cmd_ptr;
  printf("add func proc[%s] To [%x]\n", command_info->name, (int)cmd_root);
  strncpy(cur_name, command_info->name, strlen(command_info->name));
  if( (c = xconsole_get_cmd_name_by_level(cur_name, level) ) == 0)
    {
      return(0);
    }
  cp = xconsole_parse_command(cur_name);
  *cp = 0x00;
  if( (cmd_node = xconsole_cmd_find(cmd_root, c)) == 0)
    {
      cmd_node = lq_add_last(cmd_root);
      memcpy(&new_cmd, command_info, sizeof(struct command_set));
      memset(new_cmd.name ,0x00, 1024);
      new_cmd.next_arg = 0;
      new_cmd.cmd = 0;
      strncpy(new_cmd.name, c, strlen(c));
      lq_do_set_func(cmd_node, new_cmd);
      printf("Create to %x\n", (int)cmd_root);
    }
  else
    {
    }
  if(xconsole_is_last_command(command_info, level + 1) == 0)
    {
      cmd_ptr = cmd_node->data;
      cmd_ptr->cmd = command_info->cmd;
    }
  else
    {
      cmd_ptr = cmd_node->data;
      if(cmd_ptr->next_arg == 0x00)
 {
   new_cmd_root = lq_creat(xconsole_cmd_creat_func,
      xconsole_cmd_set_func,
      xconsole_cmd_dump_func,
      xconsole_cmd_destroy_func);
   cmd_ptr->next_arg = new_cmd_root;
 }
      xconsole_add_command(new_cmd_root, command_info, level + 1);
    }
  return(1);
}

variable_types: struct command_set { char name[1024]; char desc[1024]; int (*cmd)(); struct llist_queue *next_arg; } *

variable_types: struct command_set { char name[1024]; char desc[1024]; int (*cmd)(); struct llist_queue { struct llist_queue *prev; struct llist_queue *next; void *data; int (*creat_func)(struct llist_queue *ptr); int (*set_func)(struct llist_queue *ptr, __builtin_va_list ap); int (*dump_func)(struct llist_queue *ptr); int (*destroy_func)(struct llist_queue *ptr); } *next_arg; }


decompiled_code:
void __fastcall __noreturn xconsole_exit_func(int a1)
{
tcsetattr(0, 0, &orig_term + a1);
exit(0);
}

canonical_decompiled_code:
void __fastcall __noreturn func6(int a1)
{
tcsetattr(0, 0, &orig_term + a1);
exit(0);
}

original_code:
void xconsole_exit_func(int sd)
{
  tcsetattr(0, 0, &orig_term[sd]);
  exit(0);
}


decompiled_code:
int __fastcall xconsole_delete_current_char(int a1)
{
__int64 *v1; // rbx
int result; // eax

v1 = &xconsole_ti[129 * a1];
result = *((_DWORD *)v1 + 257);
if ( result )
{
fputc(8, stdout);
fputc(32, stdout);
result = fputc(8, stdout);
--*((_DWORD *)v1 + 257);
}
return result;
}

canonical_decompiled_code:
int __fastcall func7(int a1)
{
__int64 *v1; // rbx
int result; // eax

v1 = &xconsole_ti[129 * a1];
result = *((_DWORD *)v1 + 257);
if ( result )
{
fputc(8, stdout);
fputc(32, stdout);
result = fputc(8, stdout);
--*((_DWORD *)v1 + 257);
}
return result;
}

original_code:
void xconsole_delete_current_char(int sd)
{
  if( xconsole_ti[sd].cmd_cursor == 0){
    return;
  }
  fputc(('H' - '@'), stdout);
  fputc(' ', stdout);
  fputc(('H' - '@'), stdout);
  xconsole_ti[sd].cmd_cursor--;
}


decompiled_code:
int xconsole_do_tab()
{
return puts("<TAB>");
}

canonical_decompiled_code:
int func8()
{
return puts("<TAB>");
}

original_code:
void xconsole_do_tab(int sd)
{
  printf("<TAB>\n");
}


decompiled_code:
__int64 __fastcall xconsole_do_enter(signed int a1)
{
__int64 v1; // rbx

write(a1, "\n", 1uLL);
v1 = 129LL * a1;
*((_BYTE *)&xconsole_ti[v1] + SHIDWORD(xconsole_ti[v1 + 128]) + 4) = 0;
putchar(10);
printf("Command was entered: %s\n", (const char *)&xconsole_ti[v1] + 4);
xconsole_do_command(a1, cmd_root, (const char *)&xconsole_ti[v1] + 4, 0);
return xconsole_clear_cmd_line_cur(a1);
}

canonical_decompiled_code:
__int64 __fastcall func9(signed int a1)
{
__int64 v1; // rbx

write(a1, "\n", 1uLL);
v1 = 129LL * a1;
*((_BYTE *)&xconsole_ti[v1] + SHIDWORD(xconsole_ti[v1 + 128]) + 4) = 0;
putchar(10);
printf("Command was entered: %s\n", (const char *)&xconsole_ti[v1] + 4);
func4(a1, cmd_root, (const char *)&xconsole_ti[v1] + 4, 0);
return func1(a1);
}

original_code:
void xconsole_do_enter(int sd)
{
  write(sd, "\n", 1);
  xconsole_ti[sd].cmd_buffer[xconsole_ti[sd].cmd_cursor] = 0x00;
  printf("\n");
  printf("Command was entered: %s\n", xconsole_ti[sd].cmd_buffer);
  xconsole_do_command(sd, cmd_root, xconsole_ti[sd].cmd_buffer, 0);
  xconsole_clear_cmd_line_cur(sd);
}


decompiled_code:
__int64 __fastcall xconsole_read(signed int a1, char a2)
{
__int64 result; // rax
__int64 *v3; // rdx
int v4; // eax
char buf[12]; // [rsp+Ch] [rbp-Ch] BYREF

buf[0] = a2;
if ( a2 <= 13 )
{
if ( a2 > 7 )
{
switch ( a2 )
{
case 8:
goto LABEL_6;
case 9:
goto LABEL_9;
case 10:
xconsole_do_enter(a1);
result = 0LL;
break;
case 11:
case 13:
return 0LL;
default:
goto LABEL_10;
}
return result;
}
LABEL_10:
v3 = &xconsole_ti[129 * a1];
v4 = *((_DWORD *)v3 + 257);
*((_BYTE *)v3 + v4 + 4) = a2;
*((_DWORD *)v3 + 257) = v4 + 1;
write(a1, buf, 1uLL);
return 0LL;
}
if ( a2 == 63 )
{
LABEL_9:
xconsole_do_tab();
return 0LL;
}
if ( a2 != 127 )
goto LABEL_10;
LABEL_6:
xconsole_delete_current_char(a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func10(signed int a1, char a2)
{
__int64 result; // rax
__int64 *v3; // rdx
int v4; // eax
char buf[12]; // [rsp+Ch] [rbp-Ch] BYREF

buf[0] = a2;
if ( a2 <= 13 )
{
if ( a2 > 7 )
{
switch ( a2 )
{
case 8:
goto LABEL_6;
case 9:
goto LABEL_9;
case 10:
func9(a1);
result = 0LL;
break;
case 11:
case 13:
return 0LL;
default:
goto LABEL_10;
}
return result;
}
LABEL_10:
v3 = &xconsole_ti[129 * a1];
v4 = *((_DWORD *)v3 + 257);
*((_BYTE *)v3 + v4 + 4) = a2;
*((_DWORD *)v3 + 257) = v4 + 1;
write(a1, buf, 1uLL);
return 0LL;
}
if ( a2 == 63 )
{
LABEL_9:
func8();
return 0LL;
}
if ( a2 != 127 )
goto LABEL_10;
LABEL_6:
func7(a1);
return 0LL;
}

original_code:
int xconsole_read(int in_sd, char ch)
{
  switch(ch)
    {
    case ('K' - '@'):
      break;
    case 0x7f:
    case 0x08:
      xconsole_delete_current_char(in_sd);
      break;
    case 0x09:
    case 0x3f:
      xconsole_do_tab(in_sd);
      break;
  case 0x0d:
   break;
    case 0x0a:
      xconsole_do_enter(in_sd);
      break;
    default:
      xconsole_ti[in_sd].cmd_buffer[xconsole_ti[in_sd].cmd_cursor] = ch;
      xconsole_ti[in_sd].cmd_cursor++;
      write(in_sd, &ch, 1);
      break;
    }
  return(0);
}

variable_types: ch char


decompiled_code:
size_t __fastcall mem_mgmt_lq_delete_ptr(__int64 a1, __int64 *a2)
{
__int64 v2; // r14
__int64 v3; // r15
__int64 v4; // r13
__int64 v5; // rbx
__int64 v6; // rsi

v2 = lq_get_prev(a1);
v3 = lq_get_next(a1);
v4 = lq_get_prev(a2);
v5 = lq_get_next(a2);
if ( (unsigned int)lq_cmp(a2, a1) )
return fwrite("ROOTNOOOOOOD\n", 1uLL, 0xDuLL, stderr);
lq_set_next(v4, v5);
if ( (unsigned int)lq_cmp(a2, v2) )
{
if ( (unsigned int)lq_cmp(a2, v3) )
v6 = 0LL;
else
v6 = v4;
}
else
{
lq_set_next(*a2, a2[1]);
a1 = a2[1];
v6 = *a2;
}
return lq_set_prev(a1, v6);
}

canonical_decompiled_code:
size_t __fastcall func1(__int64 a1, __int64 *a2)
{
__int64 v2; // r14
__int64 v3; // r15
__int64 v4; // r13
__int64 v5; // rbx
__int64 v6; // rsi

v2 = lq_get_prev(a1);
v3 = lq_get_next(a1);
v4 = lq_get_prev(a2);
v5 = lq_get_next(a2);
if ( (unsigned int)lq_cmp(a2, a1) )
return fwrite("ROOTNOOOOOOD\n", 1uLL, 0xDuLL, stderr);
lq_set_next(v4, v5);
if ( (unsigned int)lq_cmp(a2, v2) )
{
if ( (unsigned int)lq_cmp(a2, v3) )
v6 = 0LL;
else
v6 = v4;
}
else
{
lq_set_next(*a2, a2[1]);
a1 = a2[1];
v6 = *a2;
}
return lq_set_prev(a1, v6);
}

original_code:
void mem_mgmt_lq_delete_ptr(struct llist_queue *root, struct llist_queue *ptr)
{
  struct llist_queue *root_prev;
  struct llist_queue *root_next;
  struct llist_queue *ptr_prev;
  struct llist_queue *ptr_next;
  root_prev = lq_get_prev(root);
  root_next = lq_get_next(root);
  ptr_prev = lq_get_prev(ptr);
  ptr_next = lq_get_next(ptr);
  if(lq_cmp(ptr, root))
    {
      fprintf(stderr, "ROOTNOOOOOOD\n");
      return;
    }
  lq_set_next(ptr_prev, ptr_next);
  if(lq_cmp(ptr, root_prev))
    {
      if(lq_cmp(ptr, root_next))
 {
   lq_set_prev(root, 0);
 }
      else
 {
   lq_set_prev(root, ptr_prev);
 }
    }
  else
    {
      lq_set_next(ptr->prev, ptr->next);
      lq_set_prev(ptr->next, ptr->prev);
    }
}

variable_types: struct llist_queue { struct llist_queue *prev; struct llist_queue *next; void *data; int (*creat_func)(struct llist_queue *ptr); int (*set_func)(struct llist_queue *ptr, __builtin_va_list ap); int (*dump_func)(struct llist_queue *ptr); int (*destroy_func)(struct llist_queue *ptr); } *


decompiled_code:
void *xmem_mgmt()
{
_QWORD *v0; // rbx
void *result; // rax

v0 = calloc(0x38uLL, 1uLL);
mem_mgmt_root = (__int64)v0;
result = malloc(0x78uLL);
v0[2] = result;
return result;
}

canonical_decompiled_code:
void *func2()
{
_QWORD *v0; // rbx
void *result; // rax

v0 = calloc(0x38uLL, 1uLL);
mem_mgmt_root = (__int64)v0;
result = malloc(0x78uLL);
v0[2] = result;
return result;
}

original_code:
void xmem_mgmt(void)
{
  struct xmem_mgmt_data *mgmt_data;
  mem_mgmt_root = malloc(sizeof(struct llist_queue));
  memset(mem_mgmt_root, 0, sizeof(struct llist_queue));
  mgmt_data = malloc(sizeof(struct xmem_mgmt_data));
  mem_mgmt_root->data = mgmt_data;
}

canonical_original_code:
void xmem_mgmt()
{
  struct xmem_mgmt_data *mgmt_data;
  mem_mgmt_root = malloc(sizeof(struct llist_queue));
  memset(mem_mgmt_root, 0, sizeof(struct llist_queue));
  mgmt_data = malloc(sizeof(struct xmem_mgmt_data));
  mem_mgmt_root->data = mgmt_data;
}

variable_types: struct xmem_mgmt_data { unsigned long size; char purpose[32]; char filename[64]; void *addr; int line; } *


Xalloc

decompiled_code:
void *__fastcall Xalloc(size_t size, char *src, char *a3, unsigned int a4)
{
void *v6; // r12
char *v7; // rax
char *v8; // rbx

fprintf(stderr, "MEM_MGMT: malloc request[size %d] at %s(line:%d)\n", size, a3, a4);
v6 = malloc(size);
v7 = (char *)malloc(0x78uLL);
*(_QWORD *)v7 = size;
v8 = v7;
*((_DWORD *)v7 + 28) = a4;
*((_QWORD *)v7 + 13) = v6;
strncpy(v7 + 40, a3, 0x40uLL);
strncpy(v8 + 8, src, 0x20uLL);
*((_QWORD *)mem_mgmt_lq_add_last(mem_mgmt_root) + 2) = v8;
return v6;
}

canonical_decompiled_code:
void *__fastcall func3(size_t size, char *src, char *a3, unsigned int a4)
{
void *v6; // r12
char *v7; // rax
char *v8; // rbx

fprintf(stderr, "MEM_MGMT: malloc request[size %d] at %s(line:%d)\n", size, a3, a4);
v6 = malloc(size);
v7 = (char *)malloc(0x78uLL);
*(_QWORD *)v7 = size;
v8 = v7;
*((_DWORD *)v7 + 28) = a4;
*((_QWORD *)v7 + 13) = v6;
strncpy(v7 + 40, a3, 0x40uLL);
strncpy(v8 + 8, src, 0x20uLL);
*((_QWORD *)func0(mem_mgmt_root) + 2) = v8;
return v6;
}

original_code:
void *Xalloc(size_t size, const char *purpose, const char *filename, int line)
{
  struct xmem_mgmt_data *mgmt_data;
  struct llist_queue *new;
  void *addr;
  fprintf(stderr, "MEM_MGMT: malloc request[size %d] at %s(line:%d)\n", size, filename, line);
  addr = malloc(size);
  mgmt_data = malloc(sizeof(struct xmem_mgmt_data));
  mgmt_data->size = size;
  mgmt_data->line = line;
  mgmt_data->addr = addr;
  strncpy(mgmt_data->filename, filename, 64);
  strncpy(mgmt_data->purpose, purpose, 32);
  new = mem_mgmt_lq_add_last(mem_mgmt_root);
  new->data = mgmt_data;
  return(addr);
}

canonical_original_code:
void *Xalloc(unsigned long size, char *purpose, char *filename, int line)
{
  struct xmem_mgmt_data *mgmt_data;
  struct llist_queue *new;
  void *addr;
  fprintf(stderr, "MEM_MGMT: malloc request[size %d] at %s(line:%d)\n", size, filename, line);
  addr = malloc(size);
  mgmt_data = malloc(sizeof(struct xmem_mgmt_data));
  mgmt_data->size = size;
  mgmt_data->line = line;
  mgmt_data->addr = addr;
  strncpy(mgmt_data->filename, filename, 64);
  strncpy(mgmt_data->purpose, purpose, 32);
  new = mem_mgmt_lq_add_last(mem_mgmt_root);
  new->data = mgmt_data;
  return(addr);
}

variable_types:
size
unsigned long

variable_types:
purpose
char *

variable_types:
filename
char *

variable_types: line int

variable_types:
addr
void *

user_defined_types: struct xmem_mgmt_data { unsigned long size; char purpose[32]; char filename[64]; void *addr; int line; }


xfree

decompiled_code:
void __fastcall xfree(void *ptr)
{
__int64 v1; // rax
__int64 v2; // rbp

fflush(stdout);
fprintf(stderr, "MEM_MGMT: free request[%x]\n", (unsigned int)ptr);
v1 = lq_get_next(mem_mgmt_root);
if ( !v1 )
{
LABEL_6:
fwrite("CATION: cannot find memory\n", 1uLL, 0x1BuLL, stderr);
exit(1);
}
v2 = v1;
while ( *(void **)(lq_get_data(v2) + 104) != ptr )
{
v2 = lq_get_next(v2);
if ( !v2 )
goto LABEL_6;
}
free(*(void **)(v2 + 16));
mem_mgmt_lq_delete_ptr(mem_mgmt_root, (__int64 *)v2);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func4(void *ptr)
{
__int64 v1; // rax
__int64 v2; // rbp

fflush(stdout);
fprintf(stderr, "MEM_MGMT: free request[%x]\n", (unsigned int)ptr);
v1 = lq_get_next(mem_mgmt_root);
if ( !v1 )
{
LABEL_6:
fwrite("CATION: cannot find memory\n", 1uLL, 0x1BuLL, stderr);
exit(1);
}
v2 = v1;
while ( *(void **)(lq_get_data(v2) + 104) != ptr )
{
v2 = lq_get_next(v2);
if ( !v2 )
goto LABEL_6;
}
free(*(void **)(v2 + 16));
func1(mem_mgmt_root, (__int64 *)v2);
free(ptr);
}

original_code:
void xfree(void *ptr)
{
  fflush(stdout);
  struct llist_queue *lq_ptr;
  struct xmem_mgmt_data *mgmt_data;
  fprintf(stderr, "MEM_MGMT: free request[%x]\n", (int)ptr);
  lq_ptr = lq_get_next(mem_mgmt_root);
  for(;lq_ptr != 0; lq_ptr = lq_get_next(lq_ptr))
  {
    mgmt_data = (struct xmem_mgmt_data *)lq_get_data(lq_ptr);
    if(ptr == mgmt_data->addr)
    {
      free(lq_ptr->data);
      mem_mgmt_lq_delete_ptr(mem_mgmt_root, lq_ptr);
      free(ptr);
      return;
    }
  }
  fprintf(stderr, "CATION: cannot find memory\n");
  exit(1);
}

variable_types:
ptr
void *


xdump

decompiled_code:
size_t xdump()
{
__int64 v0; // rax
__int64 v1; // rbp
__int64 v2; // rax

fwrite("XMEM_MGMT_DUMP_BEGIN\n", 1uLL, 0x15uLL, stderr);
v0 = lq_get_next(mem_mgmt_root);
if ( v0 )
{
v1 = v0;
do
{
v2 = lq_get_data(v1);
printf(
"[%x(%d)] allocated %s by %s(line:%d)\n",
*(_QWORD *)(v2 + 104),
*(_QWORD *)v2,
(const char *)(v2 + 8),
(const char *)(v2 + 40),
*(unsigned int *)(v2 + 112));
v1 = lq_get_next(v1);
}
while ( v1 );
}
return fwrite("XMEM_MGMT_DUMP_END\n", 1uLL, 0x13uLL, stderr);
}

canonical_decompiled_code:
size_t func5()
{
__int64 v0; // rax
__int64 v1; // rbp
__int64 v2; // rax

fwrite("XMEM_MGMT_DUMP_BEGIN\n", 1uLL, 0x15uLL, stderr);
v0 = lq_get_next(mem_mgmt_root);
if ( v0 )
{
v1 = v0;
do
{
v2 = lq_get_data(v1);
printf(
"[%x(%d)] allocated %s by %s(line:%d)\n",
*(_QWORD *)(v2 + 104),
*(_QWORD *)v2,
(const char *)(v2 + 8),
(const char *)(v2 + 40),
*(unsigned int *)(v2 + 112));
v1 = lq_get_next(v1);
}
while ( v1 );
}
return fwrite("XMEM_MGMT_DUMP_END\n", 1uLL, 0x13uLL, stderr);
}

original_code:
void xdump()
{
  struct llist_queue *ptr;
  struct xmem_mgmt_data *mgmt_data;
  fprintf(stderr, "XMEM_MGMT_DUMP_BEGIN\n");
  ptr = lq_get_next(mem_mgmt_root);
  for(;ptr != 0; ptr = lq_get_next(ptr))
  {
    mgmt_data = (struct xmem_mgmt_data *)lq_get_data(ptr);
    printf("[%x(%d)] allocated %s by %s(line:%d)\n",
        (int)mgmt_data->addr,
        mgmt_data->size,
        mgmt_data->purpose,
        mgmt_data->filename,
        mgmt_data->line);
  }
  fprintf(stderr, "XMEM_MGMT_DUMP_END\n");
}


decompiled_code:
__int64 __fastcall lq_int_creat_func(__int64 a1)
{
pointer v1; // rax

v1 = Xalloc(4uLL);
lq_set_data(a1, v1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
pointer v1; // rax

v1 = Xalloc(4uLL);
lq_set_data(a1, v1);
return 0LL;
}

original_code:
int lq_int_creat_func(struct llist_queue *ptr)
{
  int *i;
  i = Xalloc(sizeof(int), "lq_int", "llist_queue_int.c", 15);
  lq_set_data(ptr, i);
  return 0;
}

variable_types:
i
int *


decompiled_code:
__int64 __fastcall lq_int_set_func(__int64 a1, unsigned int *a2)
{
unsigned int v2; // eax
int *v3; // rdx
int v4; // ebx

v2 = *a2;
if ( *a2 > 0x2F )
{
v3 = (int *)*((_QWORD *)a2 + 1);
*((_QWORD *)a2 + 1) = v3 + 2;
}
else
{
v3 = (int *)(*((_QWORD *)a2 + 2) + v2);
*a2 = v2 + 8;
}
v4 = *v3;
*(_DWORD *)lq_get_data() = v4;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, unsigned int *a2)
{
unsigned int v2; // eax
int *v3; // rdx
int v4; // ebx

v2 = *a2;
if ( *a2 > 0x2F )
{
v3 = (int *)*((_QWORD *)a2 + 1);
*((_QWORD *)a2 + 1) = v3 + 2;
}
else
{
v3 = (int *)(*((_QWORD *)a2 + 2) + v2);
*a2 = v2 + 8;
}
v4 = *v3;
*(_DWORD *)lq_get_data() = v4;
return 0LL;
}

original_code:
int lq_int_set_func(struct llist_queue *ptr, va_list ap)
{
  int i, *i_ptr;
  i = __builtin_va_arg(ap,int);
  i_ptr = lq_get_data(ptr);
  *i_ptr = i;
  return 0;
}

canonical_original_code:
int lq_int_set_func(struct llist_queue *ptr, __builtin_va_list ap)
{
  int i; int *i_ptr;
  i = __builtin_va_arg(ap,int);
  i_ptr = lq_get_data(ptr);
  *i_ptr = i;
  return 0;
}

variable_types: i int


decompiled_code:
__int64 lq_int_dump_func()
{
unsigned int *v0; // rax

v0 = (unsigned int *)lq_get_data();
printf("Int: %d\n", *v0);
return 0LL;
}

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

v0 = (unsigned int *)lq_get_data();
printf("Int: %d\n", *v0);
return 0LL;
}

original_code:
int lq_int_dump_func(struct llist_queue *ptr)
{
  int *i;
  i = lq_get_data(ptr);
  printf("Int: %d\n", *i);
  return 0;
}


decompiled_code:
__int64 lq_int_destroy_func()
{
__int64 v0; // rax

v0 = lq_get_data();
xfree(v0);
return 0LL;
}

canonical_decompiled_code:
__int64 func3()
{
__int64 v0; // rax

v0 = lq_get_data();
xfree(v0);
return 0LL;
}

original_code:
int lq_int_destroy_func(struct llist_queue *ptr)
{
  int *i;
  i = lq_get_data(ptr);
  xfree(i);
  return 0;
}


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

v2 = lq_add_last();
lq_do_set_func(v2, a2);
return 0LL;
}

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

v2 = lq_add_last();
lq_do_set_func(v2, a2);
return 0LL;
}

original_code:
int lq_int_add(struct llist_queue *ptr, int data)
{
  struct llist_queue *new;
  new = lq_add_last(ptr);
  lq_do_set_func(new, data);
  return 0;
}

variable_types: data int


decompiled_code:
__int64 __fastcall lq_int_find(__int64 a1, int a2)
{
while ( 1 )
{
if ( (unsigned int)lq_is_null(a1) )
return 0LL;
if ( *(_DWORD *)lq_get_data(a1) == a2 )
break;
a1 = lq_get_next(a1);
}
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, int a2)
{
while ( 1 )
{
if ( (unsigned int)lq_is_null(a1) )
return 0LL;
if ( *(_DWORD *)lq_get_data(a1) == a2 )
break;
a1 = lq_get_next(a1);
}
return a1;
}

original_code:
struct llist_queue *lq_int_find(struct llist_queue *root, int data)
{
 struct llist_queue *ptr;
  int *i;
 for(ptr = root ; !lq_is_null(ptr); ptr = lq_get_next(ptr) ){
    i = lq_get_data(ptr);
  if(*i == data){
   return ptr;
  }
 }
 return 0;
}

variable_types:
root
struct llist_queue *


decompiled_code:
__int64 __fastcall lq_int_count(__int64 a1, int a2)
{
unsigned int v2; // ebx
unsigned int v3; // er13
__int64 v4; // rbp

v2 = 0;
while ( 1 )
{
v3 = v2++;
v4 = lq_int_find(a1, a2);
if ( (unsigned int)lq_is_null(v4) )
break;
a1 = lq_get_next(v4);
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, int a2)
{
unsigned int v2; // ebx
unsigned int v3; // er13
__int64 v4; // rbp

v2 = 0;
while ( 1 )
{
v3 = v2++;
v4 = func5(a1, a2);
if ( (unsigned int)lq_is_null(v4) )
break;
a1 = lq_get_next(v4);
}
return v3;
}

original_code:
int lq_int_count(struct llist_queue *root, int data)
{
  struct llist_queue *ptr_next;
  struct llist_queue *ptr_next_next;
  ptr_next = lq_int_find(root, data);
  if(lq_is_null(ptr_next))
  {
    return(0);
  }
  ptr_next_next = lq_get_next(ptr_next);
  return(1 + lq_int_count(ptr_next_next, data));
}


decompiled_code:
__int64 __fastcall xconsole_cmd_creat_func(__int64 a1)
{
pointer v1; // rax

v1 = Xalloc(0x810uLL);
lq_set_data(a1, v1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
pointer v1; // rax

v1 = Xalloc(0x810uLL);
lq_set_data(a1, v1);
return 0LL;
}

original_code:
int xconsole_cmd_creat_func(struct llist_queue *ptr)
{
  struct command_set *cmd;
  cmd = Xalloc(sizeof(struct command_set), "commad_set", "backdoor_lq.c", 22);
  lq_set_data(ptr, cmd);
  return 0;
}

variable_types: struct command_set { char name[1024]; char desc[1024]; int (*cmd)(); struct llist_queue { struct llist_queue *prev; struct llist_queue *next; void *data; int (*creat_func)(struct llist_queue *ptr); int (*set_func)(struct llist_queue *ptr, __builtin_va_list ap); int (*dump_func)(struct llist_queue *ptr); int (*destroy_func)(struct llist_queue *ptr); } *next_arg; } *


decompiled_code:
__int64 __fastcall xconsole_cmd_dump_func(__int64 a1)
{
__int64 v1; // rax

v1 = lq_get_data(a1);
printf("[%s] func=%x nexrarg=%x\n", (const char *)v1, *(unsigned int *)(v1 + 2048), *(unsigned int *)(v1 + 2056));
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
__int64 v1; // rax

v1 = lq_get_data(a1);
printf("[%s] func=%x nexrarg=%x\n", (const char *)v1, *(unsigned int *)(v1 + 2048), *(unsigned int *)(v1 + 2056));
return 0LL;
}

original_code:
int xconsole_cmd_dump_func(struct llist_queue *ptr)
{
  struct command_set *cmd;
  cmd = lq_get_data(ptr);
  printf("[%s] func=%x nexrarg=%x\n",
  cmd->name,
  (int)cmd->cmd,
  (int)cmd->next_arg);
  return 0;
}


decompiled_code:
__int64 __fastcall xconsole_cmd_destroy_func(__int64 a1)
{
__int64 v1; // rax

v1 = lq_get_data(a1);
xfree(v1);
return 0LL;
}

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

v1 = lq_get_data(a1);
xfree(v1);
return 0LL;
}

original_code:
int xconsole_cmd_destroy_func(struct llist_queue *ptr)
{
  int *cmd;
  cmd = lq_get_data(ptr);
  xfree(cmd);
  return 0;
}

variable_types:
cmd
int *


decompiled_code:
__int64 __fastcall xconsole_cmd_add(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, char a7)
{
__int64 v7; // rax
_BYTE v9[2064]; // [rsp-810h] [rbp-818h] BYREF

v7 = lq_add_last();
qmemcpy(v9, &a7, sizeof(v9));
lq_do_set_func(v7);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, char a7)
{
__int64 v7; // rax
_BYTE v9[2064]; // [rsp-810h] [rbp-818h] BYREF

v7 = lq_add_last();
qmemcpy(v9, &a7, sizeof(v9));
lq_do_set_func(v7);
return 0LL;
}

original_code:
int xconsole_cmd_add(struct llist_queue *ptr, struct command_set data)
{
  struct llist_queue *new;
  new = lq_add_last(ptr);
  lq_do_set_func(new, data);
  return 0;
}

variable_types: struct command_set { char name[1024]; char desc[1024]; int (*cmd)(); struct llist_queue *next_arg; }


decompiled_code:
__int64 console_create_cmd_root()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func5()
{
return 0LL;
}

original_code:
struct llist_queue *console_create_cmd_root(void)
{
  return(0);
}

canonical_original_code:
struct llist_queue *console_create_cmd_root()
{
  return(0);
}


decompiled_code:
__int64 __fastcall xconsole_cmd_find(__int64 a1, const char *a2)
{
const char *v3; // r12
size_t v4; // rax

while ( 1 )
{
if ( (unsigned int)lq_is_null(a1) )
return 0LL;
v3 = (const char *)lq_get_data(a1);
v4 = strlen(a2);
if ( !strncmp(v3, a2, v4) )
break;
a1 = lq_get_next(a1);
}
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, const char *a2)
{
const char *v3; // r12
size_t v4; // rax

while ( 1 )
{
if ( (unsigned int)lq_is_null(a1) )
return 0LL;
v3 = (const char *)lq_get_data(a1);
v4 = strlen(a2);
if ( !strncmp(v3, a2, v4) )
break;
a1 = lq_get_next(a1);
}
return a1;
}

original_code:
struct llist_queue *xconsole_cmd_find(struct llist_queue *root, char *data)
{
  struct llist_queue *ptr;
  struct command_set *cmd_ptr;
  for(ptr = root ; !lq_is_null(ptr); ptr = lq_get_next(ptr) )
    {
      cmd_ptr = lq_get_data(ptr);
      if( strncmp(cmd_ptr->name, data, strlen(data)) == 0){
 return ptr;
      }
    }
  return 0;
}

variable_types:
data
char *


decompiled_code:
__int64 __fastcall xconsole_cmd_find_with_level(__int64 a1, const char *a2, unsigned int a3)
{
const char *v5; // rbp
size_t v6; // rax
__int64 v7; // rax
const char *v8; // rbp
size_t v9; // rax
char v11[1064]; // [rsp+0h] [rbp-428h] BYREF

while ( 1 )
{
if ( (unsigned int)lq_is_null(a1) )
return 0LL;
v5 = (const char *)lq_get_data(a1);
v6 = strlen(v5);
strncpy(v11, v5, v6);
v7 = xconsole_get_cmd_name_by_level(v5, a3);
v8 = (const char *)v7;
if ( !v7 )
return 0LL;
*(_BYTE *)xconsole_parse_command(v7) = 0;
printf("CMP[%s][%s]\n", a2, v8);
v9 = strlen(a2);
if ( !strncmp(v8, a2, v9) )
break;
a1 = lq_get_next(a1);
}
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, const char *a2, unsigned int a3)
{
const char *v5; // rbp
size_t v6; // rax
__int64 v7; // rax
const char *v8; // rbp
size_t v9; // rax
char v11[1064]; // [rsp+0h] [rbp-428h] BYREF

while ( 1 )
{
if ( (unsigned int)lq_is_null(a1) )
return 0LL;
v5 = (const char *)lq_get_data(a1);
v6 = strlen(v5);
strncpy(v11, v5, v6);
v7 = xconsole_get_cmd_name_by_level(v5, a3);
v8 = (const char *)v7;
if ( !v7 )
return 0LL;
*(_BYTE *)xconsole_parse_command(v7) = 0;
printf("CMP[%s][%s]\n", a2, v8);
v9 = strlen(a2);
if ( !strncmp(v8, a2, v9) )
break;
a1 = lq_get_next(a1);
}
return a1;
}

original_code:
struct llist_queue *xconsole_cmd_find_with_level(struct llist_queue *root, char *data, int level)
{
  struct llist_queue *ptr;
  struct command_set *cmd_ptr;
  char ptr_name[1024];
  char *ptr_cmd_ptr;
  char *cp;
  for(ptr = root ; !lq_is_null(ptr); ptr = lq_get_next(ptr) )
    {
      cmd_ptr = lq_get_data(ptr);
      strncpy(ptr_name, cmd_ptr->name, strlen(cmd_ptr->name));
      if( (ptr_cmd_ptr = xconsole_get_cmd_name_by_level(cmd_ptr->name, level) ) == 0)
 {
   return(0);
 }
      cp = xconsole_parse_command(ptr_cmd_ptr);
      *cp = 0x00;
      printf("CMP[%s][%s]\n", data,ptr_cmd_ptr);
      if(strncmp(ptr_cmd_ptr, data, strlen(data)) == 0 ){
 return ptr;
      }
    }
  return 0;
}

variable_types: level int

variable_types:
cp
char *


decompiled_code:
__int64 __fastcall xconsole_cmd_count(__int64 a1, const char *a2)
{
unsigned int v2; // ebx
unsigned int v3; // er13
__int64 v4; // rbp

v2 = 0;
while ( 1 )
{
v3 = v2++;
v4 = xconsole_cmd_find(a1, a2);
if ( (unsigned int)lq_is_null(v4) )
break;
a1 = lq_get_next(v4);
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, const char *a2)
{
unsigned int v2; // ebx
unsigned int v3; // er13
__int64 v4; // rbp

v2 = 0;
while ( 1 )
{
v3 = v2++;
v4 = func6(a1, a2);
if ( (unsigned int)lq_is_null(v4) )
break;
a1 = lq_get_next(v4);
}
return v3;
}

original_code:
int xconsole_cmd_count(struct llist_queue *root, char *data)
{
  struct llist_queue *ptr_next;
  struct llist_queue *ptr_next_next;
  ptr_next = xconsole_cmd_find(root, data);
  if(lq_is_null(ptr_next))
    {
      return(0);
    }
  ptr_next_next = lq_get_next(ptr_next);
  return(1 + xconsole_cmd_count(ptr_next_next, data));
}

variable_types: struct llist_queue { struct llist_queue *prev; struct llist_queue *next; void *data; int (*creat_func)(struct llist_queue *ptr); int (*set_func)(struct llist_queue *ptr, __builtin_va_list ap); int (*dump_func)(struct llist_queue *ptr); int (*destroy_func)(struct llist_queue *ptr); } *


decompiled_code:
__int64 c_func()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 0LL;
}

original_code:
int c_func( void )
{
 return 0;
}

canonical_original_code:
int c_func()
{
 return 0;
}


decompiled_code:
__int64 b_func()
{
return 0LL;
}

original_code:
int b_func( void )
{
 return 0;
}

canonical_original_code:
int b_func()
{
 return 0;
}


decompiled_code:
__int64 a_func()
{
return 0LL;
}

original_code:
int a_func( void )
{
 return 0;
}

canonical_original_code:
int a_func()
{
 return 0;
}


length

repo: redbluff/stan-lists

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

for ( result = 0LL; a1; result = (unsigned int)(result + 1) )
a1 = *(_QWORD *)(a1 + 8);
return result;
}

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

for ( result = 0LL; a1; result = (unsigned int)(result + 1) )
a1 = *(_QWORD *)(a1 + 8);
return result;
}

original_code:
int length(struct node* head) {
    int numNodes = 0;
    struct node* current = head;
    while(current != ((void *)0)) {
        numNodes++;
        current = current->next;
    }
    return numNodes;
}

canonical_original_code:
int length(struct node *head) {
    int numNodes = 0;
    struct node *current = head;
    while(current != ((void *)0)) {
        numNodes++;
        current = current->next;
    }
    return numNodes;
}

variable_types: struct node { int data; struct node *next; } *

variable_types: numNodes int


BuildOneTwoThree

decompiled_code:
__int64 BuildOneTwoThree()
{
int v0; // ebx
__int64 result; // rax
__int64 v2; // [rsp+8h] [rbp-10h] BYREF

v0 = 3;
v2 = 0LL;
do
{
push(&v2, v0);
result = v2;
if ( !v2 )
_assert_fail("head != NULL", "lists.c", 0x43u, "BuildOneTwoThree");
--v0;
}
while ( v0 );
return result;
}

canonical_decompiled_code:
__int64 func1()
{
int v0; // ebx
__int64 result; // rax
__int64 v2; // [rsp+8h] [rbp-10h] BYREF

v0 = 3;
v2 = 0LL;
do
{
push(&v2, v0);
result = v2;
if ( !v2 )
_assert_fail("head != NULL", "lists.c", 0x43u, "BuildOneTwoThree");
--v0;
}
while ( v0 );
return result;
}

original_code:
struct node* BuildOneTwoThree() {
    struct node* head = ((void *)0);
    for (int i = 3; i > 0; i--) {
        push(&head, i);
        ((head != ((void *)0)) ? (void) (0) : __assert_fail ("head != NULL", "lists.c", 67, __extension__ __PRETTY_FUNCTION__));
    }
    return head;
}

canonical_original_code:
struct node *BuildOneTwoThree() {
    struct node *head = ((void *)0);
    for (int i = 3; i > 0; i--) {
        push(&head, i);
        ((head != ((void *)0)) ? (void) (0) : __assert_fail ("head != NULL", "lists.c", 67, __extension__ __PRETTY_FUNCTION__));
    }
    return head;
}

return_type: struct node { int data; struct node *next; } *


print

decompiled_code:
int __fastcall print(__int64 a1)
{
unsigned int *v1; // rbx
int result; // eax

v1 = (unsigned int *)a1;
if ( (unsigned int)length(a1) )
{
if ( a1 )
{
do
{
printf("%d ", *v1);
v1 = (unsigned int *)*((_QWORD *)v1 + 1);
}
while ( v1 );
}
result = putchar(10);
}
else
{
printf("List is empty!");
result = putchar(10);
}
return result;
}

canonical_decompiled_code:
int __fastcall func2(__int64 a1)
{
unsigned int *v1; // rbx
int result; // eax

v1 = (unsigned int *)a1;
if ( (unsigned int)func0(a1) )
{
if ( a1 )
{
do
{
printf("%d ", *v1);
v1 = (unsigned int *)*((_QWORD *)v1 + 1);
}
while ( v1 );
}
result = putchar(10);
}
else
{
printf("List is empty!");
result = putchar(10);
}
return result;
}

original_code:
void print(struct node* head) {
    struct node* current = head;
    if (length(current)) {
        while (current != ((void *)0)) {
            printf("%d ", current->data);
            current = current->next;
        }
    } else {
        printf("List is empty!");
    }
    printf("\n");
}

canonical_original_code:
void print(struct node *head) {
    struct node *current = head;
    if (length(current)) {
        while (current != ((void *)0)) {
            printf("%d ", current->data);
            current = current->next;
        }
    } else {
        printf("List is empty!");
    }
    printf("\n");
}

user_defined_types: struct node { int data; struct node *next; }


Count

decompiled_code:
__int64 __fastcall Count(__int64 a1, int a2)
{
__int64 result; // rax
bool v3; // zf

for ( result = 0LL; a1; result = v3 + (unsigned int)result )
{
v3 = *(_DWORD *)a1 == a2;
a1 = *(_QWORD *)(a1 + 8);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, int a2)
{
__int64 result; // rax
bool v3; // zf

for ( result = 0LL; a1; result = v3 + (unsigned int)result )
{
v3 = *(_DWORD *)a1 == a2;
a1 = *(_QWORD *)(a1 + 8);
}
return result;
}

original_code:
int Count(struct node* head, int searchFor) {
    int itemCount = 0;
    struct node* current = head;
    while (current != ((void *)0)) {
        if (searchFor == current->data) {
            itemCount++;
        }
        current = current->next;
    }
    return itemCount;
}

canonical_original_code:
int Count(struct node *head, int searchFor) {
    int itemCount = 0;
    struct node *current = head;
    while (current != ((void *)0)) {
        if (searchFor == current->data) {
            itemCount++;
        }
        current = current->next;
    }
    return itemCount;
}

variable_types: searchFor int

variable_types: itemCount int


GetNth

decompiled_code:
__int64 __fastcall GetNth(__int64 a1, int a2)
{
int v2; // eax
unsigned int *v3; // rdx
int v4; // eax
__int64 result; // rax

v2 = length(a1);
if ( v2 && v2 > a2 )
{
v4 = 0;
if ( a2 > 0 )
{
do
{
++v4;
v3 = (unsigned int *)*((_QWORD *)v3 + 1);
}
while ( a2 != v4 );
}
result = *v3;
}
else
{
printf("Index is invalid, length of list %d, index %d\n", (unsigned int)v2, (unsigned int)a2);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, int a2)
{
int v2; // eax
unsigned int *v3; // rdx
int v4; // eax
__int64 result; // rax

v2 = func0(a1);
if ( v2 && v2 > a2 )
{
v4 = 0;
if ( a2 > 0 )
{
do
{
++v4;
v3 = (unsigned int *)*((_QWORD *)v3 + 1);
}
while ( a2 != v4 );
}
result = *v3;
}
else
{
printf("Index is invalid, length of list %d, index %d\n", (unsigned int)v2, (unsigned int)a2);
result = 0LL;
}
return result;
}

original_code:
int GetNth(struct node* head, int index) {
    int len = length(head);
    if (!len || len <= index) {
        printf("Index is invalid, length of list %d, index %d\n",len, index);
        return 0;
    }
    struct node* current = head;
    for (int i = 0; i < index; i++) {
        current = current->next;
    }
    return current->data;
}

canonical_original_code:
int GetNth(struct node *head, int index) {
    int len = length(head);
    if (!len || len <= index) {
        printf("Index is invalid, length of list %d, index %d\n",len, index);
        return 0;
    }
    struct node *current = head;
    for (int i = 0; i < index; i++) {
        current = current->next;
    }
    return current->data;
}

variable_types: index int

variable_types: len int


Pop

decompiled_code:
__int64 __fastcall Pop(void **a1)
{
int *v1; // r8
unsigned int v2; // er12

v1 = (int *)*a1;
if ( !*a1 )
_assert_fail("current != NULL", "lists.c", 0xA2u, "Pop");
v2 = *v1;
*a1 = (void *)*((_QWORD *)v1 + 1);
free(v1);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func6(void **a1)
{
int *v1; // r8
unsigned int v2; // er12

v1 = (int *)*a1;
if ( !*a1 )
_assert_fail("current != NULL", "lists.c", 0xA2u, "Pop");
v2 = *v1;
*a1 = (void *)*((_QWORD *)v1 + 1);
free(v1);
return v2;
}

original_code:
int Pop(struct node** headRef) {
    struct node* current = *headRef;
    ((current != ((void *)0)) ? (void) (0) : __assert_fail ("current != NULL", "lists.c", 162, __extension__ __PRETTY_FUNCTION__));
    int retval = current->data;
    *headRef = current->next;
    free(current);
    return retval;
}

canonical_original_code:
int Pop(struct node **headRef) {
    struct node *current = *headRef;
    ((current != ((void *)0)) ? (void) (0) : __assert_fail ("current != NULL", "lists.c", 162, __extension__ __PRETTY_FUNCTION__));
    int retval = current->data;
    *headRef = current->next;
    free(current);
    return retval;
}

variable_types: struct node { int data; struct node *next; } **

variable_types: retval int


InsertNth

decompiled_code:
int __fastcall InsertNth(__int64 *a1, int a2)
{
__int64 v2; // rbx
int v3; // eax
__int64 v4; // rdx
__int64 *v5; // r8
int v6; // er9
int v7; // eax
int result; // eax
__int64 v9; // [rsp+8h] [rbp-10h] BYREF

v3 = length(*a1);
if ( v3 < a2 )
return printf("Index is too large for list, list size %d, index %d.\n", (unsigned int)v3, (unsigned int)a2);
v9 = v4;
if ( !a2 )
return (unsigned int)push(v5, v6);
v7 = 0;
if ( a2 > 0 )
{
do
{
++v7;
v2 = v4;
v4 = *(_QWORD *)(v4 + 8);
}
while ( a2 != v7 );
v9 = v4;
}
push(&v9, v6);
result = v9;
*(_QWORD *)(v2 + 8) = v9;
return result;
}

canonical_decompiled_code:
int __fastcall func7(__int64 *a1, int a2)
{
__int64 v2; // rbx
int v3; // eax
__int64 v4; // rdx
__int64 *v5; // r8
int v6; // er9
int v7; // eax
int result; // eax
__int64 v9; // [rsp+8h] [rbp-10h] BYREF

v3 = func0(*a1);
if ( v3 < a2 )
return printf("Index is too large for list, list size %d, index %d.\n", (unsigned int)v3, (unsigned int)a2);
v9 = v4;
if ( !a2 )
return (unsigned int)push(v5, v6);
v7 = 0;
if ( a2 > 0 )
{
do
{
++v7;
v2 = v4;
v4 = *(_QWORD *)(v4 + 8);
}
while ( a2 != v7 );
v9 = v4;
}
push(&v9, v6);
result = v9;
*(_QWORD *)(v2 + 8) = v9;
return result;
}

original_code:
void InsertNth(struct node** headRef, int index, int data) {
    int len = length(*headRef);
    if (index > len) {
        printf("Index is too large for list, list size %d, index %d.\n", len, index);
        return;
    }
    struct node* current = *headRef;
    if (!index) {
        push(headRef, data);
    } else {
        struct node* prev;
        for (int i = 0; i < index; i++) {
            prev = current;
            current = current->next;
        }
        push(&current, data);
        prev->next = current;
    }
}

canonical_original_code:
void InsertNth(struct node **headRef, int index, int data) {
    int len = length(*headRef);
    if (index > len) {
        printf("Index is too large for list, list size %d, index %d.\n", len, index);
        return;
    }
    struct node *current = *headRef;
    if (!index) {
        push(headRef, data);
    } else {
        struct node *prev;
        for (int i = 0; i < index; i++) {
            prev = current;
            current = current->next;
        }
        push(&current, data);
        prev->next = current;
    }
}

variable_types: data int

variable_types: i int


SortedInsert

decompiled_code:
__int64 __fastcall SortedInsert(__int64 *a1, int *a2)
{
__int64 result; // rax
int v5; // esi
__int64 v6; // rcx

result = *a1;
if ( *a1 )
{
v5 = *a2;
v6 = 0LL;
while ( *(_DWORD *)result < v5 )
{
v6 = result;
if ( !*(_QWORD *)(result + 8) )
{
*(_QWORD *)(result + 8) = a2;
result = 0LL;
LABEL_7:
*((_QWORD *)a2 + 1) = result;
return result;
}
result = *(_QWORD *)(result + 8);
}
if ( v6 )
{
*(_QWORD *)(v6 + 8) = a2;
goto LABEL_7;
}
}
*a1 = (__int64)a2;
*((_QWORD *)a2 + 1) = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 *a1, int *a2)
{
__int64 result; // rax
int v5; // esi
__int64 v6; // rcx

result = *a1;
if ( *a1 )
{
v5 = *a2;
v6 = 0LL;
while ( *(_DWORD *)result < v5 )
{
v6 = result;
if ( !*(_QWORD *)(result + 8) )
{
*(_QWORD *)(result + 8) = a2;
result = 0LL;
LABEL_7:
*((_QWORD *)a2 + 1) = result;
return result;
}
result = *(_QWORD *)(result + 8);
}
if ( v6 )
{
*(_QWORD *)(v6 + 8) = a2;
goto LABEL_7;
}
}
*a1 = (__int64)a2;
*((_QWORD *)a2 + 1) = result;
return result;
}

original_code:
void SortedInsert(struct node** headRef, struct node* newNode) {
    struct node* current = *headRef;
    struct node* prev = ((void *)0);
    int data = newNode->data;
    if (current) {
        while(current && current->data < data) {
            prev = current;
            current = current->next;
        }
    }
    if (!prev) {
        *headRef = newNode;
    } else {
        prev->next = newNode;
    }
    newNode->next = current;
}

canonical_original_code:
void SortedInsert(struct node **headRef, struct node *newNode) {
    struct node *current = *headRef;
    struct node *prev = ((void *)0);
    int data = newNode->data;
    if (current) {
        while(current && current->data < data) {
            prev = current;
            current = current->next;
        }
    }
    if (!prev) {
        *headRef = newNode;
    } else {
        prev->next = newNode;
    }
    newNode->next = current;
}

variable_types:
newNode
struct node *


InsertSort

decompiled_code:
__int64 __fastcall InsertSort(__int64 *a1)
{
__int64 v1; // rsi
__int64 result; // rax
__int64 v4; // [rsp+0h] [rbp-8h] BYREF

if ( a1 )
{
v1 = *a1;
v4 = 0LL;
if ( v1 )
{
do
{
*a1 = *(_QWORD *)(v1 + 8);
*(_QWORD *)(v1 + 8) = 0LL;
result = SortedInsert(&v4, (int *)v1);
v1 = *a1;
}
while ( *a1 );
v1 = v4;
}
*a1 = v1;
}
return result;
}

original_code:
void InsertSort(struct node** headRef) {
    if (!headRef) {
        return;
    }
    struct node* sortedList = ((void *)0);
    struct node* current = *headRef;
    while(current) {
        *headRef = current->next;
        current->next = ((void *)0);
        SortedInsert(&sortedList, current);
        current = *headRef;
    }
    *headRef = sortedList;
}

canonical_original_code:
void InsertSort(struct node **headRef) {
    if (!headRef) {
        return;
    }
    struct node *sortedList = ((void *)0);
    struct node *current = *headRef;
    while(current) {
        *headRef = current->next;
        current->next = ((void *)0);
        SortedInsert(&sortedList, current);
        current = *headRef;
    }
    *headRef = sortedList;
}


RemoveDuplicates

decompiled_code:
void __fastcall RemoveDuplicates(_QWORD *a1)
{
_QWORD *v1; // rbx
_QWORD *v2; // rdi

if ( a1 )
{
v1 = a1;
v2 = (_QWORD *)a1[1];
while ( v2 )
{
if ( *(_DWORD *)v1 == *(_DWORD *)v2 )
{
v1[1] = v2[1];
free(v2);
v2 = (_QWORD *)v1[1];
}
else
{
v1 = v2;
v2 = (_QWORD *)v2[1];
}
}
}
}

original_code:
void RemoveDuplicates(struct node* head) {
    if (!(head && head->next)) {
        return;
    }
    struct node* current = head;
    struct node* delNode = ((void *)0);
    while(current->next) {
        if (current->data == current->next->data) {
            delNode = current->next;
            current->next = delNode->next;
            free(delNode);
        } else {
            current = current->next;
        }
    }
}

canonical_original_code:
void RemoveDuplicates(struct node *head) {
    if (!(head && head->next)) {
        return;
    }
    struct node *current = head;
    struct node *delNode = ((void *)0);
    while(current->next) {
        if (current->data == current->next->data) {
            delNode = current->next;
            current->next = delNode->next;
            free(delNode);
        } else {
            current = current->next;
        }
    }
}


AlternatingSplit

decompiled_code:
__int64 __fastcall AlternatingSplit(__int64 a1, _QWORD *a2, _QWORD *a3)
{
__int64 result; // rax
_QWORD *v5; // r8
__int64 v6; // [rsp+0h] [rbp-8h] BYREF

*a2 = 0LL;
v6 = a1;
for ( *a3 = 0LL; v6; result = MoveNode(v5, &v6) )
{
result = MoveNode(a2, &v6);
if ( !v6 )
break;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, _QWORD *a2, _QWORD *a3)
{
__int64 result; // rax
_QWORD *v5; // r8
__int64 v6; // [rsp+0h] [rbp-8h] BYREF

*a2 = 0LL;
v6 = a1;
for ( *a3 = 0LL; v6; result = func13(v5, &v6) )
{
result = func13(a2, &v6);
if ( !v6 )
break;
}
return result;
}

original_code:
void AlternatingSplit(struct node* source, struct node** aRef, struct node** bRef) {
    *aRef = ((void *)0);
    *bRef = ((void *)0);
    if (!source) {
        return;
    }
    while(source) {
        MoveNode(aRef, &source);
        if (source) {
            MoveNode(bRef, &source);
        }
    }
}

canonical_original_code:
void AlternatingSplit(struct node *source, struct node **aRef, struct node **bRef) {
    *aRef = ((void *)0);
    *bRef = ((void *)0);
    if (!source) {
        return;
    }
    while(source) {
        MoveNode(aRef, &source);
        if (source) {
            MoveNode(bRef, &source);
        }
    }
}

variable_types:
aRef
struct node **

variable_types:
bRef
struct node **


ShuffleMerge

original_code:
struct node* ShuffleMerge(struct node* a, struct node* b) {
    struct node dummy;
    struct node* tail = &dummy;
    dummy.next = ((void *)0);
    int aDone = 0;
    int bDone = 0;
    if (!a) {
        aDone = 1;
    }
    if (!b) {
        bDone = 1;
    }
    while (!(aDone && bDone)) {
        if (!aDone) {
            MoveNode(&(tail->next), &a);
            tail = tail->next;
            if (!a) {
                aDone = 1;
            }
        }
        if (!bDone) {
            MoveNode(&(tail->next), &b);
            tail = tail->next;
            if (!b) {
                bDone = 1;
            }
        }
    }
    return dummy.next;
}

canonical_original_code:
struct node *ShuffleMerge(struct node *a, struct node *b) {
    struct node dummy;
    struct node *tail = &dummy;
    dummy.next = ((void *)0);
    int aDone = 0;
    int bDone = 0;
    if (!a) {
        aDone = 1;
    }
    if (!b) {
        bDone = 1;
    }
    while (!(aDone && bDone)) {
        if (!aDone) {
            MoveNode(&(tail->next), &a);
            tail = tail->next;
            if (!a) {
                aDone = 1;
            }
        }
        if (!bDone) {
            MoveNode(&(tail->next), &b);
            tail = tail->next;
            if (!b) {
                bDone = 1;
            }
        }
    }
    return dummy.next;
}

variable_types:
a
struct node *

variable_types:
b
struct node *

variable_types: struct node { int data; struct node *next; }

variable_types: aDone int

variable_types: bDone int


repo: redhog/Dirt

decompiled_code:
int __fastcall ReaderTest_free(__int64 a1, const void *a2)
{
int v2; // ebx

v2 = level - 1;
level = v2;
if ( v2 > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
return printf("free: %p\n", a2);
}

canonical_decompiled_code:
int __fastcall func0(__int64 a1, const void *a2)
{
int v2; // ebx

v2 = level - 1;
level = v2;
if ( v2 > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
return printf("free: %p\n", a2);
}

original_code: void ReaderTest_free(Dirt_Reader *reader, void *item) { level--; do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("free: %p\n", item); }

canonical_original_code: void ReaderTest_free(struct Dirt_ReaderT *reader, void *item) { level--; do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("free: %p\n", item); }

variable_types: struct Dirt_ReaderT { struct Dirt_ReaderType { long (*readStr_readUnicodeescape)(struct Dirt_ReaderT *reader, long *pos, char *dst); long (*readStr_read)(struct Dirt_ReaderT *reader, char *start, char startlen, char *dst); void *(*readStr)(struct Dirt_ReaderT *reader, char unicode); void *(*readNum)(struct Dirt_ReaderT *reader); long (*readIdentifier_read)(struct Dirt_ReaderT *reader, char *dst); void *(*readIdentifier)(struct Dirt_ReaderT *reader); void *(*readIdentifiers)(struct Dirt_ReaderT *reader); void *(*readUnicodeOrId)(struct Dirt_ReaderT *reader); void *(*read)(struct Dirt_ReaderT *reader, char inParens); } *type; struct Dirt_Reader_Callbacks { void (*free)(struct Dirt_ReaderT *reader, void *item); void *(*str)(struct Dirt_ReaderT *reader, char *str, unsigned long len); void *(*unicodeStr)(struct Dirt_ReaderT *reader, char *str, unsigned long len); void *(*identifier)(struct Dirt_ReaderT *reader, char *identifier, unsigned long len); void *(*num_float)(struct Dirt_ReaderT *reader, float real); void *(*num_int)(struct Dirt_ReaderT *reader, int integer); void *(*num_long)(struct Dirt_ReaderT *reader, long integer); void *(*none)(struct Dirt_ReaderT *reader); void *(*false)(struct Dirt_ReaderT *reader); void *(*true)(struct Dirt_ReaderT *reader); void *(*structure)(struct Dirt_ReaderT *reader); void *(*structure_add)(struct Dirt_ReaderT *reader, void *structure, void *item); void *(*structure_finalize_tuple)(struct Dirt_ReaderT *reader, void *structure); void *(*structure_finalize_list)(struct Dirt_ReaderT *reader, void *structure); void *(*structure_finalize_dictionary)(struct Dirt_ReaderT *reader, void *structure); void *(*structure_finalize_type)(struct Dirt_ReaderT *reader, void *structure); void *(*keyvalue)(struct Dirt_ReaderT *reader, void *key, void *value); void *(*parameter)(struct Dirt_ReaderT *reader, void *name, void *value); void *(*member)(struct Dirt_ReaderT *reader, void *name, void *value); void *(*application)(struct Dirt_ReaderT *reader, void *function, void *parameters); } *callback; struct Dirt_BufferT { struct Dirt_BufferTypeT { struct Dirt_SessionT { struct Dirt_SessionTypeT { void (*error)(struct Dirt_SessionT *session, char *class, char *error); unsigned long (*unicodeLookupName)(struct Dirt_SessionT *session, char *name, char *dst); unsigned long (*unicodeLookupOrdinal)(struct Dirt_SessionT *session, int ordinal, char *dst); } *type; } *session; void (*free)(struct Dirt_BufferT *buffer); char (*advance)(struct Dirt_BufferT *buffer, unsigned long nr); char (*cut)(struct Dirt_BufferT *buffer, char *dst, unsigned long nr); char (*contains)(struct Dirt_BufferT *buffer, char *buf, unsigned long len, unsigned long at); long (*read)(struct Dirt_BufferT *buffer, unsigned long nr); char (*extend)(struct Dirt_BufferT *buffer, unsigned long nr); } *type; struct Dirt_SessionT *session; char *buf; long pos; unsigned long len; unsigned long size; unsigned long maxsize; } *buffer; } *

variable_types:
item
void *

user_defined_types: struct Dirt_ReaderT { struct Dirt_ReaderType *type; struct Dirt_Reader_Callbacks *callback; struct Dirt_BufferT *buffer; }

user_defined_types: struct Dirt_BufferT { struct Dirt_BufferTypeT *type; struct Dirt_SessionT *session; char *buf; long pos; unsigned long len; unsigned long size; unsigned long maxsize; }

user_defined_types: struct Dirt_BufferTypeT { struct Dirt_SessionT *session; void (*free)(struct Dirt_BufferT *buffer); char (*advance)(struct Dirt_BufferT *buffer, unsigned long nr); char (*cut)(struct Dirt_BufferT *buffer, char *dst, unsigned long nr); char (*contains)(struct Dirt_BufferT *buffer, char *buf, unsigned long len, unsigned long at); long (*read)(struct Dirt_BufferT *buffer, unsigned long nr); char (*extend)(struct Dirt_BufferT *buffer, unsigned long nr); }

user_defined_types: struct Dirt_SessionT { struct Dirt_SessionTypeT *type; }


decompiled_code:
__int64 __fastcall ReaderTest_str(__int64 a1, const char *a2)
{
int v2; // ebx

v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("str: '%s'\n", a2);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, const char *a2)
{
int v2; // ebx

v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("str: '%s'\n", a2);
return 1LL;
}

original_code: void *ReaderTest_str(Dirt_Reader *reader, char *str, size_t len) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("str: '%s'\n", str); return (void*)1; }

canonical_original_code: void *ReaderTest_str(struct Dirt_ReaderT *reader, char *str, unsigned long len) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("str: '%s'\n", str); return (void *)1; }

variable_types:
str
char *

variable_types:
len
unsigned long

user_defined_types: struct Dirt_ReaderType { long (*readStr_readUnicodeescape)(struct Dirt_ReaderT *reader, long *pos, char *dst); long (*readStr_read)(struct Dirt_ReaderT *reader, char *start, char startlen, char *dst); void *(*readStr)(struct Dirt_ReaderT *reader, char unicode); void *(*readNum)(struct Dirt_ReaderT *reader); long (*readIdentifier_read)(struct Dirt_ReaderT *reader, char *dst); void *(*readIdentifier)(struct Dirt_ReaderT *reader); void *(*readIdentifiers)(struct Dirt_ReaderT *reader); void *(*readUnicodeOrId)(struct Dirt_ReaderT *reader); void *(*read)(struct Dirt_ReaderT *reader, char inParens); }

user_defined_types: struct Dirt_Reader_Callbacks { void (*free)(struct Dirt_ReaderT *reader, void *item); void *(*str)(struct Dirt_ReaderT *reader, char *str, unsigned long len); void *(*unicodeStr)(struct Dirt_ReaderT *reader, char *str, unsigned long len); void *(*identifier)(struct Dirt_ReaderT *reader, char *identifier, unsigned long len); void *(*num_float)(struct Dirt_ReaderT *reader, float real); void *(*num_int)(struct Dirt_ReaderT *reader, int integer); void *(*num_long)(struct Dirt_ReaderT *reader, long integer); void *(*none)(struct Dirt_ReaderT *reader); void *(*false)(struct Dirt_ReaderT *reader); void *(*true)(struct Dirt_ReaderT *reader); void *(*structure)(struct Dirt_ReaderT *reader); void *(*structure_add)(struct Dirt_ReaderT *reader, void *structure, void *item); void *(*structure_finalize_tuple)(struct Dirt_ReaderT *reader, void *structure); void *(*structure_finalize_list)(struct Dirt_ReaderT *reader, void *structure); void *(*structure_finalize_dictionary)(struct Dirt_ReaderT *reader, void *structure); void *(*structure_finalize_type)(struct Dirt_ReaderT *reader, void *structure); void *(*keyvalue)(struct Dirt_ReaderT *reader, void *key, void *value); void *(*parameter)(struct Dirt_ReaderT *reader, void *name, void *value); void *(*member)(struct Dirt_ReaderT *reader, void *name, void *value); void *(*application)(struct Dirt_ReaderT *reader, void *function, void *parameters); }

user_defined_types: struct Dirt_SessionTypeT { void (*error)(struct Dirt_SessionT *session, char *class, char *error); unsigned long (*unicodeLookupName)(struct Dirt_SessionT *session, char *name, char *dst); unsigned long (*unicodeLookupOrdinal)(struct Dirt_SessionT *session, int ordinal, char *dst); }


decompiled_code:
__int64 __fastcall ReaderTest_unicodeStr(__int64 a1, const char *a2)
{
int v2; // ebx

v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("unicodeStr: '%s'\n", a2);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, const char *a2)
{
int v2; // ebx

v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("unicodeStr: '%s'\n", a2);
return 1LL;
}

original_code: void *ReaderTest_unicodeStr(Dirt_Reader *reader, char *str, size_t len) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("unicodeStr: '%s'\n", str); return (void*)1; }

canonical_original_code: void *ReaderTest_unicodeStr(struct Dirt_ReaderT *reader, char *str, unsigned long len) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("unicodeStr: '%s'\n", str); return (void *)1; }


decompiled_code:
__int64 __fastcall ReaderTest_identifier(__int64 a1, const char *a2)
{
int v2; // ebx

v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("identifier: '%s'\n", a2);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, const char *a2)
{
int v2; // ebx

v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("identifier: '%s'\n", a2);
return 1LL;
}

original_code: void *ReaderTest_identifier(Dirt_Reader *reader, char *identifier, size_t len) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("identifier: '%s'\n", identifier); return (void*)1; }

canonical_original_code: void *ReaderTest_identifier(struct Dirt_ReaderT *reader, char *identifier, unsigned long len) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("identifier: '%s'\n", identifier); return (void *)1; }

variable_types:
identifier
char *


decompiled_code:
__int64 __fastcall ReaderTest_num_float(__m128i a1)
{
float v1; // er14
int v2; // ebx

v1 = COERCE_FLOAT(_mm_cvtsi128_si32(a1));
v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("float: %f\n", v1);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(__m128i a1)
{
float v1; // er14
int v2; // ebx

v1 = COERCE_FLOAT(_mm_cvtsi128_si32(a1));
v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("float: %f\n", v1);
return 1LL;
}

original_code: void *ReaderTest_num_float(Dirt_Reader *reader, float real) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("float: %f\n", real); return (void*)1; }

canonical_original_code: void *ReaderTest_num_float(struct Dirt_ReaderT *reader, float real) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("float: %f\n", real); return (void *)1; }

variable_types: real float


decompiled_code:
__int64 __fastcall ReaderTest_num_long(__int64 a1, __int64 a2)
{
int v2; // ebx

v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("long: %li\n", a2);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2)
{
int v2; // ebx

v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("long: %li\n", a2);
return 1LL;
}

original_code: void *ReaderTest_num_long(Dirt_Reader *reader, long integer) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("long: %li\n", integer); return (void*)1; }

canonical_original_code: void *ReaderTest_num_long(struct Dirt_ReaderT *reader, long integer) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("long: %li\n", integer); return (void *)1; }

variable_types: integer long


decompiled_code:
__int64 __fastcall ReaderTest_num_int(__int64 a1, unsigned int a2)
{
int v2; // ebx

v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("int: %i\n", a2);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, unsigned int a2)
{
int v2; // ebx

v2 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v2;
}
while ( v2 );
}
printf("int: %i\n", a2);
return 1LL;
}

original_code: void *ReaderTest_num_int(Dirt_Reader *reader, int integer) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("int: %i\n", integer); return (void*)1; }

canonical_original_code: void *ReaderTest_num_int(struct Dirt_ReaderT *reader, int integer) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("int: %i\n", integer); return (void *)1; }

variable_types: integer int


decompiled_code:
__int64 ReaderTest_none()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("none");
return 1LL;
}

canonical_decompiled_code:
__int64 func7()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("none");
return 1LL;
}

original_code: void *ReaderTest_none(Dirt_Reader *reader) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("none\n"); return (void*)1; }

canonical_original_code: void *ReaderTest_none(struct Dirt_ReaderT *reader) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("none\n"); return (void *)1; }

variable_types: i int


decompiled_code:
__int64 ReaderTest_false()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("false");
return 1LL;
}

canonical_decompiled_code:
__int64 func8()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("false");
return 1LL;
}

original_code: void *ReaderTest_false(Dirt_Reader *reader) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("false\n"); return (void*)1; }

canonical_original_code: void *ReaderTest_false(struct Dirt_ReaderT *reader) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("false\n"); return (void *)1; }


decompiled_code:
__int64 ReaderTest_true()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("true");
return 1LL;
}

canonical_decompiled_code:
__int64 func9()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("true");
return 1LL;
}

original_code: void *ReaderTest_true(Dirt_Reader *reader) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("true\n"); return (void*)1; }

canonical_original_code: void *ReaderTest_true(struct Dirt_ReaderT *reader) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("true\n"); return (void *)1; }


decompiled_code:
__int64 ReaderTest_structure()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
v0 = level;
}
level = v0 + 1;
puts("structure");
return 1LL;
}

canonical_decompiled_code:
__int64 func10()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
v0 = level;
}
level = v0 + 1;
puts("structure");
return 1LL;
}

original_code: void *ReaderTest_structure(Dirt_Reader *reader) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); level++; printf("structure\n"); return (void*)1; }

canonical_original_code: void *ReaderTest_structure(struct Dirt_ReaderT *reader) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); level++; printf("structure\n"); return (void *)1; }


decompiled_code:
__int64 ReaderTest_structure_add()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("structure_add");
return 1LL;
}

canonical_decompiled_code:
__int64 func11()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("structure_add");
return 1LL;
}

original_code: void *ReaderTest_structure_add(Dirt_Reader *reader, void *structure, void *item) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("structure_add\n"); return (void*)1; }

canonical_original_code: void *ReaderTest_structure_add(struct Dirt_ReaderT *reader, void *structure, void *item) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("structure_add\n"); return (void *)1; }

variable_types:
structure
void *


decompiled_code:
__int64 ReaderTest_structure_finalize_tuple()
{
int v0; // ebx

v0 = level - 1;
level = v0;
if ( v0 > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("structure_finalize_tuple");
return 1LL;
}

canonical_decompiled_code:
__int64 func12()
{
int v0; // ebx

v0 = level - 1;
level = v0;
if ( v0 > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("structure_finalize_tuple");
return 1LL;
}

original_code: void *ReaderTest_structure_finalize_tuple(Dirt_Reader *reader, void *structure) { level--; do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("structure_finalize_tuple\n"); return (void*)1; }

canonical_original_code: void *ReaderTest_structure_finalize_tuple(struct Dirt_ReaderT *reader, void *structure) { level--; do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("structure_finalize_tuple\n"); return (void *)1; }


decompiled_code:
__int64 ReaderTest_structure_finalize_list()
{
int v0; // ebx

v0 = level - 1;
level = v0;
if ( v0 > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("structure_finalize_list");
return 1LL;
}

canonical_decompiled_code:
__int64 func13()
{
int v0; // ebx

v0 = level - 1;
level = v0;
if ( v0 > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("structure_finalize_list");
return 1LL;
}

original_code: void *ReaderTest_structure_finalize_list(Dirt_Reader *reader, void *structure) { level--; do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("structure_finalize_list\n"); return (void*)1; }

canonical_original_code: void *ReaderTest_structure_finalize_list(struct Dirt_ReaderT *reader, void *structure) { level--; do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("structure_finalize_list\n"); return (void *)1; }


decompiled_code:
__int64 ReaderTest_structure_finalize_dictionary()
{
int v0; // ebx

v0 = level - 1;
level = v0;
if ( v0 > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("structure_finalize_dictionary");
return 1LL;
}

canonical_decompiled_code:
__int64 func14()
{
int v0; // ebx

v0 = level - 1;
level = v0;
if ( v0 > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("structure_finalize_dictionary");
return 1LL;
}

original_code: void *ReaderTest_structure_finalize_dictionary(Dirt_Reader *reader, void *structure) { level--; do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("structure_finalize_dictionary\n"); return (void*)1; }

canonical_original_code: void *ReaderTest_structure_finalize_dictionary(struct Dirt_ReaderT *reader, void *structure) { level--; do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("structure_finalize_dictionary\n"); return (void *)1; }


decompiled_code:
__int64 ReaderTest_structure_finalize_type()
{
int v0; // ebx

v0 = level - 1;
level = v0;
if ( v0 > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("structure_finalize_type");
return 1LL;
}

canonical_decompiled_code:
__int64 func15()
{
int v0; // ebx

v0 = level - 1;
level = v0;
if ( v0 > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("structure_finalize_type");
return 1LL;
}

original_code: void *ReaderTest_structure_finalize_type(Dirt_Reader *reader, void *structure) { level--; do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("structure_finalize_type\n"); return (void*)1; }

canonical_original_code: void *ReaderTest_structure_finalize_type(struct Dirt_ReaderT *reader, void *structure) { level--; do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("structure_finalize_type\n"); return (void *)1; }


decompiled_code:
__int64 ReaderTest_keyvalue()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("keyvalue");
return 1LL;
}

canonical_decompiled_code:
__int64 func16()
{
int v0; // ebx

v0 = level;
if ( level > 0 )
{
do
{
putchar(32);
--v0;
}
while ( v0 );
}
puts("keyvalue");
return 1LL;
}

original_code: void *ReaderTest_keyvalue(Dirt_Reader *reader, void *key, void *value) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("keyvalue\n"); return (void*)1; }

canonical_original_code: void *ReaderTest_keyvalue(struct Dirt_ReaderT *reader, void *key, void *value) { do { int i; for (i = level; i > 0; i--) printf(" "); } while(0); printf("keyvalue\n"); return (void *)1; }

variable_types:
key
void *

variable_types:
value
void *