original_code:
void cfg_show(void)
{
 int sfp, fi;
 printf(" ***************************************************************\r\n");
 printf(" **                   Current Configuration                   **\r\n");
 printf(" ***************************************************************\r\n");
 printf("\r\n");
 for (sfp = 0; sfp < 2; sfp++)
  printf("  SFP %d: %sinserted\r\n", sfp + 1, Cfg.sfp[sfp].enable ? "" : "not ");
 for (fi = 0; fi < 2; fi++) {
  int fault;
  printf("\r\n");
  printf("\r\n");
  printf("  Fault Injection %d\r\n", fi + 1);
  printf("    Status:         %s\r\n", Cfg.i2c_fi[fi].enable ? "enabled" : "disabled");
  printf("    Device Address: 0x%02x\r\n", Cfg.i2c_fi[fi].dev_address);
  printf("    General read:   %s\r\n", Cfg.i2c_fi[fi].general_read_enable ? "enabled" : "disabled");
  printf("    General write:  %s\r\n", Cfg.i2c_fi[fi].general_write_enable ? "enabled" : "disabled");
  printf("\r\n");
  printf("     Custom Fault # | Register Address | R/W | Forced Response \r\n");
  printf("    ----------------+------------------+-----+-----------------\r\n");
  for (fault = 0; fault < 5; fault++) {
   char forced_resp_str[9];
   if (Cfg.i2c_fi[fi].i2c_cust_fault[fault].forced_response == -1)
    sprintf(forced_resp_str, "No force");
   else
    sprintf(forced_resp_str, "0x%02x", Cfg.i2c_fi[fi].i2c_cust_fault[fault].forced_response);
   printf("           %2d       |       0x%02x       |  %s |        %s\r\n",
     fault + 1,
     Cfg.i2c_fi[fi].i2c_cust_fault[fault].reg_addr,
     Cfg.i2c_fi[fi].i2c_cust_fault[fault].read_enable && Cfg.i2c_fi[fi].i2c_cust_fault[fault].write_enable ? "RW" :
      Cfg.i2c_fi[fi].i2c_cust_fault[fault].read_enable ? "RO" :
      Cfg.i2c_fi[fi].i2c_cust_fault[fault].write_enable ? "WO" : "--",
     forced_resp_str);
  }
 }
 printf("\r\n");
}

canonical_original_code:
void cfg_show()
{
 int sfp; int fi;
 printf(" ***************************************************************\r\n");
 printf(" **                   Current Configuration                   **\r\n");
 printf(" ***************************************************************\r\n");
 printf("\r\n");
 for (sfp = 0; sfp < 2; sfp++)
  printf("  SFP %d: %sinserted\r\n", sfp + 1, Cfg.sfp[sfp].enable ? "" : "not ");
 for (fi = 0; fi < 2; fi++) {
  int fault;
  printf("\r\n");
  printf("\r\n");
  printf("  Fault Injection %d\r\n", fi + 1);
  printf("    Status:         %s\r\n", Cfg.i2c_fi[fi].enable ? "enabled" : "disabled");
  printf("    Device Address: 0x%02x\r\n", Cfg.i2c_fi[fi].dev_address);
  printf("    General read:   %s\r\n", Cfg.i2c_fi[fi].general_read_enable ? "enabled" : "disabled");
  printf("    General write:  %s\r\n", Cfg.i2c_fi[fi].general_write_enable ? "enabled" : "disabled");
  printf("\r\n");
  printf("     Custom Fault # | Register Address | R/W | Forced Response \r\n");
  printf("    ----------------+------------------+-----+-----------------\r\n");
  for (fault = 0; fault < 5; fault++) {
   char forced_resp_str[9];
   if (Cfg.i2c_fi[fi].i2c_cust_fault[fault].forced_response == -1)
    sprintf(forced_resp_str, "No force");
   else
    sprintf(forced_resp_str, "0x%02x", Cfg.i2c_fi[fi].i2c_cust_fault[fault].forced_response);
   printf("           %2d       |       0x%02x       |  %s |        %s\r\n",
     fault + 1,
     Cfg.i2c_fi[fi].i2c_cust_fault[fault].reg_addr,
     Cfg.i2c_fi[fi].i2c_cust_fault[fault].read_enable && Cfg.i2c_fi[fi].i2c_cust_fault[fault].write_enable ? "RW" :
      Cfg.i2c_fi[fi].i2c_cust_fault[fault].read_enable ? "RO" :
      Cfg.i2c_fi[fi].i2c_cust_fault[fault].write_enable ? "WO" : "--",
     forced_resp_str);
  }
 }
 printf("\r\n");
}


repo: redivo/tcc

decompiled_code:
__int64 __fastcall cfg_dbg_reg(unsigned __int8 a1, const char *a2)
{
__int64 result; // rax

result = hw_dbg_get_reg(a1);
if ( (int)result >= 0 )
{
printf("%s = 0x%x\r\n", a2, (unsigned int)result);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned __int8 a1, const char *a2)
{
__int64 result; // rax

result = hw_dbg_get_reg(a1);
if ( (int)result >= 0 )
{
printf("%s = 0x%x\r\n", a2, (unsigned int)result);
result = 0LL;
}
return result;
}

original_code:
int cfg_dbg_reg(_Bool write, char *reg, int value)
{
 int reg_value;
 if ((reg_value = hw_dbg_get_reg(write, reg, value)) < 0)
  return reg_value;
 printf("%s = 0x%x\r\n", reg, reg_value);
 return 0;
}

variable_types:
reg
char *

variable_types: value int

return_type: int


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

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

original_code:
int cli_debug_read(char *line, int num_of_args)
{
 return 0;
}

variable_types:
line
char *


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

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

original_code:
int cli_debug_write(char *line, int num_of_args)
{
 return 0;
}


decompiled_code:
__int64 __fastcall hw_enable_led(int a1, unsigned __int8 a2)
{
__int64 result; // rax

result = hw_set_value((unsigned int)Leds[2 * a1], (unsigned int)Leds[2 * a1 + 1], a2 ^ 1u);
if ( (int)result > 0 )
result = 0LL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, unsigned __int8 a2)
{
__int64 result; // rax

result = hw_set_value((unsigned int)Leds[2 * a1], (unsigned int)Leds[2 * a1 + 1], a2 ^ 1u);
if ( (int)result > 0 )
result = 0LL;
return result;
}

original_code:
int hw_enable_led(int led, _Bool enable)
{
 do {int _ret; _ret = hw_set_value(Leds[led].port, Leds[led].pin, !enable); if (_ret < 0) { return _ret; }} while (0);
 return 0;
}

variable_types: led int


decompiled_code:
__int64 hw_leds_init()
{
__int64 v0; // rbx
__int64 result; // rax

v0 = 0LL;
while ( 1 )
{
result = hw_pin_set_dir((unsigned int)Leds[2 * v0], (unsigned int)Leds[2 * v0 + 1], 1LL);
if ( (int)result < 0 )
break;
result = hw_enable_led(v0, 0);
if ( (int)result < 0 )
break;
if ( ++v0 == 2 )
return 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 v0; // rbx
__int64 result; // rax

v0 = 0LL;
while ( 1 )
{
result = hw_pin_set_dir((unsigned int)Leds[2 * v0], (unsigned int)Leds[2 * v0 + 1], 1LL);
if ( (int)result < 0 )
break;
result = func0(v0, 0);
if ( (int)result < 0 )
break;
if ( ++v0 == 2 )
return 0LL;
}
return result;
}

original_code:
int hw_leds_init(void)
{
 int led;
 for (led = 0; led < 2; led++) {
  do {int _ret; _ret = hw_pin_set_dir(Leds[led].port, Leds[led].pin, 1); if (_ret < 0) { return _ret; }} while (0);
  do {int _ret; _ret = hw_enable_led(led, 0); if (_ret < 0) { return _ret; }} while (0);
 }
 return 0;
}

canonical_original_code:
int hw_leds_init()
{
 int led;
 for (led = 0; led < 2; led++) {
  do {int _ret; _ret = hw_pin_set_dir(Leds[led].port, Leds[led].pin, 1); if (_ret < 0) { return _ret; }} while (0);
  do {int _ret; _ret = hw_enable_led(led, 0); if (_ret < 0) { return _ret; }} while (0);
 }
 return 0;
}


main

canonical_name: main

repo: refaim/paralabs

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int *v3; // rbx
int arg; // [rsp+Ch] [rbp-2Ch] BYREF
pthread_t th; // [rsp+10h] [rbp-28h] BYREF
pthread_t newthread[4]; // [rsp+18h] [rbp-20h] BYREF

arg = 100;
pthread_create(newthread, 0LL, first_body, &arg);
pthread_create(&th, 0LL, second_body, &arg);
pthread_join(newthread[0], 0LL);
pthread_join(th, 0LL);
v3 = (unsigned int *)numbers;
do
printf("%d\n", *v3++);
while ( v3 != (unsigned int *)&end );
return 0;
}

original_code:
int main(int argc, char* argv[])
{
  int require = 0;
  require += info_compiler[argc];
  require += info_platform[argc];
#ifdef COMPILER_VERSION_MAJOR
  require += info_version[argc];
#endif
#ifdef COMPILER_VERSION_INTERNAL
  require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
  require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
  require += info_simulate_version[argc];
#endif
#if defined(__CRAYXE) || defined(__CRAYXC)
  require += info_cray[argc];
#endif
  require += info_language_dialect_default[argc];
  (void)argv;
  return require;
}

canonical_original_code:
int main(int argc, char *argv[])
{
  int require = 0;
  require += info_compiler[argc];
  require += info_platform[argc];
#ifdef COMPILER_VERSION_MAJOR
  require += info_version[argc];
#endif
#ifdef COMPILER_VERSION_INTERNAL
  require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
  require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
  require += info_simulate_version[argc];
#endif
#if defined(__CRAYXE) || defined(__CRAYXC)
  require += info_cray[argc];
#endif
  require += info_language_dialect_default[argc];
  (void)argv;
  return require;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: require int


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // er13
__int64 v4; // r14
_DWORD *v5; // r12
_DWORD *v6; // rbp
float *v7; // rbx
__int64 v8; // rax
float v9; // xmm0_4
struct timeval v11; // [rsp+20h] [rbp-58h] BYREF
struct timeval tv; // [rsp+30h] [rbp-48h] BYREF

v3 = atoi(argv[1]);
v4 = (unsigned int)atoi(argv[2]);
printf("N=%d P=%d\n", v3, v4);
v5 = malloc(4LL * (int)(v3 * v3));
v6 = malloc(4LL * (int)(v3 * v3));
v7 = (float *)malloc(4LL * (int)(v3 * v3));
if ( (int)(v3 * v3) > 0 )
{
v8 = 0LL;
do
{
v5[v8] = 1036831949;
v6[v8] = 1045220557;
v7[v8++] = 0.0;
}
while ( v8 != v3 * v3 );
}
omp_set_num_threads();
gettimeofday(&tv, 0LL);
GOMP_parallel();
gettimeofday(&v11, 0LL);
v9 = (double)(LODWORD(v11.tv_usec) - LODWORD(tv.tv_usec)) * 0.000001
+ (double)(LODWORD(v11.tv_sec) - LODWORD(tv.tv_sec));
printf("Computation time = %.4f\n", v9);
printf("c[0,0]=%f\n", *v7);
free(v5);
free(v6);
free(v7);
return 0;
}


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rdx
pthread_cond_t v5[2]; // [rsp+0h] [rbp-D8h] BYREF
char v6[96]; // [rsp+60h] [rbp-78h] BYREF
pthread_t newthread; // [rsp+C0h] [rbp-18h] BYREF
pthread_t th[2]; // [rsp+C8h] [rbp-10h] BYREF

event_init(v5, argv, envp);
event_init(v6, argv, v3);
pthread_create(&newthread, 0LL, print_odd, v5);
event_wait(v5);
pthread_create(th, 0LL, print_even, v5);
pthread_join(th[0], 0LL);
pthread_join(newthread, 0LL);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rdx
pthread_cond_t v5[2]; // [rsp+0h] [rbp-D8h] BYREF
char v6[96]; // [rsp+60h] [rbp-78h] BYREF
pthread_t newthread; // [rsp+C0h] [rbp-18h] BYREF
pthread_t th[2]; // [rsp+C8h] [rbp-10h] BYREF

func9(v5, argv, envp);
func9(v6, argv, v3);
pthread_create(&newthread, 0LL, print_odd, v5);
func10(v5);
pthread_create(th, 0LL, print_even, v5);
pthread_join(th[0], 0LL);
pthread_join(newthread, 0LL);
return 0;
}


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // eax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // eax
int v8; // eax
pthread_t v10; // [rsp+8h] [rbp-20h] BYREF
pthread_t th; // [rsp+10h] [rbp-18h] BYREF
pthread_t newthread[2]; // [rsp+18h] [rbp-10h] BYREF

v3 = pthread_create(newthread, 0LL, first_body, 0LL);
check_pthread(v3, "task03.c", 0x39u);
v4 = pthread_create(&th, 0LL, second_body, 0LL);
check_pthread(v4, "task03.c", 0x3Au);
v5 = pthread_create(&v10, 0LL, third_body, 0LL);
check_pthread(v5, "task03.c", 0x3Bu);
v6 = pthread_join(newthread[0], 0LL);
check_pthread(v6, "task03.c", 0x3Cu);
v7 = pthread_join(th, 0LL);
check_pthread(v7, "task03.c", 0x3Du);
v8 = pthread_join(v10, 0LL);
check_pthread(v8, "task03.c", 0x3Eu);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int v3; // eax
int v4; // eax
int v5; // eax
int v6; // eax
int v7; // eax
int v8; // eax
pthread_t v10; // [rsp+8h] [rbp-20h] BYREF
pthread_t th; // [rsp+10h] [rbp-18h] BYREF
pthread_t newthread[2]; // [rsp+18h] [rbp-10h] BYREF

v3 = pthread_create(newthread, 0LL, first_body, 0LL);
func10(v3, "task03.c", 0x39u);
v4 = pthread_create(&th, 0LL, second_body, 0LL);
func10(v4, "task03.c", 0x3Au);
v5 = pthread_create(&v10, 0LL, third_body, 0LL);
func10(v5, "task03.c", 0x3Bu);
v6 = pthread_join(newthread[0], 0LL);
func10(v6, "task03.c", 0x3Cu);
v7 = pthread_join(th, 0LL);
func10(v7, "task03.c", 0x3Du);
v8 = pthread_join(v10, 0LL);
func10(v8, "task03.c", 0x3Eu);
return 0;
}


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
pthread_cond_t v4[2]; // [rsp+0h] [rbp-2F8h] BYREF
pthread_t newthread; // [rsp+68h] [rbp-290h] BYREF
pthread_t v6; // [rsp+70h] [rbp-288h] BYREF
pthread_t v7; // [rsp+78h] [rbp-280h] BYREF
pthread_t v8; // [rsp+80h] [rbp-278h] BYREF
pthread_t v9; // [rsp+88h] [rbp-270h] BYREF
int arg[4]; // [rsp+90h] [rbp-268h] BYREF
char v11[96]; // [rsp+A0h] [rbp-258h] BYREF
char v12[96]; // [rsp+100h] [rbp-1F8h] BYREF
pthread_cond_t cond; // [rsp+160h] [rbp-198h] BYREF
int v14[4]; // [rsp+1C0h] [rbp-138h] BYREF
char v15[96]; // [rsp+1D0h] [rbp-128h] BYREF
char v16[96]; // [rsp+230h] [rbp-C8h] BYREF
pthread_cond_t v17; // [rsp+290h] [rbp-68h] BYREF

