decompiled_code:
void __fastcall prompt_ctrl_r(__int64 *a1, unsigned __int64 *a2, __int64 *a3)
{
int v6; // eax
__int64 v7; // rax
char v8; // r15
char *v9; // rbp
size_t v10; // rax
__int64 v11; // rdi
size_t v12; // r14
__int64 v13; // rax
unsigned __int64 v14; // rsi
__int64 v15; // rax
_QWORD *v16; // rax
__int64 v17; // rax
char v18; // [rsp+7h] [rbp-41h] BYREF
unsigned int v19; // [rsp+8h] [rbp-40h] BYREF
unsigned int v20[15]; // [rsp+Ch] [rbp-3Ch] BYREF

nc_get_yx(&v19, v20);
nc_addch(34LL);
nc_set_yx(v19, v20[0]);
v6 = io_getch(1LL, &v18, 1LL);
switch ( v6 )
{
case 23:
v7 = windows_cur();
v8 = 1;
v9 = (char *)window_current_word(v7);
break;
case 37:
v16 = (_QWORD *)windows_cur();
v8 = 0;
v9 = (char *)buffer_fname(*v16);
break;
case 6:
v15 = windows_cur();
v8 = 1;
v9 = (char *)window_current_fname(v15);
break;
default:
LABEL_4:
nc_clrtoeol();
return;
}
if ( !v9 )
goto LABEL_4;
v10 = strlen(v9);
v11 = *a1;
v12 = v10;
v13 = *a3;
v14 = *a3 + v12 + 1;
if ( v14 >= *a2 )
{
*a2 = v14;
v17 = urealloc(v11);
*a1 = v17;
v11 = v17;
v13 = *a3;
}
memcpy((void *)(v13 + v11), v9, v12 + 1);
*a3 += v12;
if ( v8 )
free(v9);
}

canonical_decompiled_code:
void __fastcall func0(__int64 *a1, unsigned __int64 *a2, __int64 *a3)
{
int v6; // eax
__int64 v7; // rax
char v8; // r15
char *v9; // rbp
size_t v10; // rax
__int64 v11; // rdi
size_t v12; // r14
__int64 v13; // rax
unsigned __int64 v14; // rsi
__int64 v15; // rax
_QWORD *v16; // rax
__int64 v17; // rax
char v18; // [rsp+7h] [rbp-41h] BYREF
unsigned int v19; // [rsp+8h] [rbp-40h] BYREF
unsigned int v20[15]; // [rsp+Ch] [rbp-3Ch] BYREF

nc_get_yx(&v19, v20);
nc_addch(34LL);
nc_set_yx(v19, v20[0]);
v6 = io_getch(1LL, &v18, 1LL);
switch ( v6 )
{
case 23:
v7 = windows_cur();
v8 = 1;
v9 = (char *)window_current_word(v7);
break;
case 37:
v16 = (_QWORD *)windows_cur();
v8 = 0;
v9 = (char *)buffer_fname(*v16);
break;
case 6:
v15 = windows_cur();
v8 = 1;
v9 = (char *)window_current_fname(v15);
break;
default:
LABEL_4:
nc_clrtoeol();
return;
}
if ( !v9 )
goto LABEL_4;
v10 = strlen(v9);
v11 = *a1;
v12 = v10;
v13 = *a3;
v14 = *a3 + v12 + 1;
if ( v14 >= *a2 )
{
*a2 = v14;
v17 = urealloc(v11);
*a1 = v17;
v11 = v17;
v13 = *a3;
}
memcpy((void *)(v13 + v11), v9, v12 + 1);
*a3 += v12;
if ( v8 )
free(v9);
}

original_code:
static void prompt_ctrl_r(char **const buf, size_t *const len, size_t *const i)
{
 int y, x;
 nc_get_yx(&y, &x);
 nc_addch('"');
 nc_set_yx(y, x);
 _Bool wasraw;
 int ch = io_getch(IO_NOMAP, &wasraw, 1);
 char *to_insert = ((void *)0);
 _Bool free_to_insert = 1;
 switch(ch){
  case (('f') & 037):
   to_insert = window_current_fname(windows_cur());
   break;
  case (('w') & 037):
   to_insert = window_current_word(windows_cur());
   break;
  case '%':
   to_insert = (char *)buffer_fname(windows_cur()->buf);
   free_to_insert = 0;
   break;
  default:
   goto cancel;
 }
 if(!to_insert)
  goto cancel;
 size_t to_insert_len = strlen(to_insert);
 if(*i + to_insert_len + 1 >= *len){
  *len = *i + to_insert_len + 1;
  *buf = urealloc(*buf, *len);
 }
 memcpy(*buf + *i, to_insert, to_insert_len + 1);
 *i += to_insert_len;
 if(free_to_insert)
  free(to_insert);
 return;
cancel:
 nc_clrtoeol();
}

canonical_original_code:
static void prompt_ctrl_r(char **buf, unsigned long *len, unsigned long *i)
{
 int y; int x;
 nc_get_yx(&y, &x);
 nc_addch('"');
 nc_set_yx(y, x);
 _Bool wasraw;
 int ch = io_getch(IO_NOMAP, &wasraw, 1);
 char *to_insert = ((void *)0);
 _Bool free_to_insert = 1;
 switch(ch){
  case (('f') & 037):
   to_insert = window_current_fname(windows_cur());
   break;
  case (('w') & 037):
   to_insert = window_current_word(windows_cur());
   break;
  case '%':
   to_insert = (char *)buffer_fname(windows_cur()->buf);
   free_to_insert = 0;
   break;
  default:
   goto cancel;
 }
 if(!to_insert)
  goto cancel;
 unsigned long to_insert_len = strlen(to_insert);
 if(*i + to_insert_len + 1 >= *len){
  *len = *i + to_insert_len + 1;
  *buf = urealloc(*buf, *len);
 }
 memcpy(*buf + *i, to_insert, to_insert_len + 1);
 *i += to_insert_len;
 if(free_to_insert)
  free(to_insert);
 return;
cancel:
 nc_clrtoeol();
}

variable_types:
buf
char **

variable_types:
len
unsigned long *

variable_types:
i
unsigned long *

variable_types: ch int


yesno

repo: bobrippling/tim

decompiled_code:
bool yesno(__int64 a1, ...)
{
int v1; // eax
int v2; // ebp
char v4; // [rsp+Fh] [rbp-D9h] BYREF
unsigned int v5; // [rsp+10h] [rbp-D8h] BYREF
unsigned int v6; // [rsp+14h] [rbp-D4h] BYREF
gcc_va_list va; // [rsp+18h] [rbp-D0h] BYREF

va_start(va, a1);
nc_get_yx(&v5, &v6);
v1 = nc_LINES();
nc_set_yx((unsigned int)(v1 - 1), 0LL);
nc_vprintf(a1, va);
v2 = io_getch(1LL, &v4, 1LL);
nc_set_yx(v5, v6);
return tolower(v2) == 121;
}

canonical_decompiled_code:
bool func2(__int64 a1, ...)
{
int v1; // eax
int v2; // ebp
char v4; // [rsp+Fh] [rbp-D9h] BYREF
unsigned int v5; // [rsp+10h] [rbp-D8h] BYREF
unsigned int v6; // [rsp+14h] [rbp-D4h] BYREF
gcc_va_list va; // [rsp+18h] [rbp-D0h] BYREF

va_start(va, a1);
nc_get_yx(&v5, &v6);
v1 = nc_LINES();
nc_set_yx((unsigned int)(v1 - 1), 0LL);
nc_vprintf(a1, va);
v2 = io_getch(1LL, &v4, 1LL);
nc_set_yx(v5, v6);
return tolower(v2) == 121;
}

original_code:
_Bool yesno(const char *fmt, ...)
{
 int y, x;
 nc_get_yx(&y, &x);
 nc_set_yx(nc_LINES() - 1, 0);
 va_list l;
 __builtin_va_start(l,fmt);
 nc_vprintf(fmt, l);
 __builtin_va_end(l);
 _Bool wasraw;
 int ch = io_getch(IO_NOMAP, &wasraw, 1);
 nc_set_yx(y, x);
 return tolower(ch) == 'y';
}

canonical_original_code:
_Bool yesno(char *fmt, ...)
{
 int y; int x;
 nc_get_yx(&y, &x);
 nc_set_yx(nc_LINES() - 1, 0);
 __builtin_va_list l;
 __builtin_va_start(l,fmt);
 nc_vprintf(fmt, l);
 __builtin_va_end(l);
 _Bool wasraw;
 int ch = io_getch(IO_NOMAP, &wasraw, 1);
 nc_set_yx(y, x);
 return tolower(ch) == 'y';
}

variable_types:
fmt
char *

variable_types: y int

variable_types: x int


decompiled_code:
void __fastcall ctag_free(void **a1)
{
free(*a1);
free(a1[1]);
*(_OWORD *)a1 = 0LL;
}

canonical_decompiled_code:
void __fastcall func1(void **a1)
{
free(*a1);
free(a1[1]);
*(_OWORD *)a1 = 0LL;
}

original_code:
void ctag_free(struct ctag_result *r)
{
 free(r->fname);
 free(r->line);
 memset(r, 0, sizeof *r);
}

variable_types: struct ctag_result { char *fname; char *line; } *

return_type: void


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

if ( (*a1)-- == 1 )
result = a2();
return result;
}

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

if ( (*a1)-- == 1 )
result = a2();
return result;
}

original_code:
void release_nochk(struct retain *r, void (*fn)(void *))
{
 if(--r->rcount == 0)
  fn(r);
}

variable_types:
r
struct retain { int rcount; } *

variable_types:
fn
void (*)(void *)


repo: bobrippling/ucc-c-compiler

decompiled_code:
char *__fastcall op_to_str(unsigned int a1)
{
char *result; // rax

result = 0LL;
if ( a1 <= 0x16 )
result = CSWTCH_2[a1];
return result;
}

canonical_decompiled_code:
char *__fastcall func0(unsigned int a1)
{
char *result; // rax

result = 0LL;
if ( a1 <= 0x16 )
result = CSWTCH_2[a1];
return result;
}

original_code:
const char *op_to_str(const enum op_type o)
{
 switch(o){
  case op_multiply: return "*";
  case op_divide: return "/";
  case op_plus: return "+";
  case op_minus: return "-";
  case op_modulus: return "%";
  case op_eq: return "==";
  case op_ne: return "!=";
  case op_le: return "<=";
  case op_lt: return "<";
  case op_ge: return ">=";
  case op_gt: return ">";
  case op_or: return "|";
  case op_xor: return "^";
  case op_and: return "&";
  case op_orsc: return "||";
  case op_andsc: return "&&";
  case op_not: return "!";
  case op_bnot: return "~";
  case op_shiftl: return "<<";
  case op_shiftr: return ">>";
  case op_signbit: return "SIGNBIT";
  case op_no_signbit: return "NOSIGNBIT";
  case op_unknown: return "unknown";
 }
 return ((void *)0);
}

canonical_original_code:
char *op_to_str(enum op_type o)
{
 switch(o){
  case op_multiply: return "*";
  case op_divide: return "/";
  case op_plus: return "+";
  case op_minus: return "-";
  case op_modulus: return "%";
  case op_eq: return "==";
  case op_ne: return "!=";
  case op_le: return "<=";
  case op_lt: return "<";
  case op_ge: return ">=";
  case op_gt: return ">";
  case op_or: return "|";
  case op_xor: return "^";
  case op_and: return "&";
  case op_orsc: return "||";
  case op_andsc: return "&&";
  case op_not: return "!";
  case op_bnot: return "~";
  case op_shiftl: return "<<";
  case op_shiftr: return ">>";
  case op_signbit: return "SIGNBIT";
  case op_no_signbit: return "NOSIGNBIT";
  case op_unknown: return "unknown";
 }
 return ((void *)0);
}

variable_types: enum op_type { op_multiply=0, op_divide=1, op_modulus=2, op_plus=3, op_minus=4, op_xor=5, op_or=6, op_and=7, op_orsc=8, op_andsc=9, op_shiftl=10, op_shiftr=11, op_not=12, op_bnot=13, op_eq=14, op_ne=15, op_le=16, op_lt=17, op_ge=18, op_gt=19, op_signbit=20, op_no_signbit=21, op_unknown=22 }

return_type: char *


decompiled_code:
_BOOL8 __fastcall op_can_compound(unsigned int a1)
{
_BOOL8 result; // rax

result = 1LL;
if ( a1 > 7 )
result = a1 - 10 <= 3;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(unsigned int a1)
{
_BOOL8 result; // rax

result = 1LL;
if ( a1 > 7 )
result = a1 - 10 <= 3;
return result;
}

original_code:
int op_can_compound(enum op_type o)
{
 switch(o){
  case op_plus:
  case op_minus:
  case op_multiply:
  case op_divide:
  case op_modulus:
  case op_not:
  case op_bnot:
  case op_and:
  case op_or:
  case op_xor:
  case op_shiftl:
  case op_shiftr:
   return 1;
  default:
   break;
 }
 return 0;
}

return_type: int

user_defined_types: enum op_type { op_multiply=0, op_divide=1, op_modulus=2, op_plus=3, op_minus=4, op_xor=5, op_or=6, op_and=7, op_orsc=8, op_andsc=9, op_shiftl=10, op_shiftr=11, op_not=12, op_bnot=13, op_eq=14, op_ne=15, op_le=16, op_lt=17, op_ge=18, op_gt=19, op_signbit=20, op_no_signbit=21, op_unknown=22 }


decompiled_code:
_BOOL8 __fastcall op_can_float(unsigned int a1)
{
_BOOL8 result; // rax

if ( a1 > 0xD )
result = 1LL;
else
result = ((1LL << a1) & 0x2CE4) == 0;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(unsigned int a1)
{
_BOOL8 result; // rax

if ( a1 > 0xD )
result = 1LL;
else
result = ((1LL << a1) & 0x2CE4) == 0;
return result;
}

original_code:
int op_can_float(enum op_type o)
{
 switch(o){
  case op_modulus:
  case op_xor:
  case op_or:
  case op_and:
  case op_shiftl:
  case op_shiftr:
  case op_bnot:
   return 0;
  default:
   return 1;
 }
}


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

switch ( a1 )
{
case 0:
case 3:
case 5:
case 6:
case 7:
case 14:
case 15:
case 20:
case 21:
result = 1LL;
break;
case 22:
_assert_fail("0", "op.c", 0x5Au, "op_is_commutative");
default:
result = 0LL;
break;
}
return result;
}

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

switch ( a1 )
{
case 0:
case 3:
case 5:
case 6:
case 7:
case 14:
case 15:
case 20:
case 21:
result = 1LL;
break;
case 22:
_assert_fail("0", "op.c", 0x5Au, "op_is_commutative");
default:
result = 0LL;
break;
}
return result;
}

