decompiled_code:
int __fastcall vector_col6_printf_decimated(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7, char *format)
{
__int64 v11; // rbx
int v12; // er12
int result; // eax
int v14; // [rsp+Ch] [rbp-5Ch]

if ( a7 <= 2000 )
{
if ( a7 <= 0 )
return result;
v14 = 1;
}
else
{
v14 = a7 / 2000;
}
v11 = 0LL;
v12 = 0;
do
{
printf(format, *(double *)(a1 + v11));
putchar(32);
printf(format, *(double *)(a2 + v11));
putchar(32);
printf(format, *(double *)(a3 + v11));
putchar(32);
printf(format, *(double *)(a4 + v11));
putchar(32);
printf(format, *(double *)(a5 + v11));
putchar(32);
printf(format, *(double *)(a6 + v11));
result = putchar(10);
v12 += v14;
v11 += 8LL * v14;
}
while ( a7 > v12 );
return result;
}

canonical_decompiled_code:
int __fastcall func11(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7, char *format)
{
__int64 v11; // rbx
int v12; // er12
int result; // eax
int v14; // [rsp+Ch] [rbp-5Ch]

if ( a7 <= 2000 )
{
if ( a7 <= 0 )
return result;
v14 = 1;
}
else
{
v14 = a7 / 2000;
}
v11 = 0LL;
v12 = 0;
do
{
printf(format, *(double *)(a1 + v11));
putchar(32);
printf(format, *(double *)(a2 + v11));
putchar(32);
printf(format, *(double *)(a3 + v11));
putchar(32);
printf(format, *(double *)(a4 + v11));
putchar(32);
printf(format, *(double *)(a5 + v11));
putchar(32);
printf(format, *(double *)(a6 + v11));
result = putchar(10);
v12 += v14;
v11 += 8LL * v14;
}
while ( a7 > v12 );
return result;
}

original_code:
void vector_col6_printf_decimated(
 double* v1, double* v2, double* v3, double* v4, double* v5, double* v6,
 int length, char* format)
{
 int stride = 1;
 int i;
 const int maxlen = 2000;
 if (length > maxlen)
  stride = length / maxlen;
 for (i = 0; i < length; i += stride) {
  printf(format, v1[i]);
  printf(" ");
  printf(format, v2[i]);
  printf(" ");
  printf(format, v3[i]);
  printf(" ");
  printf(format, v4[i]);
  printf(" ");
  printf(format, v5[i]);
  printf(" ");
  printf(format, v6[i]);
  printf("\n");
 }
}

canonical_original_code:
void vector_col6_printf_decimated(double *v1, double *v2, double *v3, double *v4, double *v5, double *v6, int length, char *format)
{
 int stride = 1;
 int i;
 int maxlen = 2000;
 if (length > maxlen)
  stride = length / maxlen;
 for (i = 0; i < length; i += stride) {
  printf(format, v1[i]);
  printf(" ");
  printf(format, v2[i]);
  printf(" ");
  printf(format, v3[i]);
  printf(" ");
  printf(format, v4[i]);
  printf(" ");
  printf(format, v5[i]);
  printf(" ");
  printf(format, v6[i]);
  printf("\n");
 }
}


decompiled_code:
int __fastcall vector_col7_printf_decimated(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, int a8, char *format)
{
__int64 v12; // rbx
int v13; // er12
int result; // eax
int v15; // [rsp+Ch] [rbp-5Ch]

if ( a8 <= 2000 )
{
if ( a8 <= 0 )
return result;
v15 = 1;
}
else
{
v15 = a8 / 2000;
}
v12 = 0LL;
v13 = 0;
do
{
printf(format, *(double *)(a1 + v12));
putchar(32);
printf(format, *(double *)(a2 + v12));
putchar(32);
printf(format, *(double *)(a3 + v12));
putchar(32);
printf(format, *(double *)(a4 + v12));
putchar(32);
printf(format, *(double *)(a5 + v12));
putchar(32);
printf(format, *(double *)(a6 + v12));
putchar(32);
printf(format, *(double *)(a7 + v12));
result = putchar(10);
v13 += v15;
v12 += 8LL * v15;
}
while ( a8 > v13 );
return result;
}

canonical_decompiled_code:
int __fastcall func12(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int64 a7, int a8, char *format)
{
__int64 v12; // rbx
int v13; // er12
int result; // eax
int v15; // [rsp+Ch] [rbp-5Ch]

if ( a8 <= 2000 )
{
if ( a8 <= 0 )
return result;
v15 = 1;
}
else
{
v15 = a8 / 2000;
}
v12 = 0LL;
v13 = 0;
do
{
printf(format, *(double *)(a1 + v12));
putchar(32);
printf(format, *(double *)(a2 + v12));
putchar(32);
printf(format, *(double *)(a3 + v12));
putchar(32);
printf(format, *(double *)(a4 + v12));
putchar(32);
printf(format, *(double *)(a5 + v12));
putchar(32);
printf(format, *(double *)(a6 + v12));
putchar(32);
printf(format, *(double *)(a7 + v12));
result = putchar(10);
v13 += v15;
v12 += 8LL * v15;
}
while ( a8 > v13 );
return result;
}

original_code:
void vector_col7_printf_decimated(
 double* v1, double* v2, double* v3, double* v4, double* v5, double* v6,
 double* v7, int length, char* format)
{
 int stride = 1;
 int i;
 const int maxlen = 2000;
 if (length > maxlen)
  stride = length / maxlen;
 for (i = 0; i < length; i += stride) {
  printf(format, v1[i]);
  printf(" ");
  printf(format, v2[i]);
  printf(" ");
  printf(format, v3[i]);
  printf(" ");
  printf(format, v4[i]);
  printf(" ");
  printf(format, v5[i]);
  printf(" ");
  printf(format, v6[i]);
  printf(" ");
  printf(format, v7[i]);
  printf("\n");
 }
}

canonical_original_code:
void vector_col7_printf_decimated(double *v1, double *v2, double *v3, double *v4, double *v5, double *v6, double *v7, int length, char *format)
{
 int stride = 1;
 int i;
 int maxlen = 2000;
 if (length > maxlen)
  stride = length / maxlen;
 for (i = 0; i < length; i += stride) {
  printf(format, v1[i]);
  printf(" ");
  printf(format, v2[i]);
  printf(" ");
  printf(format, v3[i]);
  printf(" ");
  printf(format, v4[i]);
  printf(" ");
  printf(format, v5[i]);
  printf(" ");
  printf(format, v6[i]);
  printf(" ");
  printf(format, v7[i]);
  printf("\n");
 }
}

variable_types: length int

variable_types:
format
char *

variable_types: stride int

variable_types: i int

variable_types: maxlen int

return_type: void


decompiled_code:
double get_sys_time_double()
{
struct timeval v1; // [rsp+0h] [rbp-18h] BYREF

if ( gettimeofday(&v1, 0LL) < 0 )
{
perror("gettimeofday");
exit(1);
}
return (double)SLODWORD(v1.tv_usec) * 0.000001 + (double)SLODWORD(v1.tv_sec);
}

canonical_decompiled_code:
double func0()
{
struct timeval v1; // [rsp+0h] [rbp-18h] BYREF

if ( gettimeofday(&v1, 0LL) < 0 )
{
perror("gettimeofday");
exit(1);
}
return (double)SLODWORD(v1.tv_usec) * 0.000001 + (double)SLODWORD(v1.tv_sec);
}

original_code:
double get_sys_time_double(void)
{
 struct timeval now;
 if (gettimeofday(&now, 0) < 0) {
  perror("gettimeofday");
  exit(1);
 }
 return (double)now.tv_sec + (double)now.tv_usec * 1e-6;
}

canonical_original_code:
double get_sys_time_double()
{
 struct timeval now;
 if (gettimeofday(&now, 0) < 0) {
  perror("gettimeofday");
  exit(1);
 }
 return (double)now.tv_sec + (double)now.tv_usec * 1e-6;
}

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

return_type: double


