main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v4; // rax
bool v5; // zf
__int64 v6; // rdi
__int64 v7; // rbp
const char *v8; // rax
_QWORD *v9; // rax
__int64 v10; // rdx
__int64 v11; // rcx
_QWORD *v12; // rsi
_QWORD *v13; // rax
__int64 v14; // rcx
__int64 v15; // rdi
_QWORD *v17; // rdi
__int64 v18; // rax
_QWORD *v19; // rdx
__int64 v20; // rcx
_QWORD *v21; // rdx
_QWORD *v22; // rdi
__int64 v23; // rax
_QWORD *v24; // rdx
__int64 v25; // rcx
_QWORD *v26; // rdx
char **v27; // r12
char v28; // [rsp+7h] [rbp-21h] BYREF
__int16 v29; // [rsp+8h] [rbp-20h]
char v30; // [rsp+Ah] [rbp-1Eh]
unsigned __int8 v31; // [rsp+Bh] [rbp-1Dh]
char v32; // [rsp+Dh] [rbp-1Bh]
char v33; // [rsp+Eh] [rbp-1Ah]

v4 = parse_args(argc, (char **)argv, (__int64)&v28);
v5 = v32 == 0;
v6 = *(_QWORD *)(v4 + 8);
v7 = v4;
*(_DWORD *)(v6 + 72) = v31;
if ( v5 )
{
if ( v28 )
goto LABEL_14;
printfd(2LL, "\x1B[91m[x] \x1B[0mNo such target or porcess\n");
LABEL_32:
btrace_banner(*argv, 1);
}
if ( v28 )
{
bt_proc_destroy(v4);
printfd(2LL, "\x1B[91m[x] \x1B[0m You can't choose target and pid together !\n");
goto LABEL_32;
}
v8 = (const char *)check_target_path(*(_QWORD *)(v6 + 8), *(_QWORD *)(v6 + 80));
*(_QWORD *)v7 = v8;
if ( !v8 )
goto LABEL_27;
if ( v33 )
{
(*(void (__fastcall **)(_QWORD, __int64))(v7 + 24))(*(_QWORD *)(*(_QWORD *)(v7 + 8) + 16LL), v7);
}
else
{
v27 = *(char ***)(v7 + 16);
*v27 = strdup(v8);
}
if ( !(_BYTE)v29 )
{
if ( !HIBYTE(v29) )
goto LABEL_8;
LABEL_26:
printfd(2LL, "\x1B[92m[-] \x1B[0mYou may choose both of address and offset !\n");
LABEL_27:
bt_proc_destroy(v7);
btrace_banner(*argv, 1);
}
if ( !HIBYTE(v29) )
goto LABEL_26;
LABEL_8:
v9 = *(_QWORD **)(v7 + 8);
v10 = v9[3];
v11 = v9[8];
v12 = (_QWORD *)v9[12];
v13 = (_QWORD *)v9[11];
v14 = v10 + v11;
*v12 = v10;
v12[1] = v14;
*v13 = v10;
v13[1] = v14;
exec_target(v7);
if ( !v29 )
{
printfd(
2LL,
"\x1B[94m[+] \x1B[0mTarget :\x1B[92m %s \x1B[0m PID : \x1B[92m%d\x1B[0m\n",
*(const char **)v7,
**(unsigned int **)(v7 + 8));
if ( (unsigned int)read_procfs_maps(*(_QWORD *)(v7 + 8)) == -1 )
die("no such process");
}
fetch_data(*(_QWORD *)(v7 + 8));
if ( v28 )
{
LABEL_14:
if ( (unsigned int)attach_process() == -1 )
die("\x1B[91m[x] \x1B[0mCan't attach process");
get_cmdline_by_pid(*(_QWORD *)(v7 + 8));
printfd(
2LL,
"\x1B[94m[+] \x1B[0mAttach PID:\x1B[92m %d\x1B[0m Target :\x1B[92m %s\x1B[0m\n",
**(unsigned int **)(v7 + 8),
*(const char **)(*(_QWORD *)(*(_QWORD *)(v7 + 8) + 80LL) + 1LL));
if ( (_BYTE)v29 )
{
if ( HIBYTE(v29) )
{
v22 = *(_QWORD **)(v7 + 8);
v23 = v22[3];
v24 = (_QWORD *)v22[12];
v25 = v23 + v22[8];
*v24 = v23;
v24[1] = v25;
v26 = (_QWORD *)v22[11];
*v26 = v23;
v26[1] = v25;
LABEL_24:
fetch_data(v22);
goto LABEL_10;
}
}
else if ( !HIBYTE(v29) )
{
v17 = *(_QWORD **)(v7 + 8);
v18 = v17[3];
v19 = (_QWORD *)v17[12];
v20 = v18 + v17[8];
*v19 = v18;
v19[1] = v20;
v21 = (_QWORD *)v17[11];
*v21 = v18;
v21[1] = v20;
if ( (unsigned int)read_procfs_maps(v17) == -1 )
die("\x1B[91m[x] \x1B[0mNo such process");
v22 = *(_QWORD **)(v7 + 8);
goto LABEL_24;
}
goto LABEL_26;
}
LABEL_10:
v15 = *(_QWORD *)(v7 + 8);
if ( v30 )
raw_dump(v15);
else
dump_using_memory(v15);
pinfo_destroy(*(_QWORD *)(v7 + 8));
bt_proc_destroy(v7);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v4; // rax
bool v5; // zf
__int64 v6; // rdi
__int64 v7; // rbp
const char *v8; // rax
_QWORD *v9; // rax
__int64 v10; // rdx
__int64 v11; // rcx
_QWORD *v12; // rsi
_QWORD *v13; // rax
__int64 v14; // rcx
__int64 v15; // rdi
_QWORD *v17; // rdi
__int64 v18; // rax
_QWORD *v19; // rdx
__int64 v20; // rcx
_QWORD *v21; // rdx
_QWORD *v22; // rdi
__int64 v23; // rax
_QWORD *v24; // rdx
__int64 v25; // rcx
_QWORD *v26; // rdx
char **v27; // r12
char v28; // [rsp+7h] [rbp-21h] BYREF
__int16 v29; // [rsp+8h] [rbp-20h]
char v30; // [rsp+Ah] [rbp-1Eh]
unsigned __int8 v31; // [rsp+Bh] [rbp-1Dh]
char v32; // [rsp+Dh] [rbp-1Bh]
char v33; // [rsp+Eh] [rbp-1Ah]

v4 = func1(argc, (char **)argv, (__int64)&v28);
v5 = v32 == 0;
v6 = *(_QWORD *)(v4 + 8);
v7 = v4;
*(_DWORD *)(v6 + 72) = v31;
if ( v5 )
{
if ( v28 )
goto LABEL_14;
printfd(2LL, "\x1B[91m[x] \x1B[0mNo such target or porcess\n");
LABEL_32:
func0(*argv, 1);
}
if ( v28 )
{
bt_proc_destroy(v4);
printfd(2LL, "\x1B[91m[x] \x1B[0m You can't choose target and pid together !\n");
goto LABEL_32;
}
v8 = (const char *)check_target_path(*(_QWORD *)(v6 + 8), *(_QWORD *)(v6 + 80));
*(_QWORD *)v7 = v8;
if ( !v8 )
goto LABEL_27;
if ( v33 )
{
(*(void (__fastcall **)(_QWORD, __int64))(v7 + 24))(*(_QWORD *)(*(_QWORD *)(v7 + 8) + 16LL), v7);
}
else
{
v27 = *(char ***)(v7 + 16);
*v27 = strdup(v8);
}
if ( !(_BYTE)v29 )
{
if ( !HIBYTE(v29) )
goto LABEL_8;
LABEL_26:
printfd(2LL, "\x1B[92m[-] \x1B[0mYou may choose both of address and offset !\n");
LABEL_27:
bt_proc_destroy(v7);
func0(*argv, 1);
}
if ( !HIBYTE(v29) )
goto LABEL_26;
LABEL_8:
v9 = *(_QWORD **)(v7 + 8);
v10 = v9[3];
v11 = v9[8];
v12 = (_QWORD *)v9[12];
v13 = (_QWORD *)v9[11];
v14 = v10 + v11;
*v12 = v10;
v12[1] = v14;
*v13 = v10;
v13[1] = v14;
exec_target(v7);
if ( !v29 )
{
printfd(
2LL,
"\x1B[94m[+] \x1B[0mTarget :\x1B[92m %s \x1B[0m PID : \x1B[92m%d\x1B[0m\n",
*(const char **)v7,
**(unsigned int **)(v7 + 8));
if ( (unsigned int)read_procfs_maps(*(_QWORD *)(v7 + 8)) == -1 )
die("no such process");
}
fetch_data(*(_QWORD *)(v7 + 8));
if ( v28 )
{
LABEL_14:
if ( (unsigned int)attach_process() == -1 )
die("\x1B[91m[x] \x1B[0mCan't attach process");
get_cmdline_by_pid(*(_QWORD *)(v7 + 8));
printfd(
2LL,
"\x1B[94m[+] \x1B[0mAttach PID:\x1B[92m %d\x1B[0m Target :\x1B[92m %s\x1B[0m\n",
**(unsigned int **)(v7 + 8),
*(const char **)(*(_QWORD *)(*(_QWORD *)(v7 + 8) + 80LL) + 1LL));
if ( (_BYTE)v29 )
{
if ( HIBYTE(v29) )
{
v22 = *(_QWORD **)(v7 + 8);
v23 = v22[3];
v24 = (_QWORD *)v22[12];
v25 = v23 + v22[8];
*v24 = v23;
v24[1] = v25;
v26 = (_QWORD *)v22[11];
*v26 = v23;
v26[1] = v25;
LABEL_24:
fetch_data(v22);
goto LABEL_10;
}
}
else if ( !HIBYTE(v29) )
{
v17 = *(_QWORD **)(v7 + 8);
v18 = v17[3];
v19 = (_QWORD *)v17[12];
v20 = v18 + v17[8];
*v19 = v18;
v19[1] = v20;
v21 = (_QWORD *)v17[11];
*v21 = v18;
v21[1] = v20;
if ( (unsigned int)read_procfs_maps(v17) == -1 )
die("\x1B[91m[x] \x1B[0mNo such process");
v22 = *(_QWORD **)(v7 + 8);
goto LABEL_24;
}
goto LABEL_26;
}
LABEL_10:
v15 = *(_QWORD *)(v7 + 8);
if ( v30 )
raw_dump(v15);
else
dump_using_memory(v15);
pinfo_destroy(*(_QWORD *)(v7 + 8));
bt_proc_destroy(v7);
return 0;
}

original_code:
int main(int argc, char **argv)
{
 struct bt_opts opts;
 struct btproc *bt_proc;
 bt_proc = parse_args(argc, argv, &opts);
 bt_proc->pi->pi_debug = opts.debug_opt;
 if (opts.target_opt && opts.pid_opt) {
  bt_proc_destroy(bt_proc);
  printfd(2,
   "\033[91m""[x] ""\033[0m" " You can't choose target and pid together !\n");
  btrace_banner(*argv, 1);
 } else if (!opts.target_opt && !opts.pid_opt) {
  printfd(2, "\033[91m""[x] ""\033[0m" "No such target or porcess\n");
  btrace_banner(*argv, 1);
 } else {
  if (opts.target_opt) {
   bt_proc->exec =
       check_target_path(bt_proc->pi->pi_target,
           bt_proc->pi->pi_perm);
   if (!bt_proc->exec) {
    bt_proc_destroy(bt_proc);
    btrace_banner(*argv, 1);
   }
   if (opts.target_has_args)
    bt_proc->args_parser((char *)bt_proc->pi->
           pi_args, bt_proc);
   else
    bt_proc->proc_arguments[0] =
        strdup((const char *)bt_proc->exec);
   if ((!opts.force_addr_opt && opts.off_opt) ||
       (opts.force_addr_opt && !opts.off_opt)) {
    printfd(2,
     "\033[92m""[-] ""\033[0m"
     "You may choose both of address and offset !\n");
    bt_proc_destroy(bt_proc);
    btrace_banner(*argv, 1);
   }
   else {
    bt_proc->pi->pi_stack->ma_map[0] =
     bt_proc->pi->pi_address;
    bt_proc->pi->pi_stack->ma_map[1] =
     bt_proc->pi->pi_address +
     bt_proc->pi->pi_offset;
    bt_proc->pi->pi_addr->ma_map[0] =
        bt_proc->pi->pi_address;
    bt_proc->pi->pi_addr->ma_map[1] =
        bt_proc->pi->pi_address +
        bt_proc->pi->pi_offset;
   }
   exec_target(bt_proc);
   if (!opts.force_addr_opt && !opts.off_opt) {
    printfd(2,
     "\033[94m""[+] ""\033[0m" "Target :" "\033[92m" " %s " "\033[0m"
     " PID : " "\033[92m" "%d" "\033[0m" "\n",
     bt_proc->exec, bt_proc->pi->pi_pid);
    if (read_procfs_maps(bt_proc->pi) == -1)
     die("no such process");
   }
   fetch_data(bt_proc->pi);
  }
  if (opts.pid_opt) {
   if (attach_process(bt_proc->pi) == -1)
    die("\033[91m""[x] ""\033[0m" "Can't attach process");
   get_cmdline_by_pid(bt_proc->pi);
   printfd(2,
    "\033[94m""[+] ""\033[0m" "Attach PID:" "\033[92m" " %d" "\033[0m" "  Target :"
    "\033[92m" " %s" "\033[0m" "\n", bt_proc->pi->pi_pid,
    bt_proc->pi->pi_perm->p_full_path);
   if ((!opts.force_addr_opt && opts.off_opt) ||
       (opts.force_addr_opt && !opts.off_opt)) {
    printfd(2,
     "\033[92m""[-] ""\033[0m"
     "You may choose both of address and offset !\n");
    bt_proc_destroy(bt_proc);
    btrace_banner(*argv, 1);
   }
   else {
    bt_proc->pi->pi_stack->ma_map[0] =
     bt_proc->pi->pi_address;
    bt_proc->pi->pi_stack->ma_map[1] =
     bt_proc->pi->pi_address +
     bt_proc->pi->pi_offset;
    bt_proc->pi->pi_addr->ma_map[0] =
        bt_proc->pi->pi_address;
    bt_proc->pi->pi_addr->ma_map[1] =
        bt_proc->pi->pi_address +
        bt_proc->pi->pi_offset;
   }
   if (!opts.force_addr_opt && !opts.off_opt)
    if (read_procfs_maps(bt_proc->pi) == -1)
     die("\033[91m""[x] ""\033[0m" "No such process");
   fetch_data(bt_proc->pi);
  }
  if (opts.raw_opt)
   raw_dump(bt_proc->pi);
  else
   dump_using_memory(bt_proc->pi);
  if(opts.elf_dump_opts) {
  }
  pinfo_destroy(bt_proc->pi);
  bt_proc_destroy(bt_proc);
 }
 return 0;
}