init_rand();
event_init(v4);
pthread_create(&newthread, 0LL, (void *(*)(void *))server, v4);
event_wait(v4);
arg[0] = 0;
event_init(&cond);
event_init(v11);
event_init(v12);
pthread_create(&v6, 0LL, (void *(*)(void *))client, arg);
event_wait(&cond);
pthread_create(&v8, 0LL, (void *(*)(void *))user, arg);
v14[0] = 1;
event_init(&v17);
event_init(v15);
event_init(v16);
pthread_create(&v7, 0LL, (void *(*)(void *))client, v14);
event_wait(&v17);
pthread_create(&v9, 0LL, (void *(*)(void *))user, v14);
pthread_join(newthread, 0LL);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
pthread_cond_t v4[2]; // [rsp+0h] [rbp-2F8h] BYREF
pthread_t newthread; // [rsp+68h] [rbp-290h] BYREF
pthread_t v6; // [rsp+70h] [rbp-288h] BYREF
pthread_t v7; // [rsp+78h] [rbp-280h] BYREF
pthread_t v8; // [rsp+80h] [rbp-278h] BYREF
pthread_t v9; // [rsp+88h] [rbp-270h] BYREF
int arg[4]; // [rsp+90h] [rbp-268h] BYREF
char v11[96]; // [rsp+A0h] [rbp-258h] BYREF
char v12[96]; // [rsp+100h] [rbp-1F8h] BYREF
pthread_cond_t cond; // [rsp+160h] [rbp-198h] BYREF
int v14[4]; // [rsp+1C0h] [rbp-138h] BYREF
char v15[96]; // [rsp+1D0h] [rbp-128h] BYREF
char v16[96]; // [rsp+230h] [rbp-C8h] BYREF
pthread_cond_t v17; // [rsp+290h] [rbp-68h] BYREF

func12();
func15(v4);
pthread_create(&newthread, 0LL, (void *(*)(void *))server, v4);
func16(v4);
arg[0] = 0;
func15(&cond);
func15(v11);
func15(v12);
pthread_create(&v6, 0LL, (void *(*)(void *))client, arg);
func16(&cond);
pthread_create(&v8, 0LL, (void *(*)(void *))user, arg);
v14[0] = 1;
func15(&v17);
func15(v15);
func15(v16);
pthread_create(&v7, 0LL, (void *(*)(void *))client, v14);
func16(&v17);
pthread_create(&v9, 0LL, (void *(*)(void *))user, v14);
pthread_join(newthread, 0LL);
return 0;
}


mpzCmp

decompiled_code:
__int64 __fastcall mpzCmp(const void *a1, const void *a2)
{
return __gmpz_cmp();
}

canonical_decompiled_code:
__int64 __fastcall func7(const void *a1, const void *a2)
{
return __gmpz_cmp();
}

original_code:
int mpzCmp(const void* a, const void* b)
{
  mpz_t* first = (mpz_t*)a;
  mpz_t* second = (mpz_t*)b;
  return __gmpz_cmp(*first, *second);
}

canonical_original_code:
int mpzCmp(void *a, void *b)
{
  struct __mpz_struct (*first)[1] = (mpz_t*)a;
  struct __mpz_struct (*second)[1] = (mpz_t*)b;
  return __gmpz_cmp(*first, *second);
}

variable_types:
a
void *

variable_types:
b
void *

variable_types: struct __mpz_struct { int _mp_alloc; int _mp_size; unsigned long *_mp_d; } (*)[1]


determineSide

decompiled_code:
__int64 determineSide()
{
__int64 result; // rax
int v1; // edx

if ( !(unsigned int)__gmpz_cmp() )
return (unsigned int)__gmpz_cmp() != 0;
v1 = __gmpz_cmp();
result = 1LL;
if ( v1 )
result = 1 - ((unsigned int)((unsigned int)__gmpz_cmp() == 0) - 1);
return result;
}

canonical_decompiled_code:
__int64 func8()
{
__int64 result; // rax
int v1; // edx

if ( !(unsigned int)__gmpz_cmp() )
return (unsigned int)__gmpz_cmp() != 0;
v1 = __gmpz_cmp();
result = 1LL;
if ( v1 )
result = 1 - ((unsigned int)((unsigned int)__gmpz_cmp() == 0) - 1);
return result;
}

original_code:
Side determineSide(mpz_t sqdLens[3])
{
  if (__gmpz_cmp(sqdLens[0], sqdLens[1]) == 0 &&
      __gmpz_cmp(sqdLens[1], sqdLens[2]) == 0)
    return Equ;
  else if (__gmpz_cmp(sqdLens[0], sqdLens[1]) == 0 ||
           __gmpz_cmp(sqdLens[1], sqdLens[2]) == 0 ||
           __gmpz_cmp(sqdLens[2], sqdLens[0]) == 0)
    return Iso;
  else
    return Sca;
}

canonical_original_code:
enum Side determineSide(struct __mpz_struct sqdLens[3][1])
{
  if (__gmpz_cmp(sqdLens[0], sqdLens[1]) == 0 &&
      __gmpz_cmp(sqdLens[1], sqdLens[2]) == 0)
    return Equ;
  else if (__gmpz_cmp(sqdLens[0], sqdLens[1]) == 0 ||
           __gmpz_cmp(sqdLens[1], sqdLens[2]) == 0 ||
           __gmpz_cmp(sqdLens[2], sqdLens[0]) == 0)
    return Iso;
  else
    return Sca;
}

variable_types: struct __mpz_struct { int _mp_alloc; int _mp_size; unsigned long *_mp_d; } [3][1]

return_type: enum Side { Equ=0, Iso=1, Sca=2 }


determineAngle

decompiled_code:
__int64 determineAngle()
{
unsigned int v0; // ebx
int v2; // [rsp+4h] [rbp-14h]

__gmpz_init_set();
__gmpz_sub();
__gmpz_sub();
v0 = 1 - ((v2 == 0) - 1);
if ( v2 < 0 )
v0 = 0;
__gmpz_clear();
return v0;
}

canonical_decompiled_code:
__int64 func9()
{
unsigned int v0; // ebx
int v2; // [rsp+4h] [rbp-14h]

__gmpz_init_set();
__gmpz_sub();
__gmpz_sub();
v0 = 1 - ((v2 == 0) - 1);
if ( v2 < 0 )
v0 = 0;
__gmpz_clear();
return v0;
}

original_code:
Angle determineAngle(mpz_t sqdLens[3])
{
  Angle toRet;
  mpz_t leftOver;
  __gmpz_init_set(leftOver, sqdLens[2]);
  __gmpz_sub(leftOver, leftOver, sqdLens[1]);
  __gmpz_sub(leftOver, leftOver, sqdLens[0]);
  int cmp = (__builtin_constant_p ((0) >= 0) && (0) >= 0 ? (__builtin_constant_p (((unsigned long) (0))) && (((unsigned long) (0))) == 0 ? ((leftOver)->_mp_size < 0 ? -1 : (leftOver)->_mp_size > 0) : __gmpz_cmp_ui (leftOver,((unsigned long) (0)))) : __gmpz_cmp_si (leftOver,0));
  if (cmp < 0)
    toRet = Acu;
  else if (cmp == 0)
    toRet = Rig;
  else
    toRet = Obt;
  __gmpz_clear(leftOver);
  return toRet;
}

canonical_original_code:
enum Angle determineAngle(struct __mpz_struct sqdLens[3][1])
{
  enum Angle toRet;
  struct __mpz_struct leftOver[1];
  __gmpz_init_set(leftOver, sqdLens[2]);
  __gmpz_sub(leftOver, leftOver, sqdLens[1]);
  __gmpz_sub(leftOver, leftOver, sqdLens[0]);
  int cmp = (__builtin_constant_p ((0) >= 0) && (0) >= 0 ? (__builtin_constant_p (((unsigned long) (0))) && (((unsigned long) (0))) == 0 ? ((leftOver)->_mp_size < 0 ? -1 : (leftOver)->_mp_size > 0) : __gmpz_cmp_ui (leftOver,((unsigned long) (0)))) : __gmpz_cmp_si (leftOver,0));
  if (cmp < 0)
    toRet = Acu;
  else if (cmp == 0)
    toRet = Rig;
  else
    toRet = Obt;
  __gmpz_clear(leftOver);
  return toRet;
}

variable_types:
toRet
enum Angle { Acu=0, Rig=1, Obt=2 }

variable_types: struct __mpz_struct { int _mp_alloc; int _mp_size; unsigned long *_mp_d; } [1]

variable_types: cmp int

return_type: enum Angle { Acu=0, Rig=1, Obt=2 }


determineTriangle

decompiled_code:
__int64 __fastcall determineTriangle(__int64 a1, __int64 a2, _DWORD *a3, _DWORD *a4)
{
__int64 v4; // rbp
int i; // er12
__int64 j; // rbx
unsigned int v7; // ebx
char base[16]; // [rsp+20h] [rbp-F8h] BYREF
char v12[16]; // [rsp+40h] [rbp-D8h] BYREF
int v13; // [rsp+54h] [rbp-C4h]

v4 = 0LL;
for ( i = 0; ; ++i )
{
__gmpz_inits();
__gmpz_sub();
__gmpz_sub();
v4 += 16LL;
if ( i == 2 )
break;
}
__gmpz_inits();
__gmpz_mul();
__gmpz_mul();
__gmpz_sub();
if ( v13 )
{
for ( j = 0LL; j != 48; j += 16LL )
{
__gmpz_init();
__gmpz_mul();
__gmpz_mul();
__gmpz_add();
}
qsort(base, 3uLL, 0x10uLL, (__compar_fn_t)mpzCmp);
if ( (int)__gmpz_cmp() > 0 || (int)__gmpz_cmp() > 0 )
__assert_fail(
"mpz_cmp(sqdLens[0], sqdLens[1]) <= 0 && mpz_cmp(sqdLens[1], sqdLens[2]) <= 0 && \"Squared lengths in bad order\"",
"triangle.c",
0x6Au,
"determineTriangle");
*a3 = determineSide(base, v12);
*a4 = determineAngle(base);
__gmpz_clear();
__gmpz_clear();
__gmpz_clear();
v7 = 1;
}
else
{
v7 = 0;
}
__gmpz_clears();
__gmpz_clears();
__gmpz_clears();
__gmpz_clears();
return v7;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, __int64 a2, _DWORD *a3, _DWORD *a4)
{
__int64 v4; // rbp
int i; // er12
__int64 j; // rbx
unsigned int v7; // ebx
char base[16]; // [rsp+20h] [rbp-F8h] BYREF
char v12[16]; // [rsp+40h] [rbp-D8h] BYREF
int v13; // [rsp+54h] [rbp-C4h]

v4 = 0LL;
for ( i = 0; ; ++i )
{
__gmpz_inits();
__gmpz_sub();
__gmpz_sub();
v4 += 16LL;
if ( i == 2 )
break;
}
__gmpz_inits();
__gmpz_mul();
__gmpz_mul();
__gmpz_sub();
if ( v13 )
{
for ( j = 0LL; j != 48; j += 16LL )
{
__gmpz_init();
__gmpz_mul();
__gmpz_mul();
__gmpz_add();
}
qsort(base, 3uLL, 0x10uLL, (__compar_fn_t)mpzCmp);
if ( (int)__gmpz_cmp() > 0 || (int)__gmpz_cmp() > 0 )
__assert_fail(
"mpz_cmp(sqdLens[0], sqdLens[1]) <= 0 && mpz_cmp(sqdLens[1], sqdLens[2]) <= 0 && \"Squared lengths in bad order\"",
"triangle.c",
0x6Au,
"determineTriangle");
*a3 = func8(base, v12);
*a4 = func9(base);
__gmpz_clear();
__gmpz_clear();
__gmpz_clear();
v7 = 1;
}
else
{
v7 = 0;
}
__gmpz_clears();
__gmpz_clears();
__gmpz_clears();
__gmpz_clears();
return v7;
}

original_code:
_Bool determineTriangle(mpz_t xs[3], mpz_t ys[3], Side* side, Angle* angle)
{
  _Bool toRet;
  mpz_t xdiffs[3];
  mpz_t ydiffs[3];
  for (int i = 0, j = 2; i < 3; j = i++) {
    __gmpz_inits(xdiffs[i], ydiffs[i], ((void *)0));
    __gmpz_sub(xdiffs[i], xs[i], xs[j]);
    __gmpz_sub(ydiffs[i], ys[i], ys[j]);
  }
  mpz_t tmp1, tmp2, result;
  __gmpz_inits(tmp1, tmp2, result, ((void *)0));
  __gmpz_mul(tmp1, xdiffs[0], ydiffs[1]);
  __gmpz_mul(tmp2, ydiffs[0], xdiffs[1]);
  __gmpz_sub(result, tmp1, tmp2);
  if ((__builtin_constant_p ((0) >= 0) && (0) >= 0 ? (__builtin_constant_p (((unsigned long) (0))) && (((unsigned long) (0))) == 0 ? ((result)->_mp_size < 0 ? -1 : (result)->_mp_size > 0) : __gmpz_cmp_ui (result,((unsigned long) (0)))) : __gmpz_cmp_si (result,0)) == 0) {
    toRet = 0;
  } else {
    mpz_t sqdLens[3];
    for (int i = 0; i < 3; i++) {
      __gmpz_init(sqdLens[i]);
      __gmpz_mul(tmp1, xdiffs[i], xdiffs[i]);
      __gmpz_mul(tmp2, ydiffs[i], ydiffs[i]);
      __gmpz_add(sqdLens[i], tmp1, tmp2);
    }
    qsort(sqdLens, sizeof(sqdLens) / sizeof(sqdLens[0]), sizeof(sqdLens[0]), mpzCmp);
    ((__gmpz_cmp(sqdLens[0], sqdLens[1]) <= 0 && __gmpz_cmp(sqdLens[1], sqdLens[2]) <= 0 && "Squared lengths in bad order") ? (void) (0) : __assert_fail ("mpz_cmp(sqdLens[0], sqdLens[1]) <= 0 && mpz_cmp(sqdLens[1], sqdLens[2]) <= 0 && \"Squared lengths in bad order\"", "triangle.c", 106, __extension__ __PRETTY_FUNCTION__));
    *side = determineSide(sqdLens);
    *angle = determineAngle(sqdLens);
    for (int i = 0; i < 3; i++)
      __gmpz_clear(sqdLens[i]);
    toRet = 1;
  }
  __gmpz_clears(tmp1, tmp2, result, ((void *)0));
  for (int i = 0; i < 3; i++)
    __gmpz_clears(xdiffs[i], ydiffs[i], ((void *)0));
  return toRet;
}