decompiled_code:
char *get_sys_time_string()
{
struct timeval v1; // [rsp+0h] [rbp-18h] BYREF

if ( gettimeofday(&v1, 0LL) < 0 )
{
perror("gettimeofday");
exit(1);
}
return ctime(&v1.tv_sec);
}

canonical_decompiled_code:
char *func1()
{
struct timeval v1; // [rsp+0h] [rbp-18h] BYREF

if ( gettimeofday(&v1, 0LL) < 0 )
{
perror("gettimeofday");
exit(1);
}
return ctime(&v1.tv_sec);
}

original_code:
char* get_sys_time_string(void)
{
 struct timeval now;
 if (gettimeofday(&now, 0) < 0) {
  perror("gettimeofday");
  exit(1);
 }
 return ctime(&now.tv_sec);
}

canonical_original_code:
char *get_sys_time_string()
{
 struct timeval now;
 if (gettimeofday(&now, 0) < 0) {
  perror("gettimeofday");
  exit(1);
 }
 return ctime(&now.tv_sec);
}

return_type: char *

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


decompiled_code:
void __fastcall sran32(int a1)
{
non_reentrant_state0 = 0;
non_reentrant_state1 = a1;
non_reentrant_seeded = 1;
}

canonical_decompiled_code:
void __fastcall func0(int a1)
{
non_reentrant_state0 = 0;
non_reentrant_state1 = a1;
non_reentrant_seeded = 1;
}

original_code:
void sran32(unsigned s)
{
 non_reentrant_state0 = 0;
 non_reentrant_state1 = s;
 non_reentrant_seeded = 1;
}

canonical_original_code:
void sran32(unsigned int s)
{
 non_reentrant_state0 = 0;
 non_reentrant_state1 = s;
 non_reentrant_seeded = 1;
}

variable_types:
s
unsigned int


decompiled_code:
void __fastcall sran32b(int a1, int a2)
{
non_reentrant_state0 = a1;
non_reentrant_state1 = a2;
non_reentrant_seeded = 1;
}

canonical_decompiled_code:
void __fastcall func1(int a1, int a2)
{
non_reentrant_state0 = a1;
non_reentrant_state1 = a2;
non_reentrant_seeded = 1;
}

original_code:
void sran32b(unsigned s0, unsigned s1)
{
 non_reentrant_state0 = s0;
 non_reentrant_state1 = s1;
 non_reentrant_seeded = 1;
}

canonical_original_code:
void sran32b(unsigned int s0, unsigned int s1)
{
 non_reentrant_state0 = s0;
 non_reentrant_state1 = s1;
 non_reentrant_seeded = 1;
}


decompiled_code:
__int64 sran32_tod()
{
__int64 result; // rax
struct timeval v1; // [rsp+0h] [rbp-18h] BYREF

gettimeofday(&v1, 0LL);
non_reentrant_state0 = LODWORD(v1.tv_usec) ^ getpid();
result = LODWORD(v1.tv_sec) ^ (unsigned int)(LODWORD(v1.tv_usec) * LODWORD(v1.tv_usec) + 1);
non_reentrant_state1 = LODWORD(v1.tv_sec) ^ (LODWORD(v1.tv_usec) * LODWORD(v1.tv_usec) + 1);
non_reentrant_seeded = 1;
return result;
}

canonical_decompiled_code:
__int64 func2()
{
__int64 result; // rax
struct timeval v1; // [rsp+0h] [rbp-18h] BYREF

gettimeofday(&v1, 0LL);
non_reentrant_state0 = LODWORD(v1.tv_usec) ^ getpid();
result = LODWORD(v1.tv_sec) ^ (unsigned int)(LODWORD(v1.tv_usec) * LODWORD(v1.tv_usec) + 1);
non_reentrant_state1 = LODWORD(v1.tv_sec) ^ (LODWORD(v1.tv_usec) * LODWORD(v1.tv_usec) + 1);
non_reentrant_seeded = 1;
return result;
}

original_code:
void sran32_tod(void)
{
 struct timeval tod;
 (void)gettimeofday(&tod, 0);
 non_reentrant_state0 = getpid() ^ tod.tv_usec;
 non_reentrant_state1 = tod.tv_sec ^ (tod.tv_usec * tod.tv_usec + 1);
 non_reentrant_seeded = 1;
}

canonical_original_code:
void sran32_tod()
{
 struct timeval tod;
 (void)gettimeofday(&tod, 0);
 non_reentrant_state0 = getpid() ^ tod.tv_usec;
 non_reentrant_state1 = tod.tv_sec ^ (tod.tv_usec * tod.tv_usec + 1);
 non_reentrant_seeded = 1;
}