canonical_original_code:
int main(int argc, char **argv)
{
 struct bt_opts opts;
 struct btproc *bt_proc;
 bt_proc = parse_args(argc, argv, &opts);
 bt_proc->pi->pi_debug = opts.debug_opt;
 if (opts.target_opt && opts.pid_opt) {
  bt_proc_destroy(bt_proc);
  printfd(2,
   "\033[91m""[x] ""\033[0m" " You can't choose target and pid together !\n");
  btrace_banner(*argv, 1);
 } else if (!opts.target_opt && !opts.pid_opt) {
  printfd(2, "\033[91m""[x] ""\033[0m" "No such target or porcess\n");
  btrace_banner(*argv, 1);
 } else {
  if (opts.target_opt) {
   bt_proc->exec =
       check_target_path(bt_proc->pi->pi_target,
           bt_proc->pi->pi_perm);
   if (!bt_proc->exec) {
    bt_proc_destroy(bt_proc);
    btrace_banner(*argv, 1);
   }
   if (opts.target_has_args)
    bt_proc->args_parser((char *)bt_proc->pi->
           pi_args, bt_proc);
   else
    bt_proc->proc_arguments[0] =
        strdup((char *)bt_proc->exec);
   if ((!opts.force_addr_opt && opts.off_opt) ||
       (opts.force_addr_opt && !opts.off_opt)) {
    printfd(2,
     "\033[92m""[-] ""\033[0m"
     "You may choose both of address and offset !\n");
    bt_proc_destroy(bt_proc);
    btrace_banner(*argv, 1);
   }
   else {
    bt_proc->pi->pi_stack->ma_map[0] =
     bt_proc->pi->pi_address;
    bt_proc->pi->pi_stack->ma_map[1] =
     bt_proc->pi->pi_address +
     bt_proc->pi->pi_offset;
    bt_proc->pi->pi_addr->ma_map[0] =
        bt_proc->pi->pi_address;
    bt_proc->pi->pi_addr->ma_map[1] =
        bt_proc->pi->pi_address +
        bt_proc->pi->pi_offset;
   }
   exec_target(bt_proc);
   if (!opts.force_addr_opt && !opts.off_opt) {
    printfd(2,
     "\033[94m""[+] ""\033[0m" "Target :" "\033[92m" " %s " "\033[0m"
     " PID : " "\033[92m" "%d" "\033[0m" "\n",
     bt_proc->exec, bt_proc->pi->pi_pid);
    if (read_procfs_maps(bt_proc->pi) == -1)
     die("no such process");
   }
   fetch_data(bt_proc->pi);
  }
  if (opts.pid_opt) {
   if (attach_process(bt_proc->pi) == -1)
    die("\033[91m""[x] ""\033[0m" "Can't attach process");
   get_cmdline_by_pid(bt_proc->pi);
   printfd(2,
    "\033[94m""[+] ""\033[0m" "Attach PID:" "\033[92m" " %d" "\033[0m" "  Target :"
    "\033[92m" " %s" "\033[0m" "\n", bt_proc->pi->pi_pid,
    bt_proc->pi->pi_perm->p_full_path);
   if ((!opts.force_addr_opt && opts.off_opt) ||
       (opts.force_addr_opt && !opts.off_opt)) {
    printfd(2,
     "\033[92m""[-] ""\033[0m"
     "You may choose both of address and offset !\n");
    bt_proc_destroy(bt_proc);
    btrace_banner(*argv, 1);
   }
   else {
    bt_proc->pi->pi_stack->ma_map[0] =
     bt_proc->pi->pi_address;
    bt_proc->pi->pi_stack->ma_map[1] =
     bt_proc->pi->pi_address +
     bt_proc->pi->pi_offset;
    bt_proc->pi->pi_addr->ma_map[0] =
        bt_proc->pi->pi_address;
    bt_proc->pi->pi_addr->ma_map[1] =
        bt_proc->pi->pi_address +
        bt_proc->pi->pi_offset;
   }
   if (!opts.force_addr_opt && !opts.off_opt)
    if (read_procfs_maps(bt_proc->pi) == -1)
     die("\033[91m""[x] ""\033[0m" "No such process");
   fetch_data(bt_proc->pi);
  }
  if (opts.raw_opt)
   raw_dump(bt_proc->pi);
  else
   dump_using_memory(bt_proc->pi);
  if(opts.elf_dump_opts) {
  }
  pinfo_destroy(bt_proc->pi);
  bt_proc_destroy(bt_proc);
 }
 return 0;
}

variable_types: struct bt_opts { unsigned int pid_opt; unsigned int force_addr_opt; unsigned int off_opt; unsigned int raw_opt; unsigned int debug_opt; unsigned int use_data_opt; unsigned int target_opt; unsigned int target_has_args; unsigned int elf_dump_opts; }

user_defined_types: struct perms { unsigned short p_read; unsigned short p_write; unsigned short p_exec; unsigned short p_exist; unsigned char *p_full_path; unsigned char *p_symb; }

user_defined_types: struct map_addr { unsigned long long ma_map[2]; unsigned char *ma_data; struct map_addr *ma_next; }


decompiled_code:
__pid_t catch_child_proc()
{
__pid_t result; // eax
int stat_loc[3]; // [rsp+Ch] [rbp-Ch] BYREF

do
result = waitpid(-1, stat_loc, 1);
while ( result > 0 );
return result;
}

canonical_decompiled_code:
__pid_t func1()
{
__pid_t result; // eax
int stat_loc[3]; // [rsp+Ch] [rbp-Ch] BYREF

do
result = waitpid(-1, stat_loc, 1);
while ( result > 0 );
return result;
}

original_code:
static void catch_child_proc(int sig)
{
 pid_t target_pid;
 int status;
 while ((target_pid = waitpid(-1, &status, 1)) > 0) ;
}

canonical_original_code:
static void catch_child_proc(int sig)
{
 int target_pid;
 int status;
 while ((target_pid = waitpid(-1, &status, 1)) > 0) ;
}

variable_types: sig int

variable_types: status int

return_type: void


original_code:
struct procinfo *pinfo_init()
{
 struct procinfo *pi;
 pi = (struct procinfo *)xmalloc(sizeof(struct procinfo));
 pi->pi_pid = 0;
 pi->pi_target = ((void *)0);
 pi->pi_debug = 0;
 pi->pi_address = 0;
 pi->pi_stack = 0;
 pi->pi_data = ((void *)0);
 pi->pi_map[0] = pi->pi_map[1] = 0;
 pi->pi_offset = 0;
 pi->pi_addr = (struct map_addr *)xmalloc(sizeof(struct map_addr));
 pi->pi_addr->ma_map[0] = pi->pi_addr->ma_map[1] = 0;
 pi->pi_addr->ma_next = ((void *)0);
 pi->pi_stack = (struct map_addr *)xmalloc(sizeof(struct map_addr));
 pi->pi_stack->ma_map[0] = pi->pi_addr->ma_map[1] = 0;
 pi->pi_stack->ma_next = ((void *)0);
 pi->pi_perm = (struct perms *)xmalloc(sizeof(struct perms));
 pi->pi_perm->p_read = 0;
 pi->pi_perm->p_write = 0;
 pi->pi_perm->p_exec = 0;
 pi->pi_perm->p_symb = (u_char *) malloc(4 * sizeof(u_char));
 return pi;
}

canonical_original_code:
struct procinfo *pinfo_init()
{
 struct procinfo *pi;
 pi = (struct procinfo *)xmalloc(sizeof(struct procinfo));
 pi->pi_pid = 0;
 pi->pi_target = ((void *)0);
 pi->pi_debug = 0;
 pi->pi_address = 0;
 pi->pi_stack = 0;
 pi->pi_data = ((void *)0);
 pi->pi_map[0] = pi->pi_map[1] = 0;
 pi->pi_offset = 0;
 pi->pi_addr = (struct map_addr *)xmalloc(sizeof(struct map_addr));
 pi->pi_addr->ma_map[0] = pi->pi_addr->ma_map[1] = 0;
 pi->pi_addr->ma_next = ((void *)0);
 pi->pi_stack = (struct map_addr *)xmalloc(sizeof(struct map_addr));
 pi->pi_stack->ma_map[0] = pi->pi_addr->ma_map[1] = 0;
 pi->pi_stack->ma_next = ((void *)0);
 pi->pi_perm = (struct perms *)xmalloc(sizeof(struct perms));
 pi->pi_perm->p_read = 0;
 pi->pi_perm->p_write = 0;
 pi->pi_perm->p_exec = 0;
 pi->pi_perm->p_symb = (unsigned char *) malloc(4 * sizeof(u_char));
 return pi;
}

variable_types: struct procinfo { int pi_pid; unsigned char *pi_target; unsigned char *pi_args; unsigned long pi_address; unsigned char *pi_data; unsigned long long pi_map[2]; unsigned long pi_saved_offset; unsigned long pi_offset; unsigned int pi_debug; struct perms { unsigned short p_read; unsigned short p_write; unsigned short p_exec; unsigned short p_exist; unsigned char *p_full_path; unsigned char *p_symb; } *pi_perm; struct map_addr { unsigned long long ma_map[2]; unsigned char *ma_data; struct map_addr *ma_next; } *pi_addr; struct map_addr *pi_stack; struct map_addr *pi_heap; } *

user_defined_types: struct procinfo { int pi_pid; unsigned char *pi_target; unsigned char *pi_args; unsigned long pi_address; unsigned char *pi_data; unsigned long long pi_map[2]; unsigned long pi_saved_offset; unsigned long pi_offset; unsigned int pi_debug; struct perms *pi_perm; struct map_addr *pi_addr; struct map_addr *pi_stack; struct map_addr *pi_heap; }


decompiled_code:
_QWORD *bt_proc_init()
{
_QWORD *v0; // r12
_QWORD *v1; // rax

v0 = (_QWORD *)xmalloc(32LL);
if ( v0 )
{
v0[1] = pinfo_init();
v1 = (_QWORD *)xmalloc(16LL);
v0[2] = v1;
*v1 = 0LL;
v0[3] = parse_target_args;
}
return v0;
}

canonical_decompiled_code:
_QWORD *func3()
{
_QWORD *v0; // r12
_QWORD *v1; // rax

v0 = (_QWORD *)xmalloc(32LL);
if ( v0 )
{
v0[1] = func2();
v1 = (_QWORD *)xmalloc(16LL);
v0[2] = v1;
*v1 = 0LL;
v0[3] = parse_target_args;
}
return v0;
}

original_code:
struct btproc *bt_proc_init()
{
 struct btproc *bt;
 bt = (struct btproc *)xmalloc(sizeof(struct btproc));
 if (!bt)
  return ((void *)0);
 bt->pi = pinfo_init();
 bt->proc_arguments = (char **)xmalloc(2 * sizeof(char *));
 bt->proc_arguments[0] = ((void *)0);
 if (!bt->proc_arguments) {
  printf("\033[91m""[x] ""\033[0m"
         "line : %d,parse_target_args() : error allocation\n",
         118);
  die("Error");
 }
 bt->args_parser = parse_target_args;
 return bt;
}

variable_types: struct btproc { unsigned char *exec; struct procinfo { int pi_pid; unsigned char *pi_target; unsigned char *pi_args; unsigned long pi_address; unsigned char *pi_data; unsigned long long pi_map[2]; unsigned long pi_saved_offset; unsigned long pi_offset; unsigned int pi_debug; struct perms { unsigned short p_read; unsigned short p_write; unsigned short p_exec; unsigned short p_exist; unsigned char *p_full_path; unsigned char *p_symb; } *pi_perm; struct map_addr { unsigned long long ma_map[2]; unsigned char *ma_data; struct map_addr *ma_next; } *pi_addr; struct map_addr *pi_stack; struct map_addr *pi_heap; } *pi; char **proc_arguments; void (*args_parser)(char *, struct btproc *); } *

user_defined_types: struct btproc { unsigned char *exec; struct procinfo *pi; char **proc_arguments; void (*args_parser)(char *, struct btproc *); }


decompiled_code:
char *__fastcall check_target_path(char *name, __int64 a2)
{
char *v2; // r13
char *v3; // rax
char *v4; // r14
char *v6; // rax
char *v7; // rbp
int v8; // er12
int v9; // eax
void *v10; // r12
size_t v11; // r15
size_t v12; // rax
char *v13; // rax
char v14[1096]; // [rsp+0h] [rbp-448h] BYREF

v2 = strdup(name);
memset(v14, 0, 0x400uLL);
v14[1024] = 0;
v3 = realpath(name, v14);
v4 = v3;
if ( v3 )
{
*(_QWORD *)(a2 + 1) = strdup(v3);
}
else if ( access(name, 0) )
{
v6 = getenv("PATH");
v7 = strtok(v6, ":");
if ( !v7 )
{
LABEL_12:
printf("\x1B[91m[x] \x1B[0m\x1B[91m%s \x1B[0m:not found !\n", v2);
return v4;
}
while ( 1 )
{
v8 = strlen(v7);
v9 = strlen(v2);
v10 = (void *)xmalloc((unsigned int)(v8 + v9 + 2));
v11 = strlen(v7);
v12 = strlen(v2);
memset(v10, 0, v11 + v12 + 2);
v13 = stpcpy((char *)v10, v7);
*v13 = 47;
strcpy(v13 + 1, v2);
if ( !access((const char *)v10, 0) )
break;
v7 = strtok(0LL, ":");
free(v10);
if ( !v7 )
goto LABEL_12;
}
get_file_permissions((char *)v10, a2);
*(_QWORD *)(a2 + 1) = strdup((const char *)v10);
free(v10);
}
else
{
get_file_permissions(name, a2);
*(_QWORD *)(a2 + 1) = strdup(name);
}
free(v2);
return *(char **)(a2 + 1);
}

canonical_decompiled_code:
char *__fastcall func5(char *name, __int64 a2)
{
char *v2; // r13
char *v3; // rax
char *v4; // r14
char *v6; // rax
char *v7; // rbp
int v8; // er12
int v9; // eax
void *v10; // r12
size_t v11; // r15
size_t v12; // rax
char *v13; // rax
char v14[1096]; // [rsp+0h] [rbp-448h] BYREF

v2 = strdup(name);
memset(v14, 0, 0x400uLL);
v14[1024] = 0;
v3 = realpath(name, v14);
v4 = v3;
if ( v3 )
{
*(_QWORD *)(a2 + 1) = strdup(v3);
}
else if ( access(name, 0) )
{
v6 = getenv("PATH");
v7 = strtok(v6, ":");
if ( !v7 )
{
LABEL_12:
printf("\x1B[91m[x] \x1B[0m\x1B[91m%s \x1B[0m:not found !\n", v2);
return v4;
}
while ( 1 )
{
v8 = strlen(v7);
v9 = strlen(v2);
v10 = (void *)xmalloc((unsigned int)(v8 + v9 + 2));
v11 = strlen(v7);
v12 = strlen(v2);
memset(v10, 0, v11 + v12 + 2);
v13 = stpcpy((char *)v10, v7);
*v13 = 47;
strcpy(v13 + 1, v2);
if ( !access((const char *)v10, 0) )
break;
v7 = strtok(0LL, ":");
free(v10);
if ( !v7 )
goto LABEL_12;
}
func4((char *)v10, a2);
*(_QWORD *)(a2 + 1) = strdup((const char *)v10);
free(v10);
}
else
{
func4(name, a2);
*(_QWORD *)(a2 + 1) = strdup(name);
}
free(v2);
return *(char **)(a2 + 1);
}