canonical_original_code:
_Bool determineTriangle(struct __mpz_struct xs[3][1], struct __mpz_struct ys[3][1], enum Side *side, enum Angle *angle)
{
  _Bool toRet;
  struct __mpz_struct xdiffs[3][1];
  struct __mpz_struct ydiffs[3][1];
  for (int i = 0; int j = 2; i < 3; j = i++) {
    __gmpz_inits(xdiffs[i], ydiffs[i], ((void *)0));
    __gmpz_sub(xdiffs[i], xs[i], xs[j]);
    __gmpz_sub(ydiffs[i], ys[i], ys[j]);
  }
  struct __mpz_struct tmp1[1]; struct __mpz_struct tmp2[1]; struct __mpz_struct result[1];
  __gmpz_inits(tmp1, tmp2, result, ((void *)0));
  __gmpz_mul(tmp1, xdiffs[0], ydiffs[1]);
  __gmpz_mul(tmp2, ydiffs[0], xdiffs[1]);
  __gmpz_sub(result, tmp1, tmp2);
  if ((__builtin_constant_p ((0) >= 0) && (0) >= 0 ? (__builtin_constant_p (((unsigned long) (0))) && (((unsigned long) (0))) == 0 ? ((result)->_mp_size < 0 ? -1 : (result)->_mp_size > 0) : __gmpz_cmp_ui (result,((unsigned long) (0)))) : __gmpz_cmp_si (result,0)) == 0) {
    toRet = 0;
  } else {
    struct __mpz_struct sqdLens[3][1];
    for (int i = 0; i < 3; i++) {
      __gmpz_init(sqdLens[i]);
      __gmpz_mul(tmp1, xdiffs[i], xdiffs[i]);
      __gmpz_mul(tmp2, ydiffs[i], ydiffs[i]);
      __gmpz_add(sqdLens[i], tmp1, tmp2);
    }
    qsort(sqdLens, sizeof(sqdLens) / sizeof(sqdLens[0]), sizeof(sqdLens[0]), mpzCmp);
    ((__gmpz_cmp(sqdLens[0], sqdLens[1]) <= 0 && __gmpz_cmp(sqdLens[1], sqdLens[2]) <= 0 && "Squared lengths in bad order") ? (void) (0) : __assert_fail ("mpz_cmp(sqdLens[0], sqdLens[1]) <= 0 && mpz_cmp(sqdLens[1], sqdLens[2]) <= 0 && \"Squared lengths in bad order\"", "triangle.c", 106, __extension__ __PRETTY_FUNCTION__));
    *side = determineSide(sqdLens);
    *angle = determineAngle(sqdLens);
    for (int i = 0; i < 3; i++)
      __gmpz_clear(sqdLens[i]);
    toRet = 1;
  }
  __gmpz_clears(tmp1, tmp2, result, ((void *)0));
  for (int i = 0; i < 3; i++)
    __gmpz_clears(xdiffs[i], ydiffs[i], ((void *)0));
  return toRet;
}

variable_types:
ys
struct __mpz_struct [3][1]

variable_types:
side
enum Side { Equ=0, Iso=1, Sca=2 } *

variable_types:
angle
enum Angle { Acu=0, Rig=1, Obt=2 } *

variable_types: i int

variable_types: j int

user_defined_types: struct __mpz_struct { int _mp_alloc; int _mp_size; unsigned long *_mp_d; }


printTri

decompiled_code:
int __fastcall printTri(int a1, int a2)
{
const char *v2; // rax
const char *v3; // rdx

if ( a1 == 1 )
{
v2 = "isosceles";
}
else if ( a1 == 2 )
{
v2 = "scalene";
}
else
{
if ( a1 )
__assert_fail("0 && \"bad Side enum value\"", "triangle.c", 0xB6u, "printTri");
v2 = "equilateral";
}
if ( a2 == 1 )
{
v3 = "right";
}
else if ( a2 == 2 )
{
v3 = "obtuse";
}
else
{
if ( a2 )
__assert_fail("0 && \"bad Angle enum value\"", "triangle.c", 0xC5u, "printTri");
v3 = "acute";
}
return printf("%s %s\n", v2, v3);
}

canonical_decompiled_code:
int __fastcall func11(int a1, int a2)
{
const char *v2; // rax
const char *v3; // rdx

if ( a1 == 1 )
{
v2 = "isosceles";
}
else if ( a1 == 2 )
{
v2 = "scalene";
}
else
{
if ( a1 )
__assert_fail("0 && \"bad Side enum value\"", "triangle.c", 0xB6u, "printTri");
v2 = "equilateral";
}
if ( a2 == 1 )
{
v3 = "right";
}
else if ( a2 == 2 )
{
v3 = "obtuse";
}
else
{
if ( a2 )
__assert_fail("0 && \"bad Angle enum value\"", "triangle.c", 0xC5u, "printTri");
v3 = "acute";
}
return printf("%s %s\n", v2, v3);
}

original_code:
void printTri(Side side, Angle angle)
{
  const char* sideStr = ((void *)0);
  switch (side) {
    case Equ:
      sideStr = "equilateral";
      break;
    case Iso:
      sideStr = "isosceles";
      break;
    case Sca:
      sideStr = "scalene";
      break;
    default:
      ((0 && "bad Side enum value") ? (void) (0) : __assert_fail ("0 && \"bad Side enum value\"", "triangle.c", 182, __extension__ __PRETTY_FUNCTION__));
      break;
  }
  const char* angleStr = ((void *)0);
  switch (angle) {
    case Acu:
      angleStr = "acute";
      break;
    case Rig:
      angleStr = "right";
      break;
    case Obt:
      angleStr = "obtuse";
      break;
    default:
      ((0 && "bad Angle enum value") ? (void) (0) : __assert_fail ("0 && \"bad Angle enum value\"", "triangle.c", 197, __extension__ __PRETTY_FUNCTION__));
      break;
  }
  printf("%s %s\n", sideStr, angleStr);
}

canonical_original_code:
void printTri(enum Side side, enum Angle angle)
{
  char *sideStr = ((void *)0);
  switch (side) {
    case Equ:
      sideStr = "equilateral";
      break;
    case Iso:
      sideStr = "isosceles";
      break;
    case Sca:
      sideStr = "scalene";
      break;
    default:
      ((0 && "bad Side enum value") ? (void) (0) : __assert_fail ("0 && \"bad Side enum value\"", "triangle.c", 182, __extension__ __PRETTY_FUNCTION__));
      break;
  }
  char *angleStr = ((void *)0);
  switch (angle) {
    case Acu:
      angleStr = "acute";
      break;
    case Rig:
      angleStr = "right";
      break;
    case Obt:
      angleStr = "obtuse";
      break;
    default:
      ((0 && "bad Angle enum value") ? (void) (0) : __assert_fail ("0 && \"bad Angle enum value\"", "triangle.c", 197, __extension__ __PRETTY_FUNCTION__));
      break;
  }
  printf("%s %s\n", sideStr, angleStr);
}

variable_types:
side
enum Side { Equ=0, Iso=1, Sca=2 }

variable_types:
angle
enum Angle { Acu=0, Rig=1, Obt=2 }

variable_types:
sideStr
char *

variable_types:
angleStr
char *

return_type: void

user_defined_types:
enum Side { Equ=0, Iso=1, Sca=2 }
enum Angle { Acu=0, Rig=1, Obt=2 }


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbx
int result; // eax
int v5; // [rsp+8h] [rbp-80h] BYREF
int v6; // [rsp+Ch] [rbp-7Ch] BYREF
char v7[16]; // [rsp+10h] [rbp-78h] BYREF
char v8[16]; // [rsp+40h] [rbp-48h] BYREF

v3 = 0LL;
if ( argc == 7 )
{
do
{
__gmpz_init_set_str();
__gmpz_init_set_str();
v3 += 16LL;
}
while ( v3 != 48 );
if ( (unsigned __int8)determineTriangle((__int64)v8, (__int64)v7, &v6, &v5) )
printTri(v6, v5);
else
puts("not a triangle");
__gmpz_clears();
__gmpz_clears();
__gmpz_clears();
result = 0;
}
else
{
fwrite("Usage: ./triangle x1 y1 x2 y2 x3 y3\n", 1uLL, 0x24uLL, _bss_start);
result = 1;
}
return result;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbx
int result; // eax
int v5; // [rsp+8h] [rbp-80h] BYREF
int v6; // [rsp+Ch] [rbp-7Ch] BYREF
char v7[16]; // [rsp+10h] [rbp-78h] BYREF
char v8[16]; // [rsp+40h] [rbp-48h] BYREF

v3 = 0LL;
if ( argc == 7 )
{
do
{
__gmpz_init_set_str();
__gmpz_init_set_str();
v3 += 16LL;
}
while ( v3 != 48 );
if ( (unsigned __int8)func10((__int64)v8, (__int64)v7, &v6, &v5) )
func11(v6, v5);
else
puts("not a triangle");
__gmpz_clears();
__gmpz_clears();
__gmpz_clears();
result = 0;
}
else
{
fwrite("Usage: ./triangle x1 y1 x2 y2 x3 y3\n", 1uLL, 0x24uLL, _bss_start);
result = 1;
}
return result;
}

original_code:
int main(int argc, char* argv[])
{
  if (argc != 7) {
    fputs("Usage: ./triangle x1 y1 x2 y2 x3 y3\n", stderr);
    return 1;
  }
  mpz_t xs[3];
  mpz_t ys[3];
  for (int i = 0; i < 3; i++) {
    __gmpz_init_set_str(xs[i], argv[2*i + 1], 10);
    __gmpz_init_set_str(ys[i], argv[2*i + 2], 10);
  }
  Side side;
  Angle angle;
  if (determineTriangle(xs, ys, &side, &angle))
    printTri(side, angle);
  else
    puts("not a triangle");
  for (int i = 0; i < 3; i++)
    __gmpz_clears(xs[i], ys[i], ((void *)0));
  return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
  if (argc != 7) {
    fputs("Usage: ./triangle x1 y1 x2 y2 x3 y3\n", stderr);
    return 1;
  }
  struct __mpz_struct xs[3][1];
  struct __mpz_struct ys[3][1];
  for (int i = 0; i < 3; i++) {
    __gmpz_init_set_str(xs[i], argv[2*i + 1], 10);
    __gmpz_init_set_str(ys[i], argv[2*i + 2], 10);
  }
  enum Side side;
  enum Angle angle;
  if (determineTriangle(xs, ys, &side, &angle))
    printTri(side, angle);
  else
    puts("not a triangle");
  for (int i = 0; i < 3; i++)
    __gmpz_clears(xs[i], ys[i], ((void *)0));
  return 0;
}

variable_types: argc int

variable_types:
argv
char *[]