decompiled_code:
__int64 __fastcall sran32_tod_r(int *a1, _DWORD *a2)
{
__pid_t v2; // edx
int v3; // eax
__int64 result; // rax
struct timeval v5; // [rsp+0h] [rbp-28h] BYREF

gettimeofday(&v5, 0LL);
v2 = getpid();
v3 = v5.tv_usec;
*a1 = LODWORD(v5.tv_usec) ^ v2;
result = LODWORD(v5.tv_sec) ^ (unsigned int)(v3 * v3 + 1);
*a2 = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(int *a1, _DWORD *a2)
{
__pid_t v2; // edx
int v3; // eax
__int64 result; // rax
struct timeval v5; // [rsp+0h] [rbp-28h] BYREF

gettimeofday(&v5, 0LL);
v2 = getpid();
v3 = v5.tv_usec;
*a1 = LODWORD(v5.tv_usec) ^ v2;
result = LODWORD(v5.tv_sec) ^ (unsigned int)(v3 * v3 + 1);
*a2 = result;
return result;
}

original_code:
void sran32_tod_r(unsigned * pstate0, unsigned * pstate1)
{
 struct timeval tod;
 (void)gettimeofday(&tod, 0);
 *pstate0 = getpid() ^ tod.tv_usec;
 *pstate1 = tod.tv_sec ^ (tod.tv_usec * tod.tv_usec + 1);
}

canonical_original_code:
void sran32_tod_r(unsigned int *pstate0, unsigned int *pstate1)
{
 struct timeval tod;
 (void)gettimeofday(&tod, 0);
 *pstate0 = getpid() ^ tod.tv_usec;
 *pstate1 = tod.tv_sec ^ (tod.tv_usec * tod.tv_usec + 1);
}


decompiled_code:
__int64 __fastcall psdes_hash_64(_DWORD *a1, int *a2)
{
__int64 i; // rdi
int v4; // er8
unsigned int v5; // ecx
__int64 result; // rax

for ( i = 0LL; i != 4; ++i )
{
v4 = *a2;
v5 = c1_1[i] ^ *a2;
result = *a1 ^ ((unsigned __int16)v5 * HIWORD(v5)
+ (c2_0[i] ^ __ROL4__((unsigned __int16)v5 * (unsigned __int16)v5 - 1 - HIWORD(v5) * HIWORD(v5), 16)));
*a2 = result;
*a1 = v4;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(_DWORD *a1, int *a2)
{
__int64 i; // rdi
int v4; // er8
unsigned int v5; // ecx
__int64 result; // rax

for ( i = 0LL; i != 4; ++i )
{
v4 = *a2;
v5 = c1_1[i] ^ *a2;
result = *a1 ^ ((unsigned __int16)v5 * HIWORD(v5)
+ (c2_0[i] ^ __ROL4__((unsigned __int16)v5 * (unsigned __int16)v5 - 1 - HIWORD(v5) * HIWORD(v5), 16)));
*a2 = result;
*a1 = v4;
}
return result;
}

original_code:
void psdes_hash_64(
 unsigned * pword0,
 unsigned * pword1)
{
 unsigned i;
 unsigned iswap, ia, iah, ial, ib, ic;
 static unsigned c1[4] = {
  0xbaa96887, 0x1e17d32c, 0x03bcdc3c, 0x0f33d1b2 };
 static unsigned c2[4] = {
  0x4b0f3b58, 0xe874f0c3, 0x6955c5a6, 0x55a7ca46 };
 for (i = 0; i < 4; i++) {
  iswap = *pword1;
  ia = iswap ^ c1[i];
  ial = ia & 0xffff;
  iah = ia >> 16;
  ib = ial * ial + ~(iah * iah);
  ic = (ib >> 16) | ((ib & 0xffff) << 16);
  *pword1 = (*pword0) ^ ((ic ^ c2[i]) + ial * iah);
  *pword0 = iswap;
 }
}

canonical_original_code:
void psdes_hash_64(unsigned int *pword0, unsigned int *pword1)
{
 unsigned int i;
 unsigned int iswap; unsigned int ia; unsigned int iah; unsigned int ial; unsigned int ib; unsigned int ic;
 static unsigned int c1[4] = {
  0xbaa96887, 0x1e17d32c, 0x03bcdc3c, 0x0f33d1b2 };
 static unsigned int c2[4] = {
  0x4b0f3b58, 0xe874f0c3, 0x6955c5a6, 0x55a7ca46 };
 for (i = 0; i < 4; i++) {
  iswap = *pword1;
  ia = iswap ^ c1[i];
  ial = ia & 0xffff;
  iah = ia >> 16;
  ib = ial * ial + ~(iah * iah);
  ic = (ib >> 16) | ((ib & 0xffff) << 16);
  *pword1 = (*pword0) ^ ((ic ^ c2[i]) + ial * iah);
  *pword0 = iswap;
 }
}

variable_types:
i
unsigned int

variable_types:
iswap
unsigned int

variable_types:
ia
unsigned int

variable_types:
iah
unsigned int

variable_types:
ial
unsigned int

variable_types:
ib
unsigned int

variable_types:
ic
unsigned int


decompiled_code:
__int64 __fastcall iran32_r(int *a1, int *a2)
{
unsigned int v4; // [rsp+8h] [rbp-18h] BYREF
int v5[5]; // [rsp+Ch] [rbp-14h] BYREF

v5[0] = *a1;
v4 = *a2;
psdes_hash_64(v5, (int *)&v4);
if ( (*a2)++ == -1 )
++*a1;
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func5(int *a1, int *a2)
{
unsigned int v4; // [rsp+8h] [rbp-18h] BYREF
int v5[5]; // [rsp+Ch] [rbp-14h] BYREF

v5[0] = *a1;
v4 = *a2;
func4(v5, (int *)&v4);
if ( (*a2)++ == -1 )
++*a1;
return v4;
}

original_code:
unsigned iran32_r(unsigned * pstate0, unsigned * pstate1)
{
 unsigned word0 = *pstate0;
 unsigned word1 = *pstate1;
 psdes_hash_64(&word0, &word1);
 (*pstate1)++;
 if (*pstate1 == 0)
  (*pstate0)++;
 return word1;
}

canonical_original_code:
unsigned int iran32_r(unsigned int *pstate0, unsigned int *pstate1)
{
 unsigned int word0 = *pstate0;
 unsigned int word1 = *pstate1;
 psdes_hash_64(&word0, &word1);
 (*pstate1)++;
 if (*pstate1 == 0)
  (*pstate0)++;
 return word1;
}

return_type: unsigned int


decompiled_code:
__int64 iran32()
{
if ( !non_reentrant_seeded )
sran32_tod();
return iran32_r(&non_reentrant_state0, &non_reentrant_state1);
}

canonical_decompiled_code:
__int64 func6()
{
if ( !non_reentrant_seeded )
func2();
return func5(&non_reentrant_state0, &non_reentrant_state1);
}

original_code:
unsigned iran32(void)
{
 if (!non_reentrant_seeded)
  sran32_tod();
 return iran32_r(&non_reentrant_state0, &non_reentrant_state1);
}

canonical_original_code:
unsigned int iran32()
{
 if (!non_reentrant_seeded)
  sran32_tod();
 return iran32_r(&non_reentrant_state0, &non_reentrant_state1);
}


decompiled_code:
double __fastcall fran32_r(int *a1, int *a2)
{
return (double)(int)iran32_r(a1, a2) * 2.328306436538696e-10;
}

canonical_decompiled_code:
double __fastcall func7(int *a1, int *a2)
{
return (double)(int)func5(a1, a2) * 2.328306436538696e-10;
}

original_code:
double fran32_r(unsigned * pstate0, unsigned * pstate1)
{
 unsigned word = iran32_r(pstate0, pstate1);
 return (double)( (double)word / (double)4294967296.0 );
}

canonical_original_code:
double fran32_r(unsigned int *pstate0, unsigned int *pstate1)
{
 unsigned int word = iran32_r(pstate0, pstate1);
 return (double)( (double)word / (double)4294967296.0 );
}

variable_types:
word
unsigned int


decompiled_code:
double fran32()
{
if ( !non_reentrant_seeded )
sran32_tod();
return fran32_r(&non_reentrant_state0, &non_reentrant_state1);
}

canonical_decompiled_code:
double func8()
{
if ( !non_reentrant_seeded )
func2();
return func7(&non_reentrant_state0, &non_reentrant_state1);
}

original_code:
double fran32(void)
{
 if (!non_reentrant_seeded)
  sran32_tod();
 return fran32_r(&non_reentrant_state0, &non_reentrant_state1);
}

canonical_original_code:
double fran32()
{
 if (!non_reentrant_seeded)
  sran32_tod();
 return fran32_r(&non_reentrant_state0, &non_reentrant_state1);
}


decompiled_code:
__int64 __fastcall iran64_r(_DWORD *a1, int *a2, _DWORD *a3, int *a4)
{
bool v6; // zf
__int64 result; // rax

*a1 = *a3;
*a2 = *a4;
psdes_hash_64(a1, a2);
v6 = *a4 == -1;
result = (unsigned int)(*a4 + 1);
*a4 = result;
if ( v6 )
++*a3;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(_DWORD *a1, int *a2, _DWORD *a3, int *a4)
{
bool v6; // zf
__int64 result; // rax

*a1 = *a3;
*a2 = *a4;
func4(a1, a2);
v6 = *a4 == -1;
result = (unsigned int)(*a4 + 1);
*a4 = result;
if ( v6 )
++*a3;
return result;
}

original_code:
void iran64_r(unsigned * pout0, unsigned * pout1,
 unsigned * pstate0, unsigned * pstate1)
{
 *pout0 = *pstate0;
 *pout1 = *pstate1;
 psdes_hash_64(pout0, pout1);
 (*pstate1)++;
 if (*pstate1 == 0)
  (*pstate0)++;
}

canonical_original_code:
void iran64_r(unsigned int *pout0, unsigned int *pout1, unsigned int *pstate0, unsigned int *pstate1)
{
 *pout0 = *pstate0;
 *pout1 = *pstate1;
 psdes_hash_64(pout0, pout1);
 (*pstate1)++;
 if (*pstate1 == 0)
  (*pstate0)++;
}


decompiled_code:
__int64 __fastcall iran64(_DWORD *a1, int *a2)
{
if ( !non_reentrant_seeded )
sran32_tod();
return iran64_r(a1, a2, &non_reentrant_state0, &non_reentrant_state1);
}

canonical_decompiled_code:
__int64 __fastcall func10(_DWORD *a1, int *a2)
{
if ( !non_reentrant_seeded )
func2();
return func9(a1, a2, &non_reentrant_state0, &non_reentrant_state1);
}

original_code:
void iran64(unsigned * pout0, unsigned * pout1)
{
 if (!non_reentrant_seeded)
  sran32_tod();
 return iran64_r(pout0, pout1,
  &non_reentrant_state0, &non_reentrant_state1);
}

canonical_original_code:
void iran64(unsigned int *pout0, unsigned int *pout1)
{
 if (!non_reentrant_seeded)
  sran32_tod();
 return iran64_r(pout0, pout1,
  &non_reentrant_state0, &non_reentrant_state1);
}


xmalloc

decompiled_code:
void *__fastcall xmalloc(int a1)
{
void *v1; // rax
void *v2; // rbx

v1 = malloc(a1);
v2 = v1;
if ( v1 )
memset(v1, 0, a1);
else
fprintf(stderr, "Line : %d , malloc\n", 21LL);
return v2;
}

canonical_decompiled_code:
void *__fastcall func0(int a1)
{
void *v1; // rax
void *v2; // rbx

v1 = malloc(a1);
v2 = v1;
if ( v1 )
memset(v1, 0, a1);
else
fprintf(stderr, "Line : %d , malloc\n", 21LL);
return v2;
}

original_code:
void *xmalloc(int bytes)
{
 void *tmp = malloc(bytes);
 if (!tmp) {
  fprintf(stderr, "Line : %d , malloc\n", 21);
  return ((void *)0);
 }
 memset(tmp, 0, bytes);
 return tmp;
}

variable_types: bytes int

variable_types:
tmp
void *

return_type: void *


printfd

decompiled_code:
ssize_t printfd(int fd, char *format, ...)
{
int v2; // eax
gcc_va_list arg; // [rsp+8h] [rbp-2D0h] BYREF
char s[512]; // [rsp+20h] [rbp-2B8h] BYREF

va_start(arg, format);
v2 = vsnprintf(s, 0x200uLL, format, arg);
return write(fd, s, v2);
}

canonical_decompiled_code:
ssize_t func1(int fd, char *format, ...)
{
int v2; // eax
gcc_va_list arg; // [rsp+8h] [rbp-2D0h] BYREF
char s[512]; // [rsp+20h] [rbp-2B8h] BYREF

va_start(arg, format);
v2 = vsnprintf(s, 0x200uLL, format, arg);
return write(fd, s, v2);
}

original_code:
int printfd(int fd, const char *fmt, ...)
{
 char data[512];
 int len;
 va_list ap;
 int wr;
 __builtin_va_start(ap,fmt);
 len = vsnprintf(data, 512, fmt, ap);
 __builtin_va_end(ap);
 wr = write(fd, data, len);
 return wr;
}

canonical_original_code:
int printfd(int fd, char *fmt, ...)
{
 char data[512];
 int len;
 __builtin_va_list ap;
 int wr;
 __builtin_va_start(ap,fmt);
 len = vsnprintf(data, 512, fmt, ap);
 __builtin_va_end(ap);
 wr = write(fd, data, len);
 return wr;
}

variable_types: fd int

variable_types:
fmt
char *

variable_types:
data
char [512]

variable_types: len int

variable_types: wr int

return_type: int


ascii

decompiled_code:
char *__fastcall ascii(char *s, unsigned int a2)
{
unsigned int v2; // ebp

v2 = a2;
if ( ((*_ctype_b_loc())[a2] & 0x4000) == 0 )
v2 = 46;
sprintf(s, "%c", v2);
return s + 1;
}

canonical_decompiled_code:
char *__fastcall func2(char *s, unsigned int a2)
{
unsigned int v2; // ebp

v2 = a2;
if ( ((*_ctype_b_loc())[a2] & 0x4000) == 0 )
v2 = 46;
sprintf(s, "%c", v2);
return s + 1;
}

original_code:
char *ascii(char *position, int c)
{
 if (!((*__ctype_b_loc ())[(int) ((c))] & (unsigned short int) _ISprint))
  c = '.';
 sprintf(position, "%c", c);
 return (++position);
}

canonical_original_code:
char *ascii(char *position, int c)
{
 if (!((*__ctype_b_loc ())[(int) ((c))] & (unsigned short) _ISprint))
  c = '.';
 sprintf(position, "%c", c);
 return (++position);
}

variable_types:
position
char *

variable_types: c int


hex

decompiled_code:
char *__fastcall hex(char *a1, unsigned __int8 a2)
{
sprintf(a1, "%02x ", a2);
a1[3] = 32;
return a1 + 3;
}

canonical_decompiled_code:
char *__fastcall func3(char *a1, unsigned __int8 a2)
{
sprintf(a1, "%02x ", a2);
a1[3] = 32;
return a1 + 3;
}

original_code:
char *hex(char *position, int c)
{
 int offset = 3;
 sprintf(position, "%02x ", (unsigned char)c);
 *(position + offset) = ' ';
 return (position + offset);
}

variable_types: offset int


original_code:
void raw_dump(struct procinfo *pi)
{
 int left, written;
 u_char *ptr;
 struct map_addr *ma_ptr,*ma_tmp;
 if((pi->pi_debug | 4) & 1)
  ma_tmp = pi->pi_stack;
 else
  ma_tmp = pi->pi_addr;
 for (ma_ptr = ma_tmp; ma_ptr; ma_ptr = ma_ptr->ma_next) {
  ptr = ma_ptr->ma_data;
  left = pi->pi_offset;
  while (left > 0) {
   written = write(1, ptr, left);
   left -= written;
   ptr += written;
  }
 }
}

canonical_original_code:
void raw_dump(struct procinfo *pi)
{
 int left; int written;
 unsigned char *ptr;
 struct map_addr *ma_ptr; struct map_addr *ma_tmp;
 if((pi->pi_debug | 4) & 1)
  ma_tmp = pi->pi_stack;
 else
  ma_tmp = pi->pi_addr;
 for (ma_ptr = ma_tmp; ma_ptr; ma_ptr = ma_ptr->ma_next) {
  ptr = ma_ptr->ma_data;
  left = pi->pi_offset;
  while (left > 0) {
   written = write(1, ptr, left);
   left -= written;
   ptr += written;
  }
 }
}

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

variable_types: left int

variable_types: written int

variable_types:
ptr
unsigned char *

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


die

decompiled_code:
void __fastcall __noreturn die(const char *a1)
{
int *v1; // rax

perror(a1);
v1 = _errno_location();
exit(*v1);
}

canonical_decompiled_code:
void __fastcall __noreturn func6(const char *a1)
{
int *v1; // rax

perror(a1);
v1 = _errno_location();
exit(*v1);
}

original_code:
void die(const char *msg)
{
 perror(msg);
 exit((*__errno_location ()));
}

canonical_original_code:
void die(char *msg)
{
 perror(msg);
 exit((*__errno_location ()));
}

variable_types:
msg
char *


decompiled_code:
void __fastcall __noreturn btrace_banner(const char *a1, int a2)
{
printfd(1LL, "Usage : %s <options> \n", a1);
printfd(1LL, "Written By M.Ghannam (Simo36)\n\n");
printfd(
1LL,
"Process Invoker methods : \n"
" -p --attach <process id> \tSet a process id\n"
" -t --target <binary process>\tBinary process which you want to leak from\n"
" -A --args [bianry args] \tTarget arguments (optional)\n"
"\n");
printfd(
1LL,
"Dump facilities : \n"
" -d --dump <hex/raw> \tDump memory data (default output)\n"
" -D --dump-elf <out_file> \tDump ELF binary\n"
" -a --address <memory_addr> \tMemory address\n"
" -o --offset <byte offset> \tHow many byte you want to leak?\n"
" -s --stack\t\t\t \tDump the stack \n"
"\n");
exit(a2);
}

canonical_decompiled_code:
void __fastcall __noreturn func0(const char *a1, int a2)
{
printfd(1LL, "Usage : %s <options> \n", a1);
printfd(1LL, "Written By M.Ghannam (Simo36)\n\n");
printfd(
1LL,
"Process Invoker methods : \n"
" -p --attach <process id> \tSet a process id\n"
" -t --target <binary process>\tBinary process which you want to leak from\n"
" -A --args [bianry args] \tTarget arguments (optional)\n"
"\n");
printfd(
1LL,
"Dump facilities : \n"
" -d --dump <hex/raw> \tDump memory data (default output)\n"
" -D --dump-elf <out_file> \tDump ELF binary\n"
" -a --address <memory_addr> \tMemory address\n"
" -o --offset <byte offset> \tHow many byte you want to leak?\n"
" -s --stack\t\t\t \tDump the stack \n"
"\n");
exit(a2);
}

original_code:
void btrace_banner(char *arg, int status)
{
 printfd(1, "Usage : %s <options>  \n", arg);
 printfd(1, "Written By  M.Ghannam (Simo36)\n\n");
 printfd(1,
  "Process Invoker methods : \n"
  "  -p  --attach  <process id>    \tSet a process id\n"
  "  -t  --target  <binary process>\tBinary process which you want to leak from\n"
  "  -A  --args    [bianry args]   \tTarget arguments (optional)\n"
  "\n");
 printfd(1,
  "Dump facilities : \n"
  "  -d  --dump     <hex/raw>       \tDump memory data (default output)\n"
  "  -D  --dump-elf <out_file>       \tDump ELF binary\n"
  "  -a  --address  <memory_addr>    \tMemory address\n"
  "  -o  --offset   <byte offset>    \tHow many byte you want to leak?\n"
  "  -s  --stack			   \tDump the stack \n"
  "\n"
  );
 exit(status);
}

variable_types:
arg
char *

variable_types: status int


decompiled_code:
__int64 __fastcall parse_args(int argc, char **argv, _BYTE *a3)
{
__int64 v6; // r14
__int64 v7; // r13
int v8; // eax
int longind[11]; // [rsp+Ch] [rbp-2Ch] BYREF

longind[0] = 0;
*a3 = 0;
a3[1] = 0;
a3[2] = 0;
a3[3] = 0;
a3[6] = 0;
a3[4] = 0;
a3[7] = 0;
a3[8] = 0;
a3[5] = 1;
v6 = bt_proc_init();
v7 = *(_QWORD *)(v6 + 8);
while ( 1 )
{
v8 = getopt_long(argc, argv, "a:p:o:d:D:rst:A:h", &lo, longind);
if ( v8 == -1 )
break;
switch ( v8 )
{
case 'A':
*(_QWORD *)(v7 + 16) = strdup(optarg);
a3[7] |= 1u;
break;
case 'D':
a3[8] |= 1u;
break;
case 'a':
*(_QWORD *)(v7 + 24) = strtol(optarg, 0LL, 16);
a3[1] |= 1u;
break;
case 'd':
a3[5] |= 1u;
a3[4] |= 2u;
if ( !memcmp(optarg, "raw", 3uLL) )
a3[3] |= 1u;
break;
case 'h':
btrace_banner(*argv, 0);
case 'o':
*(_QWORD *)(v7 + 64) = strtol(optarg, 0LL, 10);
a3[2] |= 1u;
break;
case 'p':
*(_DWORD *)v7 = atoi(optarg);
*a3 |= 1u;
break;
case 's':
a3[4] |= 1u;
break;
case 't':
*(_QWORD *)(v7 + 8) = strdup(optarg);
a3[6] |= 1u;
break;
default:
btrace_banner(*argv, -1);
}
}
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func1(int argc, char **argv, _BYTE *a3)
{
__int64 v6; // r14
__int64 v7; // r13
int v8; // eax
int longind[11]; // [rsp+Ch] [rbp-2Ch] BYREF

longind[0] = 0;
*a3 = 0;
a3[1] = 0;
a3[2] = 0;
a3[3] = 0;
a3[6] = 0;
a3[4] = 0;
a3[7] = 0;
a3[8] = 0;
a3[5] = 1;
v6 = bt_proc_init();
v7 = *(_QWORD *)(v6 + 8);
while ( 1 )
{
v8 = getopt_long(argc, argv, "a:p:o:d:D:rst:A:h", &lo, longind);
if ( v8 == -1 )
break;
switch ( v8 )
{
case 'A':
*(_QWORD *)(v7 + 16) = strdup(optarg);
a3[7] |= 1u;
break;
case 'D':
a3[8] |= 1u;
break;
case 'a':
*(_QWORD *)(v7 + 24) = strtol(optarg, 0LL, 16);
a3[1] |= 1u;
break;
case 'd':
a3[5] |= 1u;
a3[4] |= 2u;
if ( !memcmp(optarg, "raw", 3uLL) )
a3[3] |= 1u;
break;
case 'h':
func0(*argv, 0);
case 'o':
*(_QWORD *)(v7 + 64) = strtol(optarg, 0LL, 10);
a3[2] |= 1u;
break;
case 'p':
*(_DWORD *)v7 = atoi(optarg);
*a3 |= 1u;
break;
case 's':
a3[4] |= 1u;
break;
case 't':
*(_QWORD *)(v7 + 8) = strdup(optarg);
a3[6] |= 1u;
break;
default:
func0(*argv, -1);
}
}
return v6;
}

original_code:
static struct btproc *parse_args(int argc, char **argv, struct bt_opts *opts)
{
 int opt, long_opt_index = 0;
 struct procinfo *pi;
 struct btproc *bt;
 opts->pid_opt = 0;
 opts->force_addr_opt = 0;
 opts->off_opt = 0;
 opts->raw_opt = 0;
 opts->target_opt = 0;
 opts->debug_opt = 0;
 opts->target_has_args = 0;
 opts->elf_dump_opts = 0;
 opts->use_data_opt = 1;
 opts->off_opt = 0;
 bt = bt_proc_init();
 pi = bt->pi;
 while ((opt =
  getopt_long(argc, argv, "a:p:o:d:D:rst:A:h", lo,
       &long_opt_index)) != -1) {
  switch (opt) {
  case 'a':
   pi->pi_address = strtol(optarg, ((void *)0), 0x10);
   opts->force_addr_opt |= 1;
   break;
  case 'p':
   pi->pi_pid = atoi(optarg);
   opts->pid_opt |= 1;
   break;
  case 't':
   pi->pi_target = (u_char *) strdup((const char *)optarg);
   opts->target_opt |= 1;
   break;
  case 'A':
   pi->pi_args = (u_char *) strdup((const char *)optarg);
   opts->target_has_args |= 1;
   break;
  case 'h':
   btrace_banner(*argv, 0);
   break;
  case 'o':
   pi->pi_offset = strtol(optarg, ((void *)0), 10);
   opts->off_opt |= 1;
   break;
  case 'd':
   opts->use_data_opt |= 1;
   opts->debug_opt |= 2;
   if(!strncmp(optarg,"raw",3))
    opts->raw_opt |= 1;
   break;
  case 's':
   opts->debug_opt |= 1;
   break;
  case 'D':
   opts->elf_dump_opts |= 1;
   break;
  default:
   btrace_banner(*argv, -1);
  }
 }
 return bt;
}

canonical_original_code:
static struct btproc *parse_args(int argc, char **argv, struct bt_opts *opts)
{
 int opt; int long_opt_index = 0;
 struct procinfo *pi;
 struct btproc *bt;
 opts->pid_opt = 0;
 opts->force_addr_opt = 0;
 opts->off_opt = 0;
 opts->raw_opt = 0;
 opts->target_opt = 0;
 opts->debug_opt = 0;
 opts->target_has_args = 0;
 opts->elf_dump_opts = 0;
 opts->use_data_opt = 1;
 opts->off_opt = 0;
 bt = bt_proc_init();
 pi = bt->pi;
 while ((opt =
  getopt_long(argc, argv, "a:p:o:d:D:rst:A:h", lo,
       &long_opt_index)) != -1) {
  switch (opt) {
  case 'a':
   pi->pi_address = strtol(optarg, ((void *)0), 0x10);
   opts->force_addr_opt |= 1;
   break;
  case 'p':
   pi->pi_pid = atoi(optarg);
   opts->pid_opt |= 1;
   break;
  case 't':
   pi->pi_target = (unsigned char *) strdup((char *)optarg);
   opts->target_opt |= 1;
   break;
  case 'A':
   pi->pi_args = (unsigned char *) strdup((char *)optarg);
   opts->target_has_args |= 1;
   break;
  case 'h':
   btrace_banner(*argv, 0);
   break;
  case 'o':
   pi->pi_offset = strtol(optarg, ((void *)0), 10);
   opts->off_opt |= 1;
   break;
  case 'd':
   opts->use_data_opt |= 1;
   opts->debug_opt |= 2;
   if(!strncmp(optarg,"raw",3))
    opts->raw_opt |= 1;
   break;
  case 's':
   opts->debug_opt |= 1;
   break;
  case 'D':
   opts->elf_dump_opts |= 1;
   break;
  default:
   btrace_banner(*argv, -1);
  }
 }
 return bt;
}

variable_types: argc int

variable_types:
argv
char **

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

variable_types: opt int

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


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbx
const char *v4; // rax
char **v5; // r12
char v7; // [rsp+7h] [rbp-21h] BYREF
__int16 v8; // [rsp+8h] [rbp-20h]
char v9; // [rsp+Ah] [rbp-1Eh]
unsigned __int8 v10; // [rsp+Bh] [rbp-1Dh]
char v11; // [rsp+Dh] [rbp-1Bh]
char v12; // [rsp+Eh] [rbp-1Ah]

v3 = parse_args(argc, (char **)argv, &v7);
*(_DWORD *)(*(_QWORD *)(v3 + 8) + 72LL) = v10;
if ( !v11 )
{
if ( !v7 )
{
printfd(2LL, "\x1B[91m[x] \x1B[0mNo such target or porcess\n");
btrace_banner(*argv, 1);
}
goto LABEL_11;
}
if ( v7 )
{
bt_proc_destroy(v3);
printfd(2LL, "\x1B[91m[x] \x1B[0m You can't choose target and pid together !\n");
btrace_banner(*argv, 1);
}
v4 = (const char *)check_target_path(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 8LL), *(_QWORD *)(*(_QWORD *)(v3 + 8) + 80LL));
*(_QWORD *)v3 = v4;
if ( !v4 )
{
bt_proc_destroy(v3);
btrace_banner(*argv, 1);
}
if ( v12 )
{
(*(void (__fastcall **)(_QWORD, __int64))(v3 + 24))(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 16LL), v3);
}
else
{
v5 = *(char ***)(v3 + 16);
*v5 = strdup(v4);
}
if ( (_BYTE)v8 )
{
if ( !HIBYTE(v8) )
{
LABEL_8:
printfd(2LL, "\x1B[92m[-] \x1B[0mYou may choose both of address and offset !\n");
bt_proc_destroy(v3);
btrace_banner(*argv, 1);
}
}
else if ( HIBYTE(v8) )
{
goto LABEL_8;
}
**(_QWORD **)(*(_QWORD *)(v3 + 8) + 96LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL);
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 96LL) + 8LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL)
+ *(_QWORD *)(*(_QWORD *)(v3 + 8) + 64LL);
**(_QWORD **)(*(_QWORD *)(v3 + 8) + 88LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL);
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 88LL) + 8LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL)
+ *(_QWORD *)(*(_QWORD *)(v3 + 8) + 64LL);
exec_target(v3);
if ( !v8 )
{
printfd(
2LL,
"\x1B[94m[+] \x1B[0mTarget :\x1B[92m %s \x1B[0m PID : \x1B[92m%d\x1B[0m\n",
*(const char **)v3,
**(unsigned int **)(v3 + 8));
if ( (unsigned int)read_procfs_maps(*(_QWORD *)(v3 + 8)) == -1 )
die("no such process");
}
fetch_data(*(_QWORD *)(v3 + 8));
if ( v7 )
{
LABEL_11:
if ( (unsigned int)attach_process(*(_QWORD *)(v3 + 8)) == -1 )
die("\x1B[91m[x] \x1B[0mCan't attach process");
get_cmdline_by_pid(*(_QWORD *)(v3 + 8));
printfd(
2LL,
"\x1B[94m[+] \x1B[0mAttach PID:\x1B[92m %d\x1B[0m Target :\x1B[92m %s\x1B[0m\n",
**(unsigned int **)(v3 + 8),
*(const char **)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 80LL) + 1LL));
if ( (_BYTE)v8 )
{
if ( HIBYTE(v8) )
{
LABEL_15:
**(_QWORD **)(*(_QWORD *)(v3 + 8) + 96LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL);
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 96LL) + 8LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL)
+ *(_QWORD *)(*(_QWORD *)(v3 + 8) + 64LL);
**(_QWORD **)(*(_QWORD *)(v3 + 8) + 88LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL);
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 88LL) + 8LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL)
+ *(_QWORD *)(*(_QWORD *)(v3 + 8) + 64LL);
if ( !v8 && (unsigned int)read_procfs_maps(*(_QWORD *)(v3 + 8)) == -1 )
die("\x1B[91m[x] \x1B[0mNo such process");
fetch_data(*(_QWORD *)(v3 + 8));
goto LABEL_23;
}
}
else if ( !HIBYTE(v8) )
{
goto LABEL_15;
}
printfd(2LL, "\x1B[92m[-] \x1B[0mYou may choose both of address and offset !\n");
bt_proc_destroy(v3);
btrace_banner(*argv, 1);
}
LABEL_23:
if ( v9 )
raw_dump(*(_QWORD *)(v3 + 8));
else
dump_using_memory(*(_QWORD *)(v3 + 8));
pinfo_destroy(*(_QWORD *)(v3 + 8));
bt_proc_destroy(v3);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbx
const char *v4; // rax
char **v5; // r12
char v7; // [rsp+7h] [rbp-21h] BYREF
__int16 v8; // [rsp+8h] [rbp-20h]
char v9; // [rsp+Ah] [rbp-1Eh]
unsigned __int8 v10; // [rsp+Bh] [rbp-1Dh]
char v11; // [rsp+Dh] [rbp-1Bh]
char v12; // [rsp+Eh] [rbp-1Ah]