original_code:
u_char *check_target_path(u_char * target, struct perms * perms)
{
 char *vtarget;
 char *env_path;
 int npath;
 char *arg_wr, *full_path;
 int found = 0;
 char current[1025];
 char *rpath;
 vtarget = strdup((const char *)target);
 memset(current, 0, 1025);
 rpath = realpath((const char *)target, current);
 if (rpath)
  perms->p_full_path = (u_char *) strdup((const char *)rpath);
 else {
  if (!access((const char *)target, 0)) {
   get_file_permissions(target, perms);
   perms->p_full_path =
       (u_char *) strdup((const char *)target);
  } else {
   env_path = getenv("PATH");
   npath = 0;
   arg_wr = strtok(env_path, ":");
   while (arg_wr) {
    full_path = (char *)
        xmalloc((strlen(arg_wr) + strlen(vtarget) +
          2) * sizeof(char));
    memset(full_path, 0,
           strlen(arg_wr) + strlen(vtarget) + 2);
    strcpy(full_path, arg_wr);
    strcat(full_path, "/");
    strcat(full_path, vtarget);
    if (!access(full_path, 0)) {
     found = 1;
     get_file_permissions((u_char *)
            full_path, perms);
     perms->p_full_path =
         (u_char *) strdup((const char *)
             full_path);
     break;
    }
    arg_wr = strtok(((void *)0), ":");
    npath++;
    free(full_path);
   }
   if (!found) {
    printf("\033[91m""[x] ""\033[0m" "" "\033[91m" "%s " "\033[0m" ":not found !\n",
           vtarget);
    return ((void *)0);
   }
   free(full_path);
  }
 }
 free(vtarget);
 return perms->p_full_path;
}

canonical_original_code:
unsigned char *check_target_path(unsigned char *target, struct perms *perms)
{
 char *vtarget;
 char *env_path;
 int npath;
 char *arg_wr; char *full_path;
 int found = 0;
 char current[1025];
 char *rpath;
 vtarget = strdup((char *)target);
 memset(current, 0, 1025);
 rpath = realpath((char *)target, current);
 if (rpath)
  perms->p_full_path = (unsigned char *) strdup((char *)rpath);
 else {
  if (!access((char *)target, 0)) {
   get_file_permissions(target, perms);
   perms->p_full_path =
       (unsigned char *) strdup((char *)target);
  } else {
   env_path = getenv("PATH");
   npath = 0;
   arg_wr = strtok(env_path, ":");
   while (arg_wr) {
    full_path = (char *)
        xmalloc((strlen(arg_wr) + strlen(vtarget) +
          2) * sizeof(char));
    memset(full_path, 0,
           strlen(arg_wr) + strlen(vtarget) + 2);
    strcpy(full_path, arg_wr);
    strcat(full_path, "/");
    strcat(full_path, vtarget);
    if (!access(full_path, 0)) {
     found = 1;
     get_file_permissions((unsigned char *)
            full_path, perms);
     perms->p_full_path =
         (unsigned char *) strdup((char *)
             full_path);
     break;
    }
    arg_wr = strtok(((void *)0), ":");
    npath++;
    free(full_path);
   }
   if (!found) {
    printf("\033[91m""[x] ""\033[0m" "" "\033[91m" "%s " "\033[0m" ":not found !\n",
           vtarget);
    return ((void *)0);
   }
   free(full_path);
  }
 }
 free(vtarget);
 return perms->p_full_path;
}

variable_types:
target
unsigned char *

variable_types: struct perms { unsigned short p_read; unsigned short p_write; unsigned short p_exec; unsigned short p_exist; unsigned char *p_full_path; unsigned char *p_symb; } *

variable_types:
vtarget
char *

variable_types: npath int

variable_types: found int

variable_types:
current
char [1025]

variable_types:
rpath
char *

return_type: unsigned char *


decompiled_code:
void **__fastcall bt_proc_destroy(__int64 a1)
{
void **result; // rax
void *v3; // rdi
__int64 v4; // rbx

result = *(void ***)(a1 + 16);
v3 = *result;
if ( *result )
{
v4 = 1LL;
do
{
free(v3);
result = *(void ***)(a1 + 16);
v3 = result[v4++];
}
while ( v3 );
}
*(_QWORD *)(a1 + 24) = 0LL;
return result;
}

canonical_decompiled_code:
void **__fastcall func6(__int64 a1)
{
void **result; // rax
void *v3; // rdi
__int64 v4; // rbx

result = *(void ***)(a1 + 16);
v3 = *result;
if ( *result )
{
v4 = 1LL;
do
{
free(v3);
result = *(void ***)(a1 + 16);
v3 = result[v4++];
}
while ( v3 );
}
*(_QWORD *)(a1 + 24) = 0LL;
return result;
}

original_code:
void bt_proc_destroy(struct btproc *bt)
{
 int i;
 for (i = 0; *(bt->proc_arguments + i); i++)
  free(*(bt->proc_arguments + i));
 bt->args_parser = ((void *)0);
}

variable_types: i int


original_code:
void pinfo_destroy(struct procinfo *pi)
{
 struct map_addr *ma, *tmp;
 pi->pi_pid = pi->pi_address = pi->pi_offset = 0;
 memset(pi->pi_map, 0, 2);
 if (pi->pi_target)
  free(pi->pi_target);
 if (pi->pi_data)
  free(pi->pi_data);
 if (pi->pi_perm) {
  free(pi->pi_perm->p_full_path);
  free(pi->pi_perm->p_symb);
 }
 for (ma = pi->pi_addr; ma; ma = tmp) {
  tmp = ma->ma_next;
  free(ma);
 }
 if(pi->pi_stack) {
  if(pi->pi_stack->ma_data)
   free(pi->pi_stack->ma_data);
  free(pi->pi_stack);
 }
}

canonical_original_code:
void pinfo_destroy(struct procinfo *pi)
{
 struct map_addr *ma; struct map_addr *tmp;
 pi->pi_pid = pi->pi_address = pi->pi_offset = 0;
 memset(pi->pi_map, 0, 2);
 if (pi->pi_target)
  free(pi->pi_target);
 if (pi->pi_data)
  free(pi->pi_data);
 if (pi->pi_perm) {
  free(pi->pi_perm->p_full_path);
  free(pi->pi_perm->p_symb);
 }
 for (ma = pi->pi_addr; ma; ma = tmp) {
  tmp = ma->ma_next;
  free(ma);
 }
 if(pi->pi_stack) {
  if(pi->pi_stack->ma_data)
   free(pi->pi_stack->ma_data);
  free(pi->pi_stack);
 }
}

variable_types: struct map_addr { unsigned long long ma_map[2]; unsigned char *ma_data; struct map_addr *ma_next; } *


decompiled_code:
__pid_t __fastcall exec_target(__int64 a1)
{
__pid_t *v1; // r12
__pid_t v2; // eax
__pid_t v3; // ebx
__pid_t result; // eax
__int64 v5; // rbx
int *v6; // rax
char *v7; // rax
int *v8; // rax
char *v9; // rax
int *v10; // rax
char *v11; // rax
struct sigaction v12; // [rsp+0h] [rbp-B8h] BYREF

v12.sa_handler = (__sighandler_t)catch_child_proc;
memset(&v12.sa_mask, 0, 0x90uLL);
sigemptyset(&v12.sa_mask);
if ( sigaction(17, &v12, 0LL) == -1 )
{
v8 = _errno_location();
v9 = strerror(*v8);
printfd(2LL, "\x1B[91m[x] \x1B[0msigaction : %s\n", v9);
exit(1);
}
v1 = *(__pid_t **)(a1 + 8);
v2 = fork();
v3 = v2;
if ( v2 )
{
if ( v2 != -1 )
{
result = wait(0LL);
*v1 = v3;
return result;
}
v10 = _errno_location();
v11 = strerror(*v10);
printfd(2LL, "\x1B[91m[x] \x1B[0mline : %d,can't fork :\x1B[91m%s\x1B[0m\n", 322LL, v11);
LABEL_8:
bt_proc_destroy(a1);
exit(1);
}
close(0);
close(1);
close(2);
v5 = ptrace(PTRACE_TRACEME, 0LL, 0LL, 0LL);
result = execve(*(const char **)a1, *(char *const **)(a1 + 16), 0LL);
if ( v5 == -1 )
{
v6 = _errno_location();
v7 = strerror(*v6);
printfd(2LL, "\x1B[91m[x] \x1B[0mline : %d,can't trace the process :\x1B[91m%s\x1B[0m\n", 315LL, v7);
goto LABEL_8;
}
return result;
}

canonical_decompiled_code:
__pid_t __fastcall func8(__int64 a1)
{
__pid_t *v1; // r12
__pid_t v2; // eax
__pid_t v3; // ebx
__pid_t result; // eax
__int64 v5; // rbx
int *v6; // rax
char *v7; // rax
int *v8; // rax
char *v9; // rax
int *v10; // rax
char *v11; // rax
struct sigaction v12; // [rsp+0h] [rbp-B8h] BYREF

v12.sa_handler = (__sighandler_t)catch_child_proc;
memset(&v12.sa_mask, 0, 0x90uLL);
sigemptyset(&v12.sa_mask);
if ( sigaction(17, &v12, 0LL) == -1 )
{
v8 = _errno_location();
v9 = strerror(*v8);
printfd(2LL, "\x1B[91m[x] \x1B[0msigaction : %s\n", v9);
exit(1);
}
v1 = *(__pid_t **)(a1 + 8);
v2 = fork();
v3 = v2;
if ( v2 )
{
if ( v2 != -1 )
{
result = wait(0LL);
*v1 = v3;
return result;
}
v10 = _errno_location();
v11 = strerror(*v10);
printfd(2LL, "\x1B[91m[x] \x1B[0mline : %d,can't fork :\x1B[91m%s\x1B[0m\n", 322LL, v11);
LABEL_8:
func6(a1);
exit(1);
}
close(0);
close(1);
close(2);
v5 = ptrace(PTRACE_TRACEME, 0LL, 0LL, 0LL);
result = execve(*(const char **)a1, *(char *const **)(a1 + 16), 0LL);
if ( v5 == -1 )
{
v6 = _errno_location();
v7 = strerror(*v6);
printfd(2LL, "\x1B[91m[x] \x1B[0mline : %d,can't trace the process :\x1B[91m%s\x1B[0m\n", 315LL, v7);
goto LABEL_8;
}
return result;
}

original_code:
void exec_target(struct btproc *bt)
{
 pid_t pid;
 struct procinfo *pi;
 long ret;
 struct sigaction act;
 memset(&act, 0, sizeof(act));
 act.__sigaction_handler.sa_handler = catch_child_proc;
 act.sa_flags = 0;
 sigemptyset(&act.sa_mask);
 if (sigaction(17, &act, ((void *)0)) == -1) {
  printfd(2, "\033[91m""[x] ""\033[0m" "sigaction : %s\n",
   strerror((*__errno_location ())));
  exit(1);
 }
 pi = bt->pi;
 pid = fork();
 if (pid == 0) {
  close(0);
  close(1);
  close(2);
  ret = ptrace(PTRACE_TRACEME, 0, ((void *)0), ((void *)0));
  execve((const char *)bt->exec, (char **const)bt->proc_arguments,
         ((void *)0));
  if (ret == -1) {
   printfd(2,
    "\033[91m""[x] ""\033[0m" "line : %d,can't trace the process :" "\033[91m"
    "%s" "\033[0m" "\n", 315, strerror((*__errno_location ())));
   bt_proc_destroy(bt);
   exit(1);
  }
 } else if (pid == -1) {
  printfd(2,
   "\033[91m""[x] ""\033[0m" "line : %d,can't fork :" "\033[91m" "%s" "\033[0m" "\n",
   322, strerror((*__errno_location ())));
  bt_proc_destroy(bt);
  exit(1);
 } else {
  wait(((void *)0));
  pi->pi_pid = pid;
 }
}

canonical_original_code:
void exec_target(struct btproc *bt)
{
 int pid;
 struct procinfo *pi;
 long ret;
 struct sigaction act;
 memset(&act, 0, sizeof(act));
 act.__sigaction_handler.sa_handler = catch_child_proc;
 act.sa_flags = 0;
 sigemptyset(&act.sa_mask);
 if (sigaction(17, &act, ((void *)0)) == -1) {
  printfd(2, "\033[91m""[x] ""\033[0m" "sigaction : %s\n",
   strerror((*__errno_location ())));
  exit(1);
 }
 pi = bt->pi;
 pid = fork();
 if (pid == 0) {
  close(0);
  close(1);
  close(2);
  ret = ptrace(PTRACE_TRACEME, 0, ((void *)0), ((void *)0));
  execve((char *)bt->exec, (char **)bt->proc_arguments,
         ((void *)0));
  if (ret == -1) {
   printfd(2,
    "\033[91m""[x] ""\033[0m" "line : %d,can't trace the process :" "\033[91m"
    "%s" "\033[0m" "\n", 315, strerror((*__errno_location ())));
   bt_proc_destroy(bt);
   exit(1);
  }
 } else if (pid == -1) {
  printfd(2,
   "\033[91m""[x] ""\033[0m" "line : %d,can't fork :" "\033[91m" "%s" "\033[0m" "\n",
   322, strerror((*__errno_location ())));
  bt_proc_destroy(bt);
  exit(1);
 } else {
  wait(((void *)0));
  pi->pi_pid = pid;
 }
}

variable_types: pid int

variable_types: ret long

variable_types: struct sigaction { union { void (*sa_handler)(int); void (*sa_sigaction)(int, struct siginfo_t { int si_signo; int si_errno; int si_code; int __pad0; union { int _pad[-1]; struct { int si_pid; unsigned int si_uid; } _kill; struct { int si_tid; int si_overrun; union sigval { int sival_int; void *sival_ptr; } si_sigval; } _timer; struct { int si_pid; unsigned int si_uid; union sigval si_sigval; } _rt; struct { int si_pid; unsigned int si_uid; int si_status; long si_utime; long si_stime; } _sigchld; struct { void *si_addr; short si_addr_lsb; union { struct { void *_lower; void *_upper; } _addr_bnd; unsigned int _pkey; } _bounds; } _sigfault; struct { long si_band; int si_fd; } _sigpoll; struct { void *_call_addr; int _syscall; unsigned int _arch; } _sigsys; } _sifields; } *, void *); } __sigaction_handler; struct __sigset_t { unsigned long __val[-1]; } sa_mask; int sa_flags; void (*sa_restorer)(); }

user_defined_types: struct sigaction { union { void (*sa_handler)(int); void (*sa_sigaction)(int, struct siginfo_t *, void *); } __sigaction_handler; struct __sigset_t sa_mask; int sa_flags; void (*sa_restorer)(); }

user_defined_types: struct siginfo_t { int si_signo; int si_errno; int si_code; int __pad0; union { int _pad[-1]; struct { int si_pid; unsigned int si_uid; } _kill; struct { int si_tid; int si_overrun; union sigval si_sigval; } _timer; struct { int si_pid; unsigned int si_uid; union sigval si_sigval; } _rt; struct { int si_pid; unsigned int si_uid; int si_status; long si_utime; long si_stime; } _sigchld; struct { void *si_addr; short si_addr_lsb; union { struct { void *_lower; void *_upper; } _addr_bnd; unsigned int _pkey; } _bounds; } _sigfault; struct { long si_band; int si_fd; } _sigpoll; struct { void *_call_addr; int _syscall; unsigned int _arch; } _sigsys; } _sifields; }