original_code:
int op_is_commutative(enum op_type o)
{
 switch(o){
  case op_multiply:
  case op_plus:
  case op_xor:
  case op_or:
  case op_and:
  case op_eq:
  case op_ne:
  case op_signbit:
  case op_no_signbit:
   return 1;
  case op_unknown:
   ((0) ? (void) (0) : __assert_fail ("0", "op.c", 90, __extension__ __PRETTY_FUNCTION__));
  case op_minus:
  case op_divide:
  case op_modulus:
  case op_orsc:
  case op_andsc:
  case op_shiftl:
  case op_shiftr:
  case op_le:
  case op_lt:
  case op_ge:
  case op_gt:
  case op_not:
  case op_bnot:
   break;
 }
 return 0;
}


decompiled_code:
_BOOL8 __fastcall op_is_comparison(int a1)
{
return (unsigned int)(a1 - 14) <= 5;
}

canonical_decompiled_code:
_BOOL8 __fastcall func4(int a1)
{
return (unsigned int)(a1 - 14) <= 5;
}

original_code:
int op_is_comparison(enum op_type o)
{
 switch(o){
  case op_eq:
  case op_ne:
  case op_le:
  case op_lt:
  case op_ge:
  case op_gt:
   return 1;
  default:
   break;
 }
 return 0;
}


decompiled_code:
_BOOL8 __fastcall op_is_shortcircuit(int a1)
{
return (unsigned int)(a1 - 8) <= 1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func5(int a1)
{
return (unsigned int)(a1 - 8) <= 1;
}

original_code:
int op_is_shortcircuit(enum op_type o)
{
 switch(o){
  case op_andsc:
  case op_orsc:
   return 1;
  default:
   return 0;
 }
}


decompiled_code:
__int64 __fastcall op_returns_bool(int a1)
{
unsigned int v1; // er9
int v2; // er8
unsigned int v4; // er9

v1 = 1;
if ( a1 == 12 || op_is_comparison(a1) )
return v1;
LOBYTE(v4) = op_is_shortcircuit(v2);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1)
{
unsigned int v1; // er9
int v2; // er8
unsigned int v4; // er9

v1 = 1;
if ( a1 == 12 || func4(a1) )
return v1;
LOBYTE(v4) = func5(v2);
return v4;
}

original_code:
int op_returns_bool(enum op_type o)
{
 return o == op_not || op_is_comparison(o) || op_is_shortcircuit(o);
}


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

switch ( a1 )
{
case 0:
case 3:
case 6:
case 10:
result = 1LL;
break;
case 1:
case 2:
case 4:
case 5:
case 7:
case 8:
case 9:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
result = 0LL;
break;
default:
_assert_fail("0", "op.c", 0xB2u, "op_increases");
}
return result;
}

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

switch ( a1 )
{
case 0:
case 3:
case 6:
case 10:
result = 1LL;
break;
case 1:
case 2:
case 4:
case 5:
case 7:
case 8:
case 9:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
result = 0LL;
break;
default:
_assert_fail("0", "op.c", 0xB2u, "op_increases");
}
return result;
}

original_code:
int op_increases(enum op_type o)
{
 switch(o){
  case op_unknown:
   break;
  case op_multiply:
  case op_plus:
  case op_or:
  case op_shiftl:
   return 1;
  case op_divide:
  case op_modulus:
  case op_minus:
  case op_shiftr:
  case op_and:
   return 0;
  case op_xor:
  case op_orsc:
  case op_andsc:
  case op_not:
  case op_bnot:
  case op_eq:
  case op_ne:
  case op_le:
  case op_lt:
  case op_ge:
  case op_gt:
  case op_signbit:
  case op_no_signbit:
   return 0;
 }
 ((0) ? (void) (0) : __assert_fail ("0", "op.c", 178, __extension__ __PRETTY_FUNCTION__));
 return 0;
}


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

result = a1;
if ( a2 <= 0x3F )
result = a1 & ~(-1LL << a2);
if ( !cc1_fopt[25] )
goto LABEL_8;
switch ( a2 )
{
case 8u:
if ( a3 )
*a3 = (char)a1;
result = (unsigned __int8)a1;
break;
case 0x10u:
if ( a3 )
*a3 = (__int16)a1;
result = (unsigned __int16)a1;
break;
case 0x20u:
if ( a3 )
*a3 = (int)a1;
result = (unsigned int)a1;
break;
case 0x40u:
result = a1;
if ( a3 )
*a3 = a1;
break;
default:
LABEL_8:
if ( a3 )
*a3 = a1 << (64 - (unsigned __int8)a2) >> (64 - (unsigned __int8)a2);
return result;
}
return result;
}

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

result = a1;
if ( a2 <= 0x3F )
result = a1 & ~(-1LL << a2);
if ( !cc1_fopt[25] )
goto LABEL_8;
switch ( a2 )
{
case 8u:
if ( a3 )
*a3 = (char)a1;
result = (unsigned __int8)a1;
break;
case 0x10u:
if ( a3 )
*a3 = (__int16)a1;
result = (unsigned __int16)a1;
break;
case 0x20u:
if ( a3 )
*a3 = (int)a1;
result = (unsigned int)a1;
break;
case 0x40u:
result = a1;
if ( a3 )
*a3 = a1;
break;
default:
LABEL_8:
if ( a3 )
*a3 = a1 << (64 - (unsigned __int8)a2) >> (64 - (unsigned __int8)a2);
return result;
}
return result;
}

original_code:
integral_t integral_truncate_bits(
  integral_t val, unsigned bits,
  sintegral_t *signed_iv)
{
 integral_t pos_mask = bits < (sizeof(integral_t) * 8)
  ? ~(-1ULL << bits)
  : -1ULL;
 integral_t truncated = val & pos_mask;
 if(cc1_fopt.cast_w_builtin_types){
  if(bits == sizeof(char) * 8){ if(signed_iv) *signed_iv = (signed char)val; return (unsigned char)val; };
  if(bits == sizeof(short) * 8){ if(signed_iv) *signed_iv = (signed short)val; return (unsigned short)val; };
  if(bits == sizeof(int) * 8){ if(signed_iv) *signed_iv = (signed int)val; return (unsigned int)val; };
  if(bits == sizeof(long) * 8){ if(signed_iv) *signed_iv = (signed long)val; return (unsigned long)val; };
  if(bits == sizeof(long long) * 8){ if(signed_iv) *signed_iv = (signed long long)val; return (unsigned long long)val; };
 }
 if(signed_iv){
  const unsigned shamt = 8 * sizeof(val) - bits;
  *signed_iv = ((sintegral_t)val << shamt) >> shamt;
 }
 return truncated;
}

canonical_original_code:
unsigned long long integral_truncate_bits(unsigned long long val, unsigned int bits, long long *signed_iv)
{
 unsigned long long pos_mask = bits < (sizeof(integral_t) * 8)
  ? ~(-1ULL << bits)
  : -1ULL;
 unsigned long long truncated = val & pos_mask;
 if(cc1_fopt.cast_w_builtin_types){
  if(bits == sizeof(char) * 8){ if(signed_iv) *signed_iv = (char)val; return (unsigned char)val; };
  if(bits == sizeof(short) * 8){ if(signed_iv) *signed_iv = (short)val; return (unsigned short)val; };
  if(bits == sizeof(int) * 8){ if(signed_iv) *signed_iv = (int)val; return (unsigned int)val; };
  if(bits == sizeof(long) * 8){ if(signed_iv) *signed_iv = (long)val; return (unsigned long)val; };
  if(bits == sizeof(long long) * 8){ if(signed_iv) *signed_iv = (long long)val; return (unsigned long long)val; };
 }
 if(signed_iv){
  unsigned int shamt = 8 * sizeof(val) - bits;
  *signed_iv = ((long long)val << shamt) >> shamt;
 }
 return truncated;
}

variable_types:
val
unsigned long long

variable_types:
bits
unsigned int

variable_types:
truncated
unsigned long long

variable_types:
shamt
unsigned int

return_type: unsigned long long