v3 = func1(argc, (char **)argv, &v7);
*(_DWORD *)(*(_QWORD *)(v3 + 8) + 72LL) = v10;
if ( !v11 )
{
if ( !v7 )
{
printfd(2LL, "\x1B[91m[x] \x1B[0mNo such target or porcess\n");
func0(*argv, 1);
}
goto LABEL_11;
}
if ( v7 )
{
bt_proc_destroy(v3);
printfd(2LL, "\x1B[91m[x] \x1B[0m You can't choose target and pid together !\n");
func0(*argv, 1);
}
v4 = (const char *)check_target_path(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 8LL), *(_QWORD *)(*(_QWORD *)(v3 + 8) + 80LL));
*(_QWORD *)v3 = v4;
if ( !v4 )
{
bt_proc_destroy(v3);
func0(*argv, 1);
}
if ( v12 )
{
(*(void (__fastcall **)(_QWORD, __int64))(v3 + 24))(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 16LL), v3);
}
else
{
v5 = *(char ***)(v3 + 16);
*v5 = strdup(v4);
}
if ( (_BYTE)v8 )
{
if ( !HIBYTE(v8) )
{
LABEL_8:
printfd(2LL, "\x1B[92m[-] \x1B[0mYou may choose both of address and offset !\n");
bt_proc_destroy(v3);
func0(*argv, 1);
}
}
else if ( HIBYTE(v8) )
{
goto LABEL_8;
}
**(_QWORD **)(*(_QWORD *)(v3 + 8) + 96LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL);
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 96LL) + 8LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL)
+ *(_QWORD *)(*(_QWORD *)(v3 + 8) + 64LL);
**(_QWORD **)(*(_QWORD *)(v3 + 8) + 88LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL);
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 88LL) + 8LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL)
+ *(_QWORD *)(*(_QWORD *)(v3 + 8) + 64LL);
exec_target(v3);
if ( !v8 )
{
printfd(
2LL,
"\x1B[94m[+] \x1B[0mTarget :\x1B[92m %s \x1B[0m PID : \x1B[92m%d\x1B[0m\n",
*(const char **)v3,
**(unsigned int **)(v3 + 8));
if ( (unsigned int)read_procfs_maps(*(_QWORD *)(v3 + 8)) == -1 )
die("no such process");
}
fetch_data(*(_QWORD *)(v3 + 8));
if ( v7 )
{
LABEL_11:
if ( (unsigned int)attach_process(*(_QWORD *)(v3 + 8)) == -1 )
die("\x1B[91m[x] \x1B[0mCan't attach process");
get_cmdline_by_pid(*(_QWORD *)(v3 + 8));
printfd(
2LL,
"\x1B[94m[+] \x1B[0mAttach PID:\x1B[92m %d\x1B[0m Target :\x1B[92m %s\x1B[0m\n",
**(unsigned int **)(v3 + 8),
*(const char **)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 80LL) + 1LL));
if ( (_BYTE)v8 )
{
if ( HIBYTE(v8) )
{
LABEL_15:
**(_QWORD **)(*(_QWORD *)(v3 + 8) + 96LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL);
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 96LL) + 8LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL)
+ *(_QWORD *)(*(_QWORD *)(v3 + 8) + 64LL);
**(_QWORD **)(*(_QWORD *)(v3 + 8) + 88LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL);
*(_QWORD *)(*(_QWORD *)(*(_QWORD *)(v3 + 8) + 88LL) + 8LL) = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 24LL)
+ *(_QWORD *)(*(_QWORD *)(v3 + 8) + 64LL);
if ( !v8 && (unsigned int)read_procfs_maps(*(_QWORD *)(v3 + 8)) == -1 )
die("\x1B[91m[x] \x1B[0mNo such process");
fetch_data(*(_QWORD *)(v3 + 8));
goto LABEL_23;
}
}
else if ( !HIBYTE(v8) )
{
goto LABEL_15;
}
printfd(2LL, "\x1B[92m[-] \x1B[0mYou may choose both of address and offset !\n");
bt_proc_destroy(v3);
func0(*argv, 1);
}
LABEL_23:
if ( v9 )
raw_dump(*(_QWORD *)(v3 + 8));
else
dump_using_memory(*(_QWORD *)(v3 + 8));
pinfo_destroy(*(_QWORD *)(v3 + 8));
bt_proc_destroy(v3);
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


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

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


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