decompiled_code:
__int64 __fastcall attach_process(__pid_t *a1)
{
unsigned int v1; // ebx

v1 = ptrace(PTRACE_ATTACH, (unsigned int)*a1, 0LL, 0LL);
if ( v1 != -1 )
waitpid(*a1, 0LL, 0);
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func13(__pid_t *a1)
{
unsigned int v1; // ebx

v1 = ptrace(PTRACE_ATTACH, (unsigned int)*a1, 0LL, 0LL);
if ( v1 != -1 )
waitpid(*a1, 0LL, 0);
return v1;
}

original_code:
int attach_process(struct procinfo *pi)
{
 int ret;
 ret = ptrace(PTRACE_ATTACH, pi->pi_pid, 0, 0);
 if (ret == -1)
  return ret;
 waitpid(pi->pi_pid, 0, 0);
 return ret;
}

variable_types: ret int

return_type: int


decompiled_code:
int say_hello_from_extern_main()
{
printf("[%s] hello extern!\n", "say_hello_from_extern_main");
printf(" * pointer to source_one_int_extern: %p\n", &source_one_int_extern);
return printf(" * value of source_one_int_extern: %d\n", (unsigned int)source_one_int_extern);
}

canonical_decompiled_code:
int func7()
{
printf("[%s] hello extern!\n", "say_hello_from_extern_main");
printf(" * pointer to source_one_int_extern: %p\n", &source_one_int_extern);
return printf(" * value of source_one_int_extern: %d\n", (unsigned int)source_one_int_extern);
}

original_code:
void say_hello_from_extern_main(void)
{
    printf("[%s] hello extern!\n", __func__);
    printf(" * pointer to source_one_int_extern: %p\n", &source_one_int_extern);
    printf(" * value of source_one_int_extern: %d\n", source_one_int_extern);
}

canonical_original_code:
void say_hello_from_extern_main()
{
    printf("[%s] hello extern!\n", __func__);
    printf(" * pointer to source_one_int_extern: %p\n", &source_one_int_extern);
    printf(" * value of source_one_int_extern: %d\n", source_one_int_extern);
}


decompiled_code:
int say_hello_from_static_main()
{
printf("[%s] hello static!\n", "say_hello_from_static_main");
printf(" * pointer to source_one_int_static: %p\n", &source_one_int_static);
return printf(" * value of source_one_int_static: %d\n", (unsigned int)source_one_int_static);
}

canonical_decompiled_code:
int func8()
{
printf("[%s] hello static!\n", "say_hello_from_static_main");
printf(" * pointer to source_one_int_static: %p\n", &source_one_int_static);
return printf(" * value of source_one_int_static: %d\n", (unsigned int)source_one_int_static);
}

original_code:
void say_hello_from_static_main(void)
{
    printf("[%s] hello static!\n", __func__);
    printf(" * pointer to source_one_int_static: %p\n", &source_one_int_static);
    printf(" * value of source_one_int_static: %d\n", source_one_int_static);
}

canonical_original_code:
void say_hello_from_static_main()
{
    printf("[%s] hello static!\n", __func__);
    printf(" * pointer to source_one_int_static: %p\n", &source_one_int_static);
    printf(" * value of source_one_int_static: %d\n", source_one_int_static);
}


decompiled_code:
int say_hello_from_extern_source1()
{
printf("[%s] hello extern!\n", "say_hello_from_extern_source1");
printf(" * pointer to source_one_int_extern: %p\n", &source_one_int_extern);
return printf(" * value of source_one_int_extern: %d\n", (unsigned int)source_one_int_extern);
}

canonical_decompiled_code:
int func9()
{
printf("[%s] hello extern!\n", "say_hello_from_extern_source1");
printf(" * pointer to source_one_int_extern: %p\n", &source_one_int_extern);
return printf(" * value of source_one_int_extern: %d\n", (unsigned int)source_one_int_extern);
}

original_code:
void say_hello_from_extern_source1(void)
{
    printf("[%s] hello extern!\n", __func__);
    printf(" * pointer to source_one_int_extern: %p\n", &source_one_int_extern);
    printf(" * value of source_one_int_extern: %d\n", source_one_int_extern);
}

canonical_original_code:
void say_hello_from_extern_source1()
{
    printf("[%s] hello extern!\n", __func__);
    printf(" * pointer to source_one_int_extern: %p\n", &source_one_int_extern);
    printf(" * value of source_one_int_extern: %d\n", source_one_int_extern);
}


decompiled_code:
int say_hello_from_static_source1()
{
printf("[%s] hello static!\n", "say_hello_from_static_source1");
printf(" * pointer to source_one_int_static: %p\n", &source_one_int_static_0);
return printf(" * value of source_one_int_static: %d\n", (unsigned int)source_one_int_static_0);
}

canonical_decompiled_code:
int func10()
{
printf("[%s] hello static!\n", "say_hello_from_static_source1");
printf(" * pointer to source_one_int_static: %p\n", &source_one_int_static_0);
return printf(" * value of source_one_int_static: %d\n", (unsigned int)source_one_int_static_0);
}

original_code:
void say_hello_from_static_source1(void)
{
    printf("[%s] hello static!\n", __func__);
    printf(" * pointer to source_one_int_static: %p\n", &source_one_int_static);
    printf(" * value of source_one_int_static: %d\n", source_one_int_static);
}

canonical_original_code:
void say_hello_from_static_source1()
{
    printf("[%s] hello static!\n", __func__);
    printf(" * pointer to source_one_int_static: %p\n", &source_one_int_static);
    printf(" * value of source_one_int_static: %d\n", source_one_int_static);
}


canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
printf("[%s] hello world\n", "main");
say_hello_from_extern_source1();
source_one_int_extern = 42;
say_hello_from_extern_main();
say_hello_from_extern_source1();
say_hello_from_static_main();
say_hello_from_static_source1();
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
printf("[%s] hello world\n", "main");
func9();
source_one_int_extern = 42;
func7();
func9();
func8();
func10();
return 0;
}

original_code:
int main(void)
{
    printf("[%s] hello world\n", __func__);
    say_hello_from_extern_source1();
    source_one_int_extern = 42;
    say_hello_from_extern_main();
    say_hello_from_extern_source1();
    say_hello_from_static_main();
    say_hello_from_static_source1();
    return 0;
}

canonical_original_code:
int main()
{
    printf("[%s] hello world\n", __func__);
    say_hello_from_extern_source1();
    source_one_int_extern = 42;
    say_hello_from_extern_main();
    say_hello_from_extern_source1();
    say_hello_from_static_main();
    say_hello_from_static_source1();
    return 0;
}


decompiled_code:
int inline_hang_on_random()
{
unsigned int v0; // eax

v0 = time(0LL);
srand(v0);
return rand();
}

canonical_decompiled_code:
int func7()
{
unsigned int v0; // eax

v0 = time(0LL);
srand(v0);
return rand();
}

original_code:
static inline void inline_hang_on_random()
{
    srand(time(((void *)0)));
    unsigned int random_value = rand();
    random_value = random_value % 3200000;
    inline_hang_on(random_value);
}


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbx
__int64 *v4; // rbp
pthread_t *v5; // rdi
__int64 *v6; // rcx
void **v7; // rbp
__int64 i; // rbx
void **v9; // rsi
__int64 v10; // rdx
__int64 v12; // [rsp+0h] [rbp-E8h] BYREF
pthread_t newthread[10]; // [rsp+30h] [rbp-B8h] BYREF
void *thread_return; // [rsp+80h] [rbp-68h] BYREF

v3 = 0LL;
printf("[%s] hello world!\n", "main");
v4 = &v12;
do
{
*(_DWORD *)v4 = v3;
printf("[%s] create thread id %d\n", "main", (unsigned int)v3);
v5 = &newthread[v3];
v6 = v4;
++v3;
v4 = (__int64 *)((char *)v4 + 4);
pthread_create(v5, 0LL, thread_function, v6);
}
while ( v3 != 10 );
v7 = &thread_return;
for ( i = 0LL; i != 10; ++i )
{
v9 = v7++;
pthread_join(newthread[i], v9);
v10 = (unsigned int)i;
printf("[%s] thread id %d returned with exit status %d\n", "main", v10, *(unsigned int *)*(v7 - 1));
fflush(0LL);
}
printf("[%s] return\n", "main");
sleep(1u);
return 0;
}

original_code:
int main(void)
{
    pthread_t thread_handler[10];
    void* exit_status[10];
    int thread_values[10];
    printf("[%s] hello world!\n", __func__);
    for (int thread_index = 0; thread_index < 10; thread_index++)
    {
        thread_values[thread_index] = thread_index;
        printf("[%s] create thread id %d\n", __func__, thread_index);
        pthread_create(&thread_handler[thread_index], ((void *)0), thread_function, &thread_values[thread_index]);
    }
    for (int thread_index = 0; thread_index < 10; thread_index++)
    {
        pthread_join(thread_handler[thread_index], &exit_status[thread_index]);
        printf("[%s] thread id %d returned with exit status %d\n", __func__, thread_index, *(int*)exit_status[thread_index]);
        fflush(((void *)0));
    }
    printf("[%s] return\n", __func__);
    sleep(1);
    return 0;
}

canonical_original_code:
int main()
{
    unsigned long thread_handler[10];
    void *exit_status[10];
    int thread_values[10];
    printf("[%s] hello world!\n", __func__);
    for (int thread_index = 0; thread_index < 10; thread_index++)
    {
        thread_values[thread_index] = thread_index;
        printf("[%s] create thread id %d\n", __func__, thread_index);
        pthread_create(&thread_handler[thread_index], ((void *)0), thread_function, &thread_values[thread_index]);
    }
    for (int thread_index = 0; thread_index < 10; thread_index++)
    {
        pthread_join(thread_handler[thread_index], &exit_status[thread_index]);
        printf("[%s] thread id %d returned with exit status %d\n", __func__, thread_index, *(int *)exit_status[thread_index]);
        fflush(((void *)0));
    }
    printf("[%s] return\n", __func__);
    sleep(1);
    return 0;
}


decompiled_code:
void *__fastcall thread_function(void *a1)
{
unsigned int v1; // ebp
unsigned int v2; // ebx
__int64 v3; // rcx

v1 = *(_DWORD *)a1;
v2 = 0;
do
{
v3 = v2++;
printf("[%s] thread id: %d (loop index: %d)\n", "thread_function", v1, v3);
*(_DWORD *)a1 *= v1;
inline_hang_on_random();
}
while ( v2 != 5 );
return a1;
}

canonical_decompiled_code:
void *__fastcall func8(void *a1)
{
unsigned int v1; // ebp
unsigned int v2; // ebx
__int64 v3; // rcx

v1 = *(_DWORD *)a1;
v2 = 0;
do
{
v3 = v2++;
printf("[%s] thread id: %d (loop index: %d)\n", "thread_function", v1, v3);
*(_DWORD *)a1 *= v1;
func7();
}
while ( v2 != 5 );
return a1;
}

original_code:
void* thread_function(void* argument)
{
    int argument_value = *(int*)argument;
    for (int i = 0; i < 5; i++)
    {
        printf("[%s] thread id: %d (loop index: %d)\n", __func__, argument_value, i);
        *(int*)argument = *(int*)argument * argument_value;
        inline_hang_on_random();
    }
    return argument;
}

canonical_original_code:
void *thread_function(void *argument)
{
    int argument_value = *(int*)argument;
    for (int i = 0; i < 5; i++)
    {
        printf("[%s] thread id: %d (loop index: %d)\n", __func__, argument_value, i);
        *(int *)argument = *(int *)argument * argument_value;
        inline_hang_on_random();
    }
    return argument;
}

variable_types:
argument
void *

return_type: void *


decompiled_code:
__int64 default_handler()
{
char v1; // [rsp+0h] [rbp-8h]

return p_info("default handler called for value 0x%X", v1);
}

canonical_decompiled_code:
__int64 func7()
{
char v1; // [rsp+0h] [rbp-8h]

return func14("default handler called for value 0x%X", v1);
}

original_code:
static int32_t default_handler(uint8_t c)
{
 p_info("default handler called for value 0x%X", c);
}

canonical_original_code:
static int default_handler(unsigned char c)
{
 p_info("default handler called for value 0x%X", c);
}

variable_types:
c
unsigned char


decompiled_code:
__int64 lower_alpha_ascii_char_handler()
{
char v1; // [rsp+0h] [rbp-8h]

return p_info("handling lower case alphanumeric character %c", v1);
}

canonical_decompiled_code:
__int64 func8()
{
char v1; // [rsp+0h] [rbp-8h]

return func14("handling lower case alphanumeric character %c", v1);
}

original_code:
static int32_t lower_alpha_ascii_char_handler(uint8_t c)
{
 p_info("handling lower case alphanumeric character %c", c);
}

canonical_original_code:
static int lower_alpha_ascii_char_handler(unsigned char c)
{
 p_info("handling lower case alphanumeric character %c", c);
}


decompiled_code:
__int64 upper_alpha_ascii_char_handler()
{
char v1; // [rsp+0h] [rbp-8h]

return p_info("handling upper case alphanumeric character %c", v1);
}

canonical_decompiled_code:
__int64 func9()
{
char v1; // [rsp+0h] [rbp-8h]

return func14("handling upper case alphanumeric character %c", v1);
}

original_code:
static int32_t upper_alpha_ascii_char_handler(uint8_t c)
{
 p_info("handling upper case alphanumeric character %c", c);
}

canonical_original_code:
static int upper_alpha_ascii_char_handler(unsigned char c)
{
 p_info("handling upper case alphanumeric character %c", c);
}


decompiled_code:
__int64 num_ascii_char_handler()
{
char v1; // [rsp+0h] [rbp-8h]

return p_info("handling numerical character %c", v1);
}

canonical_decompiled_code:
__int64 func10()
{
char v1; // [rsp+0h] [rbp-8h]

return func14("handling numerical character %c", v1);
}

original_code:
static int32_t num_ascii_char_handler(uint8_t c)
{
 p_info("handling numerical character %c", c);
}

canonical_original_code:
static int num_ascii_char_handler(unsigned char c)
{
 p_info("handling numerical character %c", c);
}


decompiled_code:
__int64 __fastcall trigger_call(unsigned __int8 a1)
{
return ((__int64 (__fastcall *)(_QWORD))handler_lut[a1])(a1);
}

canonical_decompiled_code:
__int64 __fastcall func11(unsigned __int8 a1)
{
return ((__int64 (__fastcall *)(_QWORD))handler_lut[a1])(a1);
}

original_code:
int32_t trigger_call(uint8_t c)
{
 return (*handler_lut[c]) (c);
}

canonical_original_code:
int trigger_call(unsigned char c)
{
 return (*handler_lut[c]) (c);
}