decompiled_code:
__int64 __fastcall huff_node_frequency_comparer(const void *a1, const void *a2)
{
__int64 result; // rax

result = (unsigned int)*(_QWORD *)(*(_QWORD *)a1 + 24LL) - *(_DWORD *)(*(_QWORD *)a2 + 24LL);
if ( !(_DWORD)result )
result = 2 * (unsigned int)(*(_DWORD *)(*(_QWORD *)a1 + 20LL) >= *(_DWORD *)(*(_QWORD *)a2 + 20LL)) - 1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(const void *a1, const void *a2)
{
__int64 result; // rax

result = (unsigned int)*(_QWORD *)(*(_QWORD *)a1 + 24LL) - *(_DWORD *)(*(_QWORD *)a2 + 24LL);
if ( !(_DWORD)result )
result = 2 * (unsigned int)(*(_DWORD *)(*(_QWORD *)a1 + 20LL) >= *(_DWORD *)(*(_QWORD *)a2 + 20LL)) - 1;
return result;
}

original_code:
int huff_node_frequency_comparer(const void *a, const void *b) {
    huff_node *node_a = *((huff_node **) a);
    huff_node *node_b = *((huff_node **) b);
    int result = node_a->frequency - node_b->frequency;
    if (result == 0) {
        if (node_a->lowest_value < node_b->lowest_value) {
            return -1;
        } else {
            return 1;
        }
    }
    return result;
}

canonical_original_code:
int huff_node_frequency_comparer(void *a, void *b) {
    struct huff_node *node_a = *((huff_node **) a);
    struct huff_node *node_b = *((huff_node **) b);
    int result = node_a->frequency - node_b->frequency;
    if (result == 0) {
        if (node_a->lowest_value < node_b->lowest_value) {
            return -1;
        } else {
            return 1;
        }
    }
    return result;
}

variable_types:
a
void *

variable_types:
b
void *

variable_types: struct huff_node { struct huff_node *left_child; struct huff_node *right_child; int char_number; int lowest_value; unsigned long long frequency; struct huff_node *parent; char *encoding; } *

variable_types: result int


decompiled_code:
__int64 __fastcall get_next_character(__int64 a1, int a2)
{
__int64 result; // rax

if ( !current_6 )
current_6 = a1;
if ( a2 )
{
if ( !*(_QWORD *)(current_6 + 8) )
_assert_fail("current->right_child != 0", "huff_table.c", 0x6Bu, "get_next_character");
current_6 = *(_QWORD *)(current_6 + 8);
}
else
{
if ( !*(_QWORD *)current_6 )
_assert_fail("current->left_child != 0", "huff_table.c", 0x6Eu, "get_next_character");
current_6 = *(_QWORD *)current_6;
}
result = *(unsigned int *)(current_6 + 16);
if ( (int)result < 0 )
return 0xFFFFFFFFLL;
current_6 = a1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, int a2)
{
__int64 result; // rax

if ( !current_6 )
current_6 = a1;
if ( a2 )
{
if ( !*(_QWORD *)(current_6 + 8) )
_assert_fail("current->right_child != 0", "huff_table.c", 0x6Bu, "get_next_character");
current_6 = *(_QWORD *)(current_6 + 8);
}
else
{
if ( !*(_QWORD *)current_6 )
_assert_fail("current->left_child != 0", "huff_table.c", 0x6Eu, "get_next_character");
current_6 = *(_QWORD *)current_6;
}
result = *(unsigned int *)(current_6 + 16);
if ( (int)result < 0 )
return 0xFFFFFFFFLL;
current_6 = a1;
return result;
}

original_code:
int get_next_character(huff_node *root, int one_bit)
{
    static huff_node *current = 0;
    if(current == 0){
        current = root;
    }
    if(one_bit){
        ((current->right_child != 0) ? (void) (0) : __assert_fail ("current->right_child != 0", "huff_table.c", 107, __extension__ __PRETTY_FUNCTION__));
        current = current->right_child;
    } else{
        ((current->left_child != 0) ? (void) (0) : __assert_fail ("current->left_child != 0", "huff_table.c", 110, __extension__ __PRETTY_FUNCTION__));
        current = current->left_child;
    }
    int result = -1;
    int character = current->char_number;
    if(character >= 0){
        result = character;
        current = root;
    }
    return result;
}

canonical_original_code:
int get_next_character(struct huff_node *root, int one_bit)
{
    static struct huff_node *current = 0;
    if(current == 0){
        current = root;
    }
    if(one_bit){
        ((current->right_child != 0) ? (void) (0) : __assert_fail ("current->right_child != 0", "huff_table.c", 107, __extension__ __PRETTY_FUNCTION__));
        current = current->right_child;
    } else{
        ((current->left_child != 0) ? (void) (0) : __assert_fail ("current->left_child != 0", "huff_table.c", 110, __extension__ __PRETTY_FUNCTION__));
        current = current->left_child;
    }
    int result = -1;
    int character = current->char_number;
    if(character >= 0){
        result = character;
        current = root;
    }
    return result;
}

variable_types: character int

user_defined_types: struct huff_node { struct huff_node *left_child; struct huff_node *right_child; int char_number; int lowest_value; unsigned long long frequency; struct huff_node *parent; char *encoding; }


decompiled_code:
__int64 __fastcall create_huff_node(int a1, __int64 a2, __int64 a3)
{
__int64 result; // rax

result = xmalloc(48LL);
*(_QWORD *)result = 0LL;
*(_QWORD *)(result + 8) = 0LL;
*(_DWORD *)(result + 16) = a1;
*(_DWORD *)(result + 20) = a1;
*(_QWORD *)(result + 24) = a2;
*(_QWORD *)(result + 32) = 0LL;
*(_QWORD *)(result + 40) = a3;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1, __int64 a2, __int64 a3)
{
__int64 result; // rax

result = xmalloc(48LL);
*(_QWORD *)result = 0LL;
*(_QWORD *)(result + 8) = 0LL;
*(_DWORD *)(result + 16) = a1;
*(_DWORD *)(result + 20) = a1;
*(_QWORD *)(result + 24) = a2;
*(_QWORD *)(result + 32) = 0LL;
*(_QWORD *)(result + 40) = a3;
return result;
}

original_code:
huff_node *create_huff_node(int char_number, long long frequency, char *encoding) {
    huff_node *node = (huff_node *)xmalloc(sizeof(huff_node));
    node->left_child = ((void *)0);
    node->right_child = ((void *)0);
    node->char_number = char_number;
    node->lowest_value = char_number;
    node->frequency = frequency;
    node->parent = ((void *)0);
    node->encoding = encoding;
    return node;
}

canonical_original_code:
struct huff_node *create_huff_node(int char_number, long long frequency, char *encoding) {
    struct huff_node *node = (huff_node *)xmalloc(sizeof(huff_node));
    node->left_child = ((void *)0);
    node->right_child = ((void *)0);
    node->char_number = char_number;
    node->lowest_value = char_number;
    node->frequency = frequency;
    node->parent = ((void *)0);
    node->encoding = encoding;
    return node;
}

variable_types:
frequency
long long

variable_types:
encoding
char *

return_type: struct huff_node { struct huff_node *left_child; struct huff_node *right_child; int char_number; int lowest_value; unsigned long long frequency; struct huff_node *parent; char *encoding; } *


decompiled_code:
void __fastcall set_right_child(__int64 a1, __int64 a2)
{
if ( !a1 )
_assert_fail("parent != 0 && \"Parent can't be NULL\"", "huff_table.c", 0x89u, "set_right_child");
*(_QWORD *)(a1 + 8) = a2;
if ( a2 )
*(_QWORD *)(a2 + 32) = a1;
}

canonical_decompiled_code:
void __fastcall func3(__int64 a1, __int64 a2)
{
if ( !a1 )
_assert_fail("parent != 0 && \"Parent can't be NULL\"", "huff_table.c", 0x89u, "set_right_child");
*(_QWORD *)(a1 + 8) = a2;
if ( a2 )
*(_QWORD *)(a2 + 32) = a1;
}

original_code:
void set_right_child(huff_node *parent, huff_node *right_child){
    ((parent != 0 && "Parent can't be NULL") ? (void) (0) : __assert_fail ("parent != 0 && \"Parent can't be NULL\"", "huff_table.c", 137, __extension__ __PRETTY_FUNCTION__));
    parent->right_child = right_child;
    if(right_child != 0){
        right_child ->parent = parent;
    }
}

canonical_original_code:
void set_right_child(struct huff_node *parent, struct huff_node *right_child){
    ((parent != 0 && "Parent can't be NULL") ? (void) (0) : __assert_fail ("parent != 0 && \"Parent can't be NULL\"", "huff_table.c", 137, __extension__ __PRETTY_FUNCTION__));
    parent->right_child = right_child;
    if(right_child != 0){
        right_child ->parent = parent;
    }
}


decompiled_code:
void __fastcall free_huff_node(_QWORD *a1)
{
void *v2; // rdi

if ( a1 )
{
if ( *a1 )
free_huff_node();
if ( a1[1] )
free_huff_node();
v2 = (void *)a1[5];
if ( v2 )
free(v2);
free(a1);
}
}

canonical_decompiled_code:
void __fastcall func6(_QWORD *a1)
{
void *v2; // rdi

if ( a1 )
{
if ( *a1 )
func6();
if ( a1[1] )
func6();
v2 = (void *)a1[5];
if ( v2 )
free(v2);
free(a1);
}
}

original_code:
void free_huff_node(huff_node *node) {
    if (node == ((void *)0)) {
        return;
    }
    if (node->left_child != ((void *)0)) {
      free_huff_node(node->left_child);
    }
    if (node->right_child != ((void *)0)) {
      free_huff_node(node->right_child);
    }
    if (node->encoding != ((void *)0)) {
      free(node->encoding);
    }
    free(node);
}

canonical_original_code:
void free_huff_node(struct huff_node *node) {
    if (node == ((void *)0)) {
        return;
    }
    if (node->left_child != ((void *)0)) {
      free_huff_node(node->left_child);
    }
    if (node->right_child != ((void *)0)) {
      free_huff_node(node->right_child);
    }
    if (node->encoding != ((void *)0)) {
      free(node->encoding);
    }
    free(node);
}


decompiled_code:
void __fastcall destroy_huff_tree(_QWORD *a1)
{
_QWORD *v1; // rax

if ( a1 )
{
do
{
v1 = a1;
a1 = (_QWORD *)a1[4];
}
while ( a1 );
free_huff_node(v1);
}
}

canonical_decompiled_code:
void __fastcall func7(_QWORD *a1)
{
_QWORD *v1; // rax

if ( a1 )
{
do
{
v1 = a1;
a1 = (_QWORD *)a1[4];
}
while ( a1 );
func6(v1);
}
}

original_code:
void destroy_huff_tree(huff_node *root) {
    if (root == ((void *)0)) {
        return;
    }
    while (root->parent != ((void *)0)) {
      root = root->parent;
    }
    free_huff_node(root);
}

canonical_original_code:
void destroy_huff_tree(struct huff_node *root) {
    if (root == ((void *)0)) {
        return;
    }
    while (root->parent != ((void *)0)) {
      root = root->parent;
    }
    free_huff_node(root);
}


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

if ( !a2 )
return 0LL;
result = a2;
if ( *(_DWORD *)(a2 + 16) != (_DWORD)a1 )
{
result = find_leaf_node(a1, *(_QWORD *)a2);
if ( !result )
result = find_leaf_node((unsigned int)a1, *(_QWORD *)(a2 + 8));
}
return result;
}

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

if ( !a2 )
return 0LL;
result = a2;
if ( *(_DWORD *)(a2 + 16) != (_DWORD)a1 )
{
result = func8(a1, *(_QWORD *)a2);
if ( !result )
result = func8((unsigned int)a1, *(_QWORD *)(a2 + 8));
}
return result;
}

original_code:
huff_node *find_leaf_node(int char_value, huff_node *root) {
    if (root == ((void *)0)) {
        return ((void *)0);
    }
    if (root->char_number == char_value) {
        return root;
    }
    huff_node *result = find_leaf_node(char_value, root->left_child);
    if (result == ((void *)0)) {
        result = find_leaf_node(char_value, root->right_child);
    }
    return result;
}

canonical_original_code:
struct huff_node *find_leaf_node(int char_value, struct huff_node *root) {
    if (root == ((void *)0)) {
        return ((void *)0);
    }
    if (root->char_number == char_value) {
        return root;
    }
    struct huff_node *result = find_leaf_node(char_value, root->left_child);
    if (result == ((void *)0)) {
        result = find_leaf_node(char_value, root->right_child);
    }
    return result;
}

variable_types:
root
struct huff_node *


decompiled_code:
__int64 __fastcall encoding_for_char(__int64 a1, __int64 a2)
{
__int64 v2; // rax

v2 = find_leaf_node(a1, a2);
if ( !v2 )
_assert_fail("node != NULL", "huff_table.c", 0x13Eu, "encoding_for_char");
return *(_QWORD *)(v2 + 40);
}

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

v2 = func8(a1, a2);
if ( !v2 )
_assert_fail("node != NULL", "huff_table.c", 0x13Eu, "encoding_for_char");
return *(_QWORD *)(v2 + 40);
}

original_code:
char *encoding_for_char(int char_value, huff_node *root) {
    huff_node *node = find_leaf_node(char_value, root);
    ((node != ((void *)0)) ? (void) (0) : __assert_fail ("node != NULL", "huff_table.c", 318, __extension__ __PRETTY_FUNCTION__));
    return node->encoding;
}

canonical_original_code:
char *encoding_for_char(int char_value, struct huff_node *root) {
    struct huff_node *node = find_leaf_node(char_value, root);
    ((node != ((void *)0)) ? (void) (0) : __assert_fail ("node != NULL", "huff_table.c", 318, __extension__ __PRETTY_FUNCTION__));
    return node->encoding;
}

return_type: char *


decompiled_code:
__int64 __fastcall get_encoding(__int64 a1)
{
__int64 v1; // rbp
__int64 i; // rbx

v1 = xmalloc(2048LL);
for ( i = 0LL; i != 256; ++i )
*(_QWORD *)(v1 + 8 * i) = encoding_for_char((unsigned int)i, a1);
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1)
{
__int64 v1; // rbp
__int64 i; // rbx

v1 = xmalloc(2048LL);
for ( i = 0LL; i != 256; ++i )
*(_QWORD *)(v1 + 8 * i) = func9((unsigned int)i, a1);
return v1;
}

original_code:
char **get_encoding(huff_node *root) {
  char **encodings = xmalloc(sizeof(char*[256]));
  for (int i = 0; i < 256; i++) {
    char *seqence = encoding_for_char(i, root);
    encodings[i] = seqence;
  }
  return encodings;
}

canonical_original_code:
char **get_encoding(struct huff_node *root) {
  char **encodings = xmalloc(sizeof(char*[256]));
  for (int i = 0; i < 256; i++) {
    char *seqence = encoding_for_char(i, root);
    encodings[i] = seqence;
  }
  return encodings;
}

variable_types:
encodings
char **

variable_types:
seqence
char *

return_type: char **


min