decompiled_code:
__int64 __fastcall integral_truncate(__int64 a1, int a2, __int64 *a3)
{
return integral_truncate_bits(a1, 8 * a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, int a2, __int64 *a3)
{
return func1(a1, 8 * a2, a3);
}

original_code:
integral_t integral_truncate(
  integral_t val, unsigned bytes,
  sintegral_t *sign_extended)
{
 return integral_truncate_bits(
   val, bytes * 8,
   sign_extended);
}

canonical_original_code:
unsigned long long integral_truncate(unsigned long long val, unsigned int bytes, long long *sign_extended)
{
 return integral_truncate_bits(
   val, bytes * 8,
   sign_extended);
}

variable_types:
bytes
unsigned int


decompiled_code:
__int64 __fastcall dbg_add_file(const char ***a1, const char *a2)
{
const char **v2; // rbx
unsigned int v3; // er12
const char ***v5; // rbp
const char **v6; // rax
size_t v7; // rax
char *v8; // rbp
_BYTE v9[72]; // [rsp+0h] [rbp-48h] BYREF

v2 = *a1;
if ( *a1 )
{
v3 = 1;
while ( 1 )
{
if ( !strcmp(a2, *v2) )
return v3;
++v3;
if ( !v2[1] )
break;
v2 = (const char **)v2[1];
}
v5 = (const char ***)(v2 + 1);
}
else
{
v5 = a1;
v3 = 1;
}
v6 = (const char **)umalloc(16LL);
*v5 = v6;
*v6 = a2;
v7 = strlen(a2);
cstring_init(v9, 1LL, a2, v7, 0LL);
v8 = (char *)str_add_escape(v9);
xfprintf(cc1_output[2], ".file %u \"%s\"\n", v3, v8);
cstring_deinit(v9);
free(v8);
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func1(const char ***a1, const char *a2)
{
const char **v2; // rbx
unsigned int v3; // er12
const char ***v5; // rbp
const char **v6; // rax
size_t v7; // rax
char *v8; // rbp
_BYTE v9[72]; // [rsp+0h] [rbp-48h] BYREF

v2 = *a1;
if ( *a1 )
{
v3 = 1;
while ( 1 )
{
if ( !strcmp(a2, *v2) )
return v3;
++v3;
if ( !v2[1] )
break;
v2 = (const char **)v2[1];
}
v5 = (const char ***)(v2 + 1);
}
else
{
v5 = a1;
v3 = 1;
}
v6 = (const char **)umalloc(16LL);
*v5 = v6;
*v6 = a2;
v7 = strlen(a2);
cstring_init(v9, 1LL, a2, v7, 0LL);
v8 = (char *)str_add_escape(v9);
xfprintf(cc1_output[2], ".file %u \"%s\"\n", v3, v8);
cstring_deinit(v9);
free(v8);
return v3;
}

original_code:
unsigned dbg_add_file(struct out_dbg_filelist **files, const char *nam)
{
 struct out_dbg_filelist **p;
 unsigned i = 1;
 struct cstring local;
 char *esc;
 for(p = files; *p; p = &(*p)->next, i++)
  if(!strcmp(nam, (*p)->fname))
   return i;
 *p = umalloc(sizeof **p);
 (*p)->fname = nam;
 cstring_init(&local, CSTRING_ASCII, nam, strlen(nam), 0);
 esc = str_add_escape(&local);
 xfprintf(cc1_output.file, ".file %u \"%s\"\n", i, esc);
 cstring_deinit(&local);
 free(esc);
 return i;
}

canonical_original_code:
unsigned int dbg_add_file(struct out_dbg_filelist **files, char *nam)
{
 struct out_dbg_filelist **p;
 unsigned int i = 1;
 struct cstring local;
 char *esc;
 for(p = files; *p; p = &(*p)->next, i++)
  if(!strcmp(nam, (*p)->fname))
   return i;
 *p = umalloc(sizeof **p);
 (*p)->fname = nam;
 cstring_init(&local, CSTRING_ASCII, nam, strlen(nam), 0);
 esc = str_add_escape(&local);
 xfprintf(cc1_output.file, ".file %u \"%s\"\n", i, esc);
 cstring_deinit(&local);
 free(esc);
 return i;
}

variable_types: struct out_dbg_filelist { char *fname; struct out_dbg_filelist *next; } **

variable_types:
nam
char *

variable_types:
i
unsigned int

variable_types: struct cstring { union { char *ascii; int *wides; } bits; unsigned long count; enum cstring_type { CSTRING_RAW=0, CSTRING_ASCII=1, CSTRING_WIDE=2 } type; }

variable_types:
esc
char *

return_type: unsigned int

user_defined_types: struct cstring { union { char *ascii; int *wides; } bits; unsigned long count; enum cstring_type type; }


decompiled_code:
const char *__fastcall vwarn_colour(unsigned int a1)
{
const char *result; // rax

result = "\x1B[30m";
if ( a1 <= 3 )
result = colour_strs[CSWTCH_25[a1]];
return result;
}

canonical_decompiled_code:
const char *__fastcall func0(unsigned int a1)
{
const char *result; // rax

result = "\x1B[30m";
if ( a1 <= 3 )
result = colour_strs[CSWTCH_25[a1]];
return result;
}

original_code:
static const char *vwarn_colour(enum warn_type ty)
{
 int i = 0;
 switch(ty){
  case VWARN_ERR: i = colour_err; break;
  case VWARN_WARN: i = colour_warn; break;
  case VWARN_NOTE: i = colour_note; break;
  case VWARN_OTHER: i = colour_other; break;
 }
 return colour_strs[i];
}

canonical_original_code:
static char *vwarn_colour(enum warn_type ty)
{
 int i = 0;
 switch(ty){
  case VWARN_ERR: i = colour_err; break;
  case VWARN_WARN: i = colour_warn; break;
  case VWARN_NOTE: i = colour_note; break;
  case VWARN_OTHER: i = colour_other; break;
 }
 return colour_strs[i];
}

variable_types: enum warn_type { VWARN_NOTE=0, VWARN_WARN=1, VWARN_ERR=2, VWARN_OTHER=3 }

variable_types: i int


decompiled_code:
char *__fastcall vwarn_str(unsigned int a1)
{
char *result; // rax

result = 0LL;
if ( a1 <= 3 )
result = CSWTCH_27[a1];
return result;
}

canonical_decompiled_code:
char *__fastcall func1(unsigned int a1)
{
char *result; // rax

result = 0LL;
if ( a1 <= 3 )
result = CSWTCH_27[a1];
return result;
}

original_code:
static const char *vwarn_str(enum warn_type ty)
{
 switch(ty){
  case VWARN_ERR: return "error";
  case VWARN_WARN: return "warning";
  case VWARN_NOTE: return "note";
  case VWARN_OTHER: return "other";
 }
 return ((void *)0);
}

canonical_original_code:
static char *vwarn_str(enum warn_type ty)
{
 switch(ty){
  case VWARN_ERR: return "error";
  case VWARN_WARN: return "warning";
  case VWARN_NOTE: return "note";
  case VWARN_OTHER: return "other";
 }
 return ((void *)0);
}

user_defined_types: enum warn_type { VWARN_NOTE=0, VWARN_WARN=1, VWARN_ERR=2, VWARN_OTHER=3 }


decompiled_code:
int __fastcall warn_show_line_part(const char *a1, int a2, unsigned int a3)
{
unsigned int v4; // er12
int v5; // ebx
int v6; // eax
int v7; // ebx
const char *v8; // r8
int v9; // ebp
unsigned int v10; // ebx
int v12; // esi
const char *v13; // rcx
const char *v14; // r8

v4 = a2;
v5 = warning_length;
if ( warning_length <= 0 )
{
v7 = 0x7FFFFFFF;
v8 = (const char *)&unk_76E;
goto LABEL_6;
}
v6 = strlen(a1);
v7 = v5 - 10;
if ( v7 <= 0 )
v7 = 1;
if ( v7 >= v6 )
{
v8 = (const char *)&unk_76E;
goto LABEL_6;
}
if ( v7 > a2 )
{
v8 = "...";
a1[v7] = 0;
LABEL_6:
v9 = a2 + 3;
fprintf(stderr, " %s\"%s\"%s\n", (const char *)&unk_76E, a1, v8);
if ( a2 + 3 <= 0 )
goto LABEL_8;
goto LABEL_7;
}
v4 = (unsigned int)v7 >> 1;
v12 = a2 - v7 / 2;
v13 = &a1[v12];
if ( v7 < v6 - v12 )
{
v14 = "...";
v13[v7] = 0;
}
else
{
v14 = (const char *)&unk_76E;
}
v9 = v4 + 6;
fprintf(stderr, " %s\"%s\"%s\n", "...", v13, v14);
do
{
LABEL_7:
fputc(32, stderr);
--v9;
}
while ( v9 );
LABEL_8:
v10 = v7 - v4;
fputc(94, stderr);
if ( v10 > a3 )
v10 = a3;
if ( v10 > 1 )
{
do
{
--v10;
fputc(126, stderr);
}
while ( v10 != 1 );
}
return fputc(10, stderr);
}

canonical_decompiled_code:
int __fastcall func2(const char *a1, int a2, unsigned int a3)
{
unsigned int v4; // er12
int v5; // ebx
int v6; // eax
int v7; // ebx
const char *v8; // r8
int v9; // ebp
unsigned int v10; // ebx
int v12; // esi
const char *v13; // rcx
const char *v14; // r8

v4 = a2;
v5 = warning_length;
if ( warning_length <= 0 )
{
v7 = 0x7FFFFFFF;
v8 = (const char *)&unk_76E;
goto LABEL_6;
}
v6 = strlen(a1);
v7 = v5 - 10;
if ( v7 <= 0 )
v7 = 1;
if ( v7 >= v6 )
{
v8 = (const char *)&unk_76E;
goto LABEL_6;
}
if ( v7 > a2 )
{
v8 = "...";
a1[v7] = 0;
LABEL_6:
v9 = a2 + 3;
fprintf(stderr, " %s\"%s\"%s\n", (const char *)&unk_76E, a1, v8);
if ( a2 + 3 <= 0 )
goto LABEL_8;
goto LABEL_7;
}
v4 = (unsigned int)v7 >> 1;
v12 = a2 - v7 / 2;
v13 = &a1[v12];
if ( v7 < v6 - v12 )
{
v14 = "...";
v13[v7] = 0;
}
else
{
v14 = (const char *)&unk_76E;
}
v9 = v4 + 6;
fprintf(stderr, " %s\"%s\"%s\n", "...", v13, v14);
do
{
LABEL_7:
fputc(32, stderr);
--v9;
}
while ( v9 );
LABEL_8:
v10 = v7 - v4;
fputc(94, stderr);
if ( v10 > a3 )
v10 = a3;
if ( v10 > 1 )
{
do
{
--v10;
fputc(126, stderr);
}
while ( v10 != 1 );
}
return fputc(10, stderr);
}

original_code:
static void warn_show_line_part(char *line, int pos, unsigned wlen)
{
 int len = strlen(line);
 int i;
 struct { int start, end; } dotdot = { 0, 0 };
 int warning_length_normalise = 0x7fffffff;
 if(warning_length > 0){
  warning_length_normalise = warning_length - 10;
  if(warning_length_normalise <= 0)
   warning_length_normalise = 1;
  if(len > warning_length_normalise){
   if(pos >= warning_length_normalise){
    dotdot.start = 1;
    line += pos - warning_length_normalise / 2;
    len -= pos - warning_length_normalise / 2;
    pos = warning_length_normalise / 2;
   }
   if(len > warning_length_normalise){
    dotdot.end = 1;
    line[warning_length_normalise] = '\0';
   }
  }
 }
 fprintf(stderr, "  %s\"%s\"%s\n",
   dotdot.start ? "..." : "",
   line,
   dotdot.end ? "..." : "");
 for(i = pos + 3 + (dotdot.start ? 3 : 0); i > 0; i--)
  fputc(' ', stderr);
 fputc('^', stderr);
 for(i = ((wlen) > ((unsigned)(warning_length_normalise - pos)) ? ((unsigned)(warning_length_normalise - pos)) : (wlen));
   i > 1;
   i--)
  fputc('~', stderr);
 fputc('\n', stderr);
}

canonical_original_code:
static void warn_show_line_part(char *line, int pos, unsigned int wlen)
{
 int len = strlen(line);
 int i;
 struct { int start; } dotdot = { 0, 0 };
 int warning_length_normalise = 0x7fffffff;
 if(warning_length > 0){
  warning_length_normalise = warning_length - 10;
  if(warning_length_normalise <= 0)
   warning_length_normalise = 1;
  if(len > warning_length_normalise){
   if(pos >= warning_length_normalise){
    dotdot.start = 1;
    line += pos - warning_length_normalise / 2;
    len -= pos - warning_length_normalise / 2;
    pos = warning_length_normalise / 2;
   }
   if(len > warning_length_normalise){
    dotdot.end = 1;
    line[warning_length_normalise] = '\0';
   }
  }
 }
 fprintf(stderr, "  %s\"%s\"%s\n",
   dotdot.start ? "..." : "",
   line,
   dotdot.end ? "..." : "");
 for(i = pos + 3 + (dotdot.start ? 3 : 0); i > 0; i--)
  fputc(' ', stderr);
 fputc('^', stderr);
 for(i = ((wlen) > ((unsigned int)(warning_length_normalise - pos)) ? ((unsigned int)(warning_length_normalise - pos)) : (wlen));
   i > 1;
   i--)
  fputc('~', stderr);
 fputc('\n', stderr);
}

variable_types:
line
char *

variable_types: pos int

variable_types:
wlen
unsigned int

variable_types: len int

variable_types:
dotdot
struct { int start; }


decompiled_code:
void __fastcall warn_show_line(__int64 a1)
{
char *v2; // rbp
char v3; // al
char *v4; // rdx
const char *v5; // rdi
int v6; // eax

if ( show_current_line && *(_QWORD *)(a1 + 8) )
{
v2 = (char *)ustrdup();
if ( buffed_0 )
{
v3 = *v2;
if ( !*v2 )
goto LABEL_16;
}
else
{
setvbuf(stderr, 0LL, 1, 0LL);
v3 = *v2;
buffed_0 = 1;
if ( !v3 )
goto LABEL_16;
}
v4 = v2;
v5 = 0LL;
do
{
while ( v3 == 9 )
{
*v4 = 32;
v3 = *++v4;
if ( !v3 )
goto LABEL_12;
}
if ( v3 != 32 && !v5 )
v5 = v4;
v3 = *++v4;
}
while ( v3 );
LABEL_12:
if ( v5 )
{
v6 = (_DWORD)v5 - (_DWORD)v2;
LABEL_17:
warn_show_line_part(v5, *(unsigned __int16 *)(a1 + 20) - v6, *(unsigned __int16 *)(a1 + 22));
free(v2);
return;
}
LABEL_16:
v5 = v2;
v6 = 0;
goto LABEL_17;
}
}

canonical_decompiled_code:
void __fastcall func3(__int64 a1)
{
char *v2; // rbp
char v3; // al
char *v4; // rdx
const char *v5; // rdi
int v6; // eax

if ( show_current_line && *(_QWORD *)(a1 + 8) )
{
v2 = (char *)ustrdup();
if ( buffed_0 )
{
v3 = *v2;
if ( !*v2 )
goto LABEL_16;
}
else
{
setvbuf(stderr, 0LL, 1, 0LL);
v3 = *v2;
buffed_0 = 1;
if ( !v3 )
goto LABEL_16;
}
v4 = v2;
v5 = 0LL;
do
{
while ( v3 == 9 )
{
*v4 = 32;
v3 = *++v4;
if ( !v3 )
goto LABEL_12;
}
if ( v3 != 32 && !v5 )
v5 = v4;
v3 = *++v4;
}
while ( v3 );
LABEL_12:
if ( v5 )
{
v6 = (_DWORD)v5 - (_DWORD)v2;
LABEL_17:
func2(v5, *(unsigned __int16 *)(a1 + 20) - v6, *(unsigned __int16 *)(a1 + 22));
free(v2);
return;
}
LABEL_16:
v5 = v2;
v6 = 0;
goto LABEL_17;
}
}

original_code:
static void warn_show_line(const struct where *w)
{
 extern int show_current_line;
 if(show_current_line && w->line_str){
  static int buffed = 0;
  char *line = ustrdup(w->line_str);
  char *p, *nonblank;
  if(!buffed){
   setvbuf(stderr, ((void *)0), 1, 0);
   buffed = 1;
  }
  nonblank = ((void *)0);
  for(p = line; *p; p++)
   switch(*p){
    case '\t':
     *p = ' ';
    case ' ':
     break;
    default:
     if(!nonblank)
      nonblank = p;
   }
  if(!nonblank)
   nonblank = line;
  warn_show_line_part(nonblank, w->chr - (nonblank - line), w->len);
  free(line);
 }
}

canonical_original_code:
static void warn_show_line(struct where *w)
{
 extern int show_current_line;
 if(show_current_line && w->line_str){
  static int buffed = 0;
  char *line = ustrdup(w->line_str);
  char *p; char *nonblank;
  if(!buffed){
   setvbuf(stderr, ((void *)0), 1, 0);
   buffed = 1;
  }
  nonblank = ((void *)0);
  for(p = line; *p; p++)
   switch(*p){
    case '\t':
     *p = ' ';
    case ' ':
     break;
    default:
     if(!nonblank)
      nonblank = p;
   }
  if(!nonblank)
   nonblank = line;
  warn_show_line_part(nonblank, w->chr - (nonblank - line), w->len);
  free(line);
 }
}

variable_types: struct where { char *fname; unsigned int line; unsigned short chr; unsigned char is_sysh; } *

variable_types: buffed int

variable_types:
p
char *

variable_types:
nonblank
char *


decompiled_code:
int __fastcall warn_colour(int a1, unsigned int a2)
{
int result; // eax
FILE *v4; // rsi
const char *v5; // rax

result = is_tty_1;
if ( is_tty_1 == 2 )
{
result = colour_enabled(2LL);
is_tty_1 = result;
}
if ( result )
{
if ( a1 )
{
v4 = stderr;
v5 = vwarn_colour(a2);
result = fputs(v5, v4);
}
else
{
result = fwrite("\x1B[m", 1uLL, 3uLL, stderr);
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func4(int a1, unsigned int a2)
{
int result; // eax
FILE *v4; // rsi
const char *v5; // rax

result = is_tty_1;
if ( is_tty_1 == 2 )
{
result = colour_enabled(2LL);
is_tty_1 = result;
}
if ( result )
{
if ( a1 )
{
v4 = stderr;
v5 = func0(a2);
result = fputs(v5, v4);
}
else
{
result = fwrite("\x1B[m", 1uLL, 3uLL, stderr);
}
}
return result;
}

original_code:
void warn_colour(int on, enum warn_type ty)
{
 static enum { f = 0, t = 1, need_init = 2 } is_tty = need_init;
 if(is_tty == need_init)
  is_tty = colour_enabled(2);
 if(is_tty){
  if(on)
   fputs(vwarn_colour(ty), stderr);
  else
   fprintf(stderr, "\033[m");
 }
}

canonical_original_code:
void warn_colour(int on, enum warn_type ty)
{
 static enum { f=0, t=1, need_init=2 } is_tty = need_init;
 if(is_tty == need_init)
  is_tty = colour_enabled(2);
 if(is_tty){
  if(on)
   fputs(vwarn_colour(ty), stderr);
  else
   fprintf(stderr, "\033[m");
 }
}

variable_types: on int


vwarn

decompiled_code:
void __fastcall vwarn(__int64 a1, unsigned int a2, const char *a3, void *a4)
{
__int64 v6; // r12
const char *v7; // rax
char *v8; // rax

include_bt(stderr);
v6 = default_where(a1);
warn_colour(1, 3u);
v7 = (const char *)where_str(v6);
fprintf(stderr, "%s: ", v7);
warn_colour(1, a2);
v8 = vwarn_str(a2);
fprintf(stderr, "%s: ", v8);
warn_colour(0, a2);
vfprintf(stderr, a3, a4);
++warning_count;
if ( *a3 && a3[strlen(a3) - 1] == 58 )
{
fputc(32, stderr);
perror(0LL);
}
else
{
fputc(10, stderr);
}
warn_show_line(v6);
}

canonical_decompiled_code:
void __fastcall func5(__int64 a1, unsigned int a2, const char *a3, void *a4)
{
__int64 v6; // r12
const char *v7; // rax
char *v8; // rax

include_bt(stderr);
v6 = default_where(a1);
func4(1, 3u);
v7 = (const char *)where_str(v6);
fprintf(stderr, "%s: ", v7);
func4(1, a2);
v8 = func1(a2);
fprintf(stderr, "%s: ", v8);
func4(0, a2);
vfprintf(stderr, a3, a4);
++warning_count;
if ( *a3 && a3[strlen(a3) - 1] == 58 )
{
fputc(32, stderr);
perror(0LL);
}
else
{
fputc(10, stderr);
}
func3(v6);
}

original_code:
void vwarn(const struct where *w, enum warn_type ty,
  const char *fmt, va_list l)
{
 include_bt(stderr);
 w = default_where(w);
 warn_colour(1, VWARN_OTHER);
 fprintf(stderr, "%s: ", where_str(w));
 warn_colour(1, ty);
 fprintf(stderr, "%s: ", vwarn_str(ty));
 warn_colour(0, ty);
 vfprintf(stderr, fmt, l);
 warning_count++;
 if(*fmt && fmt[strlen(fmt)-1] == ':'){
  fputc(' ', stderr);
  perror(((void *)0));
 }else{
  fputc('\n', stderr);
 }
 warn_show_line(w);
}

canonical_original_code:
void vwarn(struct where *w, enum warn_type ty, char *fmt, __builtin_va_list l)
{
 include_bt(stderr);
 w = default_where(w);
 warn_colour(1, VWARN_OTHER);
 fprintf(stderr, "%s: ", where_str(w));
 warn_colour(1, ty);
 fprintf(stderr, "%s: ", vwarn_str(ty));
 warn_colour(0, ty);
 vfprintf(stderr, fmt, l);
 warning_count++;
 if(*fmt && fmt[strlen(fmt)-1] == ':'){
  fputc(' ', stderr);
  perror(((void *)0));
 }else{
  fputc('\n', stderr);
 }
 warn_show_line(w);
}

variable_types:
fmt
char *

user_defined_types: struct where { char *fname; unsigned int line; unsigned short chr; unsigned char is_sysh; }


decompiled_code:
void warn_at_print_error(__int64 a1, const char *a2, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a2);
vwarn(a1, 2u, a2, va);
}

canonical_decompiled_code:
void func6(__int64 a1, const char *a2, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a2);
func5(a1, 2u, a2, va);
}

original_code:
void warn_at_print_error(const struct where *w, const char *fmt, ...)
{
 va_list l;
 __builtin_va_start(l,fmt);
 vwarn(w, VWARN_ERR, fmt, l);
 __builtin_va_end(l);
}

canonical_original_code:
void warn_at_print_error(struct where *w, char *fmt, ...)
{
 __builtin_va_list l;
 __builtin_va_start(l,fmt);
 vwarn(w, VWARN_ERR, fmt, l);
 __builtin_va_end(l);
}


vdie

decompiled_code:
void __fastcall __noreturn vdie(__int64 a1, const char *a2, void *a3)
{
vwarn(a1, 2u, a2, a3);
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func7(__int64 a1, const char *a2, void *a3)
{
func5(a1, 2u, a2, a3);
exit(1);
}

original_code:
void vdie(const struct where *w, const char *fmt, va_list l)
{
 vwarn(w, VWARN_ERR, fmt, l);
 exit(1);
}

canonical_original_code:
void vdie(struct where *w, char *fmt, __builtin_va_list l)
{
 vwarn(w, VWARN_ERR, fmt, l);
 exit(1);
}


decompiled_code:
void note_at(__int64 a1, const char *a2, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a2);
vwarn(a1, 0, a2, va);
}

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

va_start(va, a2);
func5(a1, 0, a2, va);
}

original_code:
void note_at(const struct where *w, const char *fmt, ...)
{
 va_list l;
 __builtin_va_start(l,fmt);
 vwarn(w, VWARN_NOTE, fmt, l);
 __builtin_va_end(l);
}

canonical_original_code:
void note_at(struct where *w, char *fmt, ...)
{
 __builtin_va_list l;
 __builtin_va_start(l,fmt);
 vwarn(w, VWARN_NOTE, fmt, l);
 __builtin_va_end(l);
}


decompiled_code:
void warn_at(__int64 a1, const char *a2, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a2);
vwarn(a1, 1u, a2, va);
}

canonical_decompiled_code:
void func9(__int64 a1, const char *a2, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a2);
func5(a1, 1u, a2, va);
}