v0 = (_QWORD *)xmalloc(32LL);
if ( v0 )
{
v0[1] = pinfo_init();
v1 = (_QWORD *)xmalloc(16LL);
v0[2] = v1;
*v1 = 0LL;
if ( !v0[2] )
{
printf("\x1B[91m[x] \x1B[0mline : %d,parse_target_args() : error allocation\n", 118LL);
die("Error");
}
v0[3] = parse_target_args;
}
return v0;
}

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

v0 = (_QWORD *)xmalloc(32LL);
if ( v0 )
{
v0[1] = func2();
v1 = (_QWORD *)xmalloc(16LL);
v0[2] = v1;
*v1 = 0LL;
if ( !v0[2] )
{
printf("\x1B[91m[x] \x1B[0mline : %d,parse_target_args() : error allocation\n", 118LL);
die("Error");
}
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;
}

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


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

v2 = strdup(name);
memset(v13, 0, 0x400uLL);
v13[1024] = 0;
v3 = realpath(name, v13);
v4 = v3;
if ( v3 )
{
*(_QWORD *)(a2 + 1) = strdup(v3);
}
else if ( access(name, 0) )
{
v6 = getenv("PATH");
v7 = strtok(v6, ":");
if ( !v7 )
{
LABEL_10:
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 = (char *)xmalloc((unsigned int)(v8 + v9 + 2));
v11 = strlen(v7);
v12 = strlen(v2);
memset(v10, 0, v11 + v12 + 2);
strcpy(v10, v7);
*(_WORD *)&v10[strlen(v10)] = 47;
strcat(v10, v2);
if ( !access(v10, 0) )
break;
v7 = strtok(0LL, ":");
free(v10);
if ( !v7 )
goto LABEL_10;
}
get_file_permissions(v10, a2);
*(_QWORD *)(a2 + 1) = strdup(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; // r12
char *v3; // rax
char *v4; // r13
char *v6; // rax
char *v7; // rbp
int v8; // ebx
int v9; // eax
char *v10; // rbx
size_t v11; // r15
size_t v12; // rax
char v13[1096]; // [rsp+0h] [rbp-448h] BYREF

v2 = strdup(name);
memset(v13, 0, 0x400uLL);
v13[1024] = 0;
v3 = realpath(name, v13);
v4 = v3;
if ( v3 )
{
*(_QWORD *)(a2 + 1) = strdup(v3);
}
else if ( access(name, 0) )
{
v6 = getenv("PATH");
v7 = strtok(v6, ":");
if ( !v7 )
{
LABEL_10:
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 = (char *)xmalloc((unsigned int)(v8 + v9 + 2));
v11 = strlen(v7);
v12 = strlen(v2);
memset(v10, 0, v11 + v12 + 2);
strcpy(v10, v7);
*(_WORD *)&v10[strlen(v10)] = 47;
strcat(v10, v2);
if ( !access(v10, 0) )
break;
v7 = strtok(0LL, ":");
free(v10);
if ( !v7 )
goto LABEL_10;
}
func4(v10, a2);
*(_QWORD *)(a2 + 1) = strdup(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 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; } *


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
int *v5; // rax
char *v6; // rax
__int64 v7; // rbx
int *v8; // rax
char *v9; // rax
int *v10; // rax
char *v11; // rax
struct sigaction v12; // [rsp+0h] [rbp-B8h] BYREF

memset(&v12.sa_mask, 0, 0x90uLL);
v12.sa_handler = (__sighandler_t)catch_child_proc;
sigemptyset(&v12.sa_mask);
if ( sigaction(17, &v12, 0LL) == -1 )
{
v5 = _errno_location();
v6 = strerror(*v5);
printfd(2LL, "\x1B[91m[x] \x1B[0msigaction : %s\n", v6);
exit(1);
}
v1 = *(__pid_t **)(a1 + 8);
v2 = fork();
v3 = v2;
if ( v2 )
{
if ( v2 == -1 )
{
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);
bt_proc_destroy(a1);
exit(1);
}
result = wait(0LL);
*v1 = v3;
}
else
{
close(0);
close(1);
close(2);
v7 = ptrace(PTRACE_TRACEME, 0LL, 0LL, 0LL);
result = execve(*(const char **)a1, *(char *const **)(a1 + 16), 0LL);
if ( v7 == -1 )
{
v8 = _errno_location();
v9 = strerror(*v8);
printfd(2LL, "\x1B[91m[x] \x1B[0mline : %d,can't trace the process :\x1B[91m%s\x1B[0m\n", 315LL, v9);
bt_proc_destroy(a1);
exit(1);
}
}
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
int *v5; // rax
char *v6; // rax
__int64 v7; // rbx
int *v8; // rax
char *v9; // rax
int *v10; // rax
char *v11; // rax
struct sigaction v12; // [rsp+0h] [rbp-B8h] BYREF

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


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


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:
void *__fastcall thread_function(void *a1)
{
unsigned int v1; // er12
unsigned int i; // ebx

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

canonical_decompiled_code:
void *__fastcall func8(void *a1)
{
unsigned int v1; // er12
unsigned int i; // ebx

v1 = *(_DWORD *)a1;
for ( i = 0; i != 5; ++i )
{
printf("[%s] thread id: %d (loop index: %d)\n", "thread_function", v1, i);
*(_DWORD *)a1 *= v1;
func7();
}
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 *


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 *v3; // rbp
__int64 i; // rbx
void **v5; // rbp
__int64 j; // rbx
__int64 v8; // [rsp+0h] [rbp-E8h] BYREF
void *thread_return[23]; // [rsp+30h] [rbp-B8h] BYREF

printf("[%s] hello world!\n", "main");
v3 = &v8;
for ( i = 0LL; i != 10; ++i )
{
*(_DWORD *)v3 = i;
printf("[%s] create thread id %d\n", "main", (unsigned int)i);
pthread_create((pthread_t *)&thread_return[i + 10], 0LL, thread_function, v3);
v3 = (__int64 *)((char *)v3 + 4);
}
v5 = thread_return;
for ( j = 0LL; j != 10; ++j )
{
pthread_join((pthread_t)thread_return[j + 10], v5);
printf("[%s] thread id %d returned with exit status %d\n", "main", (unsigned int)j, *(unsigned int *)*v5);
fflush(0LL);
++v5;
}
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:
__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 init_handler_lut()
{
unsigned int v0; // ebx
__int64 i; // rbp
__int64 result; // rax

p_debug("sizeof handler_lut: %d", 256LL);
v0 = 1;
for ( i = 0LL; ; ++i )
{
if ( v0 - 49 <= 9 )
{
p_debug("installing nummerical char handler for 0x%x", (unsigned int)i);
handler_lut[i] = (__int64)num_ascii_char_handler;
goto LABEL_5;
}
if ( v0 - 66 <= 0x19 )
{
p_debug("installing upper alpha ascii char handler for 0x%x", (unsigned int)i);
handler_lut[i] = (__int64)upper_alpha_ascii_char_handler;
goto LABEL_5;
}
if ( v0 - 98 <= 0x19 )
{
p_debug("installing lower alpha ascii char handler for 0x%x", (unsigned int)i);
handler_lut[i] = (__int64)lower_alpha_ascii_char_handler;
goto LABEL_5;
}
result = p_debug("installing default handler for 0x%x", (unsigned int)i);
handler_lut[i] = (__int64)default_handler;
if ( v0 > 0xFF )
break;
LABEL_5:
++v0;
}
return result;
}

canonical_decompiled_code:
__int64 func12()
{
unsigned int v0; // ebx
__int64 i; // rbp
__int64 result; // rax

func15("sizeof handler_lut: %d", 256LL);
v0 = 1;
for ( i = 0LL; ; ++i )
{
if ( v0 - 49 <= 9 )
{
func15("installing nummerical char handler for 0x%x", (unsigned int)i);
handler_lut[i] = (__int64)num_ascii_char_handler;
goto LABEL_5;
}
if ( v0 - 66 <= 0x19 )
{
func15("installing upper alpha ascii char handler for 0x%x", (unsigned int)i);
handler_lut[i] = (__int64)upper_alpha_ascii_char_handler;
goto LABEL_5;
}
if ( v0 - 98 <= 0x19 )
{
func15("installing lower alpha ascii char handler for 0x%x", (unsigned int)i);
handler_lut[i] = (__int64)lower_alpha_ascii_char_handler;
goto LABEL_5;
}
result = func15("installing default handler for 0x%x", (unsigned int)i);
handler_lut[i] = (__int64)default_handler;
if ( v0 > 0xFF )
break;
LABEL_5:
++v0;
}
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, stdout);
vfprintf(stdout, format, arg);
return fputc(10, stdout);
}

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

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

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
__int64 result; // rax

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

canonical_decompiled_code:
__int64 func17()
{
int i; // ebx
__int64 result; // rax

for ( i = 0; i != 256; ++i )
result = func11(i);
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


decompiled_code:
size_t run_ascii_str_test()
{
size_t i; // rbx
size_t result; // rax
char v2[72]; // [rsp+0h] [rbp-48h] BYREF

strcpy(v2, "hello world! i am a test sting with several letters.");
for ( i = 0LL; ; ++i )
{
result = strlen(v2);
if ( result <= i )
break;
trigger_call(v2[i]);
}
return result;
}

canonical_decompiled_code:
size_t func18()
{
size_t i; // rbx
size_t result; // rax
char v2[72]; // [rsp+0h] [rbp-48h] BYREF

strcpy(v2, "hello world! i am a test sting with several letters.");
for ( i = 0LL; ; ++i )
{
result = strlen(v2);
if ( result <= i )
break;
func11(v2[i]);
}
return result;
}

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(_BYTE *a1, __int64 a2)
{
int result; // eax
__int64 v4; // r14
__int64 i; // rbx
unsigned int v6; // ebp
const unsigned __int16 **v7; // rax
unsigned __int8 v8; // di

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

canonical_decompiled_code:
int __fastcall func8(_BYTE *a1, __int64 a2)
{
int result; // eax
__int64 v4; // r14
__int64 i; // rbx
unsigned int v6; // ebp
const unsigned __int16 **v7; // rax
unsigned __int8 v8; // di

printf("\n[i] print %d bytes from address %p\n", a2, a1);
result = 8 - (a2 & 7);
if ( (a2 & 7) == 0 )
result = 0;
v4 = (unsigned int)(result + a2);
for ( i = 0LL; i != v4; ++i )
{
if ( (i & 7) == 0 )
printf("0x%06x: ", (unsigned int)i);
if ( (unsigned int)a2 <= (unsigned int)i )
result = printf(" ");
else
result = printf("%02x ", (unsigned __int8)a1[i]);
if ( (i & 7) == 7 )
{
if ( (int)i - 7 <= (unsigned int)i )
{
v6 = i - 7;
do
{
if ( (unsigned int)a2 <= v6 )
{
putchar(32);
}
else
{
v7 = __ctype_b_loc();
v8 = a1[v6];
if ( ((*v7)[(char)v8] & 0x4000) != 0 )
putchar(v8);
else
putchar(46);
}
++v6;
}
while ( (_DWORD)i - 7 + ((int)i + 1 < (unsigned int)(i - 6) ? 0xFFFFFFF9 : 0) + 8 != v6 );
}
result = putchar(10);
}
}
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)
{
__int128 v4[2]; // [rsp+0h] [rbp-68h] BYREF
__m128i s1; // [rsp+20h] [rbp-48h] BYREF
__m128i v6; // [rsp+30h] [rbp-38h] BYREF
__int64 v7[5]; // [rsp+40h] [rbp-28h] BYREF

print_data_type_size();
s1.m128i_i32[0] = -1412567278;
s1.m128i_i64[1] = 0x123456789ABCDEFLL;
v6.m128i_i8[0] = -52;
v7[0] = 4LL;
v7[1] = 5LL;
v7[2] = 6LL;
v6.m128i_i64[1] = (__int64)v7;
printf("[i] data0 memory:");
hexdump(&s1, 32LL);
memset(v4, 66, sizeof(v4));
printf("[i] data1 memory:");
hexdump(v4, 32LL);
puts("[i] assign data0 to data1...");
v4[0] = (__int128)_mm_loadu_si128(&s1);
v4[1] = (__int128)_mm_loadu_si128(&v6);
puts("[i] compare data, byte by byte...");
if ( !memcmp(&s1, v4, 0x20uLL) )
puts(" * data does match!");
else
puts(" * data does _not_ match!");
puts("\n");
printf("[i] data0 memory:");
hexdump(&s1, 32LL);
putchar(10);
printf("[i] data1 memory:");
hexdump(v4, 32LL);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int128 v4[2]; // [rsp+0h] [rbp-68h] BYREF
__m128i s1; // [rsp+20h] [rbp-48h] BYREF
__m128i v6; // [rsp+30h] [rbp-38h] BYREF
__int64 v7[5]; // [rsp+40h] [rbp-28h] BYREF

func7();
s1.m128i_i32[0] = -1412567278;
s1.m128i_i64[1] = 0x123456789ABCDEFLL;
v6.m128i_i8[0] = -52;
v7[0] = 4LL;
v7[1] = 5LL;
v7[2] = 6LL;
v6.m128i_i64[1] = (__int64)v7;
printf("[i] data0 memory:");
func8(&s1, 32LL);
memset(v4, 66, sizeof(v4));
printf("[i] data1 memory:");
func8(v4, 32LL);
puts("[i] assign data0 to data1...");
v4[0] = (__int128)_mm_loadu_si128(&s1);
v4[1] = (__int128)_mm_loadu_si128(&v6);
puts("[i] compare data, byte by byte...");
if ( !memcmp(&s1, v4, 0x20uLL) )
puts(" * data does match!");
else
puts(" * data does _not_ match!");
puts("\n");
printf("[i] data0 memory:");
func8(&s1, 32LL);
putchar(10);
printf("[i] data1 memory:");
func8(v4, 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; }