decompiled_code:
__int64 __fastcall min(unsigned int a1, unsigned int a2)
{
__int64 result; // rax

result = a2;
if ( (int)a1 <= (int)a2 )
result = a1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(unsigned int a1, unsigned int a2)
{
__int64 result; // rax

result = a2;
if ( (int)a1 <= (int)a2 )
result = a1;
return result;
}

original_code:
int min(int a, int b) {
    if (a > b) {
        return b;
    } else {
        return a;
    }
}

variable_types: a int

variable_types: b int


decompiled_code:
char *__fastcall create_string_from_cat(char *src, char *a2)
{
size_t v2; // rbx
size_t v3; // r13
char *v4; // rbp

v2 = strlen(src);
v3 = strlen(a2);
v4 = (char *)xmalloc(v2 + v3 + 1);
strncpy(v4, src, v2 + 1);
return strncat(v4, a2, v3);
}

canonical_decompiled_code:
char *__fastcall func13(char *src, char *a2)
{
size_t v2; // rbx
size_t v3; // r13
char *v4; // rbp

v2 = strlen(src);
v3 = strlen(a2);
v4 = (char *)xmalloc(v2 + v3 + 1);
strncpy(v4, src, v2 + 1);
return strncat(v4, a2, v3);
}

original_code:
char *create_string_from_cat(char *start, char *end) {
  size_t length_s = strlen(start);
  size_t length_e = strlen(end);
  size_t total_length = length_s + length_e + 1;
  char *new_string = (char *)xmalloc(total_length);
  strncpy(new_string, start, length_s + 1);
  strncat(new_string, end, length_e);
  return new_string;
}

canonical_original_code:
char *create_string_from_cat(char *start, char *end) {
  unsigned long length_s = strlen(start);
  unsigned long length_e = strlen(end);
  unsigned long total_length = length_s + length_e + 1;
  char *new_string = (char *)xmalloc(total_length);
  strncpy(new_string, start, length_s + 1);
  strncat(new_string, end, length_e);
  return new_string;
}

variable_types:
start
char *

variable_types:
end
char *


decompiled_code:
size_t __fastcall insert_encoded_node(__int64 a1, __int64 a2)
{
const char *v3; // r12
size_t result; // rax
__int64 v5; // r13
__int64 v6; // rbx
int v7; // er15
char *v8; // rax
char *v9; // rax
__int64 v10; // [rsp+8h] [rbp-40h]
__int64 v11; // [rsp+8h] [rbp-40h]

v3 = *(const char **)(a2 + 40);
result = strlen(v3);
if ( (int)result > 0 )
{
v5 = (unsigned int)(result - 1);
v6 = 0LL;
v7 = result - 1;
while ( 1 )
{
if ( v3[v6] == 48 )
{
result = *(_QWORD *)a1;
if ( *(_QWORD *)a1 )
{
a1 = *(_QWORD *)a1;
}
else
{
if ( v7 == (_DWORD)v6 )
{
*(_QWORD *)a1 = a2;
return result;
}
v8 = create_string_from_cat(*(char **)(a1 + 40), "0");
v10 = create_huff_node(-1, -1LL, (__int64)v8);
set_left_child((_QWORD *)a1, v10);
a1 = v10;
}
}
else
{
result = *(_QWORD *)(a1 + 8);
if ( result )
{
a1 = *(_QWORD *)(a1 + 8);
}
else
{
if ( v7 == (_DWORD)v6 )
{
*(_QWORD *)(a1 + 8) = a2;
return result;
}
v9 = create_string_from_cat(*(char **)(a1 + 40), "1");
v11 = create_huff_node(-1, -1LL, (__int64)v9);
set_right_child(a1, v11);
a1 = v11;
}
}
result = v6 + 1;
if ( v6 == v5 )
return result;
++v6;
}
}
return result;
}

original_code:
void insert_encoded_node(huff_node *root, huff_node *node){
    int length = strlen(node->encoding);
    char *encoding = node->encoding;
    huff_node *current = root;
    for(int i = 0; i < length; i++){
        if(encoding[i] == '0'){
            if(current->left_child == 0){
                if(i == length-1){
                    current->left_child = node;
                    return;
                } else{
                    huff_node *left_child = create_huff_node(-1, -1,create_string_from_cat(current->encoding, "0"));
                    set_left_child(current, left_child);
                    current = left_child;
                    continue;
                }
            } else{
                    current = current->left_child;
            }
        }
        else{
            if(current->right_child == 0){
                if(i == length-1){
                    current->right_child = node;
                    return;
                } else{
                    huff_node *right_child = create_huff_node(-1, -1,create_string_from_cat(current->encoding, "1"));
                    set_right_child(current, right_child);
                    current = right_child;
                    continue;
                }
            } else{
                    current = current->right_child;
            }
        }
    }
}

canonical_original_code:
void insert_encoded_node(struct huff_node *root, struct huff_node *node){
    int length = strlen(node->encoding);
    char *encoding = node->encoding;
    struct huff_node *current = root;
    for(int i = 0; i < length; i++){
        if(encoding[i] == '0'){
            if(current->left_child == 0){
                if(i == length-1){
                    current->left_child = node;
                    return;
                } else{
                    struct huff_node *left_child = create_huff_node(-1, -1,create_string_from_cat(current->encoding, "0"));
                    set_left_child(current, left_child);
                    current = left_child;
                    continue;
                }
            } else{
                    current = current->left_child;
            }
        }
        else{
            if(current->right_child == 0){
                if(i == length-1){
                    current->right_child = node;
                    return;
                } else{
                    struct huff_node *right_child = create_huff_node(-1, -1,create_string_from_cat(current->encoding, "1"));
                    set_right_child(current, right_child);
                    current = right_child;
                    continue;
                }
            } else{
                    current = current->right_child;
            }
        }
    }
}

variable_types:
node
struct huff_node *

variable_types: length int

variable_types: i int


decompiled_code:
__int64 __fastcall create_huff_tree_from_encoding(__int64 a1)
{
__int64 i; // rbx
size_t v2; // rax
char *v3; // rbp
__int64 v5[259]; // [rsp+0h] [rbp-818h] BYREF

for ( i = 0LL; i != 256; ++i )
{
v5[i] = 0LL;
v2 = strlen(*(const char **)(a1 + 8 * i));
v3 = (char *)xmalloc(v2 + 1);
strcpy(v3, *(const char **)(a1 + 8 * i));
v5[i] = create_huff_node(i, -2LL, (__int64)v3);
}
return build_encoded_tree(v5);
}

original_code:
huff_node *create_huff_tree_from_encoding(char **encoding) {
    huff_node *nodes[256];
    for (int i = 0; i < 256; i++) {
        nodes[i] = ((void *)0);
        char *node_encoding = xmalloc(strlen(encoding[i]) + 1);
        strcpy(node_encoding, encoding[i]);
        nodes[i] = create_huff_node(i, -2, node_encoding);
    }
    huff_node *root = build_encoded_tree(nodes);
    return root;
}

canonical_original_code:
struct huff_node *create_huff_tree_from_encoding(char **encoding) {
    struct huff_node *nodes[256];
    for (int i = 0; i < 256; i++) {
        nodes[i] = ((void *)0);
        char *node_encoding = xmalloc(strlen(encoding[i]) + 1);
        strcpy(node_encoding, encoding[i]);
        nodes[i] = create_huff_node(i, -2, node_encoding);
    }
    struct huff_node *root = build_encoded_tree(nodes);
    return root;
}

variable_types:
encoding
char **

variable_types: struct huff_node { struct huff_node *left_child; struct huff_node *right_child; int char_number; int lowest_value; unsigned long long frequency; struct huff_node *parent; char *encoding; } *[256]


decompiled_code:
void __fastcall generate_encoding(_QWORD *a1, char *a2)
{
if ( a1 )
{
a1[5] = create_string_from_cat(*(char **)(a1[4] + 40LL), a2);
generate_encoding(*a1, "0");
generate_encoding(a1[1], "1");
}
}

original_code:
void generate_encoding(huff_node *node, char *path) {
    if (node == ((void *)0)) {
        return;
    }
    char *parent_encoding = node->parent->encoding;
    char *encoding = create_string_from_cat(parent_encoding, path);
    node->encoding = encoding;
    generate_encoding(node->left_child, "0");
    generate_encoding(node->right_child, "1");
}

canonical_original_code:
void generate_encoding(struct huff_node *node, char *path) {
    if (node == ((void *)0)) {
        return;
    }
    char *parent_encoding = node->parent->encoding;
    char *encoding = create_string_from_cat(parent_encoding, path);
    node->encoding = encoding;
    generate_encoding(node->left_child, "0");
    generate_encoding(node->right_child, "1");
}

variable_types: struct huff_node { struct huff_node *left_child; struct huff_node *right_child; int char_number; int lowest_value; unsigned long long frequency; struct huff_node *parent; char *encoding; } *

variable_types:
path
char *


decompiled_code:
void __fastcall generate_encoding_tree(__int64 a1)
{
_BYTE *v1; // rax

if ( !a1 )
_assert_fail("root != NULL", "huff_table.c", 0xFFu, "generate_encoding_tree");
v1 = (_BYTE *)xmalloc(1LL);
*v1 = 0;
*(_QWORD *)(a1 + 40) = v1;
generate_encoding(*(_QWORD **)(a1 + 8), "1");
generate_encoding(*(_QWORD **)a1, "0");
}

canonical_decompiled_code:
void __fastcall func18(__int64 a1)
{
_BYTE *v1; // rax

if ( !a1 )
_assert_fail("root != NULL", "huff_table.c", 0xFFu, "generate_encoding_tree");
v1 = (_BYTE *)xmalloc(1LL);
*v1 = 0;
*(_QWORD *)(a1 + 40) = v1;
func17(*(_QWORD **)(a1 + 8), "1");
func17(*(_QWORD **)a1, "0");
}

original_code:
void generate_encoding_tree(huff_node *root) {
    ((root != ((void *)0)) ? (void) (0) : __assert_fail ("root != NULL", "huff_table.c", 255, __extension__ __PRETTY_FUNCTION__));
    char *encoding = (char *)xmalloc(1);
    encoding[0] = '\0';
    root->encoding = encoding;
    generate_encoding(root->right_child, "1");
    generate_encoding(root->left_child, "0");
}

canonical_original_code:
void generate_encoding_tree(struct huff_node *root) {
    ((root != ((void *)0)) ? (void) (0) : __assert_fail ("root != NULL", "huff_table.c", 255, __extension__ __PRETTY_FUNCTION__));
    char *encoding = (char *)xmalloc(1);
    encoding[0] = '\0';
    root->encoding = encoding;
    generate_encoding(root->right_child, "1");
    generate_encoding(root->left_child, "0");
}


decompiled_code:
__int64 __fastcall create_huff_tree_from_frequency(__int64 a1)
{
size_t i; // rbx
__int64 *v2; // rbp
__int64 v3; // rbx
__int64 v5[255]; // [rsp+0h] [rbp-818h] BYREF
__int64 v6; // [rsp+7F8h] [rbp-20h] BYREF

for ( i = 0LL; i != 256; ++i )
{
v5[i] = 0LL;
v5[i] = create_huff_node(i, *(_QWORD *)(a1 + 8 * i), 0LL);
}
v2 = v5;
do
{
qsort(v2, i, 8uLL, (__compar_fn_t)huff_node_frequency_comparer);
v2[1] = create_parent_node(*v2, v2[1]);
++v2;
--i;
}
while ( v2 != &v6 );
v3 = v6;
generate_encoding_tree(v6);
return v3;
}

original_code:
huff_node *create_huff_tree_from_frequency(unsigned long long frequencyArray[256]) {
    huff_node *nodes[256];
    for (int i = 0; i < 256; i++) {
        nodes[i] = ((void *)0);
        nodes[i] = create_huff_node(i, frequencyArray[i], ((void *)0));
    }
    for (int firstIndex = 0; firstIndex < 255; firstIndex++) {
      qsort(nodes+firstIndex, 256-firstIndex, sizeof (huff_node *), huff_node_frequency_comparer);
      huff_node* left_child = nodes[firstIndex];
      huff_node* right_child = nodes[firstIndex+1];
      huff_node* new_parent = create_parent_node(left_child, right_child);
      nodes[firstIndex+1] = new_parent;
    }
    huff_node *root = nodes[255];
    generate_encoding_tree(root);
    return root;
}

canonical_original_code:
struct huff_node *create_huff_tree_from_frequency(unsigned long long frequencyArray[256]) {
    struct huff_node *nodes[256];
    for (int i = 0; i < 256; i++) {
        nodes[i] = ((void *)0);
        nodes[i] = create_huff_node(i, frequencyArray[i], ((void *)0));
    }
    for (int firstIndex = 0; firstIndex < 255; firstIndex++) {
      qsort(nodes+firstIndex, 256-firstIndex, sizeof (struct huff_node *), huff_node_frequency_comparer);
      struct huff_node *left_child = nodes[firstIndex];
      struct huff_node *right_child = nodes[firstIndex+1];
      struct huff_node *new_parent = create_parent_node(left_child, right_child);
      nodes[firstIndex+1] = new_parent;
    }
    struct huff_node *root = nodes[255];
    generate_encoding_tree(root);
    return root;
}

variable_types:
frequencyArray
unsigned long long [256]

variable_types: firstIndex int


decompiled_code:
int __fastcall print_angle(_QWORD *a1)
{
unsigned __int64 v1; // rdx
unsigned __int64 v2; // rax

v1 = a1[2];
v2 = a1[1] + *a1;
if ( v1 > v2 )
return puts("obtuse");
if ( v1 >= v2 )
return puts("right");
return puts("acute");
}

canonical_decompiled_code:
int __fastcall func10(_QWORD *a1)
{
unsigned __int64 v1; // rdx
unsigned __int64 v2; // rax

v1 = a1[2];
v2 = a1[1] + *a1;
if ( v1 > v2 )
return puts("obtuse");
if ( v1 >= v2 )
return puts("right");
return puts("acute");
}

original_code:
void print_angle(unsigned long long lengths[])
{
    if (lengths[2] > (lengths[1] + lengths[0]))
    {
 puts("obtuse");
    }
    else if (lengths[2] < (lengths[1] + lengths[0]))
    {
 puts("acute");
    }
    else
    {
 puts("right");
    }
}

variable_types:
lengths
unsigned long long []


comp

decompiled_code:
__int64 __fastcall comp(const void *a1, const void *a2)
{
__int64 result; // rax

result = 1LL;
if ( *(_QWORD *)a1 <= *(_QWORD *)a2 )
result = (unsigned int)-(*(_QWORD *)a1 < *(_QWORD *)a2);
return result;
}

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

result = 1LL;
if ( *(_QWORD *)a1 <= *(_QWORD *)a2 )
result = (unsigned int)-(*(_QWORD *)a1 < *(_QWORD *)a2);
return result;
}

original_code:
int comp(const void *a, const void *b)
{
    unsigned long long *x = (unsigned long long *) a;
    unsigned long long *y = (unsigned long long *) b;
    if (*x > *y)
    {
 return 1;
    }
    if (*y > *x)
    {
 return -1;
    }
    return 0;
}

canonical_original_code:
int comp(void *a, void *b)
{
    unsigned long long *x = (unsigned long long *) a;
    unsigned long long *y = (unsigned long long *) b;
    if (*x > *y)
    {
 return 1;
    }
    if (*y > *x)
    {
 return -1;
    }
    return 0;
}

variable_types:
a
void *

variable_types:
b
void *

variable_types:
x
unsigned long long *

variable_types:
y
unsigned long long *


square

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

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

original_code:
unsigned long long square(unsigned long long x)
{
    return x*x;
}

variable_types:
x
unsigned long long

return_type: unsigned long long


collinear

original_code:
int collinear(Point points[])
{
    return (points[0].x * (points[1].y - points[2].y)) +
    (points[1].x * (points[2].y - points[0].y)) +
    (points[2].x * (points[0].y - points[1].y)) == 0;
}

canonical_original_code:
int collinear(struct _point points[])
{
    return (points[0].x * (points[1].y - points[2].y)) +
    (points[1].x * (points[2].y - points[0].y)) +
    (points[2].x * (points[0].y - points[1].y)) == 0;
}

variable_types: struct _point { unsigned long long x; unsigned long long y; } []


decompiled_code:
int __fastcall print_type(_QWORD *a1)
{
__int64 v1; // rax
int result; // eax

v1 = a1[1];
if ( *a1 == v1 || v1 == a1[2] )
result = printf("isosceles ");
else
result = printf("scalene ");
return result;
}

canonical_decompiled_code:
int __fastcall func11(_QWORD *a1)
{
__int64 v1; // rax
int result; // eax

v1 = a1[1];
if ( *a1 == v1 || v1 == a1[2] )
result = printf("isosceles ");
else
result = printf("scalene ");
return result;
}

original_code:
void print_type(unsigned long long lengths[])
{
    if (lengths[0] == lengths[1] || lengths[2] == lengths[1])
    {
 printf("isosceles ");
    }
    else
    {
 printf("scalene ");
    }
}


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbp
__int64 v4; // rbx
__int64 v5; // r13
__int64 v6; // r12
__int64 v7; // r15
__int64 v8; // r14
__int64 v9; // r13
__int64 v10; // rbp
__int64 v12; // [rsp+8h] [rbp-90h]
__int64 base[4]; // [rsp+10h] [rbp-88h] BYREF
__int64 v14[13]; // [rsp+30h] [rbp-68h] BYREF

v3 = atol(argv[1]);
v14[0] = v3;
v4 = atol(argv[2]);
v14[1] = v4;
v5 = atol(argv[3]);
v14[2] = v5;
v6 = atol(argv[4]);
v14[3] = v6;
v7 = atol(argv[5]);
v14[4] = v7;
v8 = atol(argv[6]);
v14[5] = v8;
if ( collinear(v14) )
{
puts("not a triangle");
}
else
{
v12 = square(v3 - v5);
base[0] = v12 + square(v4 - v6);
v9 = square(v5 - v7);
base[1] = square(v6 - v8) + v9;
v10 = square(v3 - v7);
base[2] = square(v4 - v8) + v10;
qsort(base, 3uLL, 8uLL, (__compar_fn_t)comp);
print_type(base);
print_angle(base);
}
return 0;
}