decompiled_code:
__int64 __fastcall init_handler_lut(const char *a1)
{
__int64 v1; // rbx
__int64 result; // rax

v1 = 0LL;
p_debug("sizeof handler_lut: %d", 256LL);
while ( 1 )
{
if ( (unsigned int)(v1 - 48) <= 9 )
{
p_debug("installing nummerical char handler for 0x%x", (unsigned int)v1);
handler_lut[v1] = (__int64)num_ascii_char_handler;
goto LABEL_3;
}
if ( (unsigned int)(v1 - 65) > 0x19 )
break;
p_debug("installing upper alpha ascii char handler for 0x%x", (unsigned int)v1);
handler_lut[v1] = (__int64)upper_alpha_ascii_char_handler;
LABEL_3:
++v1;
}
if ( (unsigned int)(v1 - 97) <= 0x19 )
{
p_debug("installing lower alpha ascii char handler for 0x%x", (unsigned int)v1);
handler_lut[v1] = (__int64)lower_alpha_ascii_char_handler;
goto LABEL_3;
}
result = p_debug("installing default handler for 0x%x", (unsigned int)v1);
handler_lut[v1] = (__int64)default_handler;
if ( (_DWORD)v1 != 255 )
goto LABEL_3;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(const char *a1)
{
__int64 v1; // rbx
__int64 result; // rax

v1 = 0LL;
func15("sizeof handler_lut: %d", 256LL);
while ( 1 )
{
if ( (unsigned int)(v1 - 48) <= 9 )
{
func15("installing nummerical char handler for 0x%x", (unsigned int)v1);
handler_lut[v1] = (__int64)num_ascii_char_handler;
goto LABEL_3;
}
if ( (unsigned int)(v1 - 65) > 0x19 )
break;
func15("installing upper alpha ascii char handler for 0x%x", (unsigned int)v1);
handler_lut[v1] = (__int64)upper_alpha_ascii_char_handler;
LABEL_3:
++v1;
}
if ( (unsigned int)(v1 - 97) <= 0x19 )
{
func15("installing lower alpha ascii char handler for 0x%x", (unsigned int)v1);
handler_lut[v1] = (__int64)lower_alpha_ascii_char_handler;
goto LABEL_3;
}
result = func15("installing default handler for 0x%x", (unsigned int)v1);
handler_lut[v1] = (__int64)default_handler;
if ( (_DWORD)v1 != 255 )
goto LABEL_3;
return result;
}

original_code:
void init_handler_lut()
{
 p_debug("sizeof handler_lut: %d", ((255) + 1));
 for (uint32_t i = 0; i < ((255) + 1); i++) {
  if (i >= 48 && i <= 57) {
   p_debug("installing nummerical char handler for 0x%x",
    i);
   handler_lut[i] = &num_ascii_char_handler;
   continue;
  }
  if (i >= 65 && i <= 90) {
   p_debug
       ("installing upper alpha ascii char handler for 0x%x",
        i);
   handler_lut[i] = &upper_alpha_ascii_char_handler;
   continue;
  }
  if (i >= 97 && i <= 122) {
   p_debug
       ("installing lower alpha ascii char handler for 0x%x",
        i);
   handler_lut[i] = &lower_alpha_ascii_char_handler;
   continue;
  }
  p_debug("installing default handler for 0x%x", i);
  handler_lut[i] = &default_handler;
 }
}

canonical_original_code:
void init_handler_lut()
{
 p_debug("sizeof handler_lut: %d", ((255) + 1));
 for (unsigned int i = 0; i < ((255) + 1); i++) {
  if (i >= 48 && i <= 57) {
   p_debug("installing nummerical char handler for 0x%x",
    i);
   handler_lut[i] = &num_ascii_char_handler;
   continue;
  }
  if (i >= 65 && i <= 90) {
   p_debug
       ("installing upper alpha ascii char handler for 0x%x",
        i);
   handler_lut[i] = &upper_alpha_ascii_char_handler;
   continue;
  }
  if (i >= 97 && i <= 122) {
   p_debug
       ("installing lower alpha ascii char handler for 0x%x",
        i);
   handler_lut[i] = &lower_alpha_ascii_char_handler;
   continue;
  }
  p_debug("installing default handler for 0x%x", i);
  handler_lut[i] = &default_handler;
 }
}

variable_types:
i
unsigned int


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

va_start(arg, format);
fwrite("[!] ", 1uLL, 4uLL, stderr);
vfprintf(stderr, format, arg);
return fputc(10, stderr);
}

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

va_start(arg, format);
fwrite("[!] ", 1uLL, 4uLL, stderr);
vfprintf(stderr, format, arg);
return fputc(10, stderr);
}

original_code:
void p_error(const char *format, ...)
{
 va_list args;
 fprintf(stderr, "[!] ");
 __builtin_va_start(args,format);
 vfprintf(stderr, format, args);
 __builtin_va_end(args);
 fprintf(stderr, "\n");
}

canonical_original_code:
void p_error(char *format, ...)
{
 __builtin_va_list args;
 fprintf(stderr, "[!] ");
 __builtin_va_start(args,format);
 vfprintf(stderr, format, args);
 __builtin_va_end(args);
 fprintf(stderr, "\n");
}

variable_types:
format
char *


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

va_start(arg, format);
fwrite("[i] ", 1uLL, 4uLL, _bss_start);
vfprintf(_bss_start, format, arg);
return fputc(10, _bss_start);
}

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

va_start(arg, format);
fwrite("[i] ", 1uLL, 4uLL, _bss_start);
vfprintf(_bss_start, format, arg);
return fputc(10, _bss_start);
}

original_code:
void p_info(const char *format, ...)
{
 va_list args;
 fprintf(stdout, "[i] ");
 __builtin_va_start(args,format);
 vfprintf(stdout, format, args);
 __builtin_va_end(args);
 fprintf(stdout, "\n");
}

canonical_original_code:
void p_info(char *format, ...)
{
 __builtin_va_list args;
 fprintf(stdout, "[i] ");
 __builtin_va_start(args,format);
 vfprintf(stdout, format, args);
 __builtin_va_end(args);
 fprintf(stdout, "\n");
}


decompiled_code:
void __fastcall p_debug(const char *a1)
{
;
}

canonical_decompiled_code:
void __fastcall func15(const char *a1)
{
;
}

original_code:
void p_debug(const char *format, ...)
{
}

canonical_original_code:
void p_debug(char *format, ...)
{
}


decompiled_code:
__int64 run_some_char_test()
{
trigger_call(0x61u);
trigger_call(0x42u);
trigger_call(0x30u);
return trigger_call(0x2Fu);
}

original_code:
void run_some_char_test(void)
{
 trigger_call('a');
 trigger_call('B');
 trigger_call('0');
 trigger_call('/');
}

canonical_original_code:
void run_some_char_test()
{
 trigger_call('a');
 trigger_call('B');
 trigger_call('0');
 trigger_call('/');
}


decompiled_code:
__int64 run_full_char_test()
{
int i; // ebx
unsigned __int8 v1; // di
__int64 result; // rax

for ( i = 0; i != 256; ++i )
{
v1 = i;
result = trigger_call(v1);
}
return result;
}

canonical_decompiled_code:
__int64 func17()
{
int i; // ebx
unsigned __int8 v1; // di
__int64 result; // rax

for ( i = 0; i != 256; ++i )
{
v1 = i;
result = func11(v1);
}
return result;
}

original_code:
void run_full_char_test(void)
{
 for (uint32_t i = 0; i < ((255) + 1); i++) {
  const uint8_t value = (uint8_t) i;
  trigger_call(value);
 }
}

canonical_original_code:
void run_full_char_test()
{
 for (unsigned int i = 0; i < ((255) + 1); i++) {
  unsigned char value = (uint8_t) i;
  trigger_call(value);
 }
}

variable_types:
value
unsigned char


original_code:
void run_ascii_str_test(const char *str)
{
 char test_string[] =
     "hello world! i am a test sting with several letters.";
 for (uint32_t i = 0; i < strlen(test_string); i++) {
  trigger_call(test_string[i]);
 }
}

canonical_original_code:
void run_ascii_str_test(char *str)
{
 char test_string[] = "hello world! i am a test sting with several letters.";
 for (unsigned int i = 0; i < strlen(test_string); i++) {
  trigger_call(test_string[i]);
 }
}

variable_types:
str
char *


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char v4; // [rsp+0h] [rbp-8h]
char v5; // [rsp+0h] [rbp-8h]
char v6; // [rsp+0h] [rbp-8h]
char v7; // [rsp+0h] [rbp-8h]
char v8; // [rsp+0h] [rbp-8h]

p_info("entering main", v4);
p_info("lut size:\t\t\t%d entries", v5);
p_info("size of void*:\t\t%d byte", v6);
p_info("size of handler_lut:\t%d byte", v7);
init_handler_lut("size of handler_lut:\t%d byte", 2048LL);
run_some_char_test();
run_full_char_test();
run_ascii_str_test("hello world!");
p_info("exit gracefully", v8);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char v4; // [rsp+0h] [rbp-8h]
char v5; // [rsp+0h] [rbp-8h]
char v6; // [rsp+0h] [rbp-8h]
char v7; // [rsp+0h] [rbp-8h]
char v8; // [rsp+0h] [rbp-8h]

func14("entering main", v4);
func14("lut size:\t\t\t%d entries", v5);
func14("size of void*:\t\t%d byte", v6);
func14("size of handler_lut:\t%d byte", v7);
func12("size of handler_lut:\t%d byte", 2048LL);
func16();
func17();
func18("hello world!");
func14("exit gracefully", v8);
return 0;
}

original_code:
int main(void)
{
 p_info("entering main");
 p_info("lut size:\t\t\t%d entries", ((255) + 1));
 p_info("size of void*:\t\t%d byte", sizeof(void *));
 p_info("size of handler_lut:\t%d byte", sizeof(handler_lut));
 init_handler_lut();
 run_some_char_test();
 run_full_char_test();
 run_ascii_str_test("hello world!");
 p_info("exit gracefully");
 return 0;
}

canonical_original_code:
int main()
{
 p_info("entering main");
 p_info("lut size:\t\t\t%d entries", ((255) + 1));
 p_info("size of void*:\t\t%d byte", sizeof(void *));
 p_info("size of handler_lut:\t%d byte", sizeof(handler_lut));
 init_handler_lut();
 run_some_char_test();
 run_full_char_test();
 run_ascii_str_test("hello world!");
 p_info("exit gracefully");
 return 0;
}


decompiled_code:
int print_data_type_size()
{
puts("[i] sizes on your architecture:");
printf("sizeof(char):\t\t%lu\n", 1LL);
printf("sizeof(short):\t\t%lu\n", 2LL);
printf("sizeof(int):\t\t%lu\n", 4LL);
printf("sizeof(long):\t\t%lu\n", 8LL);
putchar(10);
printf("sizeof(void*):\t\t%lu\n", 8LL);
printf("sizeof(char*):\t\t%lu\n", 8LL);
printf("sizeof(short*):\t\t%lu\n", 8LL);
printf("sizeof(int*):\t\t%lu\n", 8LL);
printf("sizeof(long*):\t\t%lu\n", 8LL);
putchar(10);
printf("sizeof(my_data_t):\t%lu\n", 32LL);
return putchar(10);
}

canonical_decompiled_code:
int func7()
{
puts("[i] sizes on your architecture:");
printf("sizeof(char):\t\t%lu\n", 1LL);
printf("sizeof(short):\t\t%lu\n", 2LL);
printf("sizeof(int):\t\t%lu\n", 4LL);
printf("sizeof(long):\t\t%lu\n", 8LL);
putchar(10);
printf("sizeof(void*):\t\t%lu\n", 8LL);
printf("sizeof(char*):\t\t%lu\n", 8LL);
printf("sizeof(short*):\t\t%lu\n", 8LL);
printf("sizeof(int*):\t\t%lu\n", 8LL);
printf("sizeof(long*):\t\t%lu\n", 8LL);
putchar(10);
printf("sizeof(my_data_t):\t%lu\n", 32LL);
return putchar(10);
}

original_code:
void print_data_type_size()
{
    printf("[i] sizes on your architecture:\n");
    printf("sizeof(char):\t\t%lu\n", sizeof(char));
    printf("sizeof(short):\t\t%lu\n", sizeof(short));
    printf("sizeof(int):\t\t%lu\n", sizeof(int));
    printf("sizeof(long):\t\t%lu\n", sizeof(long));
    printf("\n");
    printf("sizeof(void*):\t\t%lu\n", sizeof(void*));
    printf("sizeof(char*):\t\t%lu\n", sizeof(char*));
    printf("sizeof(short*):\t\t%lu\n", sizeof(short*));
    printf("sizeof(int*):\t\t%lu\n", sizeof(int*));
    printf("sizeof(long*):\t\t%lu\n", sizeof(long*));
    printf("\n");
    printf("sizeof(my_data_t):\t%lu\n", sizeof(my_data_t));
    printf("\n");
}

canonical_original_code:
void print_data_type_size()
{
    printf("[i] sizes on your architecture:\n");
    printf("sizeof(char):\t\t%lu\n", sizeof(char));
    printf("sizeof(short):\t\t%lu\n", sizeof(short));
    printf("sizeof(int):\t\t%lu\n", sizeof(int));
    printf("sizeof(long):\t\t%lu\n", sizeof(long));
    printf("\n");
    printf("sizeof(void*):\t\t%lu\n", sizeof(void *));
    printf("sizeof(char*):\t\t%lu\n", sizeof(char *));
    printf("sizeof(short*):\t\t%lu\n", sizeof(short *));
    printf("sizeof(int*):\t\t%lu\n", sizeof(int *));
    printf("sizeof(long*):\t\t%lu\n", sizeof(long *));
    printf("\n");
    printf("sizeof(my_data_t):\t%lu\n", sizeof(my_data_t));
    printf("\n");
}


hexdump

decompiled_code:
int __fastcall hexdump(unsigned __int8 *a1, __int64 a2)
{
int result; // eax
__int64 v3; // rbx
__int64 v4; // r15
int v5; // ebp
unsigned int v6; // ebp
int v7; // er14
const unsigned __int16 **v8; // rax
__int64 v9; // rdx

printf("\n[i] print %d bytes from address %p\n", a2, a1);
result = 8 - (a2 & 7);
if ( (a2 & 7) == 0 )
result = 0;
v3 = 0LL;
v4 = (unsigned int)(result + a2);
while ( v4 != v3 )
{
v5 = v3 & 7;
if ( (v3 & 7) == 0 )
printf("0x%06x: ", (unsigned int)v3);
if ( (unsigned int)a2 > (unsigned int)v3 )
{
result = printf("%02x ", a1[v3]);
if ( v5 != 7 )
goto LABEL_5;
}
else
{
result = printf(" ");
if ( v5 != 7 )
goto LABEL_5;
}
v6 = v3 - 7;
v7 = v3 + ((int)v3 + 1 < (unsigned int)(v3 - 6) ? 0xFFFFFFF9 : 0) + 1;
do
{
while ( 1 )
{
if ( (unsigned int)a2 <= v6 )
{
putchar(32);
goto LABEL_13;
}
v8 = __ctype_b_loc();
v9 = (char)a1[v6];
if ( ((*v8)[v9] & 0x4000) == 0 )
break;
putchar((unsigned __int8)v9);
LABEL_13:
if ( v7 == ++v6 )
goto LABEL_17;
}
++v6;
putchar(46);
}
while ( v7 != v6 );
LABEL_17:
result = putchar(10);
LABEL_5:
++v3;
}
return result;
}