original_code:
void warn_at(const struct where *w, const char *fmt, ...)
{
 va_list l;
 __builtin_va_start(l,fmt);
 vwarn(w, VWARN_WARN, fmt, l);
 __builtin_va_end(l);
}

canonical_original_code:
void warn_at(struct where *w, char *fmt, ...)
{
 __builtin_va_list l;
 __builtin_va_start(l,fmt);
 vwarn(w, VWARN_WARN, fmt, l);
 __builtin_va_end(l);
}


decompiled_code:
void __noreturn die_at(__int64 a1, const char *a2, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a2);
vdie(a1, a2, va);
}

canonical_decompiled_code:
void __noreturn func10(__int64 a1, const char *a2, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a2);
func7(a1, a2, va);
}

original_code:
void die_at(const struct where *w, const char *fmt, ...)
{
 va_list l;
 __builtin_va_start(l,fmt);
 vdie(w, fmt, l);
 __builtin_va_end(l);
}

canonical_original_code:
void die_at(struct where *w, char *fmt, ...)
{
 __builtin_va_list l;
 __builtin_va_start(l,fmt);
 vdie(w, fmt, l);
 __builtin_va_end(l);
}


die

decompiled_code:
void __noreturn die(const char *a1, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a1);
vdie(0LL, a1, va);
}

canonical_decompiled_code:
void __noreturn func11(const char *a1, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a1);
func7(0LL, a1, va);
}

original_code:
void die(const char *fmt, ...)
{
 va_list l;
 __builtin_va_start(l,fmt);
 vdie(((void *)0), fmt, l);
 __builtin_va_end(l);
}

canonical_original_code:
void die(char *fmt, ...)
{
 __builtin_va_list l;
 __builtin_va_start(l,fmt);
 vdie(((void *)0), fmt, l);
 __builtin_va_end(l);
}


decompiled_code:
char *__fastcall where_str_r(char *a1, __int64 a2)
{
snprintf(
a1,
0x80uLL,
"%s:%d:%d",
*(const char **)a2,
*(unsigned int *)(a2 + 16),
(unsigned int)*(unsigned __int16 *)(a2 + 20) + 1);
return a1;
}

canonical_decompiled_code:
char *__fastcall func0(char *a1, __int64 a2)
{
snprintf(
a1,
0x80uLL,
"%s:%d:%d",
*(const char **)a2,
*(unsigned int *)(a2 + 16),
(unsigned int)*(unsigned __int16 *)(a2 + 20) + 1);
return a1;
}

original_code:
const char *where_str_r(char buf[128], const struct where *w)
{
 snprintf(buf, 128, "%s:%d:%d", w->fname, w->line, w->chr + 1);
 return buf;
}

canonical_original_code:
char *where_str_r(char buf[128], struct where *w)
{
 snprintf(buf, 128, "%s:%d:%d", w->fname, w->line, w->chr + 1);
 return buf;
}

variable_types:
buf
char [128]


decompiled_code:
char *__fastcall where_str(__int64 a1)
{
return where_str_r(buf_1, a1);
}

canonical_decompiled_code:
char *__fastcall func1(__int64 a1)
{
return func0(buf_1, a1);
}

original_code:
const char *where_str(const struct where *w)
{
 static char buf[128];
 return where_str_r(buf, w);
}

canonical_original_code:
char *where_str(struct where *w)
{
 static char buf[128];
 return where_str_r(buf, w);
}


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

v1 = current_fname;
*(_BYTE *)(a1 + 24) = 0;
*(_QWORD *)a1 = v1;
*(_DWORD *)(a1 + 16) = loc_tok;
*(_WORD *)(a1 + 20) = *((_DWORD *)&loc_tok + 1);
*(_QWORD *)(a1 + 8) = current_line_str;
result = 0LL;
*(_WORD *)(a1 + 22) = 0;
return result;
}

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

v1 = current_fname;
*(_BYTE *)(a1 + 24) = 0;
*(_QWORD *)a1 = v1;
*(_DWORD *)(a1 + 16) = loc_tok;
*(_WORD *)(a1 + 20) = *((_DWORD *)&loc_tok + 1);
*(_QWORD *)(a1 + 8) = current_line_str;
result = 0LL;
*(_WORD *)(a1 + 22) = 0;
return result;
}

original_code:
void where_current(where *w)
{
 extern struct loc loc_tok;
 extern const char *current_fname, *current_line_str;
 w->fname = current_fname;
 w->line = loc_tok.line;
 w->chr = loc_tok.chr;
 w->line_str = current_line_str;
 w->len = 0;
 w->is_sysh = 0;
}

canonical_original_code:
void where_current(struct where *w)
{
 extern struct loc loc_tok;
 extern char *current_fname; extern char *current_line_str;
 w->fname = current_fname;
 w->line = loc_tok.line;
 w->chr = loc_tok.chr;
 w->line_str = current_line_str;
 w->len = 0;
 w->is_sysh = 0;
}