original_code:
int main(int argc, char *argv[])
{
    Point points[3];
    unsigned long long side_lengths[3];
    points[0].x = atol(argv[1]);
    points[0].y = atol(argv[2]);
    points[1].x = atol(argv[3]);
    points[1].y = atol(argv[4]);
    points[2].x = atol(argv[5]);
    points[2].y = atol(argv[6]);
    if (collinear(points))
    {
 puts("not a triangle");
 return 0;
    }
    side_lengths[0] = square(points[0].x - points[1].x) + square(points[0].y - points[1].y);
    side_lengths[1] = square(points[1].x - points[2].x) + square(points[1].y - points[2].y);
    side_lengths[2] = square(points[0].x - points[2].x) + square(points[0].y - points[2].y);
    qsort(side_lengths, 3, sizeof(unsigned long long), comp);
    print_type(side_lengths);
    print_angle(side_lengths);
    return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
    struct _point points[3];
    unsigned long long side_lengths[3];
    points[0].x = atol(argv[1]);
    points[0].y = atol(argv[2]);
    points[1].x = atol(argv[3]);
    points[1].y = atol(argv[4]);
    points[2].x = atol(argv[5]);
    points[2].y = atol(argv[6]);
    if (collinear(points))
    {
 puts("not a triangle");
 return 0;
    }
    side_lengths[0] = square(points[0].x - points[1].x) + square(points[0].y - points[1].y);
    side_lengths[1] = square(points[1].x - points[2].x) + square(points[1].y - points[2].y);
    side_lengths[2] = square(points[0].x - points[2].x) + square(points[0].y - points[2].y);
    qsort(side_lengths, 3, sizeof(unsigned long long), comp);
    print_type(side_lengths);
    print_angle(side_lengths);
    return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: struct _point { unsigned long long x; unsigned long long y; } [3]


original_code:
static void build_bits(struct huff_enc_entry * entry, char * str_bits) {
    memset(entry->bits, 0, sizeof(entry->bits));
    for (int i = 0; i < entry->bitlen; i++) {
        SET_BIT(7 - (i % 8), str_bits[i] - '0', &entry->bits[i / 8]);
    }
}

canonical_original_code:
static void build_bits(struct huff_enc_entry *entry, char *str_bits) {
    memset(entry->bits, 0, sizeof(entry->bits));
    for (int i = 0; i < entry->bitlen; i++) {
        SET_BIT(7 - (i % 8), str_bits[i] - '0', &entry->bits[i / 8]);
    }
}

variable_types: struct huff_enc_entry { int bitlen; unsigned char bits[-1]; } *

variable_types: i int


decompiled_code:
__int64 __fastcall huff_make_encoder(_DWORD *a1, const char **a2)
{
_DWORD *v3; // rbx
__int64 result; // rax

*((_BYTE *)a1 + 9216) = 0;
a1[2305] = 0;
v3 = a1;
do
{
*v3 = strlen(*a2);
result = build_bits((__int64)v3, (__int64)*a2++);
v3 += 9;
}
while ( v3 != a1 + 2304 );
return result;
}

original_code:
void huff_make_encoder(struct huff_encoder * encoder, char *ttable[256]) {
    encoder->buffer = 0;
    encoder->buffer_used = 0;
    for (int i = 0; i < 256; i++) {
        encoder->table[i].bitlen = strlen(ttable[i]);
        build_bits(&encoder->table[i], ttable[i]);
    }
}

canonical_original_code:
void huff_make_encoder(struct huff_encoder *encoder, char *ttable[256]) {
    encoder->buffer = 0;
    encoder->buffer_used = 0;
    for (int i = 0; i < 256; i++) {
        encoder->table[i].bitlen = strlen(ttable[i]);
        build_bits(&encoder->table[i], ttable[i]);
    }
}

variable_types: struct huff_encoder { struct huff_enc_entry { int bitlen; unsigned char bits[-1]; } table[256]; unsigned char buffer; int buffer_used; } *

variable_types:
ttable
char *[256]

user_defined_types: struct huff_encoder { struct huff_enc_entry table[256]; unsigned char buffer; int buffer_used; }


original_code:
int huff_encode(uint8_t byte, uint8_t output[32], struct huff_encoder *encoder) {
    uint8_t buffer[33];
    memset(buffer, 0, sizeof(buffer));
    int packed = 0;
    int bitlen = encoder->table[byte].bitlen;
    int trans_bytes = (bitlen / 8) + (bitlen % 8 ? 1 : 0);
    buffer[0] = encoder->buffer;
    memcpy(buffer + 1, encoder->table[byte].bits, trans_bytes);
    for (int i = 1; i < trans_bytes + 1; i++) {
        buffer[i - 1] |= buffer[i] >> encoder->buffer_used;
        buffer[i] = buffer[i] << (8 - encoder->buffer_used);
    }
    bitlen += encoder->buffer_used;
    packed = bitlen / 8;
    encoder->buffer_used = bitlen % 8;
    encoder->buffer = buffer[packed];
    memcpy(output, buffer, packed);
    return packed;
}

canonical_original_code:
int huff_encode(unsigned char byte, unsigned char output[32], struct huff_encoder *encoder) {
    unsigned char buffer[33];
    memset(buffer, 0, sizeof(buffer));
    int packed = 0;
    int bitlen = encoder->table[byte].bitlen;
    int trans_bytes = (bitlen / 8) + (bitlen % 8 ? 1 : 0);
    buffer[0] = encoder->buffer;
    memcpy(buffer + 1, encoder->table[byte].bits, trans_bytes);
    for (int i = 1; i < trans_bytes + 1; i++) {
        buffer[i - 1] |= buffer[i] >> encoder->buffer_used;
        buffer[i] = buffer[i] << (8 - encoder->buffer_used);
    }
    bitlen += encoder->buffer_used;
    packed = bitlen / 8;
    encoder->buffer_used = bitlen % 8;
    encoder->buffer = buffer[packed];
    memcpy(output, buffer, packed);
    return packed;
}

variable_types:
byte
unsigned char

variable_types:
output
unsigned char [32]

variable_types:
buffer
unsigned char [33]

variable_types: packed int

variable_types: bitlen int

user_defined_types: struct huff_enc_entry { int bitlen; unsigned char bits[-1]; }


decompiled_code:
void __noreturn read_header_error()
{
fwrite("ERROR: Error while reading header from file.\n", 1uLL, 0x2DuLL, stderr);
exit(255);
}

canonical_decompiled_code:
void __noreturn func0()
{
fwrite("ERROR: Error while reading header from file.\n", 1uLL, 0x2DuLL, stderr);
exit(255);
}

original_code:
static void read_header_error(){
    fprintf(stderr, "ERROR: Error while reading header from file.\n");
    exit(255);
}


decompiled_code:
void __noreturn read_file_error()
{
fwrite("ERROR: Error while attempting to read file.\n", 1uLL, 0x2CuLL, stderr);
exit(255);
}

canonical_decompiled_code:
void __noreturn func1()
{
fwrite("ERROR: Error while attempting to read file.\n", 1uLL, 0x2CuLL, stderr);
exit(255);
}

original_code:
static void read_file_error(){
 fprintf(stderr, "ERROR: Error while attempting to read file.\n");
 exit(255);
}


decompiled_code:
void __noreturn write_header_error()
{
fwrite("ERROR: Error while writing header to file.\n", 1uLL, 0x2BuLL, stderr);
exit(255);
}

canonical_decompiled_code:
void __noreturn func2()
{
fwrite("ERROR: Error while writing header to file.\n", 1uLL, 0x2BuLL, stderr);
exit(255);
}

original_code:
static void write_header_error(){
    fprintf(stderr, "ERROR: Error while writing header to file.\n");
    exit(255);
}


decompiled_code:
void __noreturn write_body_error()
{
fwrite("ERROR: Error while writing body to file.\n", 1uLL, 0x29uLL, stderr);
exit(255);
}

canonical_decompiled_code:
void __noreturn func3()
{
fwrite("ERROR: Error while writing body to file.\n", 1uLL, 0x29uLL, stderr);
exit(255);
}

original_code:
static void write_body_error(){
    fprintf(stderr, "ERROR: Error while writing body to file.\n");
    exit(255);
}


decompiled_code:
void __noreturn read_body_error()
{
fwrite("ERROR: Error while reading body from file.\n", 1uLL, 0x2BuLL, stderr);
exit(255);
}

canonical_decompiled_code:
void __noreturn func4()
{
fwrite("ERROR: Error while reading body from file.\n", 1uLL, 0x2BuLL, stderr);
exit(255);
}

original_code:
static void read_body_error(){
    fprintf(stderr, "ERROR: Error while reading body from file.\n");
    exit(255);
}


decompiled_code:
bool __fastcall is_huff_file(const char *a1)
{
char *v1; // rax
bool result; // al

v1 = strrchr(a1, 46);
if ( !v1 || a1 == v1 )
result = 0;
else
result = strcmp(".hurl", v1) == 0;
return result;
}

canonical_decompiled_code:
bool __fastcall func8(const char *a1)
{
char *v1; // rax
bool result; // al

v1 = strrchr(a1, 46);
if ( !v1 || a1 == v1 )
result = 0;
else
result = strcmp(".hurl", v1) == 0;
return result;
}

original_code:
_Bool is_huff_file(const char* filename){
    const char *dot = strrchr(filename, '.');
    if(!dot || dot == filename) return 0;
    return strcmp(".hurl", dot) == 0;
}

canonical_original_code:
_Bool is_huff_file(char *filename){
    char *dot = strrchr(filename, '.');
    if(!dot || dot == filename) return 0;
    return strcmp(".hurl", dot) == 0;
}

variable_types:
filename
char *

variable_types:
dot
char *


decompiled_code:
const char *__fastcall remove_ext(char *src)
{
size_t v1; // rax
char *v2; // rax
const char *v3; // rbx
char *v4; // rax

if ( !src )
return 0LL;
v1 = strlen(src);
v2 = (char *)malloc(v1 + 1);
v3 = v2;
if ( !v2 )
{
fwrite("Malloc Error.\n", 1uLL, 0xEuLL, stderr);
exit(255);
}
strcpy(v2, src);
v4 = strrchr(v3, 46);
if ( v4 )
*v4 = 0;
return v3;
}

canonical_decompiled_code:
const char *__fastcall func9(char *src)
{
size_t v1; // rax
char *v2; // rax
const char *v3; // rbx
char *v4; // rax

if ( !src )
return 0LL;
v1 = strlen(src);
v2 = (char *)malloc(v1 + 1);
v3 = v2;
if ( !v2 )
{
fwrite("Malloc Error.\n", 1uLL, 0xEuLL, stderr);
exit(255);
}
strcpy(v2, src);
v4 = strrchr(v3, 46);
if ( v4 )
*v4 = 0;
return v3;
}

original_code:
char* remove_ext(const char* filename) {
    char *retstr;
    char *lastdot;
    if (filename == ((void *)0))
        return ((void *)0);
    if ((retstr = malloc (strlen (filename) + 1)) == ((void *)0)){
  fprintf(stderr, "Malloc Error.\n");
        exit(255);
    }
    strcpy (retstr, filename);
    lastdot = strrchr (retstr, '.');
    if (lastdot != ((void *)0))
        *lastdot = '\0';
    return retstr;
}

canonical_original_code:
char *remove_ext(char *filename) {
    char *retstr;
    char *lastdot;
    if (filename == ((void *)0))
        return ((void *)0);
    if ((retstr = malloc (strlen (filename) + 1)) == ((void *)0)){
  fprintf(stderr, "Malloc Error.\n");
        exit(255);
    }
    strcpy (retstr, filename);
    lastdot = strrchr (retstr, '.');
    if (lastdot != ((void *)0))
        *lastdot = '\0';
    return retstr;
}

variable_types:
retstr
char *

variable_types:
lastdot
char *


decompiled_code:
__off_t __fastcall get_file_size(const char *a1)
{
unsigned int v1; // eax
struct stat v3; // [rsp+0h] [rbp-98h] BYREF

v1 = stat(a1, &v3);
if ( v1 )
{
printf("%d\n", v1);
read_file_error();
}
return v3.st_size;
}

canonical_decompiled_code:
__off_t __fastcall func12(const char *a1)
{
unsigned int v1; // eax
struct stat v3; // [rsp+0h] [rbp-98h] BYREF

v1 = stat(a1, &v3);
if ( v1 )
{
printf("%d\n", v1);
func1();
}
return v3.st_size;
}

original_code:
unsigned long long get_file_size(const char* filename){
    struct stat st;
    int res = stat(filename, &st);
    if(res != 0)
    {
     printf("%d\n", res);
     read_file_error();
     }
    return (unsigned long long)st.st_size;
}

canonical_original_code:
unsigned long long get_file_size(char *filename){
    struct stat st;
    int res = stat(filename, &st);
    if(res != 0)
    {
     printf("%d\n", res);
     read_file_error();
     }
    return (unsigned long long)st.st_size;
}

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

variable_types: res int


decompiled_code:
__int64 __fastcall mask_lsbs(char a1)
{
return a1 & 0x7F;
}

canonical_decompiled_code:
__int64 __fastcall func0(char a1)
{
return a1 & 0x7F;
}

original_code:
static uint8_t mask_lsbs(unsigned char c)
{
  return (uint8_t) (c & 0x7F);
}

canonical_original_code:
static unsigned char mask_lsbs(unsigned char c)
{
  return (unsigned char) (c & 0x7F);
}

variable_types:
c
unsigned char

return_type: unsigned char


decompiled_code:
__int64 __fastcall bit_at(int a1, unsigned int a2)
{
if ( a2 > 7 )
_assert_fail("i >= 0 && i < 8", "rle.c", 0x21u, "bit_at");
return (a1 >> (7 - a2)) & 1;
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1, unsigned int a2)
{
if ( a2 > 7 )
_assert_fail("i >= 0 && i < 8", "rle.c", 0x21u, "bit_at");
return (a1 >> (7 - a2)) & 1;
}

original_code:
static uint8_t bit_at(int c, int i)
{
  ((i >= 0 && i < 8) ? (void) (0) : __assert_fail ("i >= 0 && i < 8", "rle.c", 33, __extension__ __PRETTY_FUNCTION__));
  int shift = 7 - i;
  return (uint8_t) (c >> shift) & 0x01;
}

canonical_original_code:
static unsigned char bit_at(int c, int i)
{
  ((i >= 0 && i < 8) ? (void) (0) : __assert_fail ("i >= 0 && i < 8", "rle.c", 33, __extension__ __PRETTY_FUNCTION__));
  int shift = 7 - i;
  return (unsigned char) (c >> shift) & 0x01;
}

variable_types: c int

variable_types: shift int


decompiled_code:
void __noreturn malloc_error()
{
fwrite("ERROR: Error while allocating space for array.\n", 1uLL, 0x2FuLL, stderr);
exit(255);
}

canonical_decompiled_code:
void __noreturn func2()
{
fwrite("ERROR: Error while allocating space for array.\n", 1uLL, 0x2FuLL, stderr);
exit(255);
}

original_code:
static void malloc_error() {
  fprintf(stderr, "ERROR: Error while allocating space for array.\n");
  exit(255);
}


decompiled_code:
void __noreturn read_char_error()
{
fwrite("ERROR: Error while reading a character from original file.\n", 1uLL, 0x3BuLL, stderr);
exit(255);
}

canonical_decompiled_code:
void __noreturn func3()
{
fwrite("ERROR: Error while reading a character from original file.\n", 1uLL, 0x3BuLL, stderr);
exit(255);
}

original_code:
static void read_char_error() {
  fprintf(stderr, "ERROR: Error while reading a character from original file.\n");
  exit(255);
}


decompiled_code:
void __noreturn array_resize_error()
{
fwrite("ERROR: Error while trying to grow byte array.\n", 1uLL, 0x2EuLL, stderr);
exit(255);
}

canonical_decompiled_code:
void __noreturn func4()
{
fwrite("ERROR: Error while trying to grow byte array.\n", 1uLL, 0x2EuLL, stderr);
exit(255);
}

original_code:
static void array_resize_error() {
  fprintf(stderr, "ERROR: Error while trying to grow byte array.\n");
  exit(255);
}


decompiled_code:
void __noreturn decode_to_file_error()
{
fwrite("ERROR: Error while trying to write decoded bits to the output file.\n", 1uLL, 0x44uLL, stderr);
exit(255);
}

canonical_decompiled_code:
void __noreturn func5()
{
fwrite("ERROR: Error while trying to write decoded bits to the output file.\n", 1uLL, 0x44uLL, stderr);
exit(255);
}

original_code:
static void decode_to_file_error() {
  fprintf(stderr, "ERROR: Error while trying to write decoded bits to the output file.\n");
  exit(255);
}


decompiled_code:
void *__fastcall grow_array(void *ptr)
{
void *result; // rax

size += 10000LL;
result = realloc(ptr, size);
if ( !result )
{
free(ptr);
array_resize_error();
}
return result;
}

canonical_decompiled_code:
void *__fastcall func6(void *ptr)
{
void *result; // rax

size += 10000LL;
result = realloc(ptr, size);
if ( !result )
{
free(ptr);
func4();
}
return result;
}

original_code:
static unsigned char* grow_array(unsigned char* ar)
{
  size += 10000;
  unsigned char* tmp = realloc(ar, size);
  if(tmp != ((void *)0)) {
    ar = tmp;
  }
  else {
    free(ar);
    array_resize_error();
  }
  return ar;
}

canonical_original_code:
static unsigned char *grow_array(unsigned char *ar)
{
  size += 10000;
  unsigned char *tmp = realloc(ar, size);
  if(tmp != ((void *)0)) {
    ar = tmp;
  }
  else {
    free(ar);
    array_resize_error();
  }
  return ar;
}

variable_types:
ar
unsigned char *

variable_types:
tmp
unsigned char *

return_type: unsigned char *


decompiled_code:
__int64 init_all_nodes()
{
__int64 *v0; // rbx
__int64 result; // rax

v0 = &all_nodes;
do
result = init_node(v0++, 0LL);
while ( v0 != (__int64 *)(unsigned int)((_DWORD)&all_nodes + 4096) );
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 *v0; // rbx
__int64 result; // rax

v0 = &all_nodes;
do
result = init_node(v0++, 0LL);
while ( v0 != (__int64 *)(unsigned int)((_DWORD)&all_nodes + 4096) );
return result;
}

original_code:
void init_all_nodes()
{
    for (int i = 0; i < 512; i++)
        init_node(&all_nodes[i], 0);
}

variable_types: i int


decompiled_code:
__int64 __fastcall get_char(unsigned __int8 a1, _BYTE *a2)
{
__int64 result; // rax

if ( !a2 )
_assert_fail("character != NULL", "decode.c", 0x17u, "get_char");
if ( a1 > 1u )
_assert_fail("huff_bit == 0 || huff_bit == 1", "decode.c", 0x18u, "get_char");
if ( char_found_2 )
{
curr_node_1 = all_nodes;
char_found_2 = 0;
}
if ( a1 )
{
if ( *(_QWORD *)(curr_node_1 + 272) )
curr_node_1 = *(_QWORD *)(curr_node_1 + 272);
}
else if ( *(_QWORD *)(curr_node_1 + 264) )
{
curr_node_1 = *(_QWORD *)(curr_node_1 + 264);
}
result = is_leaf(curr_node_1);
if ( (_BYTE)result )
{
*a2 = *(_BYTE *)(curr_node_1 + 289);
char_found_2 = 1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned __int8 a1, _BYTE *a2)
{
__int64 result; // rax

if ( !a2 )
_assert_fail("character != NULL", "decode.c", 0x17u, "get_char");
if ( a1 > 1u )
_assert_fail("huff_bit == 0 || huff_bit == 1", "decode.c", 0x18u, "get_char");
if ( char_found_2 )
{
curr_node_1 = all_nodes;
char_found_2 = 0;
}
if ( a1 )
{
if ( *(_QWORD *)(curr_node_1 + 272) )
curr_node_1 = *(_QWORD *)(curr_node_1 + 272);
}
else if ( *(_QWORD *)(curr_node_1 + 264) )
{
curr_node_1 = *(_QWORD *)(curr_node_1 + 264);
}
result = is_leaf(curr_node_1);
if ( (_BYTE)result )
{
*a2 = *(_BYTE *)(curr_node_1 + 289);
char_found_2 = 1;
}
return result;
}

original_code:
_Bool get_char(char huff_bit, char *character)
{
    static _Bool char_found = 1;
    static node *curr_node;
    ((character != ((void *)0)) ? (void) (0) : __assert_fail ("character != NULL", "decode.c", 23, __extension__ __PRETTY_FUNCTION__));
    ((huff_bit == 0 || huff_bit == 1) ? (void) (0) : __assert_fail ("huff_bit == 0 || huff_bit == 1", "decode.c", 24, __extension__ __PRETTY_FUNCTION__));
    if (char_found == 1)
    {
        curr_node = all_nodes[0];
        char_found = 0;
    }
    if (huff_bit == 0 && curr_node->left != ((void *)0))
        curr_node = curr_node->left;
    if (huff_bit == 1 && curr_node->right != ((void *)0))
        curr_node = curr_node->right;
    if (is_leaf(curr_node))
    {
        *character = curr_node->c;
        return char_found = 1;
    }
    else
        return 0;
}

canonical_original_code:
_Bool get_char(char huff_bit, char *character)
{
    static _Bool char_found = 1;
    static struct node *curr_node;
    ((character != ((void *)0)) ? (void) (0) : __assert_fail ("character != NULL", "decode.c", 23, __extension__ __PRETTY_FUNCTION__));
    ((huff_bit == 0 || huff_bit == 1) ? (void) (0) : __assert_fail ("huff_bit == 0 || huff_bit == 1", "decode.c", 24, __extension__ __PRETTY_FUNCTION__));
    if (char_found == 1)
    {
        curr_node = all_nodes[0];
        char_found = 0;
    }
    if (huff_bit == 0 && curr_node->left != ((void *)0))
        curr_node = curr_node->left;
    if (huff_bit == 1 && curr_node->right != ((void *)0))
        curr_node = curr_node->right;
    if (is_leaf(curr_node))
    {
        *character = curr_node->c;
        return char_found = 1;
    }
    else
        return 0;
}

variable_types:
character
char *

variable_types: struct node { char code[257]; struct node *left; struct node *right; unsigned long freq; _Bool visited; unsigned char c; unsigned char lowest; } *


decompiled_code:
__int64 __fastcall build_tree_tbl(_QWORD *a1)
{
int i; // er15
__int64 v3; // rbp
__int64 result; // rax
__int64 j; // rbx
int v6; // eax
char *v7; // rdi
char *v8; // r13
int v9; // eax
char *v10; // rdi
char *v11; // r13
__int64 v12; // [rsp+8h] [rbp-40h]

init_all_nodes();
all_node_curr = 1;
v12 = all_nodes[0];
for ( i = 0; i != 256; ++i )
{
result = *(unsigned __int8 *)*a1;
v3 = v12;
for ( j = 1LL; (_BYTE)result; ++j )
{
if ( (unsigned __int8)(result - 48) > 1u )
_assert_fail("curr == 48 || curr == 49", "decode.c", 0x3Eu, "build_tree_tbl");
if ( (_BYTE)result == 48 )
{
if ( !*(_QWORD *)(v3 + 264) )
{
v6 = all_node_curr++;
v7 = (char *)all_nodes[v6];
*(_QWORD *)(v3 + 264) = v7;
v8 = strcat(v7, (const char *)v3);
*(_WORD *)&v8[strlen(v8)] = 48;
}
v3 = *(_QWORD *)(v3 + 264);
}
else
{
if ( !*(_QWORD *)(v3 + 272) )
{
v9 = all_node_curr++;
v10 = (char *)all_nodes[v9];
*(_QWORD *)(v3 + 272) = v10;
v11 = strcat(v10, (const char *)v3);
*(_WORD *)&v11[strlen(v11)] = 49;
}
v3 = *(_QWORD *)(v3 + 272);
}
result = *(unsigned __int8 *)(*a1 + j);
}
*(_BYTE *)(v3 + 289) = i;
++a1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(_QWORD *a1)
{
int i; // er15
__int64 v3; // rbp
__int64 result; // rax
__int64 j; // rbx
int v6; // eax
char *v7; // rdi
char *v8; // r13
int v9; // eax
char *v10; // rdi
char *v11; // r13
__int64 v12; // [rsp+8h] [rbp-40h]

func0();
all_node_curr = 1;
v12 = all_nodes[0];
for ( i = 0; i != 256; ++i )
{
result = *(unsigned __int8 *)*a1;
v3 = v12;
for ( j = 1LL; (_BYTE)result; ++j )
{
if ( (unsigned __int8)(result - 48) > 1u )
_assert_fail("curr == 48 || curr == 49", "decode.c", 0x3Eu, "build_tree_tbl");
if ( (_BYTE)result == 48 )
{
if ( !*(_QWORD *)(v3 + 264) )
{
v6 = all_node_curr++;
v7 = (char *)all_nodes[v6];
*(_QWORD *)(v3 + 264) = v7;
v8 = strcat(v7, (const char *)v3);
*(_WORD *)&v8[strlen(v8)] = 48;
}
v3 = *(_QWORD *)(v3 + 264);
}
else
{
if ( !*(_QWORD *)(v3 + 272) )
{
v9 = all_node_curr++;
v10 = (char *)all_nodes[v9];
*(_QWORD *)(v3 + 272) = v10;
v11 = strcat(v10, (const char *)v3);
*(_WORD *)&v11[strlen(v11)] = 49;
}
v3 = *(_QWORD *)(v3 + 272);
}
result = *(unsigned __int8 *)(*a1 + j);
}
*(_BYTE *)(v3 + 289) = i;
++a1;
}
return result;
}

original_code:
void build_tree_tbl(char *huff_table[256])
{
    init_all_nodes();
    all_node_curr = 0;
    node *root = all_nodes[all_node_curr++];
    node *curr_node;
    for (int i = 0; i < 256; i++)
    {
        curr_node = root;
        int string_pos = 0;
        while (huff_table[i][string_pos] != 0)
        {
            char curr = huff_table[i][string_pos++];
            ((curr == 48 || curr == 49) ? (void) (0) : __assert_fail ("curr == 48 || curr == 49", "decode.c", 62, __extension__ __PRETTY_FUNCTION__));
            if (curr == 48)
            {
                if (curr_node->left == ((void *)0))
                {
                    curr_node->left = all_nodes[all_node_curr++];
                    strcat(strcat(curr_node->left->code, curr_node->code), "0");
                }
                curr_node = curr_node->left;
            }
            if (curr == 49)
            {
                if (curr_node->right == ((void *)0))
                {
                    curr_node->right = all_nodes[all_node_curr++];
                    strcat(strcat(curr_node->right->code, curr_node->code), "1");
                }
                curr_node = curr_node->right;
            }
        }
        curr_node->c = i;
    }
}

canonical_original_code:
void build_tree_tbl(char *huff_table[256])
{
    init_all_nodes();
    all_node_curr = 0;
    struct node *root = all_nodes[all_node_curr++];
    struct node *curr_node;
    for (int i = 0; i < 256; i++)
    {
        curr_node = root;
        int string_pos = 0;
        while (huff_table[i][string_pos] != 0)
        {
            char curr = huff_table[i][string_pos++];
            ((curr == 48 || curr == 49) ? (void) (0) : __assert_fail ("curr == 48 || curr == 49", "decode.c", 62, __extension__ __PRETTY_FUNCTION__));
            if (curr == 48)
            {
                if (curr_node->left == ((void *)0))
                {
                    curr_node->left = all_nodes[all_node_curr++];
                    strcat(strcat(curr_node->left->code, curr_node->code), "0");
                }
                curr_node = curr_node->left;
            }
            if (curr == 49)
            {
                if (curr_node->right == ((void *)0))
                {
                    curr_node->right = all_nodes[all_node_curr++];
                    strcat(strcat(curr_node->right->code, curr_node->code), "1");
                }
                curr_node = curr_node->right;
            }
        }
        curr_node->c = i;
    }
}

variable_types: curr char

user_defined_types: struct node { char code[257]; struct node *left; struct node *right; unsigned long freq; _Bool visited; unsigned char c; unsigned char lowest; }


decompiled_code:
__int64 __fastcall buf_len(_BYTE *a1)
{
_BYTE *v1; // rax
unsigned int v2; // ecx

if ( !*a1 )
return 0;
v1 = a1 + 1;
do
v2 = (_DWORD)v1++ - (_DWORD)a1;
while ( *(v1 - 1) );
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func7(_BYTE *a1)
{
_BYTE *v1; // rax
unsigned int v2; // ecx

if ( !*a1 )
return 0;
v1 = a1 + 1;
do
v2 = (_DWORD)v1++ - (_DWORD)a1;
while ( *(v1 - 1) );
return v2;
}

original_code:
static int buf_len(char *buf)
{
    int length = 0;
    while (*(buf++) != '\0')
    {
        length++;
    }
    return length;
}

variable_types:
buf
char *

variable_types: length int


decompiled_code:
__int64 __fastcall width_to_int(char *a1, double a2, double a3)
{
int v3; // eax
char v4; // bl
char *v5; // rbp
unsigned int v6; // er12
int v7; // er13
int v8; // eax

v3 = buf_len(a1);
v4 = *a1;
if ( !*a1 )
return 0;
v5 = a1;
v6 = 0;
v7 = v3 + (_DWORD)a1 - 1;
do
{
pow(a2, a3, 10, v7 - (_DWORD)v5++);
v6 += v8 * (v4 - 48);
v4 = *v5;
}
while ( *v5 );
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func10(char *a1, double a2, double a3)
{
int v3; // eax
char v4; // bl
char *v5; // rbp
unsigned int v6; // er12
int v7; // er13
int v8; // eax

v3 = func7(a1);
v4 = *a1;
if ( !*a1 )
return 0;
v5 = a1;
v6 = 0;
v7 = v3 + (_DWORD)a1 - 1;
do
{
func9(a2, a3, 10, v7 - (_DWORD)v5++);
v6 += v8 * (v4 - 48);
v4 = *v5;
}
while ( *v5 );
return v6;
}

original_code:
static int width_to_int(char *width_buf)
{
    int width = 0;
    for (int pos = buf_len(width_buf) - 1; *width_buf != '\0'; pos--)
    {
        width += pow(10, pos) * (*(width_buf++) - '0');
    }
    return width;
}

variable_types: width int

variable_types: pos int


original_code:
static void reverse_string(char *s, int s_end)
{
    int s_start = 0;
    while (s_start < s_end)
    {
        char temp = s[s_start];
        s[s_start++] = s[s_end];
        s[s_end--] = temp;
    }
}

variable_types:
s
char *

variable_types: temp char


original_code:
static int eval_width(char *widthbuf, int *length, char *padding, int output_len)
{
    if (width_to_int(widthbuf) > output_len)
    {
        widthbuf[++(*length)] = '\0';
        int width = width_to_int(widthbuf);
        set_buf(widthbuf, '\0', 256);
        width -= output_len;
        if (width > 0)
        {
            char *width_str = (char *)xmalloc(width + 1);
            int i;
            for (i = 0; i < width; i++)
            {
                width_str[i] = *padding;
            }
            width_str[i] = '\0';
            xfputs(width_str, stdout);
            free(width_str);
        }
        *length = 0;
        *padding = ' ';
        return width;
    }
    return 0;
}

variable_types:
widthbuf
char *

variable_types:
length
int *

variable_types:
padding
char *


xmalloc

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

result = malloc(a1);
if ( !result )
exit(-1);
return result;
}

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

result = malloc(a1);
if ( !result )
exit(-1);
return result;
}

original_code:
static void * xmalloc(size_t size)
{
    void * out = malloc(size);
    if (out == ((void *)0))
    {
        exit(-1);
    }
    return out;
}

canonical_original_code:
static void *xmalloc(unsigned long size)
{
    void *out = malloc(size);
    if (out == ((void *)0))
    {
        exit(-1);
    }
    return out;
}

variable_types:
size
unsigned long

variable_types:
out
void *

return_type: void *


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm2_8
double v6; // xmm3_8
double v7; // xmm6_8
double v8; // xmm7_8
double v9; // xmm4_8
double v10; // xmm5_8
double v11; // xmm4_8
double v12; // xmm5_8
double v13; // xmm4_8
double v14; // xmm5_8

printf("printf: %d\n", 10LL);
xprintf("xprintf: %d\n", v3, v4, v5, v6, v9, v10, v7, v8, 10LL);
printf("printf: %10s\n", "foo");
xprintf("xprintf: %10s\n", v3, v4, v5, v6, v11, v12, v7, v8, "foo");
printf("printf: %023x\n", 5000LL);
xprintf("xprintf: %023x\n", v3, v4, v5, v6, v13, v14, v7, v8, 5000LL);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
double v3; // xmm0_8
double v4; // xmm1_8
double v5; // xmm2_8
double v6; // xmm3_8
double v7; // xmm6_8
double v8; // xmm7_8
double v9; // xmm4_8
double v10; // xmm5_8
double v11; // xmm4_8
double v12; // xmm5_8
double v13; // xmm4_8
double v14; // xmm5_8

printf("printf: %d\n", 10LL);
func17("xprintf: %d\n", v3, v4, v5, v6, v9, v10, v7, v8, 10LL);
printf("printf: %10s\n", "foo");
func17("xprintf: %10s\n", v3, v4, v5, v6, v11, v12, v7, v8, "foo");
printf("printf: %023x\n", 5000LL);
func17("xprintf: %023x\n", v3, v4, v5, v6, v13, v14, v7, v8, 5000LL);
return 0;
}

original_code:
int main()
{
    printf("printf:  %d\n", 10);
    xprintf("xprintf: %d\n", 10);
    printf("printf:  %10s\n", "foo");
    xprintf("xprintf: %10s\n", "foo");
    printf("printf:  %023x\n", 5000);
    xprintf("xprintf: %023x\n", 5000);
}


decompiled_code:
__int64 __fastcall run_decode_type(unsigned __int8 a1)
{
return a1 >> 7;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned __int8 a1)
{
return a1 >> 7;
}

original_code:
static int run_decode_type(uint8_t run) {
  return (run >> 7) & 0x1;
}

canonical_original_code:
static int run_decode_type(unsigned char run) {
  return (run >> 7) & 0x1;
}

variable_types:
run
unsigned char


decompiled_code:
__int64 __fastcall run_decode_len(char a1)
{
return a1 & 0x7F;
}

canonical_decompiled_code:
__int64 __fastcall func1(char a1)
{
return a1 & 0x7F;
}

original_code:
static int run_decode_len(uint8_t run) {
  return (int)(run & 0x7F);
}

canonical_original_code:
static int run_decode_len(unsigned char run) {
  return (int)(run & 0x7F);
}


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

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

original_code:
static econtext econtext_init() {
  econtext con = {.run_type = 0, .run_len = 0};
  return con;
}

canonical_original_code:
static struct econtext econtext_init() {
  struct econtext con = {.run_type = 0, .run_len = 0};
  return con;
}

variable_types: struct econtext { int run_type; int run_len; }


decompiled_code:
__int64 __fastcall run_encode(unsigned int a1, unsigned int a2)
{
if ( a1 > 1 )
_assert_fail("type == 0 || type == 1", "rle.c", 0xAu, "run_encode");
if ( a2 > 0x7F )
_assert_fail("len >= 0 && len <= RUN_MAX", "rle.c", 0xBu, "run_encode");
return (a1 << 7) | a2;
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int a1, unsigned int a2)
{
if ( a1 > 1 )
_assert_fail("type == 0 || type == 1", "rle.c", 0xAu, "run_encode");
if ( a2 > 0x7F )
_assert_fail("len >= 0 && len <= RUN_MAX", "rle.c", 0xBu, "run_encode");
return (a1 << 7) | a2;
}

original_code:
static uint8_t run_encode(int type, int len) {
  ((type == 0 || type == 1) ? (void) (0) : __assert_fail ("type == 0 || type == 1", "rle.c", 10, __extension__ __PRETTY_FUNCTION__));
  ((len >= 0 && len <= RUN_MAX) ? (void) (0) : __assert_fail ("len >= 0 && len <= RUN_MAX", "rle.c", 11, __extension__ __PRETTY_FUNCTION__));
  uint8_t type_enc = type << 7;
  uint8_t len_enc = len;
  return (type_enc | len_enc);
}

canonical_original_code:
static unsigned char run_encode(int type, int len) {
  ((type == 0 || type == 1) ? (void) (0) : __assert_fail ("type == 0 || type == 1", "rle.c", 10, __extension__ __PRETTY_FUNCTION__));
  ((len >= 0 && len <= RUN_MAX) ? (void) (0) : __assert_fail ("len >= 0 && len <= RUN_MAX", "rle.c", 11, __extension__ __PRETTY_FUNCTION__));
  unsigned char type_enc = type << 7;
  unsigned char len_enc = len;
  return (type_enc | len_enc);
}

variable_types: type int

variable_types: len int


decompiled_code:
__int64 __fastcall econtext_add_bit(unsigned int *a1, unsigned int a2, _BYTE *a3)
{
unsigned int v6; // edi
signed int v7; // esi
__int64 result; // rax
int v9; // edx

v6 = *a1;
if ( v6 == a2 )
{
v9 = a1[1] + 1;
a1[1] = v9;
result = 0LL;
if ( v9 == 127 )
{
*a3 = run_encode(a2, 0x7Fu);
a1[1] = 0;
result = 1LL;
}
}
else
{
v7 = a1[1];
result = 0LL;
if ( v7 > 0 )
{
*a3 = run_encode(v6, v7);
result = 1LL;
}
*a1 = a2;
a1[1] = 1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(unsigned int *a1, unsigned int a2, _BYTE *a3)
{
unsigned int v6; // edi
signed int v7; // esi
__int64 result; // rax
int v9; // edx

v6 = *a1;
if ( v6 == a2 )
{
v9 = a1[1] + 1;
a1[1] = v9;
result = 0LL;
if ( v9 == 127 )
{
*a3 = func4(a2, 0x7Fu);
a1[1] = 0;
result = 1LL;
}
}
else
{
v7 = a1[1];
result = 0LL;
if ( v7 > 0 )
{
*a3 = func4(v6, v7);
result = 1LL;
}
*a1 = a2;
a1[1] = 1;
}
return result;
}

original_code:
static int econtext_add_bit(econtext *con, int bit, uint8_t *out_byte) {
  if (con->run_type == bit) {
    con->run_len++;
    if (con->run_len == RUN_MAX) {
      *out_byte = run_encode(con->run_type, con->run_len);
      con->run_len = 0;
      return 1;
    } else {
      return 0;
    }
  }
  int to_ret = 0;
  if (con->run_len > 0) {
    *out_byte = run_encode(con->run_type, con->run_len);
    to_ret = 1;
  }
  con->run_type = bit;
  con->run_len = 1;
  return to_ret;
}

canonical_original_code:
static int econtext_add_bit(struct econtext *con, int bit, unsigned char *out_byte) {
  if (con->run_type == bit) {
    con->run_len++;
    if (con->run_len == RUN_MAX) {
      *out_byte = run_encode(con->run_type, con->run_len);
      con->run_len = 0;
      return 1;
    } else {
      return 0;
    }
  }
  int to_ret = 0;
  if (con->run_len > 0) {
    *out_byte = run_encode(con->run_type, con->run_len);
    to_ret = 1;
  }
  con->run_type = bit;
  con->run_len = 1;
  return to_ret;
}

variable_types: struct econtext { int run_type; int run_len; } *

variable_types: bit int


decompiled_code:
__int64 __fastcall rcontext_read_bit(__int64 a1)
{
unsigned __int64 v1; // rax
unsigned __int64 v2; // rdx
unsigned int v3; // esi
__int64 result; // rax

v1 = *(_QWORD *)(a1 + 8);
v2 = *(_QWORD *)(a1 + 16);
if ( v1 < v2 )
_assert_fail("con->len >= con->byte_idx", "rle.c", 0x2Au, "rcontext_read_bit");
v3 = *(_DWORD *)(a1 + 24);
if ( v3 > 7 )
_assert_fail("con->bit_idx >= 0 && con->bit_idx <= 7", "rle.c", 0x2Bu, "rcontext_read_bit");
if ( v1 == v2 )
return 0xFFFFFFFFLL;
result = ((int)*(unsigned __int8 *)(*(_QWORD *)a1 + v2) >> (7 - v3)) & 1;
if ( v3 == 7 )
{
*(_DWORD *)(a1 + 24) = 0;
*(_QWORD *)(a1 + 16) = v2 + 1;
}
else
{
*(_DWORD *)(a1 + 24) = v3 + 1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1)
{
unsigned __int64 v1; // rax
unsigned __int64 v2; // rdx
unsigned int v3; // esi
__int64 result; // rax

v1 = *(_QWORD *)(a1 + 8);
v2 = *(_QWORD *)(a1 + 16);
if ( v1 < v2 )
_assert_fail("con->len >= con->byte_idx", "rle.c", 0x2Au, "rcontext_read_bit");
v3 = *(_DWORD *)(a1 + 24);
if ( v3 > 7 )
_assert_fail("con->bit_idx >= 0 && con->bit_idx <= 7", "rle.c", 0x2Bu, "rcontext_read_bit");
if ( v1 == v2 )
return 0xFFFFFFFFLL;
result = ((int)*(unsigned __int8 *)(*(_QWORD *)a1 + v2) >> (7 - v3)) & 1;
if ( v3 == 7 )
{
*(_DWORD *)(a1 + 24) = 0;
*(_QWORD *)(a1 + 16) = v2 + 1;
}
else
{
*(_DWORD *)(a1 + 24) = v3 + 1;
}
return result;
}

original_code:
static int rcontext_read_bit(rcontext *con) {
  ((con->len >= con->byte_idx) ? (void) (0) : __assert_fail ("con->len >= con->byte_idx", "rle.c", 42, __extension__ __PRETTY_FUNCTION__));
  ((con->bit_idx >= 0 && con->bit_idx <= 7) ? (void) (0) : __assert_fail ("con->bit_idx >= 0 && con->bit_idx <= 7", "rle.c", 43, __extension__ __PRETTY_FUNCTION__));
  if (con->len == con->byte_idx) {
    return -1;
  } else {
    uint8_t to_extract = con->data[con->byte_idx];
    int bit = (to_extract >> (7 - con->bit_idx)) & 0x1;
    con->bit_idx++;
    if (con->bit_idx == 8) {
      con->bit_idx = 0;
      con->byte_idx++;
    }
    return bit;
  }
}

canonical_original_code:
static int rcontext_read_bit(struct rcontext *con) {
  ((con->len >= con->byte_idx) ? (void) (0) : __assert_fail ("con->len >= con->byte_idx", "rle.c", 42, __extension__ __PRETTY_FUNCTION__));
  ((con->bit_idx >= 0 && con->bit_idx <= 7) ? (void) (0) : __assert_fail ("con->bit_idx >= 0 && con->bit_idx <= 7", "rle.c", 43, __extension__ __PRETTY_FUNCTION__));
  if (con->len == con->byte_idx) {
    return -1;
  } else {
    unsigned char to_extract = con->data[con->byte_idx];
    int bit = (to_extract >> (7 - con->bit_idx)) & 0x1;
    con->bit_idx++;
    if (con->bit_idx == 8) {
      con->bit_idx = 0;
      con->byte_idx++;
    }
    return bit;
  }
}

variable_types: struct rcontext { unsigned char *data; unsigned long len; unsigned long byte_idx; int bit_idx; } *


decompiled_code:
__int64 __fastcall byte_wcontext_write(_QWORD *a1, char a2)
{
unsigned __int64 v3; // rsi
unsigned __int64 v4; // rax
__int64 v5; // rdx
__int64 result; // rax

v3 = a1[1];
v4 = a1[2];
if ( v3 < v4 )
_assert_fail("con->len >= con->byte_idx", "rle.c", 0x4Bu, "byte_wcontext_write");
if ( v3 == v4 )
{
*a1 = xrealloc(*a1, 2 * v3);
a1[1] *= 2LL;
}
v5 = *a1;
result = a1[2];
a1[2] = result + 1;
*(_BYTE *)(v5 + result) = a2;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(_QWORD *a1, char a2)
{
unsigned __int64 v3; // rsi
unsigned __int64 v4; // rax
__int64 v5; // rdx
__int64 result; // rax

v3 = a1[1];
v4 = a1[2];
if ( v3 < v4 )
_assert_fail("con->len >= con->byte_idx", "rle.c", 0x4Bu, "byte_wcontext_write");
if ( v3 == v4 )
{
*a1 = xrealloc(*a1, 2 * v3);
a1[1] *= 2LL;
}
v5 = *a1;
result = a1[2];
a1[2] = result + 1;
*(_BYTE *)(v5 + result) = a2;
return result;
}

original_code:
static void byte_wcontext_write(byte_wcontext *con, uint8_t byte) {
  ((con->len >= con->byte_idx) ? (void) (0) : __assert_fail ("con->len >= con->byte_idx", "rle.c", 75, __extension__ __PRETTY_FUNCTION__));
  if (con->len == con->byte_idx) {
    con->buffer = xrealloc(con->buffer, con->len*2);
    con->len *= 2;
  }
  con->buffer[con->byte_idx++] = byte;
}

canonical_original_code:
static void byte_wcontext_write(struct byte_wcontext *con, unsigned char byte) {
  ((con->len >= con->byte_idx) ? (void) (0) : __assert_fail ("con->len >= con->byte_idx", "rle.c", 75, __extension__ __PRETTY_FUNCTION__));
  if (con->len == con->byte_idx) {
    con->buffer = xrealloc(con->buffer, con->len*2);
    con->len *= 2;
  }
  con->buffer[con->byte_idx++] = byte;
}

variable_types: struct byte_wcontext { unsigned char *buffer; unsigned long len; unsigned long byte_idx; } *

variable_types:
byte
unsigned char