canonical_decompiled_code:
int __fastcall func8(unsigned __int8 *a1, __int64 a2)
{
int result; // eax
__int64 v3; // rbx
__int64 v4; // r15
int v5; // ebp
unsigned int v6; // ebp
int v7; // er14
const unsigned __int16 **v8; // rax
__int64 v9; // rdx

printf("\n[i] print %d bytes from address %p\n", a2, a1);
result = 8 - (a2 & 7);
if ( (a2 & 7) == 0 )
result = 0;
v3 = 0LL;
v4 = (unsigned int)(result + a2);
while ( v4 != v3 )
{
v5 = v3 & 7;
if ( (v3 & 7) == 0 )
printf("0x%06x: ", (unsigned int)v3);
if ( (unsigned int)a2 > (unsigned int)v3 )
{
result = printf("%02x ", a1[v3]);
if ( v5 != 7 )
goto LABEL_5;
}
else
{
result = printf(" ");
if ( v5 != 7 )
goto LABEL_5;
}
v6 = v3 - 7;
v7 = v3 + ((int)v3 + 1 < (unsigned int)(v3 - 6) ? 0xFFFFFFF9 : 0) + 1;
do
{
while ( 1 )
{
if ( (unsigned int)a2 <= v6 )
{
putchar(32);
goto LABEL_13;
}
v8 = __ctype_b_loc();
v9 = (char)a1[v6];
if ( ((*v8)[v9] & 0x4000) == 0 )
break;
putchar((unsigned __int8)v9);
LABEL_13:
if ( v7 == ++v6 )
goto LABEL_17;
}
++v6;
putchar(46);
}
while ( v7 != v6 );
LABEL_17:
result = putchar(10);
LABEL_5:
++v3;
}
return result;
}

original_code:
void hexdump(void *mem, unsigned int len)
{
    printf("\n[i] print %d bytes from address %p\n", len, mem);
    unsigned int i, j;
    for(i = 0; i < len + ((len % 8) ? (8 - len % 8) : 0); i++)
    {
        if(i % 8 == 0)
        {
            printf("0x%06x: ", i);
        }
        if(i < len)
        {
            printf("%02x ", 0xFF & ((char*)mem)[i]);
        }
        else
        {
            printf("   ");
        }
        if(i % 8 == (8 - 1))
        {
            for(j = i - (8 - 1); j <= i; j++)
            {
                if(j >= len)
                    {
                        putchar(' ');
                    }
                    else if(((*__ctype_b_loc ())[(int) ((((char*)mem)[j]))] & (unsigned short int) _ISprint))
                    {
                        putchar(0xFF & ((char*)mem)[j]);
                    }
                    else
                    {
                        putchar('.');
                    }
                }
                putchar('\n');
        }
    }
}

canonical_original_code:
void hexdump(void *mem, unsigned int len)
{
    printf("\n[i] print %d bytes from address %p\n", len, mem);
    unsigned int i; unsigned int j;
    for(i = 0; i < len + ((len % 8) ? (8 - len % 8) : 0); i++)
    {
        if(i % 8 == 0)
        {
            printf("0x%06x: ", i);
        }
        if(i < len)
        {
            printf("%02x ", 0xFF & ((char *)mem)[i]);
        }
        else
        {
            printf("   ");
        }
        if(i % 8 == (8 - 1))
        {
            for(j = i - (8 - 1); j <= i; j++)
            {
                if(j >= len)
                    {
                        putchar(' ');
                    }
                    else if(((*__ctype_b_loc ())[(int) ((((char *)mem)[j]))] & (unsigned short) _ISprint))
                    {
                        putchar(0xFF & ((char *)mem)[j]);
                    }
                    else
                    {
                        putchar('.');
                    }
                }
                putchar('\n');
        }
    }
}

variable_types:
mem
void *

variable_types:
len
unsigned int

variable_types:
j
unsigned int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__m128i v3; // xmm2
__int64 v5[4]; // [rsp+0h] [rbp-68h] BYREF
__m128i v6; // [rsp+20h] [rbp-48h] BYREF
__m128i v7; // [rsp+30h] [rbp-38h] BYREF
__m128i v8; // [rsp+40h] [rbp-28h] BYREF
__m128i v9; // [rsp+50h] [rbp-18h]

print_data_type_size(argc, argv, envp);
v6.m128i_i32[0] = -1412567278;
v6.m128i_i64[1] = 0x123456789ABCDEFLL;
v7.m128i_i8[0] = -52;
v5[0] = 4LL;
v5[1] = 5LL;
v5[2] = 6LL;
v7.m128i_i64[1] = (__int64)v5;
printf("[i] data0 memory:");
hexdump(&v6, 32LL);
v8 = _mm_load_si128((const __m128i *)&xmmword_402190);
v9 = v8;
printf("[i] data1 memory:");
hexdump(&v8, 32LL);
puts("[i] assign data0 to data1...");
v3 = _mm_loadu_si128(&v7);
v8 = _mm_loadu_si128(&v6);
v9 = v3;
puts("[i] compare data, byte by byte...");
if ( *(_OWORD *)&v8 == *(_OWORD *)&v6 && *(_OWORD *)&v9 == *(_OWORD *)&v7 )
puts(" * data does match!");
else
puts(" * data does _not_ match!");
puts("\n");
printf("[i] data0 memory:");
hexdump(&v6, 32LL);
putchar(10);
printf("[i] data1 memory:");
hexdump(&v8, 32LL);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__m128i v3; // xmm2
__int64 v5[4]; // [rsp+0h] [rbp-68h] BYREF
__m128i v6; // [rsp+20h] [rbp-48h] BYREF
__m128i v7; // [rsp+30h] [rbp-38h] BYREF
__m128i v8; // [rsp+40h] [rbp-28h] BYREF
__m128i v9; // [rsp+50h] [rbp-18h]

func7(argc, argv, envp);
v6.m128i_i32[0] = -1412567278;
v6.m128i_i64[1] = 0x123456789ABCDEFLL;
v7.m128i_i8[0] = -52;
v5[0] = 4LL;
v5[1] = 5LL;
v5[2] = 6LL;
v7.m128i_i64[1] = (__int64)v5;
printf("[i] data0 memory:");
func8(&v6, 32LL);
v8 = _mm_load_si128((const __m128i *)&xmmword_402190);
v9 = v8;
printf("[i] data1 memory:");
func8(&v8, 32LL);
puts("[i] assign data0 to data1...");
v3 = _mm_loadu_si128(&v7);
v8 = _mm_loadu_si128(&v6);
v9 = v3;
puts("[i] compare data, byte by byte...");
if ( *(_OWORD *)&v8 == *(_OWORD *)&v6 && *(_OWORD *)&v9 == *(_OWORD *)&v7 )
puts(" * data does match!");
else
puts(" * data does _not_ match!");
puts("\n");
printf("[i] data0 memory:");
func8(&v6, 32LL);
putchar(10);
printf("[i] data1 memory:");
func8(&v8, 32LL);
return 0;
}

original_code:
int main(void)
{
    print_data_type_size();
    my_data_t data0 = {.hello = 0xABCDEF12, .world = 0x0123456789ABCDEF, .pain = 0xCC, .p_int_array = (long[]){4,5,6}};
    printf("[i] data0 memory:");
    hexdump(&data0, sizeof(data0));
    my_data_t data1;
    memset(&data1, 0x42, sizeof(data1));
    printf("[i] data1 memory:");
    hexdump(&data1, sizeof(data1));
    printf("[i] assign data0 to data1...\n");
    data1 = data0;
    printf("[i] compare data, byte by byte...\n");
    if (!memcmp(&data0, &data1, sizeof(my_data_t)))
    {
        printf(" * data does match!\n");
    }
    else
    {
        printf(" * data does _not_ match!\n");
    }
    printf("\n\n");
    printf("[i] data0 memory:");
    hexdump(&data0, sizeof(data0));
    printf("\n");
    printf("[i] data1 memory:");
    hexdump(&data1, sizeof(data1));
    return 0;
}

canonical_original_code:
int main()
{
    print_data_type_size();
    struct my_data data0 = {.hello = 0xABCDEF12, .world = 0x0123456789ABCDEF, .pain = 0xCC, .p_int_array = (long[]){4,5,6}};
    printf("[i] data0 memory:");
    hexdump(&data0, sizeof(data0));
    struct my_data data1;
    memset(&data1, 0x42, sizeof(data1));
    printf("[i] data1 memory:");
    hexdump(&data1, sizeof(data1));
    printf("[i] assign data0 to data1...\n");
    data1 = data0;
    printf("[i] compare data, byte by byte...\n");
    if (!memcmp(&data0, &data1, sizeof(my_data_t)))
    {
        printf(" * data does match!\n");
    }
    else
    {
        printf(" * data does _not_ match!\n");
    }
    printf("\n\n");
    printf("[i] data0 memory:");
    hexdump(&data0, sizeof(data0));
    printf("\n");
    printf("[i] data1 memory:");
    hexdump(&data1, sizeof(data1));
    return 0;
}

variable_types: struct my_data { int hello; long world; char pain; long *p_int_array; }


decompiled_code:
__int64 __fastcall hexchar_to_bin(char *a1)
{
char *v1; // rsi
__int64 result; // rax
char v3; // cl
int v4; // edx

v1 = a1 + 2;
LODWORD(result) = 0;
while ( 1 )
{
v3 = *a1++;
LOBYTE(v4) = v3 - 48;
if ( (unsigned __int8)(v3 - 48) <= 9u )
goto LABEL_7;
if ( (unsigned __int8)(v3 - 97) <= 5u )
{
LOBYTE(v4) = v3 - 87;
LABEL_7:
v4 = (char)v4;
goto LABEL_8;
}
if ( (unsigned __int8)(v3 - 65) > 5u )
break;
v4 = (char)(v3 - 55);
LABEL_8:
result = (unsigned int)(v4 + 16 * result);
if ( v1 == a1 )
return result;
}
printf("[ERROR @ %s] unable to convert %c%c to hex\n", "hexchar_to_bin", (unsigned int)*a1, (unsigned int)a1[1]);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *a1)
{
char *v1; // rsi
__int64 result; // rax
char v3; // cl
int v4; // edx

v1 = a1 + 2;
LODWORD(result) = 0;
while ( 1 )
{
v3 = *a1++;
LOBYTE(v4) = v3 - 48;
if ( (unsigned __int8)(v3 - 48) <= 9u )
goto LABEL_7;
if ( (unsigned __int8)(v3 - 97) <= 5u )
{
LOBYTE(v4) = v3 - 87;
LABEL_7:
v4 = (char)v4;
goto LABEL_8;
}
if ( (unsigned __int8)(v3 - 65) > 5u )
break;
v4 = (char)(v3 - 55);
LABEL_8:
result = (unsigned int)(v4 + 16 * result);
if ( v1 == a1 )
return result;
}
printf("[ERROR @ %s] unable to convert %c%c to hex\n", "hexchar_to_bin", (unsigned int)*a1, (unsigned int)a1[1]);
return 0LL;
}

original_code:
unsigned char hexchar_to_bin(const char *s)
{
    int ret = 0;
    int i;
    for(i = 0; i < 2; i++)
    {
        char c = *s++;
        int n = 0;
        if ('0' <= c && c <= '9')
            n = c - '0';
        else if ('a' <=c && c<='f')
            n = 10 + c - 'a';
        else if('A' <=c && c <= 'F')
            n = 10 + c - 'A';
        else
        {
            printf("[ERROR @ %s] unable to convert %c%c to hex\n", __func__, *(s), *(s+1));
            return 0;
        }
        ret = n + ret * 16;
    }
    return ret;
}

canonical_original_code:
unsigned char hexchar_to_bin(char *s)
{
    int ret = 0;
    int i;
    for(i = 0; i < 2; i++)
    {
        char c = *s++;
        int n = 0;
        if ('0' <= c && c <= '9')
            n = c - '0';
        else if ('a' <=c && c<='f')
            n = 10 + c - 'a';
        else if('A' <=c && c <= 'F')
            n = 10 + c - 'A';
        else
        {
            printf("[ERROR @ %s] unable to convert %c%c to hex\n", __func__, *(s), *(s+1));
            return 0;
        }
        ret = n + ret * 16;
    }
    return ret;
}

variable_types:
s
char *

variable_types: c char

variable_types: n int

return_type: unsigned char