decompiled_code:
_BOOL8 __fastcall where_equal(_OWORD *a1, _OWORD *a2)
{
return *a2 == *a1 && a2[1] == a1[1];
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(_OWORD *a1, _OWORD *a2)
{
return *a2 == *a1 && a2[1] == a1[1];
}

original_code:
int where_equal(where *a, where *b)
{
 return memcmp(a, b, sizeof *a) == 0;
}

canonical_original_code:
int where_equal(struct where *a, struct where *b)
{
 return memcmp(a, b, sizeof *a) == 0;
}

variable_types:
b
struct where *


decompiled_code:
_BOOL8 __fastcall has_builtin(char *s2)
{
_BOOL4 v1; // er12

v1 = 1;
if ( strcmp("__builtin_offsetof", s2)
&& strcmp("__builtin_unreachable", s2)
&& strcmp("__builtin_trap", s2)
&& strcmp("__builtin_debugtrap", s2)
&& strcmp("__builtin_types_compatible_p", s2)
&& strcmp("__builtin_constant_p", s2)
&& strcmp("__builtin_frame_address", s2)
&& strcmp("__builtin_return_address", s2)
&& strcmp("__builtin_extract_return_addr", s2)
&& strcmp("__builtin_expect", s2)
&& strcmp("__builtin_is_signed", s2)
&& strcmp("__builtin_nan", s2)
&& strcmp("__builtin_nanf", s2)
&& strcmp("__builtin_nanl", s2)
&& strcmp("__builtin_choose_expr", s2)
&& strcmp("__builtin_has_attribute", s2)
&& strcmp("__builtin_add_overflow", s2)
&& strcmp("__builtin_sub_overflow", s2)
&& strcmp("__builtin_mul_overflow", s2) )
{
if ( !strcmp("__builtin_va_start", s2) || !strcmp("__builtin_va_arg", s2) || !strcmp("__builtin_va_end", s2) )
v1 = 1;
else
v1 = strcmp("__builtin_va_copy", s2) == 0;
}
return v1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(char *s2)
{
_BOOL4 v1; // er12

v1 = 1;
if ( strcmp("__builtin_offsetof", s2)
&& strcmp("__builtin_unreachable", s2)
&& strcmp("__builtin_trap", s2)
&& strcmp("__builtin_debugtrap", s2)
&& strcmp("__builtin_types_compatible_p", s2)
&& strcmp("__builtin_constant_p", s2)
&& strcmp("__builtin_frame_address", s2)
&& strcmp("__builtin_return_address", s2)
&& strcmp("__builtin_extract_return_addr", s2)
&& strcmp("__builtin_expect", s2)
&& strcmp("__builtin_is_signed", s2)
&& strcmp("__builtin_nan", s2)
&& strcmp("__builtin_nanf", s2)
&& strcmp("__builtin_nanl", s2)
&& strcmp("__builtin_choose_expr", s2)
&& strcmp("__builtin_has_attribute", s2)
&& strcmp("__builtin_add_overflow", s2)
&& strcmp("__builtin_sub_overflow", s2)
&& strcmp("__builtin_mul_overflow", s2) )
{
if ( !strcmp("__builtin_va_start", s2) || !strcmp("__builtin_va_arg", s2) || !strcmp("__builtin_va_end", s2) )
v1 = 1;
else
v1 = strcmp("__builtin_va_copy", s2) == 0;
}
return v1;
}

original_code:
static int has_builtin(const char *nam)
{
 if(!strcmp("__builtin_" "offsetof", nam)) return 1; if(!strcmp("__builtin_" "unreachable", nam)) return 1; if(!strcmp("__builtin_" "trap", nam)) return 1; if(!strcmp("__builtin_" "debugtrap", nam)) return 1; if(!strcmp("__builtin_" "types_compatible_p", nam)) return 1; if(!strcmp("__builtin_" "constant_p", nam)) return 1; if(!strcmp("__builtin_" "frame_address", nam)) return 1; if(!strcmp("__builtin_" "return_address", nam)) return 1; if(!strcmp("__builtin_" "extract_return_addr", nam)) return 1; if(!strcmp("__builtin_" "expect", nam)) return 1; if(!strcmp("__builtin_" "is_signed", nam)) return 1; if(!strcmp("__builtin_" "nan", nam)) return 1; if(!strcmp("__builtin_" "nanf", nam)) return 1; if(!strcmp("__builtin_" "nanl", nam)) return 1; if(!strcmp("__builtin_" "choose_expr", nam)) return 1; if(!strcmp("__builtin_" "has_attribute", nam)) return 1; if(!strcmp("__builtin_" "add_overflow", nam)) return 1; if(!strcmp("__builtin_" "sub_overflow", nam)) return 1; if(!strcmp("__builtin_" "mul_overflow", nam)) return 1; if(!strcmp("__builtin_" "va_start", nam)) return 1; if(!strcmp("__builtin_" "va_arg", nam)) return 1; if(!strcmp("__builtin_" "va_end", nam)) return 1; if(!strcmp("__builtin_" "va_copy", nam)) return 1;
 return 0;
}

canonical_original_code:
static int has_builtin(char *nam)
{
 if(!strcmp("__builtin_" "offsetof", nam)) return 1; if(!strcmp("__builtin_" "unreachable", nam)) return 1; if(!strcmp("__builtin_" "trap", nam)) return 1; if(!strcmp("__builtin_" "debugtrap", nam)) return 1; if(!strcmp("__builtin_" "types_compatible_p", nam)) return 1; if(!strcmp("__builtin_" "constant_p", nam)) return 1; if(!strcmp("__builtin_" "frame_address", nam)) return 1; if(!strcmp("__builtin_" "return_address", nam)) return 1; if(!strcmp("__builtin_" "extract_return_addr", nam)) return 1; if(!strcmp("__builtin_" "expect", nam)) return 1; if(!strcmp("__builtin_" "is_signed", nam)) return 1; if(!strcmp("__builtin_" "nan", nam)) return 1; if(!strcmp("__builtin_" "nanf", nam)) return 1; if(!strcmp("__builtin_" "nanl", nam)) return 1; if(!strcmp("__builtin_" "choose_expr", nam)) return 1; if(!strcmp("__builtin_" "has_attribute", nam)) return 1; if(!strcmp("__builtin_" "add_overflow", nam)) return 1; if(!strcmp("__builtin_" "sub_overflow", nam)) return 1; if(!strcmp("__builtin_" "mul_overflow", nam)) return 1; if(!strcmp("__builtin_" "va_start", nam)) return 1; if(!strcmp("__builtin_" "va_arg", nam)) return 1; if(!strcmp("__builtin_" "va_end", nam)) return 1; if(!strcmp("__builtin_" "va_copy", nam)) return 1;
 return 0;
}

variable_types:
nam
char *


decompiled_code:
_BOOL8 __fastcall has_attribute(char *s2)
{
_BOOL4 v1; // er12

v1 = 1;
if ( strcmp(s2, "format")
&& strcmp("__format__", s2)
&& strcmp(s2, "unused")
&& strcmp("__unused__", s2)
&& strcmp(s2, "used")
&& strcmp("__used__", s2)
&& strcmp(s2, "warn_unused")
&& strcmp("__warn_unused__", s2)
&& strcmp(s2, "section")
&& strcmp("__section__", s2)
&& strcmp(s2, "enum_bitmask")
&& strcmp("__enum_bitmask__", s2)
&& strcmp(s2, "flag_enum")
&& strcmp("__flag_enum__", s2)
&& strcmp(s2, "noreturn")
&& strcmp("__noreturn__", s2)
&& strcmp(s2, "noderef")
&& strcmp("__noderef__", s2)
&& strcmp(s2, "nonnull") )
{
if ( !strcmp("__nonnull__", s2)
|| !strcmp(s2, "returns_nonnull")
|| !strcmp("__returns_nonnull__", s2)
|| !strcmp(s2, "packed")
|| !strcmp("__packed__", s2)
|| !strcmp(s2, "sentinel")
|| !strcmp("__sentinel__", s2)
|| !strcmp(s2, "aligned")
|| !strcmp("__aligned__", s2)
|| !strcmp(s2, "weak")
|| !strcmp("__weak__", s2)
|| !strcmp(s2, "alias")
|| !strcmp("__alias__", s2)
|| !strcmp(s2, "cleanup")
|| !strcmp("__cleanup__", s2)
|| !strcmp(s2, "always_inline")
|| !strcmp("__always_inline__", s2)
|| !strcmp(s2, "noinline")
|| !strcmp("__noinline__", s2)
|| !strcmp(s2, "flatten")
|| !strcmp("__flatten__", s2)
|| !strcmp(s2, "constructor")
|| !strcmp("__constructor__", s2)
|| !strcmp(s2, "destructor")
|| !strcmp("__destructor__", s2)
|| !strcmp(s2, "visibility")
|| !strcmp("__visibility__", s2)
|| !strcmp(s2, "stack_protect")
|| !strcmp("__stack_protect__", s2)
|| !strcmp(s2, "no_stack_protector")
|| !strcmp("__no_stack_protector__", s2)
|| !strcmp(s2, "no_sanitize")
|| !strcmp("__no_sanitize__", s2)
|| !strcmp(s2, "fallthrough")
|| !strcmp("__fallthrough__", s2)
|| !strcmp(s2, "designated_init")
|| !strcmp("__designated_init__", s2)
|| !strcmp(s2, "__ucc_debug")
|| !strcmp("____ucc_debug__", s2)
|| !strcmp(s2, "__cdecl")
|| !strcmp("____cdecl__", s2)
|| !strcmp(s2, "warn_unused_result")
|| !strcmp("__warn_unused_result__", s2)
|| !strcmp(s2, "cdecl")
|| !strcmp("__cdecl__", s2)
|| !strcmp(s2, "stdcall")
|| !strcmp("__stdcall__", s2)
|| !strcmp(s2, "fastcall")
|| !strcmp("__fastcall__", s2)
|| !strcmp(s2, "no_sanitize_undefined") )
{
v1 = 1;
}
else
{
v1 = strcmp("__no_sanitize_undefined__", s2) == 0;
}
}
return v1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(char *s2)
{
_BOOL4 v1; // er12

v1 = 1;
if ( strcmp(s2, "format")
&& strcmp("__format__", s2)
&& strcmp(s2, "unused")
&& strcmp("__unused__", s2)
&& strcmp(s2, "used")
&& strcmp("__used__", s2)
&& strcmp(s2, "warn_unused")
&& strcmp("__warn_unused__", s2)
&& strcmp(s2, "section")
&& strcmp("__section__", s2)
&& strcmp(s2, "enum_bitmask")
&& strcmp("__enum_bitmask__", s2)
&& strcmp(s2, "flag_enum")
&& strcmp("__flag_enum__", s2)
&& strcmp(s2, "noreturn")
&& strcmp("__noreturn__", s2)
&& strcmp(s2, "noderef")
&& strcmp("__noderef__", s2)
&& strcmp(s2, "nonnull") )
{
if ( !strcmp("__nonnull__", s2)
|| !strcmp(s2, "returns_nonnull")
|| !strcmp("__returns_nonnull__", s2)
|| !strcmp(s2, "packed")
|| !strcmp("__packed__", s2)
|| !strcmp(s2, "sentinel")
|| !strcmp("__sentinel__", s2)
|| !strcmp(s2, "aligned")
|| !strcmp("__aligned__", s2)
|| !strcmp(s2, "weak")
|| !strcmp("__weak__", s2)
|| !strcmp(s2, "alias")
|| !strcmp("__alias__", s2)
|| !strcmp(s2, "cleanup")
|| !strcmp("__cleanup__", s2)
|| !strcmp(s2, "always_inline")
|| !strcmp("__always_inline__", s2)
|| !strcmp(s2, "noinline")
|| !strcmp("__noinline__", s2)
|| !strcmp(s2, "flatten")
|| !strcmp("__flatten__", s2)
|| !strcmp(s2, "constructor")
|| !strcmp("__constructor__", s2)
|| !strcmp(s2, "destructor")
|| !strcmp("__destructor__", s2)
|| !strcmp(s2, "visibility")
|| !strcmp("__visibility__", s2)
|| !strcmp(s2, "stack_protect")
|| !strcmp("__stack_protect__", s2)
|| !strcmp(s2, "no_stack_protector")
|| !strcmp("__no_stack_protector__", s2)
|| !strcmp(s2, "no_sanitize")
|| !strcmp("__no_sanitize__", s2)
|| !strcmp(s2, "fallthrough")
|| !strcmp("__fallthrough__", s2)
|| !strcmp(s2, "designated_init")
|| !strcmp("__designated_init__", s2)
|| !strcmp(s2, "__ucc_debug")
|| !strcmp("____ucc_debug__", s2)
|| !strcmp(s2, "__cdecl")
|| !strcmp("____cdecl__", s2)
|| !strcmp(s2, "warn_unused_result")
|| !strcmp("__warn_unused_result__", s2)
|| !strcmp(s2, "cdecl")
|| !strcmp("__cdecl__", s2)
|| !strcmp(s2, "stdcall")
|| !strcmp("__stdcall__", s2)
|| !strcmp(s2, "fastcall")
|| !strcmp("__fastcall__", s2)
|| !strcmp(s2, "no_sanitize_undefined") )
{
v1 = 1;
}
else
{
v1 = strcmp("__no_sanitize_undefined__", s2) == 0;
}
}
return v1;
}

original_code:
static int has_attribute(const char *nam)
{
 if(!strcmp(nam, "format") || !strcmp("__" "format" "__", nam)) return 1; if(!strcmp(nam, "unused") || !strcmp("__" "unused" "__", nam)) return 1; if(!strcmp(nam, "used") || !strcmp("__" "used" "__", nam)) return 1; if(!strcmp(nam, "warn_unused") || !strcmp("__" "warn_unused" "__", nam)) return 1; if(!strcmp(nam, "section") || !strcmp("__" "section" "__", nam)) return 1; if(!strcmp(nam, "enum_bitmask") || !strcmp("__" "enum_bitmask" "__", nam)) return 1; if(!strcmp(nam, "flag_enum") || !strcmp("__" "flag_enum" "__", nam)) return 1; if(!strcmp(nam, "noreturn") || !strcmp("__" "noreturn" "__", nam)) return 1; if(!strcmp(nam, "noderef") || !strcmp("__" "noderef" "__", nam)) return 1; if(!strcmp(nam, "nonnull") || !strcmp("__" "nonnull" "__", nam)) return 1; if(!strcmp(nam, "returns_nonnull") || !strcmp("__" "returns_nonnull" "__", nam)) return 1; if(!strcmp(nam, "packed") || !strcmp("__" "packed" "__", nam)) return 1; if(!strcmp(nam, "sentinel") || !strcmp("__" "sentinel" "__", nam)) return 1; if(!strcmp(nam, "aligned") || !strcmp("__" "aligned" "__", nam)) return 1; if(!strcmp(nam, "weak") || !strcmp("__" "weak" "__", nam)) return 1; if(!strcmp(nam, "alias") || !strcmp("__" "alias" "__", nam)) return 1; if(!strcmp(nam, "cleanup") || !strcmp("__" "cleanup" "__", nam)) return 1; if(!strcmp(nam, "always_inline") || !strcmp("__" "always_inline" "__", nam)) return 1; if(!strcmp(nam, "noinline") || !strcmp("__" "noinline" "__", nam)) return 1; if(!strcmp(nam, "flatten") || !strcmp("__" "flatten" "__", nam)) return 1; if(!strcmp(nam, "constructor") || !strcmp("__" "constructor" "__", nam)) return 1; if(!strcmp(nam, "destructor") || !strcmp("__" "destructor" "__", nam)) return 1; if(!strcmp(nam, "visibility") || !strcmp("__" "visibility" "__", nam)) return 1; if(!strcmp(nam, "stack_protect") || !strcmp("__" "stack_protect" "__", nam)) return 1; if(!strcmp(nam, "no_stack_protector") || !strcmp("__" "no_stack_protector" "__", nam)) return 1; if(!strcmp(nam, "no_sanitize") || !strcmp("__" "no_sanitize" "__", nam)) return 1; if(!strcmp(nam, "fallthrough") || !strcmp("__" "fallthrough" "__", nam)) return 1; if(!strcmp(nam, "designated_init") || !strcmp("__" "designated_init" "__", nam)) return 1; if(!strcmp(nam, "__ucc_debug") || !strcmp("__" "__ucc_debug" "__", nam)) return 1; if(!strcmp(nam, "__cdecl") || !strcmp("__" "__cdecl" "__", nam)) return 1; if(!strcmp(nam, "warn_unused_result") || !strcmp("__" "warn_unused_result" "__", nam)) return 1; if(!strcmp(nam, "cdecl") || !strcmp("__" "cdecl" "__", nam)) return 1; if(!strcmp(nam, "stdcall") || !strcmp("__" "stdcall" "__", nam)) return 1; if(!strcmp(nam, "fastcall") || !strcmp("__" "fastcall" "__", nam)) return 1; if(!strcmp(nam, "no_sanitize_undefined") || !strcmp("__" "no_sanitize_undefined" "__", nam)) return 1;
 return 0;
}

canonical_original_code:
static int has_attribute(char *nam)
{
 if(!strcmp(nam, "format") || !strcmp("__" "format" "__", nam)) return 1; if(!strcmp(nam, "unused") || !strcmp("__" "unused" "__", nam)) return 1; if(!strcmp(nam, "used") || !strcmp("__" "used" "__", nam)) return 1; if(!strcmp(nam, "warn_unused") || !strcmp("__" "warn_unused" "__", nam)) return 1; if(!strcmp(nam, "section") || !strcmp("__" "section" "__", nam)) return 1; if(!strcmp(nam, "enum_bitmask") || !strcmp("__" "enum_bitmask" "__", nam)) return 1; if(!strcmp(nam, "flag_enum") || !strcmp("__" "flag_enum" "__", nam)) return 1; if(!strcmp(nam, "noreturn") || !strcmp("__" "noreturn" "__", nam)) return 1; if(!strcmp(nam, "noderef") || !strcmp("__" "noderef" "__", nam)) return 1; if(!strcmp(nam, "nonnull") || !strcmp("__" "nonnull" "__", nam)) return 1; if(!strcmp(nam, "returns_nonnull") || !strcmp("__" "returns_nonnull" "__", nam)) return 1; if(!strcmp(nam, "packed") || !strcmp("__" "packed" "__", nam)) return 1; if(!strcmp(nam, "sentinel") || !strcmp("__" "sentinel" "__", nam)) return 1; if(!strcmp(nam, "aligned") || !strcmp("__" "aligned" "__", nam)) return 1; if(!strcmp(nam, "weak") || !strcmp("__" "weak" "__", nam)) return 1; if(!strcmp(nam, "alias") || !strcmp("__" "alias" "__", nam)) return 1; if(!strcmp(nam, "cleanup") || !strcmp("__" "cleanup" "__", nam)) return 1; if(!strcmp(nam, "always_inline") || !strcmp("__" "always_inline" "__", nam)) return 1; if(!strcmp(nam, "noinline") || !strcmp("__" "noinline" "__", nam)) return 1; if(!strcmp(nam, "flatten") || !strcmp("__" "flatten" "__", nam)) return 1; if(!strcmp(nam, "constructor") || !strcmp("__" "constructor" "__", nam)) return 1; if(!strcmp(nam, "destructor") || !strcmp("__" "destructor" "__", nam)) return 1; if(!strcmp(nam, "visibility") || !strcmp("__" "visibility" "__", nam)) return 1; if(!strcmp(nam, "stack_protect") || !strcmp("__" "stack_protect" "__", nam)) return 1; if(!strcmp(nam, "no_stack_protector") || !strcmp("__" "no_stack_protector" "__", nam)) return 1; if(!strcmp(nam, "no_sanitize") || !strcmp("__" "no_sanitize" "__", nam)) return 1; if(!strcmp(nam, "fallthrough") || !strcmp("__" "fallthrough" "__", nam)) return 1; if(!strcmp(nam, "designated_init") || !strcmp("__" "designated_init" "__", nam)) return 1; if(!strcmp(nam, "__ucc_debug") || !strcmp("__" "__ucc_debug" "__", nam)) return 1; if(!strcmp(nam, "__cdecl") || !strcmp("__" "__cdecl" "__", nam)) return 1; if(!strcmp(nam, "warn_unused_result") || !strcmp("__" "warn_unused_result" "__", nam)) return 1; if(!strcmp(nam, "cdecl") || !strcmp("__" "cdecl" "__", nam)) return 1; if(!strcmp(nam, "stdcall") || !strcmp("__" "stdcall" "__", nam)) return 1; if(!strcmp(nam, "fastcall") || !strcmp("__" "fastcall" "__", nam)) return 1; if(!strcmp(nam, "no_sanitize_undefined") || !strcmp("__" "no_sanitize_undefined" "__", nam)) return 1;
 return 0;
}


decompiled_code:
__int64 __fastcall has_extension(char *a1)
{
return has_feat_ext(a1, 1);
}

canonical_decompiled_code:
__int64 __fastcall func3(char *a1)
{
return func2(a1, 1);
}

original_code:
static int has_extension(const char *nam)
{
 return has_feat_ext(nam, 1);
}

canonical_original_code:
static int has_extension(char *nam)
{
 return has_feat_ext(nam, 1);
}


decompiled_code:
__int64 __fastcall has_feature(char *a1)
{
return has_feat_ext(a1, 0);
}

canonical_decompiled_code:
__int64 __fastcall func4(char *a1)
{
return func2(a1, 0);
}

original_code:
static int has_feature(const char *nam)
{
 return has_feat_ext(nam, 0);
}

canonical_original_code:
static int has_feature(char *nam)
{
 return has_feat_ext(nam, 0);
}


decompiled_code:
__int64 __fastcall has_func(const char *a1, __int64 a2)
{
const char *v3; // rbp
char **v4; // rbx
bool v5; // zf
const char *v6; // rdi

v3 = a1;
v4 = &has_tbl;
v5 = memcmp(a1, "__has_", 6uLL) == 0;
v6 = "feature";
if ( v5 )
v3 += 6;
do
{
if ( !strcmp(v6, v3) )
return ((__int64 (__fastcall *)(__int64))v4[1])(a2);
v6 = v4[2];
v4 += 2;
}
while ( v6 );
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func5(const char *a1, __int64 a2)
{
const char *v3; // rbp
char **v4; // rbx
bool v5; // zf
const char *v6; // rdi

v3 = a1;
v4 = &has_tbl;
v5 = memcmp(a1, "__has_", 6uLL) == 0;
v6 = "feature";
if ( v5 )
v3 += 6;
do
{
if ( !strcmp(v6, v3) )
return ((__int64 (__fastcall *)(__int64))v4[1])(a2);
v6 = v4[2];
v4 += 2;
}
while ( v6 );
return 0xFFFFFFFFLL;
}

original_code:
int has_func(const char *fn, const char *arg1)
{
 const struct has_tbl *p;
 if(!strncmp(fn, "__has_", 6))
  fn += 6;
 for(p = has_tbl; p->nam; p++)
  if(!strcmp(p->nam, fn))
   return p->handler(arg1);
 return -1;
}

canonical_original_code:
int has_func(char *fn, char *arg1)
{
 struct has_tbl *p;
 if(!strncmp(fn, "__has_", 6))
  fn += 6;
 for(p = has_tbl; p->nam; p++)
  if(!strcmp(p->nam, fn))
   return p->handler(arg1);
 return -1;
}

variable_types:
fn
char *

variable_types: struct has_tbl { char *nam; int (*handler)(char *nam); } *


bname

decompiled_code:
char *__fastcall bname(const char *a1)
{
char *result; // rax

result = strrchr(a1, 47);
if ( result )
result[1] = 0;
return result;
}

canonical_decompiled_code:
char *__fastcall func0(const char *a1)
{
char *result; // rax

result = strrchr(a1, 47);
if ( result )
result[1] = 0;
return result;
}

original_code:
static void bname(char *path)
{
 char *p = strrchr(path, '/');
 if(p)
  p[1] = '\0';
}

variable_types:
path
char *


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

v2 = strlen(a1);
v3 = strlen(a2);
v4 = (char *)umalloc(v2 + v3 + 2);
sprintf(v4, "%s/%s", a1, a2);
return v4;
}

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

v2 = strlen(a1);
v3 = strlen(a2);
v4 = (char *)umalloc(v2 + v3 + 2);
sprintf(v4, "%s/%s", a1, a2);
return v4;
}

original_code:
static char *path_prepend(const char *pre, const char *path)
{
 char *buf = umalloc(strlen(pre) + strlen(path) + 2);
 sprintf(buf, "%s/%s", pre, path);
 return buf;
}

canonical_original_code:
static char *path_prepend(char *pre, char *path)
{
 char *buf = umalloc(strlen(pre) + strlen(path) + 2);
 sprintf(buf, "%s/%s", pre, path);
 return buf;
}

variable_types:
pre
char *

variable_types:
buf
char *


decompiled_code:
char *dirname_ucc()
{
ssize_t v1; // rax
char *v2; // rdi
char *v3; // rbp
char v4[1032]; // [rsp+0h] [rbp-408h] BYREF

if ( where_0 )
return &where_0;
v1 = readlink(argv0, v4, 0x400uLL);
if ( v1 == -1 )
{
snprintf(&where_0, 0x400uLL, "%s", argv0);
}
else
{
v2 = argv0;
v4[v1] = 0;
v3 = (char *)ustrdup(v2);
bname(v3);
snprintf(&where_0, 0x400uLL, "%s/%s", v3, v4);
free(v3);
}
bname(&where_0);
return &where_0;
}

canonical_decompiled_code:
char *func2()
{
ssize_t v1; // rax
char *v2; // rdi
char *v3; // rbp
char v4[1032]; // [rsp+0h] [rbp-408h] BYREF

if ( where_0 )
return &where_0;
v1 = readlink(argv0, v4, 0x400uLL);
if ( v1 == -1 )
{
snprintf(&where_0, 0x400uLL, "%s", argv0);
}
else
{
v2 = argv0;
v4[v1] = 0;
v3 = (char *)ustrdup(v2);
func0(v3);
snprintf(&where_0, 0x400uLL, "%s/%s", v3, v4);
free(v3);
}
func0(&where_0);
return &where_0;
}

original_code:
char *dirname_ucc(void)
{
 static char where[1024];
 if(!where[0]){
  char link[1024];
  ssize_t nb;
  if((nb = readlink(argv0, link, sizeof link)) == -1){
   snprintf(where, sizeof where, "%s", argv0);
  }else{
   char *argv_dup;
   link[nb] = '\0';
   argv_dup = ustrdup(argv0);
   bname(argv_dup);
   snprintf(where, sizeof where, "%s/%s", argv_dup, link);
   free(argv_dup);
  }
  bname(where);
 }
 return where;
}

canonical_original_code:
char *dirname_ucc()
{
 static char where[1024];
 if(!where[0]){
  char link[1024];
  long nb;
  if((nb = readlink(argv0, link, sizeof link)) == -1){
   snprintf(where, sizeof where, "%s", argv0);
  }else{
   char *argv_dup;
   link[nb] = '\0';
   argv_dup = ustrdup(argv0);
   bname(argv_dup);
   snprintf(where, sizeof where, "%s/%s", argv_dup, link);
   free(argv_dup);
  }
  bname(where);
 }
 return where;
}

variable_types:
where
char [1024]

variable_types:
link
char [1024]

variable_types: nb long


decompiled_code:
char *__fastcall path_prepend_relative_nofree(const char *a1)
{
char *v1; // rax

v1 = dirname_ucc();
return path_prepend(v1, a1);
}

canonical_decompiled_code:
char *__fastcall func3(const char *a1)
{
char *v1; // rax

v1 = func2();
return func1(v1, a1);
}

original_code:
static char *path_prepend_relative_nofree(const char *path)
{
 return path_prepend(dirname_ucc(), path);
}

canonical_original_code:
static char *path_prepend_relative_nofree(char *path)
{
 return path_prepend(dirname_ucc(), path);
}


decompiled_code:
char *__fastcall path_prepend_relative(void *ptr)
{
char *v1; // r12

v1 = path_prepend_relative_nofree((const char *)ptr);
free(ptr);
return v1;
}

canonical_decompiled_code:
char *__fastcall func4(void *ptr)
{
char *v1; // r12

v1 = func3((const char *)ptr);
free(ptr);
return v1;
}

original_code:
char *path_prepend_relative(char *path)
{
 char *r = path_prepend_relative_nofree(path);
 free(path);
 return r;
}

variable_types:
r
char *


decompiled_code:
char *__fastcall cmdpath_resolve(const char **a1, int (***a2)(const char *file, char *const argv[]))
{
int v2; // eax
char *result; // rax

v2 = *((_DWORD *)a1 + 2);
if ( v2 == 1 )
{
if ( a2 )
*a2 = &execvp;
result = (char *)ustrdup(*a1);
}
else if ( v2 == 2 )
{
if ( a2 )
*a2 = &execv;
result = path_prepend(Bprefix, *a1);
}
else if ( v2 )
{
result = 0LL;
}
else
{
if ( a2 )
*a2 = &execv;
result = path_prepend_relative_nofree(*a1);
}
return result;
}

canonical_decompiled_code:
char *__fastcall func5(const char **a1, int (***a2)(const char *file, char *const argv[]))
{
int v2; // eax
char *result; // rax

v2 = *((_DWORD *)a1 + 2);
if ( v2 == 1 )
{
if ( a2 )
*a2 = &execvp;
result = (char *)ustrdup(*a1);
}
else if ( v2 == 2 )
{
if ( a2 )
*a2 = &execv;
result = func1(Bprefix, *a1);
}
else if ( v2 )
{
result = 0LL;
}
else
{
if ( a2 )
*a2 = &execv;
result = func3(*a1);
}
return result;
}

original_code:
char *cmdpath_resolve(const struct cmdpath *p, cmdpath_exec_fn **fn)
{
 switch(p->type){
  case USE_PATH:
   if(fn) *fn = execvp;
   return ustrdup(p->path);
  case RELATIVE_TO_UCC:
   if(fn) *fn = execv;
   return path_prepend_relative_nofree(p->path);
  case FROM_Bprefix:
   if(fn) *fn = execv;
   return path_prepend(Bprefix, p->path);
 }
 return ((void *)0);
}

canonical_original_code:
char *cmdpath_resolve(struct cmdpath *p, int (**fn)(char *, char *[]))
{
 switch(p->type){
  case USE_PATH:
   if(fn) *fn = execvp;
   return ustrdup(p->path);
  case RELATIVE_TO_UCC:
   if(fn) *fn = execv;
   return path_prepend_relative_nofree(p->path);
  case FROM_Bprefix:
   if(fn) *fn = execv;
   return path_prepend(Bprefix, p->path);
 }
 return ((void *)0);
}

variable_types: struct cmdpath { char *path; enum cmdpath_type { RELATIVE_TO_UCC=0, USE_PATH=1, FROM_Bprefix=2 } type; } *

variable_types:
fn
int (**)(char *, char *[])

user_defined_types: struct cmdpath { char *path; enum cmdpath_type type; }


decompiled_code:
void __fastcall cmdpath_initrelative(__int64 a1, __int64 a2, __int64 a3)
{
if ( Bprefix )
{
*(_QWORD *)a1 = a2;
*(_DWORD *)(a1 + 8) = 2;
}
else
{
*(_QWORD *)a1 = a3;
*(_DWORD *)(a1 + 8) = 0;
}
}

original_code:
void cmdpath_initrelative(
  struct cmdpath *p,
  const char *bprefix,
  const char *ucc_relative)
{
 if(Bprefix){
  p->path = bprefix;
  p->type = FROM_Bprefix;
 }else{
  p->path = ucc_relative;
  p->type = RELATIVE_TO_UCC;
 }
}

canonical_original_code:
void cmdpath_initrelative(struct cmdpath *p, char *bprefix, char *ucc_relative)
{
 if(Bprefix){
  p->path = bprefix;
  p->type = FROM_Bprefix;
 }else{
  p->path = ucc_relative;
  p->type = RELATIVE_TO_UCC;
 }
}

variable_types:
bprefix
char *

user_defined_types: enum cmdpath_type { RELATIVE_TO_UCC=0, USE_PATH=1, FROM_Bprefix=2 }


decompiled_code:
char *__fastcall cmdpath_type(unsigned int a1)
{
char *result; // rax

result = 0LL;
if ( a1 <= 2 )
result = CSWTCH_13[a1];
return result;
}

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

result = 0LL;
if ( a1 <= 2 )
result = CSWTCH_13[a1];
return result;
}

original_code:
const char *cmdpath_type(enum cmdpath_type t)
{
 switch(t){
  case RELATIVE_TO_UCC: return "ucc-relative";
  case USE_PATH: return "$PATH-search";
  case FROM_Bprefix: return "Bprefix-relative";
 }
 return ((void *)0);
}

variable_types: enum cmdpath_type { RELATIVE_TO_UCC=0, USE_PATH=1, FROM_Bprefix=2 }


decompiled_code:
__int64 __fastcall tmpfile_prefix_out(__int64 a1, char **a2)
{
char *v3; // rsi
char *v4; // rbp
int v5; // er12
char *v7; // rdi

v3 = getenv("TMPDIR");
if ( !v3 )
v3 = "/tmp";
v4 = (char *)ustrprintf("%s/%sXXXXXX", v3, a1);
v5 = mkstemp(v4);
if ( v5 < 0 )
{
v7 = v4;
v4 = 0LL;
free(v7);
if ( a2 )
goto LABEL_5;
}
else if ( a2 )
{
LABEL_5:
*a2 = v4;
return (unsigned int)v5;
}
free(v4);
return (unsigned int)v5;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, char **a2)
{
char *v3; // rsi
char *v4; // rbp
int v5; // er12
char *v7; // rdi

v3 = getenv("TMPDIR");
if ( !v3 )
v3 = "/tmp";
v4 = (char *)ustrprintf("%s/%sXXXXXX", v3, a1);
v5 = mkstemp(v4);
if ( v5 < 0 )
{
v7 = v4;
v4 = 0LL;
free(v7);
if ( a2 )
goto LABEL_5;
}
else if ( a2 )
{
LABEL_5:
*a2 = v4;
return (unsigned int)v5;
}
free(v4);
return (unsigned int)v5;
}

original_code:
int tmpfile_prefix_out(const char *prefix, char **const fname)
{
 char *tmppath;
 int fd;
 char *tmpdir = getenv("TMPDIR");
 if(!tmpdir)
  tmpdir = "/tmp";
 tmppath = ustrprintf("%s/%sXXXXXX", tmpdir, prefix);
 fd = mkstemp(tmppath);
 if(fd < 0){
  free(tmppath);
  tmppath = ((void *)0);
 }
 if(fname)
  *fname = tmppath;
 else
  free(tmppath);
 return fd;
}

canonical_original_code:
int tmpfile_prefix_out(char *prefix, char **fname)
{
 char *tmppath;
 int fd;
 char *tmpdir = getenv("TMPDIR");
 if(!tmpdir)
  tmpdir = "/tmp";
 tmppath = ustrprintf("%s/%sXXXXXX", tmpdir, prefix);
 fd = mkstemp(tmppath);
 if(fd < 0){
  free(tmppath);
  tmppath = ((void *)0);
 }
 if(fname)
  *fname = tmppath;
 else
  free(tmppath);
 return fd;
}

variable_types:
prefix
char *

variable_types:
fname
char **

variable_types:
tmppath
char *

variable_types: fd int

variable_types:
tmpdir
char *


decompiled_code:
__int64 __fastcall out_label_bblock(__int64 a1)
{
__int64 v1; // r12

v1 = umalloc(16LL);
xsnprintf(v1, 16LL, "%sblk.%lu", *(const char **)(cc1_target_details[1] + 24LL), a1);
return v1;
}

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

v1 = umalloc(16LL);
xsnprintf(v1, 16LL, "%sblk.%lu", *(const char **)(cc1_target_details[1] + 24LL), a1);
return v1;
}