decompiled_code:
__int64 __fastcall convert_hex_string_to_bin(void *src, _DWORD *a2)
{
unsigned int v2; // eax
unsigned int v3; // er12
unsigned int v4; // ebx
int v5; // ebx
unsigned int v6; // er12
char *v7; // r13
int v8; // ebx
char *v9; // rdi
int v10; // eax
__int64 result; // rax
char v12; // [rsp+5h] [rbp-33h] BYREF
char dest[50]; // [rsp+6h] [rbp-32h] BYREF

v2 = strlen((const char *)src);
v3 = v2 - 3;
v4 = v2;
if ( v2 - 3 > 7 )
{
printf("[ERROR @ %s] input string length (%d) is not valid\n", "convert_hex_string_to_bin", v2);
result = 0xFFFFFFFFLL;
}
else if ( *(_BYTE *)src == 48 && (*((_BYTE *)src + 1) & 0xDF) == 88 )
{
memcpy(dest, src, (int)v2);
if ( (v4 & 1) != 0 )
dest[1] = 48;
v5 = v4 - 1;
*a2 = 0;
if ( v5 > 1 )
{
v6 = v3 & 0xFFFFFFFE;
v7 = &v12 + v5;
v8 = 0;
do
{
v9 = v7;
v7 -= 2;
*a2 |= (unsigned __int8)hexchar_to_bin(v9) << (8 * (v8 >> 1));
v10 = v8;
v8 += 2;
}
while ( v10 != v6 );
}
result = 0LL;
}
else
{
printf(
"[ERROR @ %s] hex string identifier (leading 0x) not found in string %s...\n",
"convert_hex_string_to_bin",
(const char *)src);
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(void *src, _DWORD *a2)
{
unsigned int v2; // eax
unsigned int v3; // er12
unsigned int v4; // ebx
int v5; // ebx
unsigned int v6; // er12
char *v7; // r13
int v8; // ebx
char *v9; // rdi
int v10; // eax
__int64 result; // rax
char v12; // [rsp+5h] [rbp-33h] BYREF
char dest[50]; // [rsp+6h] [rbp-32h] BYREF

v2 = strlen((const char *)src);
v3 = v2 - 3;
v4 = v2;
if ( v2 - 3 > 7 )
{
printf("[ERROR @ %s] input string length (%d) is not valid\n", "convert_hex_string_to_bin", v2);
result = 0xFFFFFFFFLL;
}
else if ( *(_BYTE *)src == 48 && (*((_BYTE *)src + 1) & 0xDF) == 88 )
{
memcpy(dest, src, (int)v2);
if ( (v4 & 1) != 0 )
dest[1] = 48;
v5 = v4 - 1;
*a2 = 0;
if ( v5 > 1 )
{
v6 = v3 & 0xFFFFFFFE;
v7 = &v12 + v5;
v8 = 0;
do
{
v9 = v7;
v7 -= 2;
*a2 |= (unsigned __int8)func0(v9) << (8 * (v8 >> 1));
v10 = v8;
v8 += 2;
}
while ( v10 != v6 );
}
result = 0LL;
}
else
{
printf(
"[ERROR @ %s] hex string identifier (leading 0x) not found in string %s...\n",
"convert_hex_string_to_bin",
(const char *)src);
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int convert_hex_string_to_bin(const char *hex_string, int32_t* integer_value)
{
    const static unsigned int min_string_size_in_chars = 2 + (sizeof(int32_t) * 2) / 8;
    const static unsigned int max_string_size_in_chars = 2 + (sizeof(int32_t) * 2) / 1;
    int string_length = strlen(hex_string);
    if (string_length < min_string_size_in_chars || string_length > max_string_size_in_chars)
    {
        printf("[ERROR @ %s] input string length (%d) is not valid\n", __func__, string_length);
        return -1;
    }
    if (!(hex_string[0] == '0' && (hex_string[1] == 'x' || hex_string[1] == 'X')))
    {
        printf("[ERROR @ %s] hex string identifier (leading 0x) not found in string %s...\n", __func__, hex_string);
        return -1;
    }
    char my_string_buffer[max_string_size_in_chars];
    memcpy(my_string_buffer, hex_string, string_length);
    if (string_length % 2 != 0 )
    {
        my_string_buffer[1] = '0';
    }
    *integer_value = 0x00000000;
    int shift = 0;
    for (int i = string_length - 1; i > 1 ; i--)
    {
        i--;
        shift = (string_length - 2 - i) / 2 * 8;
        *integer_value |= hexchar_to_bin(&my_string_buffer[i]) << shift;
    }
    return 0;
}

canonical_original_code:
int convert_hex_string_to_bin(char *hex_string, int *integer_value)
{
    static unsigned int min_string_size_in_chars = 2 + (sizeof(int32_t) * 2) / 8;
    static unsigned int max_string_size_in_chars = 2 + (sizeof(int32_t) * 2) / 1;
    int string_length = strlen(hex_string);
    if (string_length < min_string_size_in_chars || string_length > max_string_size_in_chars)
    {
        printf("[ERROR @ %s] input string length (%d) is not valid\n", __func__, string_length);
        return -1;
    }
    if (!(hex_string[0] == '0' && (hex_string[1] == 'x' || hex_string[1] == 'X')))
    {
        printf("[ERROR @ %s] hex string identifier (leading 0x) not found in string %s...\n", __func__, hex_string);
        return -1;
    }
    char my_string_buffer[-1];
    memcpy(my_string_buffer, hex_string, string_length);
    if (string_length % 2 != 0 )
    {
        my_string_buffer[1] = '0';
    }
    *integer_value = 0x00000000;
    int shift = 0;
    for (int i = string_length - 1; i > 1 ; i--)
    {
        i--;
        shift = (string_length - 2 - i) / 2 * 8;
        *integer_value |= hexchar_to_bin(&my_string_buffer[i]) << shift;
    }
    return 0;
}

variable_types: shift int

variable_types: i int


decompiled_code:
int __fastcall print_n_spaces(int a1)
{
int i; // ebx
int result; // eax

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
result = putchar(32);
}
return result;
}

canonical_decompiled_code:
int __fastcall func2(int a1)
{
int i; // ebx
int result; // eax

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
result = putchar(32);
}
return result;
}

original_code:
void print_n_spaces(int n)
{
    for (int i = 0; i < n; i++)
    {
        printf(" ");
    }
}


decompiled_code:
int global_increment_module2()
{
int result; // eax

result = printf("[%s] increment global_value...\n", "global_increment_module2");
++global_value;
return result;
}

canonical_decompiled_code:
int func0()
{
int result; // eax

result = printf("[%s] increment global_value...\n", "global_increment_module2");
++global_value;
return result;
}

original_code:
void global_increment_module2(void)
{
    printf("[%s] increment global_value...\n", __func__);
    global_value++;
}

canonical_original_code:
void global_increment_module2()
{
    printf("[%s] increment global_value...\n", __func__);
    global_value++;
}


decompiled_code:
int global_print_address_module2()
{
return printf("[%s] global_value address: %p\n", "global_print_address_module2", &global_value);
}

canonical_decompiled_code:
int func1()
{
return printf("[%s] global_value address: %p\n", "global_print_address_module2", &global_value);
}

original_code:
void global_print_address_module2(void)
{
    printf("[%s] global_value address: %p\n", __func__, &global_value);
}

canonical_original_code:
void global_print_address_module2()
{
    printf("[%s] global_value address: %p\n", __func__, &global_value);
}


decompiled_code:
int global_print_module2()
{
return printf("[%s] global_value is %d\n", "global_print_module2", (unsigned int)global_value);
}

canonical_decompiled_code:
int func2()
{
return printf("[%s] global_value is %d\n", "global_print_module2", (unsigned int)global_value);
}

original_code:
void global_print_module2(void)
{
    printf("[%s] global_value is %d\n", __func__, global_value);
}

canonical_original_code:
void global_print_module2()
{
    printf("[%s] global_value is %d\n", __func__, global_value);
}


decompiled_code:
int global_increment_module1()
{
int result; // eax

result = printf("[%s] increment global_value...\n", "global_increment_module1");
++global_value;
return result;
}

canonical_decompiled_code:
int func0()
{
int result; // eax

result = printf("[%s] increment global_value...\n", "global_increment_module1");
++global_value;
return result;
}

original_code:
void global_increment_module1(void)
{
    printf("[%s] increment global_value...\n", __func__);
    global_value++;
}

canonical_original_code:
void global_increment_module1()
{
    printf("[%s] increment global_value...\n", __func__);
    global_value++;
}


decompiled_code:
int global_print_address_module1()
{
return printf("[%s] global_value address: %p\n", "global_print_address_module1", &global_value);
}

canonical_decompiled_code:
int func1()
{
return printf("[%s] global_value address: %p\n", "global_print_address_module1", &global_value);
}

original_code:
void global_print_address_module1(void)
{
    printf("[%s] global_value address: %p\n", __func__, &global_value);
}

canonical_original_code:
void global_print_address_module1()
{
    printf("[%s] global_value address: %p\n", __func__, &global_value);
}


decompiled_code:
int global_print_module1()
{
return printf("[%s] global_value is %d\n", "global_print_module1", (unsigned int)global_value);
}

canonical_decompiled_code:
int func2()
{
return printf("[%s] global_value is %d\n", "global_print_module1", (unsigned int)global_value);
}

original_code:
void global_print_module1(void)
{
    printf("[%s] global_value is %d\n", __func__, global_value);
}

canonical_original_code:
void global_print_module1()
{
    printf("[%s] global_value is %d\n", __func__, global_value);
}


original_code:
void this_row(direction_s d)
{
    printf( d.left ? "*..\n"
            : d.right ? "..*\n"
            : ".*.\n");
}

canonical_original_code:
void this_row(struct direction_s d)
{
    printf( d.left ? "*..\n"
            : d.right ? "..*\n"
            : ".*.\n");
}

variable_types: struct direction_s { char *name; int left; int right; int up; int down; }


original_code:
void draw_box(direction_s d)
{
    printf("%s:\n", (d.name ? d.name : "a box"));
    d.up ? this_row(d) : printf("...\n");
    (!d.up && !d.down) ? this_row(d) : printf("...\n");
    d.down ? this_row(d) : printf("...\n");
    printf("\n");
}

canonical_original_code:
void draw_box(struct direction_s d)
{
    printf("%s:\n", (d.name ? d.name : "a box"));
    d.up ? this_row(d) : printf("...\n");
    (!d.up && !d.down) ? this_row(d) : printf("...\n");
    d.down ? this_row(d) : printf("...\n");
    printf("\n");
}

user_defined_types: struct direction_s { char *name; int left; int right; int up; int down; }


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // edx
int v4; // ecx
int v5; // er8
int v6; // er9
int v7; // edx
int v8; // ecx
int v9; // er8
int v10; // er9
int v11; // edx
int v12; // ecx
int v13; // er8
int v14; // er9

printf("[%s] hello world\n", "main");
draw_box((unsigned int)"[%s] hello world\n", (unsigned int)"main", v3, v4, v5, v6, (__int64)"left", 1LL, 0LL);
draw_box(
(unsigned int)"[%s] hello world\n",
(unsigned int)"main",
v7,
v8,
v9,
v10,
(__int64)"upper right",
0x100000000LL,
1LL);
draw_box((unsigned int)"[%s] hello world\n", (unsigned int)"main", v11, v12, v13, v14, 0LL, 0LL, 0LL);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // edx
int v4; // ecx
int v5; // er8
int v6; // er9
int v7; // edx
int v8; // ecx
int v9; // er8
int v10; // er9
int v11; // edx
int v12; // ecx
int v13; // er8
int v14; // er9

printf("[%s] hello world\n", "main");
func8((unsigned int)"[%s] hello world\n", (unsigned int)"main", v3, v4, v5, v6, (__int64)"left", 1LL, 0LL);
func8(
(unsigned int)"[%s] hello world\n",
(unsigned int)"main",
v7,
v8,
v9,
v10,
(__int64)"upper right",
0x100000000LL,
1LL);
func8((unsigned int)"[%s] hello world\n", (unsigned int)"main", v11, v12, v13, v14, 0LL, 0LL, 0LL);
return 0;
}

original_code:
int main(void)
{
    printf("[%s] hello world\n", __func__);
    direction_s D = {.name = "left", .left = 1};
    draw_box(D);
    D = (direction_s){"upper right", .up = 1, .right = 1};
    draw_box(D);
    draw_box((direction_s){});
    return 0;
}

canonical_original_code:
int main()
{
    printf("[%s] hello world\n", __func__);
    struct direction_s D = {.name = "left", .left = 1};
    draw_box(D);
    D = (struct direction_s){"upper right", .up = 1, .right = 1};
    draw_box(D);
    draw_box((struct direction_s){});
    return 0;
}


decompiled_code:
int __fastcall set_struct_aerConfig_s_int_data(__int64 a1, const char *a2, int a3)
{
__int64 v4; // rbx
int result; // eax

v4 = 0LL;
while ( 1 )
{
result = strcmp((&m_struct_aerConfig_s_field_reflection)[2 * v4], a2);
if ( !result )
break;
if ( ++v4 == 9 )
{
printf("[ERROR @ %s] key not found in reflection, check configuration!\n", "set_struct_aerConfig_s_int_data");
return -1;
}
}
*(_DWORD *)&(&m_struct_aerConfig_s_field_reflection)[2 * (int)v4 + 1][a1] = a3;
return result;
}

canonical_decompiled_code:
int __fastcall func0(__int64 a1, const char *a2, int a3)
{
__int64 v4; // rbx
int result; // eax

v4 = 0LL;
while ( 1 )
{
result = strcmp((&m_struct_aerConfig_s_field_reflection)[2 * v4], a2);
if ( !result )
break;
if ( ++v4 == 9 )
{
printf("[ERROR @ %s] key not found in reflection, check configuration!\n", "set_struct_aerConfig_s_int_data");
return -1;
}
}
*(_DWORD *)&(&m_struct_aerConfig_s_field_reflection)[2 * (int)v4 + 1][a1] = a3;
return result;
}

original_code:
int set_struct_aerConfig_s_int_data(void* p_aerConfig, const char* key, int32_t value)
{
    int i;
    uint8_t found_flag = 0;
    for (i = 0; i < sizeof(m_struct_aerConfig_s_field_reflection) / sizeof(struct_field); i++)
    {
        if (strcmp(m_struct_aerConfig_s_field_reflection[i].field_name, key) == 0)
        {
            *(int *)(p_aerConfig + m_struct_aerConfig_s_field_reflection[i].field_offset) = value;
            found_flag = 1;
            break;
        }
        if (found_flag)
        {
            break;
        }
    }
    if (!found_flag)
    {
        printf("[ERROR @ %s] key not found in reflection, check configuration!\n", __func__);
        return -1;
    }
    return 0;
}

canonical_original_code:
int set_struct_aerConfig_s_int_data(void *p_aerConfig, char *key, int value)
{
    int i;
    unsigned char found_flag = 0;
    for (i = 0; i < sizeof(m_struct_aerConfig_s_field_reflection) / sizeof(struct_field); i++)
    {
        if (strcmp(m_struct_aerConfig_s_field_reflection[i].field_name, key) == 0)
        {
            *(int *)(p_aerConfig + m_struct_aerConfig_s_field_reflection[i].field_offset) = value;
            found_flag = 1;
            break;
        }
        if (found_flag)
        {
            break;
        }
    }
    if (!found_flag)
    {
        printf("[ERROR @ %s] key not found in reflection, check configuration!\n", __func__);
        return -1;
    }
    return 0;
}

variable_types:
key
char *

variable_types: value int


decompiled_code:
__int64 __fastcall print_struct_aerConfig_s(__int64 a1)
{
char **v1; // rbx
char *v2; // rax
const char *v3; // rsi
unsigned int v4; // ebp
int v5; // eax

v1 = &m_struct_aerConfig_s_field_reflection;
print_default_struct_header(a1, "aerConfig_s");
do
{
v2 = v1[1];
v3 = *v1;
v1 += 2;
v4 = *(_DWORD *)&v2[a1];
printf("# * %s:", v3);
v5 = strlen(*(v1 - 2));
print_n_spaces((unsigned int)(32 - v5));
printf("0X%08X, %d\n", v4, v4);
}
while ( v1 != &m_struct_aerConfig_s_field_reflection + 18 );
return print_default_struct_footer();
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
char **v1; // rbx
char *v2; // rax
const char *v3; // rsi
unsigned int v4; // ebp
int v5; // eax

v1 = &m_struct_aerConfig_s_field_reflection;
print_default_struct_header(a1, "aerConfig_s");
do
{
v2 = v1[1];
v3 = *v1;
v1 += 2;
v4 = *(_DWORD *)&v2[a1];
printf("# * %s:", v3);
v5 = strlen(*(v1 - 2));
print_n_spaces((unsigned int)(32 - v5));
printf("0X%08X, %d\n", v4, v4);
}
while ( v1 != &m_struct_aerConfig_s_field_reflection + 18 );
return print_default_struct_footer();
}

original_code:
void print_struct_aerConfig_s(struct aerConfig_s* p_aerConfig)
{
    print_default_struct_header(p_aerConfig, "aerConfig_s");
    void* struct_address = (void*) p_aerConfig;
    int32_t int_value;
    for (int i = 0; i < sizeof(m_struct_aerConfig_s_field_reflection) / sizeof(struct_field); i++)
    {
        int_value = *((int32_t *)(((uint8_t*) struct_address) + m_struct_aerConfig_s_field_reflection[i].field_offset));
        printf("# * %s:", m_struct_aerConfig_s_field_reflection[i].field_name);
        print_n_spaces(32 - strlen(m_struct_aerConfig_s_field_reflection[i].field_name));
        printf("0X%08X, %d\n", int_value, int_value);
    }
    print_default_struct_footer();
}

canonical_original_code:
void print_struct_aerConfig_s(struct aerConfig_s *p_aerConfig)
{
    print_default_struct_header(p_aerConfig, "aerConfig_s");
    void *struct_address = (void*) p_aerConfig;
    int int_value;
    for (int i = 0; i < sizeof(m_struct_aerConfig_s_field_reflection) / sizeof(struct_field); i++)
    {
        int_value = *((int *)(((unsigned char *) struct_address) + m_struct_aerConfig_s_field_reflection[i].field_offset));
        printf("# * %s:", m_struct_aerConfig_s_field_reflection[i].field_name);
        print_n_spaces(32 - strlen(m_struct_aerConfig_s_field_reflection[i].field_name));
        printf("0X%08X, %d\n", int_value, int_value);
    }
    print_default_struct_footer();
}

variable_types: struct aerConfig_s { unsigned int reset_bitfield; unsigned int valid_bitfield; int y2x_delay; unsigned int srate_bitfield; int tail_length; int delay_tx_ag_chg; int delay_rx_ag_chg; int num_samp_interp; int phone_mode; } *


decompiled_code:
int say_std_hello()
{
return printf("hello from %s\n", "say_std_hello");
}

canonical_decompiled_code:
int func0()
{
return printf("hello from %s\n", "say_std_hello");
}

original_code:
void say_std_hello(void)
{
    printf("hello from %s\n", __func__);
}

canonical_original_code:
void say_std_hello()
{
    printf("hello from %s\n", __func__);
}


removeUser

decompiled_code:
__int64 __fastcall removeUser(int a1)
{
return removeLine(usersFilename, a1);
}

canonical_decompiled_code:
__int64 __fastcall func4(int a1)
{
return func0(usersFilename, a1);
}

original_code:
int removeUser(int targetID) {
 return removeLine(usersFilename, targetID);
}

variable_types: targetID int


updateBalance

decompiled_code:
__int64 __fastcall updateBalance(int a1, unsigned int a2)
{
if ( !getUser(a1) )
return 0xFFFFFFFFLL;
removeUser(a1);
return (unsigned int)-((unsigned int)addUser(a1, a2) == -1);
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, unsigned int a2)
{
if ( !func3(a1) )
return 0xFFFFFFFFLL;
func4(a1);
return (unsigned int)-((unsigned int)func5(a1, a2) == -1);
}

original_code:
int updateBalance(int userid, int balance) {
 USER *user = getUser(userid);
 if(user == ((void *)0)) return -1;
 removeUser(userid);
 if(addUser(userid, balance) == -1) return -1;
 return 0;
}

canonical_original_code:
int updateBalance(int userid, int balance) {
 struct USER *user = getUser(userid);
 if(user == ((void *)0)) return -1;
 removeUser(userid);
 if(addUser(userid, balance) == -1) return -1;
 return 0;
}

variable_types: userid int

variable_types: balance int

variable_types:
user
struct USER { int id; int balance; } *


getBalance

decompiled_code:
__int64 __fastcall getBalance(int a1)
{
char *v1; // rax
__int64 result; // rax

v1 = getUser(a1);
if ( v1 )
result = *((unsigned int *)v1 + 1);
else
result = 0xFFFFFFFFLL;
return result;
}

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

v1 = func3(a1);
if ( v1 )
result = *((unsigned int *)v1 + 1);
else
result = 0xFFFFFFFFLL;
return result;
}

original_code:
int getBalance(int id) {
 USER *user = getUser(id);
 if(user != ((void *)0)) return user->balance;
 return -1;
}

canonical_original_code:
int getBalance(int id) {
 struct USER *user = getUser(id);
 if(user != ((void *)0)) return user->balance;
 return -1;
}

variable_types: id int


initOpenSSL

decompiled_code:
__int64 initOpenSSL()
{
OPENSSL_init_ssl(2097154LL, 0LL);
ERR_load_BIO_strings();
return OPENSSL_init_crypto(12LL, 0LL);
}

canonical_decompiled_code:
__int64 func0()
{
OPENSSL_init_ssl(2097154LL, 0LL);
ERR_load_BIO_strings();
return OPENSSL_init_crypto(12LL, 0LL);
}

original_code:
void initOpenSSL() {
 OPENSSL_init_ssl(0x00200000L | 0x00000002L, ((void *)0));
 ERR_load_BIO_strings();
 OPENSSL_init_crypto(0x00000004L | 0x00000008L, ((void *)0));
 return;
}


buildHostString

decompiled_code:
char *__fastcall buildHostString(const char *a1, const char *a2)
{
const char *v2; // r12
int v3; // ebp
size_t v4; // rbp
char *v5; // rax
char *v6; // r13

if ( a1 )
{
v2 = a1;
v3 = strlen(a1);
}
else
{
v3 = 9;
v2 = "127.0.0.1";
}
v4 = (int)(v3 + strlen(a2) + 2);
v5 = (char *)malloc(v4);
v6 = v5;
if ( !v5 )
{
fwrite("malloc() failed in buildHostString()\n", 1uLL, 0x25uLL, stderr);
exit(1);
}
snprintf(v5, v4, "%s:%s", v2, a2);
return v6;
}

canonical_decompiled_code:
char *__fastcall func1(const char *a1, const char *a2)
{
const char *v2; // r12
int v3; // ebp
size_t v4; // rbp
char *v5; // rax
char *v6; // r13

if ( a1 )
{
v2 = a1;
v3 = strlen(a1);
}
else
{
v3 = 9;
v2 = "127.0.0.1";
}
v4 = (int)(v3 + strlen(a2) + 2);
v5 = (char *)malloc(v4);
v6 = v5;
if ( !v5 )
{
fwrite("malloc() failed in buildHostString()\n", 1uLL, 0x25uLL, stderr);
exit(1);
}
snprintf(v5, v4, "%s:%s", v2, a2);
return v6;
}

original_code:
char *buildHostString(char *hostname, char *port) {
 if(hostname == ((void *)0)) hostname = "127.0.0.1";
 int numChars = strlen(hostname) + strlen(port) + 2;
 char *hostString = malloc(numChars * sizeof(char));
 if(hostString == ((void *)0)) {
  fprintf(stderr, "malloc() failed in buildHostString()\n");
  exit(1);
 }
 snprintf(hostString, numChars, "%s:%s", hostname, port);
 return hostString;
}

variable_types:
hostname
char *

variable_types:
port
char *

variable_types: numChars int

variable_types:
hostString
char *

return_type: char *


sizeOfFile

decompiled_code:
__int64 __fastcall sizeOfFile(const char *a1)
{
struct stat v2; // [rsp+10h] [rbp-98h] BYREF

if ( stat(a1, &v2) != -1 )
return LODWORD(v2.st_size);
perror("loadFile");
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func2(const char *a1)
{
struct stat v2; // [rsp+10h] [rbp-98h] BYREF

if ( stat(a1, &v2) != -1 )
return LODWORD(v2.st_size);
perror("loadFile");
return 0xFFFFFFFFLL;
}

original_code:
int sizeOfFile(char *filename) {
 struct stat s;
 int status = stat(filename, &s);
 if(status == -1) {
  perror("loadFile");
  return -1;
 }
 return s.st_size;
}

variable_types:
filename
char *

variable_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; long st_atime; unsigned long st_atimensec; long st_mtime; unsigned long st_mtimensec; long st_ctime; unsigned long st_ctimensec; long __glibc_reserved[3]; }

variable_types: status int


decompiled_code:
__int64 __fastcall my_line_len(int a1, __int64 a2)
{
__int64 result; // rax
char v3; // dl
__int64 v4; // rax
char v5; // dl
int v6; // ecx

result = 0LL;
if ( a2 )
{
v3 = *(_BYTE *)(a2 + a1);
if ( v3 )
{
if ( v3 != 10 )
{
v4 = a1 + 1;
do
{
v5 = *(_BYTE *)(a2 + v4);
v6 = v4++;
}
while ( v5 && v5 != 10 );
result = (unsigned int)(v6 - a1);
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1, __int64 a2)
{
__int64 result; // rax
char v3; // dl
__int64 v4; // rax
char v5; // dl
int v6; // ecx

result = 0LL;
if ( a2 )
{
v3 = *(_BYTE *)(a2 + a1);
if ( v3 )
{
if ( v3 != 10 )
{
v4 = a1 + 1;
do
{
v5 = *(_BYTE *)(a2 + v4);
v6 = v4++;
}
while ( v5 && v5 != 10 );
result = (unsigned int)(v6 - a1);
}
}
}
return result;
}

original_code:
int my_line_len(int i, char *buff)
{
  int mem;
  mem = i;
  if (buff != ((void *)0) && buff[i] != '\0')
    while (buff[i] != '\0' && buff[i] != '\n')
      i = i + 1;
  return (i - mem);
}

variable_types: i int

variable_types:
buff
char *

variable_types: mem int


coregnl

decompiled_code:
__int64 __fastcall coregnl(int fd)
{
int v2; // edi
int v3; // eax
_BYTE *v4; // rax
__int64 v5; // r9

v2 = i_1;
if ( i_1 )
{
if ( !buffer_0[i_1] )
return 0LL;
}
else
{
read(fd, buffer_0, 0x1000uLL);
v2 = i_1;
if ( !buffer_0[i_1] )
return 0LL;
}
v3 = my_line_len(v2, (__int64)buffer_0);
v4 = malloc(v3 + 1);
if ( !v4 )
return 0LL;
put_in_line(v4, (__int64)buffer_0, &i_1);
if ( i_1 > 4095 )
i_1 = 0;
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func2(int fd)
{
int v2; // edi
int v3; // eax
_BYTE *v4; // rax
__int64 v5; // r9

v2 = i_1;
if ( i_1 )
{
if ( !buffer_0[i_1] )
return 0LL;
}
else
{
read(fd, buffer_0, 0x1000uLL);
v2 = i_1;
if ( !buffer_0[i_1] )
return 0LL;
}
v3 = func1(v2, (__int64)buffer_0);
v4 = malloc(v3 + 1);
if ( !v4 )
return 0LL;
func0(v4, (__int64)buffer_0, &i_1);
if ( i_1 > 4095 )
i_1 = 0;
return v5;
}

original_code:
char *coregnl(const int fd)
{
  char *line;
  int size;
  static char buffer[(4096) + 1];
  static int i;
  if (((i == 0 && (size = read(fd, buffer, (4096))) == -1) && size == 0)
      || buffer[i] == '\0')
    return (((void *)0));
  if ((line = malloc((my_line_len(i, buffer) + 1) * sizeof(char))) == ((void *)0))
    return (((void *)0));
  put_in_line(line, buffer, &i);
  if (i >= (4096))
    i = 0;
  return (line);
}

canonical_original_code:
char *coregnl(int fd)
{
  char *line;
  int size;
  static char buffer[-1];
  static int i;
  if (((i == 0 && (size = read(fd, buffer, (4096))) == -1) && size == 0)
      || buffer[i] == '\0')
    return (((void *)0));
  if ((line = malloc((my_line_len(i, buffer) + 1) * sizeof(char))) == ((void *)0))
    return (((void *)0));
  put_in_line(line, buffer, &i);
  if (i >= (4096))
    i = 0;
  return (line);
}

variable_types: fd int

variable_types:
line
char *

variable_types: size int

variable_types:
buffer
char [-1]


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
void *v3; // rbx
const char *v4; // rax
const char *v5; // rax
const char *v6; // rax
const char *v7; // rax
const char *v8; // rax
const char *v9; // rax
int v11[3]; // [rsp+Ch] [rbp-Ch] BYREF

v11[0] = 0;
v3 = malloc(0x64uLL);
BUinitGPS(0LL, 100LL);
while ( 1 )
{
puts("1. Message ID");
puts("2. Time");
puts("3. Latitude");
puts("4. Longitude");
puts("5. Number of satellites");
puts("6. Date");
_isoc99_scanf("%d", v11);
switch ( v11[0] )
{
case 1:
v9 = (const char *)getMessageID(v3);
printf("Message ID: %s\n", v9);
break;
case 2:
v8 = (const char *)getUTCTime(v3);
printf("Time: %s\n", v8);
break;
case 3:
v7 = (const char *)getLatitude(v3);
printf("Latitude: %s\n", v7);
break;
case 4:
v6 = (const char *)getLongitude(v3);
printf("Longitude: %s\n", v6);
break;
case 5:
v5 = (const char *)getSatellitesUsed(v3);
printf("Number of satellites: %s\n", v5);
break;
case 6:
v4 = (const char *)getDate(v3);
printf("Date: %s\n", v4);
break;
default:
continue;
}
}
}

original_code:
int main()
{
 char *retval;
 int choise = 0;
 retval = malloc(100);
 BUinitGPS(0, 100);
 while(1){
  printf("1. Message ID\n");
  printf("2. Time\n");
  printf("3. Latitude\n");
  printf("4. Longitude\n");
  printf("5. Number of satellites\n");
  printf("6. Date\n");
  scanf("%d", &choise);
  switch ((int)choise){
   case 1:
    printf("Message ID: %s\n", getMessageID(retval));
    break;
   case 2:
    printf("Time: %s\n", getUTCTime(retval));
    break;
   case 3:
    printf("Latitude: %s\n", getLatitude(retval));
    break;
   case 4:
    printf("Longitude: %s\n", getLongitude(retval));
    break;
   case 5:
    printf("Number of satellites: %s\n", getSatellitesUsed(retval));
    break;
   case 6:
    printf("Date: %s\n", getDate(retval));
   default:
    break;
  }
 }
 return 0;
}

variable_types:
retval
char *

variable_types: choise int


getNext

original_code:
static char *getNext(char **line, char *dest)
{
 while(**line != ',' && **line != '*' && **line != '\r'){
  *dest = **line;
  dest++;
  (*line)++;
 }
 *dest='\0';
 (*line)++;
 return *line;
}

variable_types:
line
char **

variable_types:
dest
char *


parseGPGGA

original_code:
void parseGPGGA(GPGGA *in, char *strToParse)
{
 strToParse = getNext(&strToParse, in->MessageID );
 strToParse = getNext(&strToParse, in->UTCTime );
 strToParse = getNext(&strToParse, in->Latitude );
 strToParse = getNext(&strToParse, in->NSIndicator );
 strToParse = getNext(&strToParse, in->Longitude );
 strToParse = getNext(&strToParse, in->EWIndicator );
 strToParse = getNext(&strToParse, in->PositionFixIndicator );
 strToParse = getNext(&strToParse, in->SatellitesUsed );
 strToParse = getNext(&strToParse, in->HDOP );
 strToParse = getNext(&strToParse, in->MSLAltitude );
 strToParse = getNext(&strToParse, in->MSLUnits );
 strToParse = getNext(&strToParse, in->GeoidSeparation );
 strToParse = getNext(&strToParse, in->GeoidUnits );
 strToParse = getNext(&strToParse, in->AgeOfDiffCorr );
 strToParse = getNext(&strToParse, in->DiffRefStationID );
 getNext(&strToParse, in->Checksum );
}

canonical_original_code:
void parseGPGGA(struct GPGGA *in, char *strToParse)
{
 strToParse = getNext(&strToParse, in->MessageID );
 strToParse = getNext(&strToParse, in->UTCTime );
 strToParse = getNext(&strToParse, in->Latitude );
 strToParse = getNext(&strToParse, in->NSIndicator );
 strToParse = getNext(&strToParse, in->Longitude );
 strToParse = getNext(&strToParse, in->EWIndicator );
 strToParse = getNext(&strToParse, in->PositionFixIndicator );
 strToParse = getNext(&strToParse, in->SatellitesUsed );
 strToParse = getNext(&strToParse, in->HDOP );
 strToParse = getNext(&strToParse, in->MSLAltitude );
 strToParse = getNext(&strToParse, in->MSLUnits );
 strToParse = getNext(&strToParse, in->GeoidSeparation );
 strToParse = getNext(&strToParse, in->GeoidUnits );
 strToParse = getNext(&strToParse, in->AgeOfDiffCorr );
 strToParse = getNext(&strToParse, in->DiffRefStationID );
 getNext(&strToParse, in->Checksum );
}

variable_types: struct GPGGA { char MessageID[7]; char UTCTime[11]; char Latitude[11]; char NSIndicator[2]; char Longitude[11]; char EWIndicator[2]; char PositionFixIndicator[2]; char SatellitesUsed[3]; char HDOP[5]; char MSLAltitude[4]; char MSLUnits[2]; char GeoidSeparation[4]; char GeoidUnits[2]; char AgeOfDiffCorr[8]; char DiffRefStationID[5]; char Checksum[8]; } *

variable_types:
strToParse
char *