original_code:
char *out_label_bblock(unsigned long n)
{
 char *buf = umalloc(16);
 xsnprintf(buf, 16, "%sblk.%lu", cc1_target_details.as->privatelbl_prefix, (unsigned long)n);
 return buf;
}

variable_types:
n
unsigned long


decompiled_code:
__int64 __fastcall out_label_block(const char *a1)
{
__int64 v1; // rbp
__int64 v2; // rax
__int64 v3; // r8
__int64 v4; // r12

v1 = (int)(strlen(a1) + 16);
v2 = umalloc(v1);
v3 = (unsigned int)block_last;
v4 = v2;
++block_last;
xsnprintf(v2, v1, "%s.block_%d", a1, v3);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func1(const char *a1)
{
__int64 v1; // rbp
__int64 v2; // rax
__int64 v3; // r8
__int64 v4; // r12

v1 = (int)(strlen(a1) + 16);
v2 = umalloc(v1);
v3 = (unsigned int)block_last;
v4 = v2;
++block_last;
xsnprintf(v2, v1, "%s.block_%d", a1, v3);
return v4;
}

original_code:
char *out_label_block(const char *funcsp)
{
 int len;
 char *ret;
 len = strlen(funcsp) + 16;
 ret = umalloc(len);
 xsnprintf(ret, len, "%s.block_%d", funcsp, block_last++);
 return ret;
}

canonical_original_code:
char *out_label_block(char *funcsp)
{
 int len;
 char *ret;
 len = strlen(funcsp) + 16;
 ret = umalloc(len);
 xsnprintf(ret, len, "%s.block_%d", funcsp, block_last++);
 return ret;
}

variable_types:
funcsp
char *

variable_types: len int

variable_types:
ret
char *


decompiled_code:
__int64 __fastcall out_label_code(const char *a1)
{
int v1; // ebx
__int64 v2; // rax
__int64 v3; // r9
__int64 v4; // r12

v1 = strlen(a1);
v2 = umalloc(v1 + 11);
v3 = (unsigned int)label_last;
v4 = v2;
++label_last;
xsnprintf(v2, v1 + 10, "%s%s.%d", *(const char **)(cc1_target_details[1] + 24LL), a1, v3);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func2(const char *a1)
{
int v1; // ebx
__int64 v2; // rax
__int64 v3; // r9
__int64 v4; // r12

v1 = strlen(a1);
v2 = umalloc(v1 + 11);
v3 = (unsigned int)label_last;
v4 = v2;
++label_last;
xsnprintf(v2, v1 + 10, "%s%s.%d", *(const char **)(cc1_target_details[1] + 24LL), a1, v3);
return v4;
}

original_code:
char *out_label_code(const char *fmt)
{
 int len;
 char *ret;
 len = strlen(fmt) + 10;
 ret = umalloc(len + 1);
 xsnprintf(ret, len, "%s%s.%d", cc1_target_details.as->privatelbl_prefix, fmt, label_last++);
 return ret;
}

canonical_original_code:
char *out_label_code(char *fmt)
{
 int len;
 char *ret;
 len = strlen(fmt) + 10;
 ret = umalloc(len + 1);
 xsnprintf(ret, len, "%s%s.%d", cc1_target_details.as->privatelbl_prefix, fmt, label_last++);
 return ret;
}

variable_types:
fmt
char *


decompiled_code:
__int64 __fastcall out_label_data_store(unsigned int a1)
{
const char *v1; // r13
__int64 v2; // rax
__int64 v3; // r12
__int64 v4; // r8

v2 = umalloc(16LL);
v3 = v2;
if ( a1 <= 3 )
v1 = CSWTCH_18[a1];
v4 = (unsigned int)str_last++;
xsnprintf(v2, 16LL, "%s.%d", v1, v4);
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned int a1)
{
const char *v1; // r13
__int64 v2; // rax
__int64 v3; // r12
__int64 v4; // r8

v2 = umalloc(16LL);
v3 = v2;
if ( a1 <= 3 )
v1 = CSWTCH_18[a1];
v4 = (unsigned int)str_last++;
xsnprintf(v2, 16LL, "%s.%d", v1, v4);
return v3;
}

original_code:
char *out_label_data_store(enum out_label_store ty)
{
 char *ret = umalloc(16);
 const char *pre;
 switch(ty){
  case STORE_P_CHAR: pre = "str"; break;
  case STORE_P_WCHAR: pre = "wstr"; break;
  case STORE_COMP_LIT: pre = "data"; break;
  case STORE_FLOAT: pre = "float"; break;
 }
 xsnprintf(ret, 16, "%s.%d", pre, str_last++);
 return ret;
}

canonical_original_code:
char *out_label_data_store(enum out_label_store ty)
{
 char *ret = umalloc(16);
 char *pre;
 switch(ty){
  case STORE_P_CHAR: pre = "str"; break;
  case STORE_P_WCHAR: pre = "wstr"; break;
  case STORE_COMP_LIT: pre = "data"; break;
  case STORE_FLOAT: pre = "float"; break;
 }
 xsnprintf(ret, 16, "%s.%d", pre, str_last++);
 return ret;
}

variable_types: enum out_label_store { STORE_P_CHAR=0, STORE_P_WCHAR=1, STORE_COMP_LIT=2, STORE_FLOAT=3 }

variable_types:
pre
char *


decompiled_code:
__int64 __fastcall out_label_static_local(const char *a1, const char *a2)
{
int v2; // ebp
__int64 v3; // rbp
__int64 v4; // rax
__int64 v5; // r8
__int64 v6; // r13
__int64 result; // rax

if ( a1 )
{
v2 = strlen(a1);
v3 = (int)(v2 + strlen(a2) + 16);
v4 = umalloc(v3);
v5 = (unsigned int)static_last;
v6 = v4;
++static_last;
xsnprintf(v4, v3, "%s.static%d_%s", a1, v5, a2);
result = v6;
}
else
{
ice("out/lbl.c", 70LL, "out_label_static_local", "no spel for %s", "out_label_static_local");
result = out_label_goto();
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(const char *a1, const char *a2)
{
int v2; // ebp
__int64 v3; // rbp
__int64 v4; // rax
__int64 v5; // r8
__int64 v6; // r13
__int64 result; // rax

if ( a1 )
{
v2 = strlen(a1);
v3 = (int)(v2 + strlen(a2) + 16);
v4 = umalloc(v3);
v5 = (unsigned int)static_last;
v6 = v4;
++static_last;
xsnprintf(v4, v3, "%s.static%d_%s", a1, v5, a2);
result = v6;
}
else
{
ice("out/lbl.c", 70LL, "out_label_static_local", "no spel for %s", "out_label_static_local");
result = func5();
}
return result;
}

original_code:
char *out_label_static_local(const char *funcsp, const char *spel)
{
 char *ret;
 int len;
 do if(!(funcsp)) ice("out/lbl.c", 70, __func__, "no spel for %s", __func__); while(0);
 len = strlen(funcsp) + strlen(spel) + 16;
 ret = umalloc(len);
 xsnprintf(ret, len, "%s.static%d_%s", funcsp, static_last++, spel);
 return ret;
}

canonical_original_code:
char *out_label_static_local(char *funcsp, char *spel)
{
 char *ret;
 int len;
 do if(!(funcsp)) ice("out/lbl.c", 70, __func__, "no spel for %s", __func__); while(0);
 len = strlen(funcsp) + strlen(spel) + 16;
 ret = umalloc(len);
 xsnprintf(ret, len, "%s.static%d_%s", funcsp, static_last++, spel);
 return ret;
}

variable_types:
spel
char *


decompiled_code:
__int64 __fastcall out_label_goto(const char *a1, const char *a2)
{
int v2; // ebp
__int64 v3; // rbp
__int64 v4; // r12

v2 = strlen(a1);
v3 = (int)(v2 + strlen(a2) + 6);
v4 = umalloc(v3);
xsnprintf(v4, v3, "%s%s.%s", *(const char **)(cc1_target_details[1] + 24LL), a1, a2);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func5(const char *a1, const char *a2)
{
int v2; // ebp
__int64 v3; // rbp
__int64 v4; // r12

v2 = strlen(a1);
v3 = (int)(v2 + strlen(a2) + 6);
v4 = umalloc(v3);
xsnprintf(v4, v3, "%s%s.%s", *(const char **)(cc1_target_details[1] + 24LL), a1, a2);
return v4;
}

original_code:
char *out_label_goto(char *func, char *lbl)
{
 int len = strlen(func) + strlen(lbl) + 6;
 char *ret = umalloc(len);
 xsnprintf(ret, len, "%s%s.%s", cc1_target_details.as->privatelbl_prefix, func, lbl);
 return ret;
}

variable_types:
func
char *

variable_types:
lbl
char *


decompiled_code:
__int64 __fastcall out_label_case(int a1, int a2)
{
__int64 v2; // rbp
__int64 result; // rax
__int64 v4; // r12
const char *v5; // rax
const char *v6; // rcx

v2 = (unsigned int)a2;
result = umalloc(47LL);
v4 = result;
if ( a1 == 1 )
{
xsnprintf(
result,
47LL,
"%scase_%d_default",
*(const char **)(cc1_target_details[1] + 24LL),
(unsigned int)switch_last);
result = v4;
++switch_last;
}
else if ( (a1 & 0xFFFFFFFD) != 0 )
{
++switch_last;
}
else
{
v5 = (const char *)&unk_42B;
if ( a2 < 0 )
{
v2 = (unsigned int)-a2;
v5 = "m";
}
v6 = "_rng";
if ( a1 != 2 )
v6 = (const char *)&unk_42B;
xsnprintf(
v4,
47LL,
"%scase%s_%d_%s%d",
v6,
*(const char **)(cc1_target_details[1] + 24LL),
(unsigned int)switch_last,
v5,
v2);
++switch_last;
result = v4;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, int a2)
{
__int64 v2; // rbp
__int64 result; // rax
__int64 v4; // r12
const char *v5; // rax
const char *v6; // rcx

v2 = (unsigned int)a2;
result = umalloc(47LL);
v4 = result;
if ( a1 == 1 )
{
xsnprintf(
result,
47LL,
"%scase_%d_default",
*(const char **)(cc1_target_details[1] + 24LL),
(unsigned int)switch_last);
result = v4;
++switch_last;
}
else if ( (a1 & 0xFFFFFFFD) != 0 )
{
++switch_last;
}
else
{
v5 = (const char *)&unk_42B;
if ( a2 < 0 )
{
v2 = (unsigned int)-a2;
v5 = "m";
}
v6 = "_rng";
if ( a1 != 2 )
v6 = (const char *)&unk_42B;
xsnprintf(
v4,
47LL,
"%scase%s_%d_%s%d",
v6,
*(const char **)(cc1_target_details[1] + 24LL),
(unsigned int)switch_last,
v5,
v2);
++switch_last;
result = v4;
}
return result;
}

original_code:
char *out_label_case(enum out_label_type lbltype, int val)
{
 int len;
 char *ret = umalloc(len = 15 + 32);
 switch(lbltype){
  case CASE_DEF:
   xsnprintf(ret, len, "%scase_%d_default", cc1_target_details.as->privatelbl_prefix, switch_last);
   break;
  case CASE_CASE:
  case CASE_RANGE:
  {
   const char *extra = "";
   if(val < 0){
    val = -val;
    extra = "m";
   }
   xsnprintf(ret, len, "%scase%s_%d_%s%d", lbltype == CASE_RANGE ? "_rng" : "", cc1_target_details.as->privatelbl_prefix, switch_last, extra, val);
   break;
  }
 }
 switch_last++;
 return ret;
}

canonical_original_code:
char *out_label_case(enum out_label_type lbltype, int val)
{
 int len;
 char *ret = umalloc(len = 15 + 32);
 switch(lbltype){
  case CASE_DEF:
   xsnprintf(ret, len, "%scase_%d_default", cc1_target_details.as->privatelbl_prefix, switch_last);
   break;
  case CASE_CASE:
  case CASE_RANGE:
  {
   char *extra = "";
   if(val < 0){
    val = -val;
    extra = "m";
   }
   xsnprintf(ret, len, "%scase%s_%d_%s%d", lbltype == CASE_RANGE ? "_rng" : "", cc1_target_details.as->privatelbl_prefix, switch_last, extra, val);
   break;
  }
 }
 switch_last++;
 return ret;
}

variable_types: enum out_label_type { CASE_CASE=0, CASE_DEF=1, CASE_RANGE=2 }

variable_types: val int

variable_types:
extra
char *


decompiled_code:
__int64 __fastcall out_label_flow(const char *a1)
{
__int64 v1; // rbp
__int64 v2; // rax
__int64 v3; // r9
__int64 v4; // r12

v1 = (int)(strlen(a1) + 16);
v2 = umalloc(v1);
v3 = (unsigned int)flow_last;
v4 = v2;
++flow_last;
xsnprintf(v2, v1, "%sflow_%s_%d", *(const char **)(cc1_target_details[1] + 24LL), a1, v3);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1)
{
__int64 v1; // rbp
__int64 v2; // rax
__int64 v3; // r9
__int64 v4; // r12

v1 = (int)(strlen(a1) + 16);
v2 = umalloc(v1);
v3 = (unsigned int)flow_last;
v4 = v2;
++flow_last;
xsnprintf(v2, v1, "%sflow_%s_%d", *(const char **)(cc1_target_details[1] + 24LL), a1, v3);
return v4;
}

original_code:
char *out_label_flow(const char *fmt)
{
 int len = 16 + strlen(fmt);
 char *ret = umalloc(len);
 xsnprintf(ret, len, "%sflow_%s_%d", cc1_target_details.as->privatelbl_prefix, fmt, flow_last++);
 return ret;
}

canonical_original_code:
char *out_label_flow(char *fmt)
{
 int len = 16 + strlen(fmt);
 char *ret = umalloc(len);
 xsnprintf(ret, len, "%sflow_%s_%d", cc1_target_details.as->privatelbl_prefix, fmt, flow_last++);
 return ret;
}


decompiled_code:
__int64 __fastcall out_dbg_func_end(const char *a1)
{
return ustrprintf("%sfuncend_%s", *(const char **)(cc1_target_details[1] + 24LL), a1);
}

canonical_decompiled_code:
__int64 __fastcall func8(const char *a1)
{
return ustrprintf("%sfuncend_%s", *(const char **)(cc1_target_details[1] + 24LL), a1);
}

original_code:
char *out_dbg_func_end(const char *fn)
{
 return ustrprintf("%sfuncend_%s", cc1_target_details.as->privatelbl_prefix, fn);
}

canonical_original_code:
char *out_dbg_func_end(char *fn)
{
 return ustrprintf("%sfuncend_%s", cc1_target_details.as->privatelbl_prefix, fn);
}

variable_types:
fn
char *


variable_types: c int

variable_types:
escapechars
struct { char from; } []

variable_types:
i
unsigned int


decompiled_code:
_BOOL8 __fastcall inc_and_chk(unsigned __int64 *a1, unsigned int a2, unsigned int a3)
{
unsigned __int64 v3; // rax
unsigned __int64 v4; // rsi
unsigned __int64 v5; // rdx

v3 = *a1;
v4 = *a1 * a2;
v5 = v4 + a3;
*a1 = v5;
if ( v4 > v5 )
v4 = v5;
return v3 > v4;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(unsigned __int64 *a1, unsigned int a2, unsigned int a3)
{
unsigned __int64 v3; // rax
unsigned __int64 v4; // rsi
unsigned __int64 v5; // rdx

v3 = *a1;
v4 = *a1 * a2;
v5 = v4 + a3;
*a1 = v5;
if ( v4 > v5 )
v4 = v5;
return v3 > v4;
}

original_code:
static int inc_and_chk(unsigned long long *const val, unsigned base, unsigned inc)
{
 const unsigned long long new = *val * base + inc;
 int of = new < *val || *val * base < *val;
 *val = new;
 return of;
}

canonical_original_code:
static int inc_and_chk(unsigned long long *val, unsigned int base, unsigned int inc)
{
 unsigned long long new = *val * base + inc;
 int of = new < *val || *val * base < *val;
 *val = new;
 return of;
}

variable_types:
val
unsigned long long *

variable_types:
base
unsigned int

variable_types:
inc
unsigned int

variable_types:
new
unsigned long long

variable_types: of int


isbdigit

decompiled_code:
_BOOL8 __fastcall isbdigit(int a1)
{
return (unsigned int)(a1 - 48) <= 1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(int a1)
{
return (unsigned int)(a1 - 48) <= 1;
}

original_code:
static int isbdigit(int c)
{
 return c == '0' || c == '1';
}


isodigit

decompiled_code:
_BOOL8 __fastcall isodigit(int a1)
{
return (unsigned int)(a1 - 48) <= 7;
}

canonical_decompiled_code:
_BOOL8 __fastcall func4(int a1)
{
return (unsigned int)(a1 - 48) <= 7;
}

original_code:
static int isodigit(int c)
{
 return '0' <= c && c < '8';
}


decompiled_code:
unsigned __int64 __fastcall read_ap_num(__int64 (__fastcall *a1)(_QWORD), char *a2, unsigned int a3, int a4, char **a5, _DWORD *a6)
{
const unsigned __int16 **v10; // rax
__int64 v11; // r15
unsigned int v12; // edx
char *i; // rax
unsigned __int64 v16[8]; // [rsp+18h] [rbp-40h] BYREF

*a6 = 0;
v16[0] = 0LL;
while ( (unsigned int)a1((unsigned int)*a2) )
{
v10 = _ctype_b_loc();
v11 = *a2;
v12 = v11 - 48;
if ( ((*v10)[v11] & 0x800) == 0 )
v12 = (*_ctype_tolower_loc())[v11] - 87;
if ( inc_and_chk(v16, a3, v12) )
{
overflow_handle(a2, a5, a1);
*a6 = 1;
while ( (unsigned int)a1((unsigned int)*a2) || *a2 == 95 )
++a2;
break;
}
for ( i = a2 + 1; *i == 95; ++i )
;
a2 = i;
if ( a4 > 0 && !--a4 )
break;
}
*a5 = a2;
return v16[0];
}

canonical_decompiled_code:
unsigned __int64 __fastcall func5(__int64 (__fastcall *a1)(_QWORD), char *a2, unsigned int a3, int a4, char **a5, _DWORD *a6)
{
const unsigned __int16 **v10; // rax
__int64 v11; // r15
unsigned int v12; // edx
char *i; // rax
unsigned __int64 v16[8]; // [rsp+18h] [rbp-40h] BYREF

*a6 = 0;
v16[0] = 0LL;
while ( (unsigned int)a1((unsigned int)*a2) )
{
v10 = _ctype_b_loc();
v11 = *a2;
v12 = v11 - 48;
if ( ((*v10)[v11] & 0x800) == 0 )
v12 = (*_ctype_tolower_loc())[v11] - 87;
if ( func1(v16, a3, v12) )
{
func2(a2, a5, a1);
*a6 = 1;
while ( (unsigned int)a1((unsigned int)*a2) || *a2 == 95 )
++a2;
break;
}
for ( i = a2 + 1; *i == 95; ++i )
;
a2 = i;
if ( a4 > 0 && !--a4 )
break;
}
*a5 = a2;
return v16[0];
}

original_code:
static unsigned long long read_ap_num(
  digit_test test, char *s,
  int base, int max_chars,
  char **const end, int *const of)
{
 unsigned long long val = 0;
 int i = 0;
 *of = 0;
 while(test(*s)){
  int dv = ((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int) _ISdigit) ? *s - '0' : tolower(*s) - 'a' + 10;
  if(inc_and_chk(&val, base, dv)){
   overflow_handle(s, end, test);
   *of = 1;
   while((test(*s) || *s == '_'))
    s++;
   break;
  }
  s++;
  while(*s == '_')
   s++;
  if(max_chars > 0 && --max_chars == 0)
   break;
  i++;
 }
 *end = s;
 return val;
}

canonical_original_code:
static unsigned long long read_ap_num(int test(int), char *s, int base, int max_chars, char **end, int *of)
{
 unsigned long long val = 0;
 int i = 0;
 *of = 0;
 while(test(*s)){
  int dv = ((*__ctype_b_loc ())[(int) ((*s))] & (unsigned short int) _ISdigit) ? *s - '0' : tolower(*s) - 'a' + 10;
  if(inc_and_chk(&val, base, dv)){
   overflow_handle(s, end, test);
   *of = 1;
   while((test(*s) || *s == '_'))
    s++;
   break;
  }
  s++;
  while(*s == '_')
   s++;
  if(max_chars > 0 && --max_chars == 0)
   break;
  i++;
 }
 *end = s;
 return val;
}

variable_types:
test
int (int)

variable_types:
s
char *

variable_types: base int

variable_types:
end
char **

variable_types:
of
int *

variable_types:
val
unsigned long long

variable_types: i int

variable_types: dv int


decompiled_code:
__int64 __fastcall escape_char(char *a1, char *a2, char **a3, int a4, _DWORD *a5, _DWORD *a6, _DWORD *a7)
{
char *v7; // r14
unsigned __int64 v10; // rbx
unsigned int v11; // er15
char v12; // al
unsigned int v13; // ecx
unsigned int v14; // eax
unsigned int v15; // esi
unsigned int v17; // eax
char *v20; // [rsp+18h] [rbp-40h] BYREF

if ( !a2 )
_assert_fail("limit", "escape.c", 0xC6u, "escape_char");
v7 = a2;
v10 = 0LL;
v11 = 0;
if ( a2 != a1 )
{
while ( 1 )
{
v12 = *a1;
if ( !*a1 )
{
if ( a5 )
goto LABEL_14;
goto LABEL_15;
}
++a1;
v13 = v12;
if ( v12 == 92 )
{
if ( v7 == a1 )
{
*a7 = 84;
if ( a5 )
goto LABEL_14;
goto LABEL_17;
}
v17 = escape_char_1(a1, &v20, a4, a6, a7);
a1 = v20;
v13 = v17;
}
if ( a4 )
break;
v14 = v11;
v15 = v11 << 8;
v11 = (v11 << 8) + v13;
if ( v14 <= 0xFFFFFF && v15 <= ~v13 )
{
LABEL_6:
++v10;
if ( v7 == a1 )
goto LABEL_13;
}
else
{
*a6 = 7;
++v10;
if ( v7 == a1 )
goto LABEL_13;
}
}
v11 = 0;
if ( v13 )
{
*a6 = 7;
v11 = v13;
}
goto LABEL_6;
}
LABEL_13:
if ( a5 )
{
LABEL_14:
*a5 = v10 > 1;
LABEL_15:
if ( v7 != a1 )
v7 = a1 - 1;
}
LABEL_17:
*a3 = v7;
return v11;
}

canonical_decompiled_code:
__int64 __fastcall func8(char *a1, char *a2, char **a3, int a4, _DWORD *a5, _DWORD *a6, _DWORD *a7)
{
char *v7; // r14
unsigned __int64 v10; // rbx
unsigned int v11; // er15
char v12; // al
unsigned int v13; // ecx
unsigned int v14; // eax
unsigned int v15; // esi
unsigned int v17; // eax
char *v20; // [rsp+18h] [rbp-40h] BYREF

if ( !a2 )
_assert_fail("limit", "escape.c", 0xC6u, "escape_char");
v7 = a2;
v10 = 0LL;
v11 = 0;
if ( a2 != a1 )
{
while ( 1 )
{
v12 = *a1;
if ( !*a1 )
{
if ( a5 )
goto LABEL_14;
goto LABEL_15;
}
++a1;
v13 = v12;
if ( v12 == 92 )
{
if ( v7 == a1 )
{
*a7 = 84;
if ( a5 )
goto LABEL_14;
goto LABEL_17;
}
v17 = func7(a1, &v20, a4, a6, a7);
a1 = v20;
v13 = v17;
}
if ( a4 )
break;
v14 = v11;
v15 = v11 << 8;
v11 = (v11 << 8) + v13;
if ( v14 <= 0xFFFFFF && v15 <= ~v13 )
{
LABEL_6:
++v10;
if ( v7 == a1 )
goto LABEL_13;
}
else
{
*a6 = 7;
++v10;
if ( v7 == a1 )
goto LABEL_13;
}
}
v11 = 0;
if ( v13 )
{
*a6 = 7;
v11 = v13;
}
goto LABEL_6;
}
LABEL_13:
if ( a5 )
{
LABEL_14:
*a5 = v10 > 1;
LABEL_15:
if ( v7 != a1 )
v7 = a1 - 1;
}
LABEL_17:
*a3 = v7;
return v11;
}

original_code:
int escape_char(
  char *start,
  char *limit,
  char **const end,
  int is_wide,
  int *const multi,
  int *const warn,
  int *const err)
{
 int ret = 0;
 char *i;
 size_t n = 0;
 ((limit) ? (void) (0) : __assert_fail ("limit", "escape.c", 198, __extension__ __PRETTY_FUNCTION__));
 for(i = start; i != limit && *i; i++){
  int this;
  if(*i == '\\'){
   char *escfin;
   i++;
   if(i == limit){
    *err = 84;
    break;
   }
   this = escape_char_1(i, &escfin, is_wide, warn, err);
   i = escfin - 1;
  }else{
   this = *i;
  }
  if(is_wide){
   ret = this;
   if(ret)
    *warn = 7;
  }else{
   int of = 0;
   if((unsigned)ret > (0x7fffffff * 2U + 1U) / 256u)
    of = 1;
   ret *= 256u;
   if((unsigned)ret > (0x7fffffff * 2U + 1U) - this)
    of = 1;
   ret += this;
   if(of)
    *warn = 7;
  }
  n++;
 }
 if(multi)
  *multi = n > 1;
 if(i == limit)
  *end = i;
 else
  *end = i - 1;
 return ret;
}

canonical_original_code:
int escape_char(char *start, char *limit, char **end, int is_wide, int *multi, int *warn, int *err)
{
 int ret = 0;
 char *i;
 unsigned long n = 0;
 ((limit) ? (void) (0) : __assert_fail ("limit", "escape.c", 198, __extension__ __PRETTY_FUNCTION__));
 for(i = start; i != limit && *i; i++){
  int this;
  if(*i == '\\'){
   char *escfin;
   i++;
   if(i == limit){
    *err = 84;
    break;
   }
   this = escape_char_1(i, &escfin, is_wide, warn, err);
   i = escfin - 1;
  }else{
   this = *i;
  }
  if(is_wide){
   ret = this;
   if(ret)
    *warn = 7;
  }else{
   int of = 0;
   if((unsigned int)ret > (0x7fffffff * 2U + 1U) / 256u)
    of = 1;
   ret *= 256u;
   if((unsigned int)ret > (0x7fffffff * 2U + 1U) - this)
    of = 1;
   ret += this;
   if(of)
    *warn = 7;
  }
  n++;
 }
 if(multi)
  *multi = n > 1;
 if(i == limit)
  *end = i;
 else
  *end = i - 1;
 return ret;
}

variable_types:
start
char *

variable_types:
limit
char *

variable_types:
multi
int *

variable_types:
warn
int *

variable_types:
err
int *

variable_types: ret int

variable_types:
i
char *

variable_types:
n
unsigned long

variable_types: this int

variable_types:
escfin
char *


decompiled_code:
char *__fastcall base_to_str(unsigned int a1)
{
char *result; // rax

result = 0LL;
if ( a1 <= 3 )
result = CSWTCH_28[a1];
return result;
}

canonical_decompiled_code:
char *__fastcall func9(unsigned int a1)
{
char *result; // rax

result = 0LL;
if ( a1 <= 3 )
result = CSWTCH_28[a1];
return result;
}

original_code:
const char *base_to_str(enum base b)
{
 switch(b){
  case BIN: return "binary";
  case OCT: return "octal";
  case DEC: return "decimal";
  case HEX: return "hexadecimal";
 }
 return ((void *)0);
}

variable_types: enum base { BIN=0, OCT=1, DEC=2, HEX=3 }


decompiled_code:
const char *str_stmt_case()
{
return "case";
}

canonical_decompiled_code:
const char *func0()
{
return "case";
}

original_code:
const char *str_stmt_case(void)
{
 return "case";
}


decompiled_code:
int __fastcall colour_enabled(int fd)
{
char *v1; // r8
int result; // eax

if ( from_option == 1 )
return 0;
if ( from_option == 2 )
return 1;
v1 = getenv("NO_COLOR");
result = 0;
if ( !v1 )
result = isatty(fd);
return result;
}

canonical_decompiled_code:
int __fastcall func0(int fd)
{
char *v1; // r8
int result; // eax

if ( from_option == 1 )
return 0;
if ( from_option == 2 )
return 1;
v1 = getenv("NO_COLOR");
result = 0;
if ( !v1 )
result = isatty(fd);
return result;
}

original_code:
int colour_enabled(int fd)
{
 switch(from_option){
  case TRI_UNSET:
   break;
  case TRI_FALSE:
   return 0;
  case TRI_TRUE:
   return 1;
 }
 const char *no_color = getenv("NO_COLOR");
 if(no_color)
  return 0;
 return isatty(fd);
}

canonical_original_code:
int colour_enabled(int fd)
{
 switch(from_option){
  case TRI_UNSET:
   break;
  case TRI_FALSE:
   return 0;
  case TRI_TRUE:
   return 1;
 }
 char *no_color = getenv("NO_COLOR");
 if(no_color)
  return 0;
 return isatty(fd);
}

variable_types: fd int


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

result = 1 - ((unsigned int)(a1 == 0) - 1);
from_option = 1 - ((a1 == 0) - 1);
return result;
}

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

result = 1 - ((unsigned int)(a1 == 0) - 1);
from_option = 1 - ((a1 == 0) - 1);
return result;
}

original_code:
void colour_enable(int enable)
{
 from_option = enable ? TRI_TRUE : TRI_FALSE;
}

variable_types: enable int