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

if ( a1 > 0x20 )
{
result = "CONVERTIBLE_EXPLICIT";
if ( a1 != 256 )
{
if ( a1 <= 0x100 )
{
result = "QUAL_NESTED_CHANGE";
if ( a1 != 64 )
{
result = "CONVERTIBLE_IMPLICIT";
if ( a1 != 128 )
result = 0LL;
}
}
else
{
result = "NOT_EQUAL";
if ( a1 != 512 )
result = 0LL;
}
}
}
else
{
result = 0LL;
if ( a1 )
{
switch ( a1 )
{
case 1u:
result = "EQUAL";
break;
case 2u:
result = "EQUAL_TYPEDEF";
break;
case 4u:
result = "QUAL_ADD";
break;
case 8u:
result = "QUAL_SUB";
break;
case 0x10u:
result = "QUAL_POINTED_ADD";
break;
case 0x20u:
result = "QUAL_POINTED_SUB";
break;
default:
result = 0LL;
break;
}
}
}
return result;
}

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

if ( a1 > 0x20 )
{
result = "CONVERTIBLE_EXPLICIT";
if ( a1 != 256 )
{
if ( a1 <= 0x100 )
{
result = "QUAL_NESTED_CHANGE";
if ( a1 != 64 )
{
result = "CONVERTIBLE_IMPLICIT";
if ( a1 != 128 )
result = 0LL;
}
}
else
{
result = "NOT_EQUAL";
if ( a1 != 512 )
result = 0LL;
}
}
}
else
{
result = 0LL;
if ( a1 )
{
switch ( a1 )
{
case 1u:
result = "EQUAL";
break;
case 2u:
result = "EQUAL_TYPEDEF";
break;
case 4u:
result = "QUAL_ADD";
break;
case 8u:
result = "QUAL_SUB";
break;
case 0x10u:
result = "QUAL_POINTED_ADD";
break;
case 0x20u:
result = "QUAL_POINTED_SUB";
break;
default:
result = 0LL;
break;
}
}
}
return result;
}

original_code:
const char *type_cmp_to_str(enum type_cmp cmp)
{
 switch(cmp){
  case TYPE_EQUAL: return "EQUAL";
  case TYPE_EQUAL_TYPEDEF: return "EQUAL_TYPEDEF";
  case TYPE_QUAL_ADD: return "QUAL_ADD";
  case TYPE_QUAL_SUB: return "QUAL_SUB";
  case TYPE_QUAL_POINTED_ADD: return "QUAL_POINTED_ADD";
  case TYPE_QUAL_POINTED_SUB: return "QUAL_POINTED_SUB";
  case TYPE_QUAL_NESTED_CHANGE: return "QUAL_NESTED_CHANGE";
  case TYPE_CONVERTIBLE_IMPLICIT: return "CONVERTIBLE_IMPLICIT";
  case TYPE_CONVERTIBLE_EXPLICIT: return "CONVERTIBLE_EXPLICIT";
  case TYPE_NOT_EQUAL: return "NOT_EQUAL";
 }
 return ((void *)0);
}

variable_types: enum type_cmp { TYPE_EQUAL=expr, TYPE_EQUAL_TYPEDEF=expr, TYPE_QUAL_ADD=expr, TYPE_QUAL_SUB=expr, TYPE_QUAL_POINTED_ADD=expr, TYPE_QUAL_POINTED_SUB=expr, TYPE_QUAL_NESTED_CHANGE=expr, TYPE_CONVERTIBLE_IMPLICIT=expr, TYPE_CONVERTIBLE_EXPLICIT=expr, TYPE_NOT_EQUAL=expr }


repo: bobrippling/ucc-c-compiler

decompiled_code:
char *__fastcall type_qual_to_str(char a1, int a2)
{
const char *v2; // r9
const char *v3; // r8
const char *v4; // rcx
char *v5; // rax

v2 = "restrict ";
if ( (a1 & 4) == 0 )
v2 = (const char *)&unk_8A3;
v3 = "volatile ";
if ( (a1 & 2) == 0 )
v3 = (const char *)&unk_8A3;
v4 = "const ";
if ( (a1 & 1) == 0 )
v4 = (const char *)&unk_8A3;
snprintf(buf_0, 0x20uLL, "%s%s%s", v4, v3, v2);
if ( !a2 )
{
v5 = strrchr(buf_0, 32);
if ( v5 )
*v5 = 0;
}
return buf_0;
}

canonical_decompiled_code:
char *__fastcall func13(char a1, int a2)
{
const char *v2; // r9
const char *v3; // r8
const char *v4; // rcx
char *v5; // rax

v2 = "restrict ";
if ( (a1 & 4) == 0 )
v2 = (const char *)&unk_8A3;
v3 = "volatile ";
if ( (a1 & 2) == 0 )
v3 = (const char *)&unk_8A3;
v4 = "const ";
if ( (a1 & 1) == 0 )
v4 = (const char *)&unk_8A3;
snprintf(buf_0, 0x20uLL, "%s%s%s", v4, v3, v2);
if ( !a2 )
{
v5 = strrchr(buf_0, 32);
if ( v5 )
*v5 = 0;
}
return buf_0;
}

original_code:
const char *type_qual_to_str(const enum type_qualifier qual, int trailing_space)
{
 static char buf[32];
 snprintf(buf, sizeof buf, "%s%s%s",
  qual & qual_const ? "const " : "",
  qual & qual_volatile ? "volatile " : "",
  qual & qual_restrict ? "restrict " : "");
 if(!trailing_space){
  char *last = strrchr(buf, ' ');
  if(last)
   *last = '\0';
 }
 return buf;
}

canonical_original_code:
char *type_qual_to_str(enum type_qualifier qual, int trailing_space)
{
 static char buf[32];
 snprintf(buf, sizeof buf, "%s%s%s",
  qual & qual_const ? "const " : "",
  qual & qual_volatile ? "volatile " : "",
  qual & qual_restrict ? "restrict " : "");
 if(!trailing_space){
  char *last = strrchr(buf, ' ');
  if(last)
   *last = '\0';
 }
 return buf;
}

variable_types: enum type_qualifier { qual_none=0, qual_const=expr, qual_volatile=expr, qual_restrict=expr }

variable_types:
buf
char [32]

variable_types:
last
char *

return_type: char *


decompiled_code:
__int64 __fastcall visibility_parse(_DWORD *a1, const char *a2, int a3)
{
__int64 result; // rax
bool v4; // zf

if ( !strcmp(a2, "default") )
{
*a1 = 0;
result = 1LL;
}
else if ( !strcmp(a2, "hidden") )
{
*a1 = 1;
result = 1LL;
}
else
{
v4 = strcmp(a2, "protected") == 0;
if ( a3 && v4 )
{
*a1 = 2;
result = 1LL;
}
else
{
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_DWORD *a1, const char *a2, int a3)
{
__int64 result; // rax
bool v4; // zf

if ( !strcmp(a2, "default") )
{
*a1 = 0;
result = 1LL;
}
else if ( !strcmp(a2, "hidden") )
{
*a1 = 1;
result = 1LL;
}
else
{
v4 = strcmp(a2, "protected") == 0;
if ( a3 && v4 )
{
*a1 = 2;
result = 1LL;
}
else
{
result = 0LL;
}
}
return result;
}

original_code:
int visibility_parse(enum visibility *const e, const char *s, int allow_protected)
{
 if(!strcmp(s, "default"))
  *e = VISIBILITY_DEFAULT;
 else if(!strcmp(s, "hidden"))
  *e = VISIBILITY_HIDDEN;
 else if(!strcmp(s, "protected") && allow_protected)
  *e = VISIBILITY_PROTECTED;
 else
  return 0;
 return 1;
}

canonical_original_code:
int visibility_parse(enum visibility *e, char *s, int allow_protected)
{
 if(!strcmp(s, "default"))
  *e = VISIBILITY_DEFAULT;
 else if(!strcmp(s, "hidden"))
  *e = VISIBILITY_HIDDEN;
 else if(!strcmp(s, "protected") && allow_protected)
  *e = VISIBILITY_PROTECTED;
 else
  return 0;
 return 1;
}

variable_types: enum visibility { VISIBILITY_DEFAULT=0, VISIBILITY_HIDDEN=1, VISIBILITY_PROTECTED=2 } *

variable_types:
s
char *

return_type: int


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

result = "hidden";
if ( a1 != 1 )
{
result = "protected";
if ( a1 != 2 )
{
result = "default";
if ( a1 )
result = 0LL;
}
}
return result;
}

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

result = "hidden";
if ( a1 != 1 )
{
result = "protected";
if ( a1 != 2 )
{
result = "default";
if ( a1 )
result = 0LL;
}
}
return result;
}

original_code:
const char *visibility_to_str(enum visibility v)
{
 switch(v){
  case VISIBILITY_DEFAULT: return "default";
  case VISIBILITY_HIDDEN: return "hidden";
  case VISIBILITY_PROTECTED: return "protected";
 }
 return ((void *)0);
}

variable_types: enum visibility { VISIBILITY_DEFAULT=0, VISIBILITY_HIDDEN=1, VISIBILITY_PROTECTED=2 }


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

result = 1LL;
if ( a1 != 2 )
{
result = 0LL;
if ( a1 > 2 )
result = (unsigned int)-(a1 != 3);
}
return result;
}

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

result = 1LL;
if ( a1 != 2 )
{
result = 0LL;
if ( a1 > 2 )
result = (unsigned int)-(a1 != 3);
}
return result;
}

original_code:
static enum vendor infer_vendor(enum sys sys)
{
 switch(sys){
  case SYS_linux: return VENDOR_pc;
  case SYS_darwin: return VENDOR_apple;
  case SYS_cygwin: return VENDOR_pc;
  case SYS_freebsd: return VENDOR_pc;
 }
 return -1;
}

variable_types: enum sys { SYS_linux=0, SYS_freebsd=1, SYS_darwin=2, SYS_cygwin=3 }

return_type: enum vendor { VENDOR_pc=0, VENDOR_apple=1 }


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

if ( a1 == 2 )
return 1LL;
if ( a1 > 2 )
return 3 * (unsigned int)(a1 == 3) - 1;
result = 2LL;
if ( !a1 )
result = 0LL;
return result;
}

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

if ( a1 == 2 )
return 1LL;
if ( a1 > 2 )
return 3 * (unsigned int)(a1 == 3) - 1;
result = 2LL;
if ( !a1 )
result = 0LL;
return result;
}

original_code:
static enum abi infer_abi(enum sys sys)
{
 switch(sys){
  case SYS_linux: return ABI_gnu;
  case SYS_darwin: return ABI_macho;
  case SYS_cygwin: return ABI_elf;
  case SYS_freebsd: return ABI_elf;
 }
 return -1;
}

return_type: enum abi { ABI_gnu=0, ABI_macho=1, ABI_elf=2 }

user_defined_types: enum sys { SYS_linux=0, SYS_freebsd=1, SYS_darwin=2, SYS_cygwin=3 }


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

result = "x86_64";
if ( a1 )
{
result = "i386";
if ( a1 != 1 )
result = 0LL;
}
return result;
}

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

result = "x86_64";
if ( a1 )
{
result = "i386";
if ( a1 != 1 )
result = 0LL;
}
return result;
}

original_code:
static const char *arch_to_str(enum arch a)
{
 switch(a){
  case ARCH_x86_64: return "x86_64"; case ARCH_i386: return "i386";
 }
 return ((void *)0);
}

canonical_original_code:
static char *arch_to_str(enum arch a)
{
 switch(a){
  case ARCH_x86_64: return "x86_64"; case ARCH_i386: return "i386";
 }
 return ((void *)0);
}

variable_types: enum arch { ARCH_x86_64=0, ARCH_i386=1 }


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

result = "pc";
if ( a1 )
{
result = "apple";
if ( a1 != 1 )
result = 0LL;
}
return result;
}

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

result = "pc";
if ( a1 )
{
result = "apple";
if ( a1 != 1 )
result = 0LL;
}
return result;
}

original_code:
static const char *vendor_to_str(enum vendor v)
{
 switch(v){
  case VENDOR_pc: return "pc"; case VENDOR_apple: return "apple";
 }
 return ((void *)0);
}

canonical_original_code:
static char *vendor_to_str(enum vendor v)
{
 switch(v){
  case VENDOR_pc: return "pc"; case VENDOR_apple: return "apple";
 }
 return ((void *)0);
}

variable_types: enum vendor { VENDOR_pc=0, VENDOR_apple=1 }


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

if ( a1 == 2 )
return "darwin";
if ( a1 > 2 )
{
result = "cygwin";
if ( a1 != 3 )
result = 0LL;
}
else
{
result = "freebsd";
if ( !a1 )
result = "linux";
}
return result;
}

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

if ( a1 == 2 )
return "darwin";
if ( a1 > 2 )
{
result = "cygwin";
if ( a1 != 3 )
result = 0LL;
}
else
{
result = "freebsd";
if ( !a1 )
result = "linux";
}
return result;
}

original_code:
static const char *sys_to_str(enum sys s)
{
 switch(s){
  case SYS_linux: return "linux"; case SYS_freebsd: return "freebsd"; case SYS_darwin: return "darwin"; case SYS_cygwin: return "cygwin";
 }
 return ((void *)0);
}

canonical_original_code:
static char *sys_to_str(enum sys s)
{
 switch(s){
  case SYS_linux: return "linux"; case SYS_freebsd: return "freebsd"; case SYS_darwin: return "darwin"; case SYS_cygwin: return "cygwin";
 }
 return ((void *)0);
}


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

result = "macho";
if ( a1 != 1 )
{
result = "elf";
if ( a1 != 2 )
{
result = "gnu";
if ( a1 )
result = 0LL;
}
}
return result;
}

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

result = "macho";
if ( a1 != 1 )
{
result = "elf";
if ( a1 != 2 )
{
result = "gnu";
if ( a1 )
result = 0LL;
}
}
return result;
}

original_code:
static const char *abi_to_str(enum abi a)
{
 switch(a){
  case ABI_gnu: return "gnu"; case ABI_macho: return "macho"; case ABI_elf: return "elf";
 }
 return ((void *)0);
}

canonical_original_code:
static char *abi_to_str(enum abi a)
{
 switch(a){
  case ABI_gnu: return "gnu"; case ABI_macho: return "macho"; case ABI_elf: return "elf";
 }
 return ((void *)0);
}

variable_types: enum abi { ABI_gnu=0, ABI_macho=1, ABI_elf=2 }


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

if ( !strcmp(a1, "x86_64") )
{
*a2 = 0;
result = 1LL;
}
else if ( !strcmp(a1, "i386") )
{
*a2 = 1;
result = 1LL;
}
else if ( !strcmp(a1, "amd64") )
{
*a2 = 0;
result = 1LL;
}
else
{
result = 0LL;
if ( !strcmp(a1, "i686") )
{
*a2 = 1;
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(const char *a1, _DWORD *a2)
{
__int64 result; // rax

if ( !strcmp(a1, "x86_64") )
{
*a2 = 0;
result = 1LL;
}
else if ( !strcmp(a1, "i386") )
{
*a2 = 1;
result = 1LL;
}
else if ( !strcmp(a1, "amd64") )
{
*a2 = 0;
result = 1LL;
}
else
{
result = 0LL;
if ( !strcmp(a1, "i686") )
{
*a2 = 1;
result = 1LL;
}
}
return result;
}

original_code:
static int parse_arch(const char *in, enum arch *out)
{
 if(!strcmp(in, "x86_64")){ *out = ARCH_x86_64; return 1; } if(!strcmp(in, "i386")){ *out = ARCH_i386; return 1; } if(!strcmp(in, "amd64")){ *out = ARCH_x86_64; return 1; } if(!strcmp(in, "i686")){ *out = ARCH_i386; return 1; }
 return 0;
}

canonical_original_code:
static int parse_arch(char *in, enum arch *out)
{
 if(!strcmp(in, "x86_64")){ *out = ARCH_x86_64; return 1; } if(!strcmp(in, "i386")){ *out = ARCH_i386; return 1; } if(!strcmp(in, "amd64")){ *out = ARCH_x86_64; return 1; } if(!strcmp(in, "i686")){ *out = ARCH_i386; return 1; }
 return 0;
}

variable_types:
in
char *

variable_types: enum arch { ARCH_x86_64=0, ARCH_i386=1 } *


decompiled_code:
__int64 __fastcall parse_vendor(const char *a1, _DWORD *a2)
{
unsigned int v2; // edx

if ( !strcmp(a1, "pc") )
{
*a2 = 0;
v2 = 1;
}
else
{
v2 = 0;
if ( !strcmp(a1, "apple") )
{
*a2 = 1;
v2 = 1;
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1, _DWORD *a2)
{
unsigned int v2; // edx

if ( !strcmp(a1, "pc") )
{
*a2 = 0;
v2 = 1;
}
else
{
v2 = 0;
if ( !strcmp(a1, "apple") )
{
*a2 = 1;
v2 = 1;
}
}
return v2;
}

original_code:
static int parse_vendor(const char *in, enum vendor *out)
{
 if(!strcmp(in, "pc")){ *out = VENDOR_pc; return 1; } if(!strcmp(in, "apple")){ *out = VENDOR_apple; return 1; }
 return 0;
}

canonical_original_code:
static int parse_vendor(char *in, enum vendor *out)
{
 if(!strcmp(in, "pc")){ *out = VENDOR_pc; return 1; } if(!strcmp(in, "apple")){ *out = VENDOR_apple; return 1; }
 return 0;
}

variable_types: enum vendor { VENDOR_pc=0, VENDOR_apple=1 } *


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

if ( !strcmp(a1, "gnu") )
{
*a2 = 0;
result = 1LL;
}
else if ( !strcmp(a1, "macho") )
{
*a2 = 1;
result = 1LL;
}
else
{
result = 0LL;
if ( !strcmp(a1, "elf") )
{
*a2 = 2;
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(const char *a1, _DWORD *a2)
{
__int64 result; // rax

if ( !strcmp(a1, "gnu") )
{
*a2 = 0;
result = 1LL;
}
else if ( !strcmp(a1, "macho") )
{
*a2 = 1;
result = 1LL;
}
else
{
result = 0LL;
if ( !strcmp(a1, "elf") )
{
*a2 = 2;
result = 1LL;
}
}
return result;
}

original_code:
static int parse_abi(const char *in, enum abi *out)
{
 if(!strcmp(in, "gnu")){ *out = ABI_gnu; return 1; } if(!strcmp(in, "macho")){ *out = ABI_macho; return 1; } if(!strcmp(in, "elf")){ *out = ABI_elf; return 1; }
 return 0;
}

canonical_original_code:
static int parse_abi(char *in, enum abi *out)
{
 if(!strcmp(in, "gnu")){ *out = ABI_gnu; return 1; } if(!strcmp(in, "macho")){ *out = ABI_macho; return 1; } if(!strcmp(in, "elf")){ *out = ABI_elf; return 1; }
 return 0;
}

variable_types: enum abi { ABI_gnu=0, ABI_macho=1, ABI_elf=2 } *


decompiled_code:
__int64 __fastcall parse_sys(const void *a1, _DWORD *a2)
{
bool v4; // zf
__int64 result; // rax

if ( !strcmp((const char *)a1, "linux") )
{
*a2 = 0;
result = 1LL;
}
else if ( !strcmp((const char *)a1, "freebsd") )
{
*a2 = 1;
result = 1LL;
}
else if ( !memcmp(a1, "darwin", 6uLL) )
{
*a2 = 2;
result = 1LL;
}
else if ( !memcmp(a1, "macos", 5uLL) )
{
*a2 = 2;
result = 1LL;
}
else
{
v4 = memcmp(a1, "cygwin", 6uLL) == 0;
result = 0LL;
if ( v4 )
{
*a2 = 3;
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(const void *a1, _DWORD *a2)
{
bool v4; // zf
__int64 result; // rax

if ( !strcmp((const char *)a1, "linux") )
{
*a2 = 0;
result = 1LL;
}
else if ( !strcmp((const char *)a1, "freebsd") )
{
*a2 = 1;
result = 1LL;
}
else if ( !memcmp(a1, "darwin", 6uLL) )
{
*a2 = 2;
result = 1LL;
}
else if ( !memcmp(a1, "macos", 5uLL) )
{
*a2 = 2;
result = 1LL;
}
else
{
v4 = memcmp(a1, "cygwin", 6uLL) == 0;
result = 0LL;
if ( v4 )
{
*a2 = 3;
result = 1LL;
}
}
return result;
}

original_code:
static int parse_sys(const char *in, enum sys *out)
{
 if(!strcmp(in, "linux")){ *out = SYS_linux; return 1; } if(!strcmp(in, "freebsd")){ *out = SYS_freebsd; return 1; } if(!strncmp(in, "darwin", 6)){ *out = SYS_darwin; return 1; } if(!strncmp(in, "macos", 5)){ *out = SYS_darwin; return 1; } if(!strncmp(in, "cygwin", 6)){ *out = SYS_cygwin; return 1; }
 return 0;
}

canonical_original_code:
static int parse_sys(char *in, enum sys *out)
{
 if(!strcmp(in, "linux")){ *out = SYS_linux; return 1; } if(!strcmp(in, "freebsd")){ *out = SYS_freebsd; return 1; } if(!strncmp(in, "darwin", 6)){ *out = SYS_darwin; return 1; } if(!strncmp(in, "macos", 5)){ *out = SYS_darwin; return 1; } if(!strncmp(in, "cygwin", 6)){ *out = SYS_cygwin; return 1; }
 return 0;
}

variable_types: enum sys { SYS_linux=0, SYS_freebsd=1, SYS_darwin=2, SYS_cygwin=3 } *


decompiled_code:
unsigned __int64 __fastcall filter_unam(char *a1)
{
unsigned __int64 result; // rax
char *v2; // rbp
char v3; // bl
const __int32_t **v4; // rdx

result = (unsigned __int64)a1;
if ( !strcmp(a1 + 260, "amd64") )
strcpy(a1 + 260, "x86_64");
if ( !strcmp(a1 + 260, "i686") )
strcpy(a1 + 260, "i386");
v2 = a1;
v3 = *a1;
if ( *a1 )
{
v4 = _ctype_tolower_loc();
do
{
result = (unsigned int)(*v4)[v3];
*v2++ = result;
v3 = *v2;
}
while ( *v2 );
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func10(char *a1)
{
unsigned __int64 result; // rax
char *v2; // rbp
char v3; // bl
const __int32_t **v4; // rdx

result = (unsigned __int64)a1;
if ( !strcmp(a1 + 260, "amd64") )
strcpy(a1 + 260, "x86_64");
if ( !strcmp(a1 + 260, "i686") )
strcpy(a1 + 260, "i386");
v2 = a1;
v3 = *a1;
if ( *a1 )
{
v4 = _ctype_tolower_loc();
do
{
result = (unsigned int)(*v4)[v3];
*v2++ = result;
v3 = *v2;
}
while ( *v2 );
}
return result;
}

original_code:
static void filter_unam(struct utsname *unam)
{
 char *p;
 if(!strcmp(unam->machine, "amd64")) strcpy(unam->machine, "x86_64"); if(!strcmp(unam->machine, "i686")) strcpy(unam->machine, "i386");
 for(p = unam->sysname; *p; p++)
  *p = tolower(*p);
}

variable_types: struct utsname { char sysname[65]; char nodename[65]; char release[65]; char version[65]; char machine[65]; char __domainname[65]; } *

variable_types:
p
char *

return_type: void


decompiled_code:
__int64 __fastcall triple_parse(__int64 a1, int *a2, _QWORD *a3)
{
char *v4; // rax
char *v5; // rbx
int v6; // ebx
unsigned int v7; // er13
unsigned int v8; // er13
int v10; // [rsp+0h] [rbp-38h] BYREF
unsigned int v11; // [rsp+4h] [rbp-34h] BYREF
int v12; // [rsp+8h] [rbp-30h] BYREF
int v13[11]; // [rsp+Ch] [rbp-2Ch] BYREF

v4 = (char *)((__int64 (*)(void))ustrdup)();
v13[0] = -1;
v12 = -1;
v11 = -1;
v10 = -1;
v5 = strtok(v4, "-");
if ( v5 )
{
while ( 1 )
{
if ( !(unsigned int)parse_arch(v5, v13)
&& !(unsigned int)parse_vendor(v5, &v12)
&& !(unsigned int)parse_sys(v5, &v11) )
{
v8 = parse_abi(v5, &v10);
if ( !v8 )
break;
}
v5 = strtok(0LL, "-");
if ( !v5 )
goto LABEL_2;
}
*a3 = ustrdup(v5);
}
else
{
LABEL_2:
v6 = v13[0];
if ( v13[0] == -1 )
{
*a3 = "no arch";
v8 = 0;
}
else
{
v7 = v11;
if ( v11 == -1 )
{
*a3 = "no sys";
v8 = 0;
}
else
{
if ( v12 == -1 )
v12 = infer_vendor(v11);
if ( v10 == -1 )
v10 = infer_abi(v7);
*a2 = v6;
a2[1] = v12;
a2[2] = v7;
a2[3] = v10;
v8 = 1;
}
}
}
return v8;
}

original_code:
int triple_parse(const char *str, struct triple *triple, const char **const bad)
{
 char *dup = ustrdup(str);
 char *tok;
 enum arch arch = -1;
 enum vendor vendor = -1;
 enum sys sys = -1;
 enum abi abi = -1;
 for(tok = strtok(dup, "-"); tok; tok = strtok(((void *)0), "-")){
  if(parse_arch(tok, &arch))
   continue;
  if(parse_vendor(tok, &vendor))
   continue;
  if(parse_sys(tok, &sys))
   continue;
  if(parse_abi(tok, &abi))
   continue;
  *bad = ustrdup(tok);
  return 0;
 }
 if(arch == (enum arch)-1){
  *bad = "no arch";
  return 0;
 }
 if(sys == (enum sys)-1){
  *bad = "no sys";
  return 0;
 }
 if(vendor == (enum vendor)-1)
  vendor = infer_vendor(sys);
 if(abi == (enum abi)-1)
  abi = infer_abi(sys);
 triple->arch = arch;
 triple->vendor = vendor;
 triple->sys = sys;
 triple->abi = abi;
 return 1;
}

canonical_original_code:
int triple_parse(char *str, struct triple *triple, char **bad)
{
 char *dup = ustrdup(str);
 char *tok;
 enum arch arch = -1;
 enum vendor vendor = -1;
 enum sys sys = -1;
 enum abi abi = -1;
 for(tok = strtok(dup, "-"); tok; tok = strtok(((void *)0), "-")){
  if(parse_arch(tok, &arch))
   continue;
  if(parse_vendor(tok, &vendor))
   continue;
  if(parse_sys(tok, &sys))
   continue;
  if(parse_abi(tok, &abi))
   continue;
  *bad = ustrdup(tok);
  return 0;
 }
 if(arch == (enum arch)-1){
  *bad = "no arch";
  return 0;
 }
 if(sys == (enum sys)-1){
  *bad = "no sys";
  return 0;
 }
 if(vendor == (enum vendor)-1)
  vendor = infer_vendor(sys);
 if(abi == (enum abi)-1)
  abi = infer_abi(sys);
 triple->arch = arch;
 triple->vendor = vendor;
 triple->sys = sys;
 triple->abi = abi;
 return 1;
}

variable_types:
str
char *

variable_types: struct triple { enum arch { ARCH_x86_64=0, ARCH_i386=1 } arch; enum vendor { VENDOR_pc=0, VENDOR_apple=1 } vendor; enum sys { SYS_linux=0, SYS_freebsd=1, SYS_darwin=2, SYS_cygwin=3 } sys; enum abi { ABI_gnu=0, ABI_macho=1, ABI_elf=2 } abi; } *

variable_types:
bad
char **

variable_types:
dup
char *

variable_types:
tok
char *

user_defined_types: struct triple { enum arch arch; enum vendor vendor; enum sys sys; enum abi abi; }


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

v2 = abi_to_str(*(_DWORD *)(a1 + 12));
v3 = sys_to_str(*(_DWORD *)(a1 + 8));
if ( a2 )
{
v4 = vendor_to_str(*(_DWORD *)(a1 + 4));
v5 = "-";
}
else
{
v4 = (const char *)&unk_6C1;
v5 = (const char *)&unk_6C1;
}
v6 = arch_to_str(*(_DWORD *)a1);
snprintf(buf_0, 0x20uLL, "%s%s%s-%s-%s", v6, v5, v4, v3, v2);
return buf_0;
}

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

v2 = func5(*(_DWORD *)(a1 + 12));
v3 = func4(*(_DWORD *)(a1 + 8));
if ( a2 )
{
v4 = func3(*(_DWORD *)(a1 + 4));
v5 = "-";
}
else
{
v4 = (const char *)&unk_6C1;
v5 = (const char *)&unk_6C1;
}
v6 = func2(*(_DWORD *)a1);
snprintf(buf_0, 0x20uLL, "%s%s%s-%s-%s", v6, v5, v4, v3, v2);
return buf_0;
}

original_code:
char *triple_to_str(const struct triple *triple, int showvendor)
{
 static char buf[32];
 snprintf(buf, sizeof(buf), "%s%s%s-%s-%s",
   arch_to_str(triple->arch),
   showvendor ? "-" : "",
   showvendor ? vendor_to_str(triple->vendor) : "",
   sys_to_str(triple->sys),
   abi_to_str(triple->abi));
 return buf;
}

canonical_original_code:
char *triple_to_str(struct triple *triple, int showvendor)
{
 static char buf[32];
 snprintf(buf, sizeof(buf), "%s%s%s-%s-%s",
   arch_to_str(triple->arch),
   showvendor ? "-" : "",
   showvendor ? vendor_to_str(triple->vendor) : "",
   sys_to_str(triple->sys),
   abi_to_str(triple->abi));
 return buf;
}

variable_types: showvendor int

variable_types:
buf
char [32]

user_defined_types: enum arch { ARCH_x86_64=0, ARCH_i386=1 }

user_defined_types: enum vendor { VENDOR_pc=0, VENDOR_apple=1 }

user_defined_types: enum abi { ABI_gnu=0, ABI_macho=1, ABI_elf=2 }


decompiled_code:
__int64 __fastcall triple_default(_DWORD *a1, char **a2)
{
int v2; // edx
__int64 result; // rax
unsigned int v4; // ebx
struct utsname v5; // [rsp+0h] [rbp-1A8h] BYREF

if ( a2 )
*a2 = 0LL;
v2 = uname(&v5);
result = 0LL;
if ( !v2 )
{
filter_unam(v5.sysname);
result = parse_arch(v5.machine, a1);
if ( (_DWORD)result )
{
result = parse_sys(&v5, a1 + 2);
if ( (_DWORD)result )
{
v4 = a1[2];
a1[1] = infer_vendor(v4);
a1[3] = infer_abi(v4);
result = 1LL;
}
else if ( a2 )
{
*a2 = (char *)&v5;
}
}
else if ( a2 )
{
*a2 = v5.machine;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(_DWORD *a1, char **a2)
{
int v2; // edx
__int64 result; // rax
unsigned int v4; // ebx
struct utsname v5; // [rsp+0h] [rbp-1A8h] BYREF

if ( a2 )
*a2 = 0LL;
v2 = uname(&v5);
result = 0LL;
if ( !v2 )
{
func10(v5.sysname);
result = func6(v5.machine, a1);
if ( (_DWORD)result )
{
result = func9(&v5, a1 + 2);
if ( (_DWORD)result )
{
v4 = a1[2];
a1[1] = func0(v4);
a1[3] = func1(v4);
result = 1LL;
}
else if ( a2 )
{
*a2 = (char *)&v5;
}
}
else if ( a2 )
{
*a2 = v5.machine;
}
}
return result;
}

original_code:
int triple_default(struct triple *triple, const char **const unparsed)
{
 struct utsname unam;
 if(unparsed)
  *unparsed = ((void *)0);
 if(uname(&unam))
  return 0;
 filter_unam(&unam);
 if(!parse_arch(unam.machine, &triple->arch)){
  if(unparsed)
   *unparsed = unam.machine;
  return 0;
 }
 if(!parse_sys(unam.sysname, &triple->sys)){
  if(unparsed)
   *unparsed = unam.sysname;
  return 0;
 }
 triple->vendor = infer_vendor(triple->sys);
 triple->abi = infer_abi(triple->sys);
 return 1;
}

canonical_original_code:
int triple_default(struct triple *triple, char **unparsed)
{
 struct utsname unam;
 if(unparsed)
  *unparsed = ((void *)0);
 if(uname(&unam))
  return 0;
 filter_unam(&unam);
 if(!parse_arch(unam.machine, &triple->arch)){
  if(unparsed)
   *unparsed = unam.machine;
  return 0;
 }
 if(!parse_sys(unam.sysname, &triple->sys)){
  if(unparsed)
   *unparsed = unam.sysname;
  return 0;
 }
 triple->vendor = infer_vendor(triple->sys);
 triple->abi = infer_abi(triple->sys);
 return 1;
}

variable_types:
unparsed
char **

variable_types: struct utsname { char sysname[65]; char nodename[65]; char release[65]; char version[65]; char machine[65]; char __domainname[65]; }


decompiled_code:
const char *str_expr_struct()
{
return "member-access";
}

canonical_decompiled_code:
const char *func0()
{
return "member-access";
}

original_code:
const char *str_expr_struct(void)
{
 return "member-access";
}


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

if ( *(_DWORD *)a1 )
result = (unsigned int)(*(_DWORD *)a1 - 1) > 7;
else
result = *(_BYTE *)str_spc_skip(*(_QWORD *)(a1 + 8)) == 0;
return result;
}

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

if ( *(_DWORD *)a1 )
result = (unsigned int)(*(_DWORD *)a1 - 1) > 7;
else
result = *(_BYTE *)str_spc_skip(*(_QWORD *)(a1 + 8)) == 0;
return result;
}

original_code:
static int token_is_space(token *t)
{
 switch(t->tok){
  case TOKEN_WORD:
   if(*str_spc_skip(t->w))
    return 0;
   break;
  case TOKEN_OPEN_PAREN:
  case TOKEN_CLOSE_PAREN:
  case TOKEN_COMMA:
  case TOKEN_ELIPSIS:
  case TOKEN_STRING:
  case TOKEN_HASH_QUOTE:
  case TOKEN_HASH_JOIN:
  case TOKEN_OTHER:
   return 0;
 }
 return 1;
}

canonical_original_code:
static int token_is_space(struct token *t)
{
 switch(t->tok){
  case TOKEN_WORD:
   if(*str_spc_skip(t->w))
    return 0;
   break;
  case TOKEN_OPEN_PAREN:
  case TOKEN_CLOSE_PAREN:
  case TOKEN_COMMA:
  case TOKEN_ELIPSIS:
  case TOKEN_STRING:
  case TOKEN_HASH_QUOTE:
  case TOKEN_HASH_JOIN:
  case TOKEN_OTHER:
   return 0;
 }
 return 1;
}

variable_types: struct token { enum tok { TOKEN_WORD=0, TOKEN_OPEN_PAREN=1, TOKEN_CLOSE_PAREN=2, TOKEN_COMMA=3, TOKEN_ELIPSIS=4, TOKEN_STRING=5, TOKEN_HASH_QUOTE=6, TOKEN_HASH_JOIN=7, TOKEN_OTHER=8 } tok; char *w; int had_whitespace; } *

user_defined_types: struct token { enum tok tok; char *w; int had_whitespace; }


decompiled_code:
char *__fastcall tokens_join_n(unsigned int **a1, int a2)
{
unsigned int **v2; // rbx
unsigned int *v3; // rdi
bool v4; // r14
__int64 v5; // rbp
int v6; // er13
__int16 *v7; // rax
bool v8; // al
char *v9; // r13
unsigned int *v10; // rax
int v11; // ebp
__int16 *v12; // rax

v2 = a1;
v3 = *a1;
if ( v3 )
{
v4 = a2 == -1;
if ( a2 <= 0 && a2 != -1 )
{
v9 = (char *)umalloc(1LL);
*v9 = 0;
return v9;
}
v5 = 1LL;
v6 = 1;
while ( 1 )
{
v7 = token_str(v3);
v6 += strlen((const char *)v7) + 1;
v3 = v2[v5];
if ( !v3 )
break;
v8 = a2 > (int)v5++;
if ( !v4 && !v8 )
goto LABEL_7;
}
v9 = (char *)umalloc(v6);
*v9 = 0;
v10 = *v2;
if ( *v2 )
goto LABEL_13;
}
else
{
v6 = 1;
LABEL_7:
v9 = (char *)umalloc(v6);
*v9 = 0;
v10 = *v2;
if ( *v2 )
{
v4 = a2 == -1;
if ( a2 > 0 || a2 == -1 )
{
LABEL_13:
v11 = 0;
do
{
if ( v10[4] )
*(_WORD *)&v9[strlen(v9)] = 32;
v12 = token_str(*v2);
strcat(v9, (const char *)v12);
++v11;
v10 = *++v2;
}
while ( *v2 && (a2 > v11 || v4) );
return v9;
}
}
}
return v9;
}

original_code:
char *tokens_join_n(token **tokens, int lim)
{
 int i;
 int len;
 char *val;
 len = 1;
 for(i = 0; tokens[i] && (lim == -1 || i < lim); i++)
  len += 1 + strlen(token_str(tokens[i]));
 val = umalloc(len);
 *val = '\0';
 for(i = 0; tokens[i] && (lim == -1 || i < lim); i++){
  if(tokens[i]->had_whitespace)
   strcat(val, " ");
  strcat(val, token_str(tokens[i]));
 }
 return val;
}

canonical_original_code:
char *tokens_join_n(struct token **tokens, int lim)
{
 int i;
 int len;
 char *val;
 len = 1;
 for(i = 0; tokens[i] && (lim == -1 || i < lim); i++)
  len += 1 + strlen(token_str(tokens[i]));
 val = umalloc(len);
 *val = '\0';
 for(i = 0; tokens[i] && (lim == -1 || i < lim); i++){
  if(tokens[i]->had_whitespace)
   strcat(val, " ");
  strcat(val, token_str(tokens[i]));
 }
 return val;
}

variable_types: struct token { enum tok { TOKEN_WORD=0, TOKEN_OPEN_PAREN=1, TOKEN_CLOSE_PAREN=2, TOKEN_COMMA=3, TOKEN_ELIPSIS=4, TOKEN_STRING=5, TOKEN_HASH_QUOTE=6, TOKEN_HASH_JOIN=7, TOKEN_OTHER=8 } tok; char *w; int had_whitespace; } **

variable_types: lim int

variable_types: i int

variable_types: len int

variable_types:
val
char *


decompiled_code:
char *__fastcall tokens_join(unsigned int **a1)
{
return tokens_join_n(a1, -1);
}

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

original_code:
char *tokens_join(token **tokens)
{
 return tokens_join_n(tokens, -1);
}

canonical_original_code:
char *tokens_join(struct token **tokens)
{
 return tokens_join_n(tokens, -1);
}

user_defined_types: enum tok { TOKEN_WORD=0, TOKEN_OPEN_PAREN=1, TOKEN_CLOSE_PAREN=2, TOKEN_COMMA=3, TOKEN_ELIPSIS=4, TOKEN_STRING=5, TOKEN_HASH_QUOTE=6, TOKEN_HASH_JOIN=7, TOKEN_OTHER=8 }


decompiled_code:
void __fastcall tokens_free(void *ptr)
{
void **v1; // rax
void **v2; // rbx

if ( ptr )
{
v1 = *(void ***)ptr;
if ( *(_QWORD *)ptr )
{
v2 = (void **)ptr;
do
{
free(v1[1]);
free(*v2++);
v1 = (void **)*v2;
}
while ( *v2 );
}
free(ptr);
}
}

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

if ( ptr )
{
v1 = *(void ***)ptr;
if ( *(_QWORD *)ptr )
{
v2 = (void **)ptr;
do
{
free(v1[1]);
free(*v2++);
v1 = (void **)*v2;
}
while ( *v2 );
}
free(ptr);
}
}

original_code:
void tokens_free(token **tokens)
{
 int i;
 if(!tokens)
  return;
 for(i = 0; tokens[i]; i++){
  free(tokens[i]->w);
  free(tokens[i]);
 }
 free(tokens);
}

canonical_original_code:
void tokens_free(struct token **tokens)
{
 int i;
 if(!tokens)
  return;
 for(i = 0; tokens[i]; i++){
  free(tokens[i]->w);
  free(tokens[i]);
 }
 free(tokens);
}


decompiled_code:
_BOOL8 __fastcall tokens_just_whitespace(__int64 *a1)
{
return tokens_skip_whitespace(a1) == 0LL;
}

canonical_decompiled_code:
_BOOL8 __fastcall func5(__int64 *a1)
{
return tokens_skip_whitespace(a1) == 0LL;
}

original_code:
int tokens_just_whitespace(token **tokens)
{
 return tokens_skip_whitespace(tokens) ? 0 : 1;
}

canonical_original_code:
int tokens_just_whitespace(struct token **tokens)
{
 return tokens_skip_whitespace(tokens) ? 0 : 1;
}


decompiled_code:
__int64 __fastcall tokens_count_skip_spc(__int64 *a1)
{
__int64 *v1; // rbx
unsigned int v2; // ebp

v1 = a1;
v2 = 0;
if ( a1 )
{
while ( *v1 )
v2 += !token_is_space(*v1++);
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 *a1)
{
__int64 *v1; // rbx
unsigned int v2; // ebp

v1 = a1;
v2 = 0;
if ( a1 )
{
while ( *v1 )
v2 += !func0(*v1++);
}
return v2;
}

original_code:
int tokens_count_skip_spc(token **tokens)
{
 unsigned n = 0;
 for(; tokens && *tokens; tokens++)
  if(!token_is_space(*tokens))
   n++;
 return n;
}

canonical_original_code:
int tokens_count_skip_spc(struct token **tokens)
{
 unsigned int n = 0;
 for(; tokens && *tokens; tokens++)
  if(!token_is_space(*tokens))
   n++;
 return n;
}

variable_types:
n
unsigned int


decompiled_code:
_BOOL8 __fastcall section_is_builtin(__int64 a1)
{
int v1; // eax
_BOOL4 v2; // edx

v1 = *(_DWORD *)(a1 + 8);
if ( v1 == -1 )
_assert_fail("sec->builtin != SECTION_UNINIT", "out/section.c", 0x1Du, "section_is_builtin");
v2 = 0;
if ( (unsigned int)(v1 + 3) > 1 )
v2 = *(_QWORD *)a1 == 0LL;
return v2;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(__int64 a1)
{
int v1; // eax
_BOOL4 v2; // edx

v1 = *(_DWORD *)(a1 + 8);
if ( v1 == -1 )
_assert_fail("sec->builtin != SECTION_UNINIT", "out/section.c", 0x1Du, "section_is_builtin");
v2 = 0;
if ( (unsigned int)(v1 + 3) > 1 )
v2 = *(_QWORD *)a1 == 0LL;
return v2;
}

original_code:
int section_is_builtin(const struct section *sec)
{
 ((sec->builtin != -1) ? (void) (0) : __assert_fail ("sec->builtin != SECTION_UNINIT", "out/section.c", 29, __extension__ __PRETTY_FUNCTION__));
 switch(sec->builtin){
  case -2:
  case -3:
   return 0;
  default:
   return !sec->name;
 }
}

canonical_original_code:
int section_is_builtin(struct section *sec)
{
 ((sec->builtin != -1) ? (void) (0) : __assert_fail ("sec->builtin != SECTION_UNINIT", "out/section.c", 29, __extension__ __PRETTY_FUNCTION__));
 switch(sec->builtin){
  case -2:
  case -3:
   return 0;
  default:
   return !sec->name;
 }
}

variable_types: struct section { char *name; int builtin; enum section_flags { SECTION_FLAG_EXECUTABLE=expr, SECTION_FLAG_RO=expr } flags; } *

user_defined_types: struct section { char *name; int builtin; enum section_flags flags; }


decompiled_code:
__int64 __fastcall section_name(__int64 a1, _DWORD *a2)
{
int v2; // ebx
__int64 result; // rax
const char *v4; // rsi

*a2 = 0;
v2 = *(_DWORD *)(a1 + 8);
if ( v2 == -1 )
_assert_fail("sec->builtin != SECTION_UNINIT", "out/section.c", 0x2Bu, "section_name");
if ( (unsigned int)(v2 + 3) <= 1 )
{
*a2 = 1;
if ( *(_DWORD *)(a1 + 8) == -2 )
v4 = (const char *)*cc1_target_details;
else
v4 = *(const char **)(cc1_target_details + 8LL);
result = ustrprintf("%s.%s", v4, *(const char **)a1);
}
else
{
result = *(_QWORD *)a1;
if ( !*(_QWORD *)a1 )
{
if ( !section_is_builtin(a1) )
_assert_fail("section_is_builtin(sec)", "out/section.c", 0x3Au, "section_name");
switch ( v2 )
{
case 0:
result = *cc1_target_details;
break;
case 1:
result = *(_QWORD *)(cc1_target_details + 8LL);
break;
case 2:
result = *(_QWORD *)(cc1_target_details + 16LL);
break;
case 3:
result = *(_QWORD *)(cc1_target_details + 24LL);
break;
case 4:
result = *(_QWORD *)(cc1_target_details + 32LL);
break;
case 5:
result = *(_QWORD *)(cc1_target_details + 40LL);
break;
case 6:
result = *(_QWORD *)(cc1_target_details + 48LL);
break;
case 7:
result = *(_QWORD *)(cc1_target_details + 56LL);
break;
case 8:
result = *(_QWORD *)(cc1_target_details + 64LL);
break;
case 9:
result = *(_QWORD *)(cc1_target_details + 72LL);
break;
default:
_assert_fail("0 && \"unreachable\"", "out/section.c", 0x48u, "section_name");
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, _DWORD *a2)
{
int v2; // ebx
__int64 result; // rax
const char *v4; // rsi

*a2 = 0;
v2 = *(_DWORD *)(a1 + 8);
if ( v2 == -1 )
_assert_fail("sec->builtin != SECTION_UNINIT", "out/section.c", 0x2Bu, "section_name");
if ( (unsigned int)(v2 + 3) <= 1 )
{
*a2 = 1;
if ( *(_DWORD *)(a1 + 8) == -2 )
v4 = (const char *)*cc1_target_details;
else
v4 = *(const char **)(cc1_target_details + 8LL);
result = ustrprintf("%s.%s", v4, *(const char **)a1);
}
else
{
result = *(_QWORD *)a1;
if ( !*(_QWORD *)a1 )
{
if ( !func1(a1) )
_assert_fail("section_is_builtin(sec)", "out/section.c", 0x3Au, "section_name");
switch ( v2 )
{
case 0:
result = *cc1_target_details;
break;
case 1:
result = *(_QWORD *)(cc1_target_details + 8LL);
break;
case 2:
result = *(_QWORD *)(cc1_target_details + 16LL);
break;
case 3:
result = *(_QWORD *)(cc1_target_details + 24LL);
break;
case 4:
result = *(_QWORD *)(cc1_target_details + 32LL);
break;
case 5:
result = *(_QWORD *)(cc1_target_details + 40LL);
break;
case 6:
result = *(_QWORD *)(cc1_target_details + 48LL);
break;
case 7:
result = *(_QWORD *)(cc1_target_details + 56LL);
break;
case 8:
result = *(_QWORD *)(cc1_target_details + 64LL);
break;
case 9:
result = *(_QWORD *)(cc1_target_details + 72LL);
break;
default:
_assert_fail("0 && \"unreachable\"", "out/section.c", 0x48u, "section_name");
}
}
}
return result;
}

original_code:
char *section_name(const struct section *sec, int *const allocated)
{
 *allocated = 0;
 ((sec->builtin != -1) ? (void) (0) : __assert_fail ("sec->builtin != SECTION_UNINIT", "out/section.c", 43, __extension__ __PRETTY_FUNCTION__));
 if(sec->builtin == -2 || sec->builtin == -3){
  *allocated = 1;
  return ustrprintf(
    "%s.%s",
    sec->builtin == -2
    ? cc1_target_details.section_names->section_name_text
    : cc1_target_details.section_names->section_name_data,
    sec->name);
 }
 if(sec->name)
  return (char *)sec->name;
 ((section_is_builtin(sec)) ? (void) (0) : __assert_fail ("section_is_builtin(sec)", "out/section.c", 58, __extension__ __PRETTY_FUNCTION__));
 switch((enum section_builtin)sec->builtin){
  case SECTION_TEXT: return (char *)cc1_target_details.section_names->section_name_text;
  case SECTION_DATA: return (char *)cc1_target_details.section_names->section_name_data;
  case SECTION_BSS: return (char *)cc1_target_details.section_names->section_name_bss;
  case SECTION_RODATA: return (char *)cc1_target_details.section_names->section_name_rodata;
  case SECTION_RELRO: return (char *)cc1_target_details.section_names->section_name_relro;
  case SECTION_CTORS: return (char *)cc1_target_details.section_names->section_name_ctors;
  case SECTION_DTORS: return (char *)cc1_target_details.section_names->section_name_dtors;
  case SECTION_DBG_ABBREV: return (char *)cc1_target_details.section_names->section_name_dbg_abbrev;
  case SECTION_DBG_INFO: return (char *)cc1_target_details.section_names->section_name_dbg_info;
  case SECTION_DBG_LINE: return (char *)cc1_target_details.section_names->section_name_dbg_line;
 }
 ((0 && "unreachable") ? (void) (0) : __assert_fail ("0 && \"unreachable\"", "out/section.c", 72, __extension__ __PRETTY_FUNCTION__));
 return ((void *)0);
}

canonical_original_code:
char *section_name(struct section *sec, int *allocated)
{
 *allocated = 0;
 ((sec->builtin != -1) ? (void) (0) : __assert_fail ("sec->builtin != SECTION_UNINIT", "out/section.c", 43, __extension__ __PRETTY_FUNCTION__));
 if(sec->builtin == -2 || sec->builtin == -3){
  *allocated = 1;
  return ustrprintf(
    "%s.%s",
    sec->builtin == -2
    ? cc1_target_details.section_names->section_name_text
    : cc1_target_details.section_names->section_name_data,
    sec->name);
 }
 if(sec->name)
  return (char *)sec->name;
 ((section_is_builtin(sec)) ? (void) (0) : __assert_fail ("section_is_builtin(sec)", "out/section.c", 58, __extension__ __PRETTY_FUNCTION__));
 switch((enum section_builtin)sec->builtin){
  case SECTION_TEXT: return (char *)cc1_target_details.section_names->section_name_text;
  case SECTION_DATA: return (char *)cc1_target_details.section_names->section_name_data;
  case SECTION_BSS: return (char *)cc1_target_details.section_names->section_name_bss;
  case SECTION_RODATA: return (char *)cc1_target_details.section_names->section_name_rodata;
  case SECTION_RELRO: return (char *)cc1_target_details.section_names->section_name_relro;
  case SECTION_CTORS: return (char *)cc1_target_details.section_names->section_name_ctors;
  case SECTION_DTORS: return (char *)cc1_target_details.section_names->section_name_dtors;
  case SECTION_DBG_ABBREV: return (char *)cc1_target_details.section_names->section_name_dbg_abbrev;
  case SECTION_DBG_INFO: return (char *)cc1_target_details.section_names->section_name_dbg_info;
  case SECTION_DBG_LINE: return (char *)cc1_target_details.section_names->section_name_dbg_line;
 }
 ((0 && "unreachable") ? (void) (0) : __assert_fail ("0 && \"unreachable\"", "out/section.c", 72, __extension__ __PRETTY_FUNCTION__));
 return ((void *)0);
}

variable_types:
allocated
int *

user_defined_types: enum section_builtin { SECTION_TEXT=0, SECTION_DATA=1, SECTION_BSS=2, SECTION_RODATA=3, SECTION_RELRO=4, SECTION_CTORS=5, SECTION_DTORS=6, SECTION_DBG_ABBREV=7, SECTION_DBG_INFO=8, SECTION_DBG_LINE=9 }

user_defined_types: enum section_flags { SECTION_FLAG_EXECUTABLE=expr, SECTION_FLAG_RO=expr }


decompiled_code:
int __fastcall section_cmp(__int64 a1, __int64 a2)
{
int v2; // ebx
int v3; // eax

v2 = to_type(a1);
v3 = to_type(a2);
if ( v2 != v3 )
return v2 - v3;
if ( !v2 )
return *(_DWORD *)(a1 + 8) - *(_DWORD *)(a2 + 8);
if ( (unsigned int)(v2 - 1) > 1 )
_assert_fail("0", "out/section.c", 0x6Cu, "section_cmp");
return strcmp(*(const char **)a1, *(const char **)a2);
}

canonical_decompiled_code:
int __fastcall func3(__int64 a1, __int64 a2)
{
int v2; // ebx
int v3; // eax

v2 = func0(a1);
v3 = func0(a2);
if ( v2 != v3 )
return v2 - v3;
if ( !v2 )
return *(_DWORD *)(a1 + 8) - *(_DWORD *)(a2 + 8);
if ( (unsigned int)(v2 - 1) > 1 )
_assert_fail("0", "out/section.c", 0x6Cu, "section_cmp");
return strcmp(*(const char **)a1, *(const char **)a2);
}

original_code:
int section_cmp(const struct section *a, const struct section *b)
{
 enum section_cmp_type a_type = to_type(a), b_type = to_type(b);
 if(a_type != b_type)
  return a_type - b_type;
 switch(a_type){
  case NAMED:
  case FUNCDATA:
   return strcmp(a->name, b->name);
  case BUILTIN:
   return a->builtin - b->builtin;
 }
 ((0) ? (void) (0) : __assert_fail ("0", "out/section.c", 108, __extension__ __PRETTY_FUNCTION__));
}

canonical_original_code:
int section_cmp(struct section *a, struct section *b)
{
 enum section_cmp_type a_type = to_type(a); enum section_cmp_type b_type = to_type(b);
 if(a_type != b_type)
  return a_type - b_type;
 switch(a_type){
  case NAMED:
  case FUNCDATA:
   return strcmp(a->name, b->name);
  case BUILTIN:
   return a->builtin - b->builtin;
 }
 ((0) ? (void) (0) : __assert_fail ("0", "out/section.c", 108, __extension__ __PRETTY_FUNCTION__));
}

variable_types:
b
struct section *

variable_types: enum section_cmp_type { BUILTIN=0, FUNCDATA=1, NAMED=2 }


decompiled_code:
_BOOL8 __fastcall section_eq(__int64 a1, __int64 a2)
{
return section_cmp(a1, a2) == 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func4(__int64 a1, __int64 a2)
{
return func3(a1, a2) == 0;
}

original_code:
int section_eq(const struct section *a, const struct section *b)
{
 return !section_cmp(a, b);
}

canonical_original_code:
int section_eq(struct section *a, struct section *b)
{
 return !section_cmp(a, b);
}


decompiled_code:
__int64 __fastcall section_hash(_QWORD *a1)
{
int v1; // eax
__int64 result; // rax
__int64 v3; // rdi
int v4[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v1 = to_type((__int64)a1);
if ( v1 )
{
if ( (unsigned int)(v1 - 1) > 1 )
_assert_fail("0", "out/section.c", 0x84u, "section_hash");
result = v1 ^ (unsigned int)dynmap_strhash(*a1);
}
else
{
v3 = section_name((__int64)a1, v4);
if ( v4[0] )
_assert_fail("!alloc", "out/section.c", 0x7Cu, "section_hash");
result = dynmap_strhash(v3);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(_QWORD *a1)
{
int v1; // eax
__int64 result; // rax
__int64 v3; // rdi
int v4[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v1 = func0((__int64)a1);
if ( v1 )
{
if ( (unsigned int)(v1 - 1) > 1 )
_assert_fail("0", "out/section.c", 0x84u, "section_hash");
result = v1 ^ (unsigned int)dynmap_strhash(*a1);
}
else
{
v3 = func2((__int64)a1, v4);
if ( v4[0] )
_assert_fail("!alloc", "out/section.c", 0x7Cu, "section_hash");
result = dynmap_strhash(v3);
}
return result;
}

original_code:
int section_hash(const struct section *sec)
{
 enum section_cmp_type t = to_type(sec);
 switch(t){
  case BUILTIN:
  {
   int alloc;
   const char *str = section_name(sec, &alloc);
   ((!alloc) ? (void) (0) : __assert_fail ("!alloc", "out/section.c", 124, __extension__ __PRETTY_FUNCTION__));
   return t ^ dynmap_strhash(str);
  }
  case FUNCDATA:
  case NAMED:
   return t ^ dynmap_strhash(sec->name);
 }
 ((0) ? (void) (0) : __assert_fail ("0", "out/section.c", 132, __extension__ __PRETTY_FUNCTION__));
}

canonical_original_code:
int section_hash(struct section *sec)
{
 enum section_cmp_type t = to_type(sec);
 switch(t){
  case BUILTIN:
  {
   int alloc;
   char *str = section_name(sec, &alloc);
   ((!alloc) ? (void) (0) : __assert_fail ("!alloc", "out/section.c", 124, __extension__ __PRETTY_FUNCTION__));
   return t ^ dynmap_strhash(str);
  }
  case FUNCDATA:
  case NAMED:
   return t ^ dynmap_strhash(sec->name);
 }
 ((0) ? (void) (0) : __assert_fail ("0", "out/section.c", 132, __extension__ __PRETTY_FUNCTION__));
}

variable_types: alloc int

variable_types:
str
char *

user_defined_types: enum section_cmp_type { BUILTIN=0, FUNCDATA=1, NAMED=2 }


decompiled_code:
_BOOL8 __fastcall is_op(char a1)
{
_BOOL8 result; // rax

if ( a1 < -2 )
return a1 > -11;
if ( (unsigned __int8)(a1 - 33) > 0x5Du )
return 0LL;
switch ( a1 )
{
case '!':
case '%':
case '&':
case '*':
case '+':
case '-':
case '/':
case '<':
case '>':
case '?':
case '^':
case '|':
case '~':
result = 1LL;
break;
default:
result = 0LL;
break;
}
return result;
}

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

if ( a1 < -2 )
return a1 > -11;
if ( (unsigned __int8)(a1 - 33) > 0x5Du )
return 0LL;
switch ( a1 )
{
case '!':
case '%':
case '&':
case '*':
case '+':
case '-':
case '/':
case '<':
case '>':
case '?':
case '^':
case '|':
case '~':
result = 1LL;
break;
default:
result = 0LL;
break;
}
return result;
}

original_code:
static int is_op(e_op op)
{
 switch(op){
  case tok_multiply: case tok_divide: case tok_modulus:
  case tok_plus: case tok_minus: case tok_xor:
  case tok_or: case tok_and: case tok_orsc:
  case tok_andsc: case tok_shiftl: case tok_shiftr:
  case tok_not: case tok_bnot: case tok_eq:
  case tok_ne: case tok_le: case tok_lt:
  case tok_ge: case tok_gt: case tok_question:
   return 1;
 }
 return 0;
}

canonical_original_code:
static int is_op(char op)
{
 switch(op){
  case tok_multiply: case tok_divide: case tok_modulus:
  case tok_plus: case tok_minus: case tok_xor:
  case tok_or: case tok_and: case tok_orsc:
  case tok_andsc: case tok_shiftl: case tok_shiftr:
  case tok_not: case tok_bnot: case tok_eq:
  case tok_ne: case tok_le: case tok_lt:
  case tok_ge: case tok_gt: case tok_question:
   return 1;
 }
 return 0;
}

variable_types: op char


original_code:
static void expr_init(void)
{
 static int init = 0;
 unsigned i;
 if(init)
  return;
 init = 1;
 for(i = 0; i < (sizeof(preds) / sizeof((preds)[0])); i++)
  preds[i] = 20;
 preds[tok_multiply - -10] = 1;
 preds[tok_divide - -10] = 1;
 preds[tok_modulus - -10] = 1;
 preds[tok_plus - -10] = 2;
 preds[tok_minus - -10] = 2;
 preds[tok_shiftl - -10] = 3;
 preds[tok_shiftr - -10] = 3;
 preds[tok_le - -10] = 4;
 preds[tok_lt - -10] = 4;
 preds[tok_ge - -10] = 4;
 preds[tok_gt - -10] = 4;
 preds[tok_eq - -10] = 5;
 preds[tok_ne - -10] = 5;
 preds[tok_and - -10] = 6;
 preds[tok_xor - -10] = 7;
 preds[tok_or - -10] = 8;
 preds[tok_andsc - -10] = 9;
 preds[tok_orsc - -10] = 10;
 preds[tok_question - -10] = 11;
}

canonical_original_code:
static void expr_init()
{
 static int init = 0;
 unsigned int i;
 if(init)
  return;
 init = 1;
 for(i = 0; i < (sizeof(preds) / sizeof((preds)[0])); i++)
  preds[i] = 20;
 preds[tok_multiply - -10] = 1;
 preds[tok_divide - -10] = 1;
 preds[tok_modulus - -10] = 1;
 preds[tok_plus - -10] = 2;
 preds[tok_minus - -10] = 2;
 preds[tok_shiftl - -10] = 3;
 preds[tok_shiftr - -10] = 3;
 preds[tok_le - -10] = 4;
 preds[tok_lt - -10] = 4;
 preds[tok_ge - -10] = 4;
 preds[tok_gt - -10] = 4;
 preds[tok_eq - -10] = 5;
 preds[tok_ne - -10] = 5;
 preds[tok_and - -10] = 6;
 preds[tok_xor - -10] = 7;
 preds[tok_or - -10] = 8;
 preds[tok_andsc - -10] = 9;
 preds[tok_orsc - -10] = 10;
 preds[tok_question - -10] = 11;
}

variable_types: init int

variable_types:
i
unsigned int


decompiled_code:
_DWORD *expr_ident()
{
return expr_new(0);
}

canonical_decompiled_code:
_DWORD *func2()
{
return expr_new(0);
}

original_code:
static expr *expr_ident(void)
{
 expr *e = expr_new(E_IDENT);
 return e;
}

canonical_original_code:
static struct expr *expr_ident()
{
 struct expr *e = expr_new(E_IDENT);
 return e;
}

variable_types: struct expr { enum { E_IDENT=0, E_NUM=1, E_OP=2, E_UOP=3, E_TOP=4 } type; union { long num; struct { char op; struct expr *lhs; } op; struct { char op; struct expr *e; } uop; struct { struct expr *e; } top; } bits; } *


decompiled_code:
void *__fastcall parse_rhs(void *a1, int a2)
{
__int64 v3; // rbp
__int64 v4; // rax
__int64 v5; // rdx
char v6; // r13
int v7; // er14

while ( 1 )
{
v6 = tok_cur;
LODWORD(v3) = tok_cur;
if ( !is_op(tok_cur) )
return a1;
v7 = preds[(int)v3 + 10];
if ( v7 > a2 )
return a1;
tok_next();
if ( v6 == 63 )
{
v3 = parse();
if ( tok_cur != 58 )
{
--loc_tok;
die_at(0LL, "colon expected for ternary-? operator");
goto LABEL_5;
}
tok_next();
v4 = parse();
a1 = expr_new_top((__int64)a1, v3, v4);
}
else
{
v5 = parse_primary();
if ( v7 > preds[tok_cur + 10] )
v5 = parse_rhs(v5);
LABEL_5:
a1 = expr_op(v3, (__int64)a1, v5);
}
}
}

canonical_decompiled_code:
void *__fastcall func3(void *a1, int a2)
{
__int64 v3; // rbp
__int64 v4; // rax
__int64 v5; // rdx
char v6; // r13
int v7; // er14

while ( 1 )
{
v6 = tok_cur;
LODWORD(v3) = tok_cur;
if ( !func0(tok_cur) )
return a1;
v7 = preds[(int)v3 + 10];
if ( v7 > a2 )
return a1;
tok_next();
if ( v6 == 63 )
{
v3 = func4();
if ( tok_cur != 58 )
{
--loc_tok;
die_at(0LL, "colon expected for ternary-? operator");
goto LABEL_5;
}
tok_next();
v4 = func4();
a1 = expr_new_top((__int64)a1, v3, v4);
}
else
{
v5 = func5();
if ( v7 > preds[tok_cur + 10] )
v5 = func3(v5);
LABEL_5:
a1 = expr_op(v3, (__int64)a1, v5);
}
}
}

original_code:
static expr *parse_rhs(expr *lhs, int priority)
{
 for(;;){
    int this_pri, next_pri;
  e_op op;
  expr *rhs;
  op = tok_cur;
  if(!is_op(op))
   return lhs;
  this_pri = preds[op - -10];
    if(this_pri > priority)
      return lhs;
  tok_next();
  if(op == tok_question){
   expr *if_t = parse();
   if(tok_cur != tok_colon)
    do{ if(0 == 0 || 0 & wmode){ loc_tok.line--; die_at(((void *)0), "colon expected for ternary-? operator"); loc_tok.line++; } }while(0);
   tok_next();
   rhs = parse();
   lhs = expr_new_top(lhs, if_t, rhs);
  }else{
   rhs = parse_primary();
   next_pri = preds[tok_cur - -10];
   if(next_pri < this_pri) {
    rhs = parse_rhs(rhs, next_pri);
   }
   lhs = expr_op(op, lhs, rhs);
  }
  }
}

canonical_original_code:
static struct expr *parse_rhs(struct expr *lhs, int priority)
{
 for(;;){
    int this_pri; int next_pri;
  char op;
  struct expr *rhs;
  op = tok_cur;
  if(!is_op(op))
   return lhs;
  this_pri = preds[op - -10];
    if(this_pri > priority)
      return lhs;
  tok_next();
  if(op == tok_question){
   struct expr *if_t = parse();
   if(tok_cur != tok_colon)
    do{ if(0 == 0 || 0 & wmode){ loc_tok.line--; die_at(((void *)0), "colon expected for ternary-? operator"); loc_tok.line++; } }while(0);
   tok_next();
   rhs = parse();
   lhs = expr_new_top(lhs, if_t, rhs);
  }else{
   rhs = parse_primary();
   next_pri = preds[tok_cur - -10];
   if(next_pri < this_pri) {
    rhs = parse_rhs(rhs, next_pri);
   }
   lhs = expr_op(op, lhs, rhs);
  }
  }
}

variable_types:
lhs
struct expr *

variable_types: priority int

return_type: struct expr { enum { E_IDENT=0, E_NUM=1, E_OP=2, E_UOP=3, E_TOP=4 } type; union { long num; struct { char op; struct expr *lhs; } op; struct { char op; struct expr *e; } uop; struct { struct expr *e; } top; } bits; } *


parse

decompiled_code:
void *parse()
{
void *v0; // rax

v0 = (void *)parse_primary();
return parse_rhs(v0, 20);
}

canonical_decompiled_code:
void *func4()
{
void *v0; // rax

v0 = (void *)func5();
return func3(v0, 20);
}

original_code:
static expr *parse(void)
{
  return parse_rhs(parse_primary(), 20);
}

canonical_original_code:
static struct expr *parse()
{
  return parse_rhs(parse_primary(), 20);
}

user_defined_types: struct expr { enum { E_IDENT=0, E_NUM=1, E_OP=2, E_UOP=3, E_TOP=4 } type; union { long num; struct { char op; struct expr *lhs; } op; struct { char op; struct expr *e; } uop; struct { struct expr *e; } top; } bits; }


decompiled_code:
_DWORD *parse_primary()
{
char v0; // bl
__int64 v1; // rax
void *v2; // rbx
const char *v3; // rdx
char v5; // [rsp+Eh] [rbp-Ah] BYREF
char v6; // [rsp+Fh] [rbp-9h]

v0 = tok_cur;
if ( tok_cur == -1 )
goto LABEL_14;
if ( tok_cur < 0 )
{
if ( tok_cur == -2 )
{
tok_next();
return expr_num(tok_cur_num);
}
LABEL_20:
v5 = tok_cur;
v6 = 0;
--loc_tok;
v3 = &v5;
goto LABEL_13;
}
if ( tok_cur == 40 )
{
tok_next();
v2 = parse();
if ( tok_cur == 41 )
{
tok_next();
return v2;
}
--loc_tok;
die_at(0LL, "close paren expected");
goto LABEL_19;
}
if ( tok_cur > 40 )
{
if ( tok_cur == 45 || tok_cur == 126 )
goto LABEL_7;
goto LABEL_20;
}
if ( tok_cur != 33 )
{
v5 = tok_cur;
v6 = 0;
--loc_tok;
if ( !tok_cur )
{
v3 = "eof";
LABEL_13:
die_at(0LL, "expression expected (got %s)", v3);
LABEL_14:
tok_next();
return expr_ident();
}
LABEL_19:
v3 = &v5;
goto LABEL_13;
}
LABEL_7:
tok_next();
v1 = parse_primary();
return expr_new_uop(v0, v1);
}

canonical_decompiled_code:
_DWORD *func5()
{
char v0; // bl
__int64 v1; // rax
void *v2; // rbx
const char *v3; // rdx
char v5; // [rsp+Eh] [rbp-Ah] BYREF
char v6; // [rsp+Fh] [rbp-9h]

v0 = tok_cur;
if ( tok_cur == -1 )
goto LABEL_14;
if ( tok_cur < 0 )
{
if ( tok_cur == -2 )
{
tok_next();
return expr_num(tok_cur_num);
}
LABEL_20:
v5 = tok_cur;
v6 = 0;
--loc_tok;
v3 = &v5;
goto LABEL_13;
}
if ( tok_cur == 40 )
{
tok_next();
v2 = func4();
if ( tok_cur == 41 )
{
tok_next();
return v2;
}
--loc_tok;
die_at(0LL, "close paren expected");
goto LABEL_19;
}
if ( tok_cur > 40 )
{
if ( tok_cur == 45 || tok_cur == 126 )
goto LABEL_7;
goto LABEL_20;
}
if ( tok_cur != 33 )
{
v5 = tok_cur;
v6 = 0;
--loc_tok;
if ( !tok_cur )
{
v3 = "eof";
LABEL_13:
die_at(0LL, "expression expected (got %s)", v3);
LABEL_14:
tok_next();
return func2();
}
LABEL_19:
v3 = &v5;
goto LABEL_13;
}
LABEL_7:
tok_next();
v1 = func5();
return expr_new_uop(v0, v1);
}

original_code:
static expr *parse_primary(void)
{
 switch(tok_cur){
  case tok_ident: tok_next(); return expr_ident();
  case tok_num: tok_next(); return expr_num(tok_cur_num);
  case tok_lparen:
  {
   expr *e;
   tok_next();
   e = parse();
   if(tok_cur != tok_rparen)
    do{ if(0 == 0 || 0 & wmode){ loc_tok.line--; die_at(((void *)0), "close paren expected"); loc_tok.line++; } }while(0);
   tok_next();
   return e;
  }
  case tok_not:
  case tok_bnot:
  case tok_minus:
  {
   const e_op op = tok_cur;
   tok_next();
   return expr_new_uop(op, parse_primary());
  }
  default:
   break;
 }
 {
  char s[2];
  *s = tok_cur, s[1] = '\0';
  do{ if(0 == 0 || 0 & wmode){ loc_tok.line--; die_at(((void *)0), "expression expected (got %s)", tok_cur == tok_eof ? "eof" : s); loc_tok.line++; } }while(0);
 }
}

canonical_original_code:
static struct expr *parse_primary()
{
 switch(tok_cur){
  case tok_ident: tok_next(); return expr_ident();
  case tok_num: tok_next(); return expr_num(tok_cur_num);
  case tok_lparen:
  {
   struct expr *e;
   tok_next();
   e = parse();
   if(tok_cur != tok_rparen)
    do{ if(0 == 0 || 0 & wmode){ loc_tok.line--; die_at(((void *)0), "close paren expected"); loc_tok.line++; } }while(0);
   tok_next();
   return e;
  }
  case tok_not:
  case tok_bnot:
  case tok_minus:
  {
   char op = tok_cur;
   tok_next();
   return expr_new_uop(op, parse_primary());
  }
  default:
   break;
 }
 {
  char s[2];
  *s = tok_cur, s[1] = '\0';
  do{ if(0 == 0 || 0 & wmode){ loc_tok.line--; die_at(((void *)0), "expression expected (got %s)", tok_cur == tok_eof ? "eof" : s); loc_tok.line++; } }while(0);
 }
}

variable_types:
s
char [2]


decompiled_code:
__int64 __fastcall expr_parse(__int64 a1)
{
void *v1; // rax
__int64 v2; // rbx
__int64 result; // rax
const char *v4; // rax

expr_init();
debug_push_line(a1);
tok_begin(a1);
tok_next();
v1 = parse();
if ( tok_cur )
{
--loc_tok;
v4 = (const char *)tok_last();
die_at(0LL, "'%s' at end of expression", v4);
result = expr_eval();
}
else
{
v2 = (__int64)v1;
debug_pop_line();
result = v2;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
void *v1; // rax
__int64 v2; // rbx
__int64 result; // rax
const char *v4; // rax

func1();
debug_push_line(a1);
tok_begin(a1);
tok_next();
v1 = func4();
if ( tok_cur )
{
--loc_tok;
v4 = (const char *)tok_last();
die_at(0LL, "'%s' at end of expression", v4);
result = func7();
}
else
{
v2 = (__int64)v1;
debug_pop_line();
result = v2;
}
return result;
}

original_code:
expr *expr_parse(char *str)
{
 expr *e;
 expr_init();
 debug_push_line(str);
 tok_begin(str);
 tok_next();
 e = parse();
 if(tok_cur != tok_eof)
  do{ if(0 == 0 || 0 & wmode){ loc_tok.line--; die_at(((void *)0), "'%s' at end of expression", tok_last()); loc_tok.line++; } }while(0);
 debug_pop_line();
 return e;
}

canonical_original_code:
struct expr *expr_parse(char *str)
{
 struct expr *e;
 expr_init();
 debug_push_line(str);
 tok_begin(str);
 tok_next();
 e = parse();
 if(tok_cur != tok_eof)
  do{ if(0 == 0 || 0 & wmode){ loc_tok.line--; die_at(((void *)0), "'%s' at end of expression", tok_last()); loc_tok.line++; } }while(0);
 debug_pop_line();
 return e;
}


original_code:
expr_n expr_eval(expr *e_, int *had_ident, int noop)
{
 const expr ke = *e_;
 free(e_);
 switch(ke.type){
  case E_IDENT:
   *had_ident = 1;
   return 0;
  case E_NUM:
   return ke.bits.num;
  case E_UOP:
  {
   expr_n n = expr_eval(ke.bits.uop.e, had_ident, noop);
   if(noop)
    return 0;
   switch(ke.bits.op.op){
    case '-': return - n;
    case '!': return ! n;
    case '~': return ~ n;
    default:
    break;
   }
   ice("expr.c", 284, __func__, "bad op");
  }
  case E_OP:
  {
   expr_n nums[2];
   int skip_rhs = 0;
   nums[0] = expr_eval(ke.bits.op.lhs, had_ident, noop);
   switch(ke.bits.op.op){
    case tok_andsc:
     if(!nums[0]){
      skip_rhs = 1;
     }
     break;
    case tok_orsc:
     if(nums[0]){
      skip_rhs = 1;
     }
     break;
   }
   nums[1] = expr_eval(ke.bits.op.rhs, had_ident, skip_rhs);
   if(noop)
    return 0;
   switch(ke.bits.op.op){
    case '%':
    case '/':
     if(nums[1] == 0)
      do{ if(0 == 0 || 0 & wmode){ loc_tok.line--; die_at(((void *)0), "%s by zero", ke.bits.op.op == '/' ? "division" : "modulo"); loc_tok.line++; } }while(0);
    default:
     break;
   }
   switch(ke.bits.op.op){
    case tok_divide: return nums[0] / nums[1];
    case tok_modulus: return nums[0] % nums[1];
    case tok_multiply: return nums[0] * nums[1];
    case tok_plus: return nums[0] + nums[1];
    case tok_minus: return nums[0] - nums[1];
    case tok_xor: return nums[0] ^ nums[1];
    case tok_or: return nums[0] | nums[1];
    case tok_and: return nums[0] & nums[1];
    case tok_orsc: return nums[0] || nums[1];
    case tok_andsc: return nums[0] && nums[1];
    case tok_shiftl: return nums[0] << nums[1];
    case tok_shiftr: return nums[0] >> nums[1];
    case tok_eq: return nums[0] == nums[1];
    case tok_ne: return nums[0] != nums[1];
    case tok_le: return nums[0] <= nums[1];
    case tok_lt: return nums[0] < nums[1];
    case tok_ge: return nums[0] >= nums[1];
    case tok_gt: return nums[0] > nums[1];
    default:
     break;
   }
   ice("expr.c", 346, __func__, "bad op");
  }
  case E_TOP:
  {
   expr_n a, b, c;
   a = expr_eval(ke.bits.top.e, had_ident, noop);
   b = expr_eval(ke.bits.top.if_true, had_ident, !a);
   c = expr_eval(ke.bits.top.if_false, had_ident, !!a);
   return a ? b : c;
  }
 }
 ice("expr.c", 359, __func__, "bad expr type");
}

canonical_original_code:
long expr_eval(struct expr *e_, int *had_ident, int noop)
{
 struct expr ke = *e_;
 free(e_);
 switch(ke.type){
  case E_IDENT:
   *had_ident = 1;
   return 0;
  case E_NUM:
   return ke.bits.num;
  case E_UOP:
  {
   long n = expr_eval(ke.bits.uop.e, had_ident, noop);
   if(noop)
    return 0;
   switch(ke.bits.op.op){
    case '-': return - n;
    case '!': return ! n;
    case '~': return ~ n;
    default:
    break;
   }
   ice("expr.c", 284, __func__, "bad op");
  }
  case E_OP:
  {
   long nums[2];
   int skip_rhs = 0;
   nums[0] = expr_eval(ke.bits.op.lhs, had_ident, noop);
   switch(ke.bits.op.op){
    case tok_andsc:
     if(!nums[0]){
      skip_rhs = 1;
     }
     break;
    case tok_orsc:
     if(nums[0]){
      skip_rhs = 1;
     }
     break;
   }
   nums[1] = expr_eval(ke.bits.op.rhs, had_ident, skip_rhs);
   if(noop)
    return 0;
   switch(ke.bits.op.op){
    case '%':
    case '/':
     if(nums[1] == 0)
      do{ if(0 == 0 || 0 & wmode){ loc_tok.line--; die_at(((void *)0), "%s by zero", ke.bits.op.op == '/' ? "division" : "modulo"); loc_tok.line++; } }while(0);
    default:
     break;
   }
   switch(ke.bits.op.op){
    case tok_divide: return nums[0] / nums[1];
    case tok_modulus: return nums[0] % nums[1];
    case tok_multiply: return nums[0] * nums[1];
    case tok_plus: return nums[0] + nums[1];
    case tok_minus: return nums[0] - nums[1];
    case tok_xor: return nums[0] ^ nums[1];
    case tok_or: return nums[0] | nums[1];
    case tok_and: return nums[0] & nums[1];
    case tok_orsc: return nums[0] || nums[1];
    case tok_andsc: return nums[0] && nums[1];
    case tok_shiftl: return nums[0] << nums[1];
    case tok_shiftr: return nums[0] >> nums[1];
    case tok_eq: return nums[0] == nums[1];
    case tok_ne: return nums[0] != nums[1];
    case tok_le: return nums[0] <= nums[1];
    case tok_lt: return nums[0] < nums[1];
    case tok_ge: return nums[0] >= nums[1];
    case tok_gt: return nums[0] > nums[1];
    default:
     break;
   }
   ice("expr.c", 346, __func__, "bad op");
  }
  case E_TOP:
  {
   long a; long b; long c;
   a = expr_eval(ke.bits.top.e, had_ident, noop);
   b = expr_eval(ke.bits.top.if_true, had_ident, !a);
   c = expr_eval(ke.bits.top.if_false, had_ident, !!a);
   return a ? b : c;
  }
 }
 ice("expr.c", 359, __func__, "bad expr type");
}

variable_types: noop int

variable_types: struct expr { enum { E_IDENT=0, E_NUM=1, E_OP=2, E_UOP=3, E_TOP=4 } type; union { long num; struct { char op; struct expr *lhs; } op; struct { char op; struct expr *e; } uop; struct { struct expr *e; } top; } bits; }

variable_types: n long

variable_types:
nums
long [2]

variable_types: a long

variable_types: b long

variable_types: c long

return_type: long


decompiled_code:
__int64 __fastcall pow2i(int a1)
{
int v1; // eax
__int64 v2; // rdx

v1 = a1 - 1;
if ( !a1 )
return 1LL;
v2 = 1LL;
do
{
v2 *= 2LL;
--v1;
}
while ( v1 != -1 );
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
int v1; // eax
__int64 v2; // rdx

v1 = a1 - 1;
if ( !a1 )
return 1LL;
v2 = 1LL;
do
{
v2 *= 2LL;
--v1;
}
while ( v1 != -1 );
return v2;
}

original_code:
static unsigned long long pow2i(unsigned v)
{
 unsigned long long out = 1;
 while(v--)
  out *= 2;
 return out;
}

canonical_original_code:
static unsigned long long pow2i(unsigned int v)
{
 unsigned long long out = 1;
 while(v--)
  out *= 2;
 return out;
}

variable_types:
v
unsigned int

variable_types:
out
unsigned long long

return_type: unsigned long long


decompiled_code:
__int64 __fastcall last_bit_index(__int64 a1)
{
__int64 result; // rax
unsigned __int64 v2; // rcx

if ( !a1 )
return 0xFFFFFFFFLL;
result = 0xFFFFFFFFLL;
v2 = 0LL;
do
{
if ( _bittest64(&a1, v2) )
{
a1 &= ~(1LL << v2);
result = (unsigned int)v2;
}
v2 = (unsigned int)(v2 + 1);
}
while ( a1 );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
__int64 result; // rax
unsigned __int64 v2; // rcx

if ( !a1 )
return 0xFFFFFFFFLL;
result = 0xFFFFFFFFLL;
v2 = 0LL;
do
{
if ( _bittest64(&a1, v2) )
{
a1 &= ~(1LL << v2);
result = (unsigned int)v2;
}
v2 = (unsigned int)(v2 + 1);
}
while ( a1 );
return result;
}

original_code:
static unsigned last_bit_index(unsigned long long v)
{
 int i;
 int last = -1;
 for(i = 0; v; i++){
  if(v & (1ull << i)){
   last = i;
   v &= ~(1ull << i);
  }
 }
 return last;
}

canonical_original_code:
static unsigned int last_bit_index(unsigned long long v)
{
 int i;
 int last = -1;
 for(i = 0; v; i++){
  if(v & (1ull << i)){
   last = i;
   v &= ~(1ull << i);
  }
 }
 return last;
}

variable_types:
v
unsigned long long

variable_types: i int

variable_types: last int

return_type: unsigned int


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

result = 0LL;
if ( a1 )
result = (a1 & (a1 - 1)) == 0;
return result;
}

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

result = 0LL;
if ( a1 )
result = (a1 & (a1 - 1)) == 0;
return result;
}

original_code:
int ispow2(unsigned long long v)
{
 return v && (v & (v - 1)) == 0;
}


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

if ( !a1 )
return 0xFFFFFFFFLL;
LODWORD(result) = -1;
do
{
result = (unsigned int)(result + 1);
a1 >>= 1;
}
while ( a1 );
return result;
}

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

if ( !a1 )
return 0xFFFFFFFFLL;
LODWORD(result) = -1;
do
{
result = (unsigned int)(result + 1);
a1 >>= 1;
}
while ( a1 );
return result;
}

original_code:
int log2ll(unsigned long long v)
{
 int r = -1;
 int adj = 0;
 if(!ispow2(v))
  adj = 0;
 for(; v; v >>= 1, r++);
 return r + adj;
}

variable_types: r int

variable_types: adj int


decompiled_code:
__int64 __fastcall log2i(unsigned int a1)
{
return log2ll(a1);
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int a1)
{
return func3(a1);
}

original_code:
int log2i(unsigned v)
{
 return log2ll(v);
}

canonical_original_code:
int log2i(unsigned int v)
{
 return log2ll(v);
}


decompiled_code:
__int64 __fastcall round2(__int64 a1)
{
_BOOL4 v1; // edx
__int64 result; // rax
int v3; // eax

v1 = ispow2(a1);
result = a1;
if ( !v1 )
{
v3 = last_bit_index(a1);
result = pow2i(v3 + 1);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
_BOOL4 v1; // edx
__int64 result; // rax
int v3; // eax

v1 = func2(a1);
result = a1;
if ( !v1 )
{
v3 = func1(a1);
result = func0(v3 + 1);
}
return result;
}

original_code:
unsigned long long round2(unsigned long long v)
{
 if(ispow2(v))
  return v;
 return pow2i(last_bit_index(v) + 1);
}


extractbottombit

decompiled_code:
__int64 __fastcall extractbottombit(int *a1)
{
int v1; // edx
int v2; // eax

v1 = *a1;
v2 = v1 & (v1 - 1);
*a1 = v2;
return v1 & (unsigned int)~v2;
}

canonical_decompiled_code:
__int64 __fastcall func6(int *a1)
{
int v1; // edx
int v2; // eax

v1 = *a1;
v2 = v1 & (v1 - 1);
*a1 = v2;
return v1 & (unsigned int)~v2;
}

original_code:
unsigned extractbottombit(unsigned *const bitset)
{
 unsigned next = *bitset & (*bitset - 1);
 unsigned bit = *bitset & ~next;
 *bitset = next;
 return bit;
}

canonical_original_code:
unsigned int extractbottombit(unsigned int *bitset)
{
 unsigned int next = *bitset & (*bitset - 1);
 unsigned int bit = *bitset & ~next;
 *bitset = next;
 return bit;
}

variable_types:
bitset
unsigned int *

variable_types:
next
unsigned int

variable_types:
bit
unsigned int


decompiled_code:
__int64 __fastcall dynmap_first_pair(__int64 a1, unsigned int a2)
{
for ( ; a2 > 0xFF; a2 = (a2 >> 8) ^ (unsigned __int8)a2 )
;
return a1 + 24LL * a2 + 16;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, unsigned int a2)
{
for ( ; a2 > 0xFF; a2 = (a2 >> 8) ^ (unsigned __int8)a2 )
;
return a1 + 24LL * a2 + 16;
}

original_code:
static pair *
dynmap_first_pair(dynmap *map, unsigned hash)
{
 while(hash >= 256)
  hash = (hash >> 8) ^ (hash & (256 - 1));
 return &map->pairs[hash];
}

canonical_original_code:
static struct pair *dynmap_first_pair(struct dynmap *map, unsigned int hash)
{
 while(hash >= 256)
  hash = (hash >> 8) ^ (hash & (256 - 1));
 return &map->pairs[hash];
}

variable_types: struct dynmap { int (*cmp)(void *, void *); unsigned int (*hash)(void *); struct pair pairs[256]; } *

variable_types:
hash
unsigned int

return_type: struct pair { void *key; struct pair *next; } *


decompiled_code:
__int64 __fastcall dynmap_strhash(char *a1)
{
char v1; // al
unsigned int v2; // ecx

v1 = *a1;
if ( !*a1 )
return 5381;
v2 = 5381;
do
{
v2 += 32 * v2 + v1;
v1 = *++a1;
}
while ( *a1 );
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func1(char *a1)
{
char v1; // al
unsigned int v2; // ecx

v1 = *a1;
if ( !*a1 )
return 5381;
v2 = 5381;
do
{
v2 += 32 * v2 + v1;
v1 = *++a1;
}
while ( *a1 );
return v2;
}

original_code:
unsigned dynmap_strhash(const char *s)
{
 unsigned hash = 5381;
 for(; *s; s++)
  hash = ((hash << 5) + hash) + *s;
 return hash;
}

canonical_original_code:
unsigned int dynmap_strhash(char *s)
{
 unsigned int hash = 5381;
 for(; *s; s++)
  hash = ((hash << 5) + hash) + *s;
 return hash;
}

variable_types:
s
char *


decompiled_code:
void __fastcall dynmap_free(void *a1)
{
free(a1);
}

canonical_decompiled_code:
void __fastcall func2(void *a1)
{
free(a1);
}

original_code:
void
dynmap_free(dynmap *map)
{
 free(map);
}

canonical_original_code:
void dynmap_free(struct dynmap *map)
{
 free(map);
}

variable_types: struct dynmap { int (*cmp)(void *, void *); unsigned int (*hash)(void *); struct pair { void *key; struct pair *next; } pairs[256]; } *

user_defined_types: struct dynmap { int (*cmp)(void *, void *); unsigned int (*hash)(void *); struct pair pairs[256]; }


decompiled_code:
_BOOL8 __fastcall dynmap_nochk_exists(__int64 a1, _QWORD *a2)
{
_BOOL8 result; // rax

result = 0LL;
if ( a1 )
result = dynmap_nochk_pair(a1, a2, 0LL) != 0LL;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(__int64 a1, _QWORD *a2)
{
_BOOL8 result; // rax

result = 0LL;
if ( a1 )
result = dynmap_nochk_pair(a1, a2, 0LL) != 0LL;
return result;
}

original_code:
int dynmap_nochk_exists(dynmap *map, void *key)
{
 if(!map)
  return 0;
 return !!dynmap_nochk_pair(map, key, ((void *)0));
}

canonical_original_code:
int dynmap_nochk_exists(struct dynmap *map, void *key)
{
 if(!map)
  return 0;
 return !!dynmap_nochk_pair(map, key, ((void *)0));
}

variable_types:
key
void *

user_defined_types: struct pair { void *key; struct pair *next; }


decompiled_code:
__int64 __fastcall dynmap_nochk_set(__int64 a1, _QWORD *a2, __int64 a3)
{
_QWORD *v4; // rax
_QWORD *v5; // rbx
__int64 result; // rax
_QWORD *v7; // rax
_QWORD *v8; // r12
unsigned int v9[11]; // [rsp+Ch] [rbp-2Ch] BYREF

if ( !a2 )
_assert_fail("key && \"null dynmap key\"", "dynmap.c", 0x76u, "dynmap_nochk_set");
v4 = dynmap_nochk_pair(a1, a2, v9);
v5 = v4;
if ( v4 )
{
result = v4[1];
v5[1] = a3;
}
else
{
v7 = (_QWORD *)dynmap_first_pair(a1, v9[0]);
if ( *v7 )
{
do
{
v8 = v7;
v7 = (_QWORD *)v7[2];
}
while ( v7 );
v7 = (_QWORD *)umalloc(24LL);
v8[2] = v7;
}
*v7 = a2;
v7[1] = a3;
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, _QWORD *a2, __int64 a3)
{
_QWORD *v4; // rax
_QWORD *v5; // rbx
__int64 result; // rax
_QWORD *v7; // rax
_QWORD *v8; // r12
unsigned int v9[11]; // [rsp+Ch] [rbp-2Ch] BYREF

if ( !a2 )
_assert_fail("key && \"null dynmap key\"", "dynmap.c", 0x76u, "dynmap_nochk_set");
v4 = dynmap_nochk_pair(a1, a2, v9);
v5 = v4;
if ( v4 )
{
result = v4[1];
v5[1] = a3;
}
else
{
v7 = (_QWORD *)func0(a1, v9[0]);
if ( *v7 )
{
do
{
v8 = v7;
v7 = (_QWORD *)v7[2];
}
while ( v7 );
v7 = (_QWORD *)umalloc(24LL);
v8[2] = v7;
}
*v7 = a2;
v7[1] = a3;
result = 0LL;
}
return result;
}

original_code:
void *
dynmap_nochk_set(dynmap *map, void *key, void *val)
{
 pair *p;
 unsigned hash;
 ((key && "null dynmap key") ? (void) (0) : __assert_fail ("key && \"null dynmap key\"", "dynmap.c", 118, __extension__ __PRETTY_FUNCTION__));
 p = dynmap_nochk_pair(map, key, &hash);
 if(p){
  void *old = p->value;
  p->value = val;
  return old;
 }else{
  p = dynmap_first_pair(map, hash);
  if(p->key){
   while(p->next)
    p = p->next;
   p->next = umalloc(sizeof *p);
   p = p->next;
  }
  p->key = key;
  p->value = val;
  return ((void *)0);
 }
}

canonical_original_code:
void *dynmap_nochk_set(struct dynmap *map, void *key, void *val)
{
 struct pair *p;
 unsigned int hash;
 ((key && "null dynmap key") ? (void) (0) : __assert_fail ("key && \"null dynmap key\"", "dynmap.c", 118, __extension__ __PRETTY_FUNCTION__));
 p = dynmap_nochk_pair(map, key, &hash);
 if(p){
  void *old = p->value;
  p->value = val;
  return old;
 }else{
  p = dynmap_first_pair(map, hash);
  if(p->key){
   while(p->next)
    p = p->next;
   p->next = umalloc(sizeof *p);
   p = p->next;
  }
  p->key = key;
  p->value = val;
  return ((void *)0);
 }
}

variable_types:
val
void *

variable_types: struct pair { void *key; struct pair *next; } *

variable_types:
old
void *

return_type: void *


original_code:
void *dynmap_nochk_rm(dynmap *map, void *key)
{
 unsigned hash;
 pair *p = dynmap_nochk_pair(map, key, &hash);
 pair *first;
 void *value;
 if(!p)
  return ((void *)0);
 value = p->value;
 first = dynmap_first_pair(map, hash);
 if(p == first){
  if(first->next)
   (*(first) = *(p->next));
  else
   memset(first, 0, sizeof *first);
 }else{
  pair *i;
  for(i = first; i->next != p; i = i->next)
   ;
  i->next = p->next;
  free(p);
 }
 return value;
}

canonical_original_code:
void *dynmap_nochk_rm(struct dynmap *map, void *key)
{
 unsigned int hash;
 struct pair *p = dynmap_nochk_pair(map, key, &hash);
 struct pair *first;
 void *value;
 if(!p)
  return ((void *)0);
 value = p->value;
 first = dynmap_first_pair(map, hash);
 if(p == first){
  if(first->next)
   (*(first) = *(p->next));
  else
   memset(first, 0, sizeof *first);
 }else{
  struct pair *i;
  for(i = first; i->next != p; i = i->next)
   ;
  i->next = p->next;
  free(p);
 }
 return value;
}

variable_types:
value
void *


decompiled_code:
int __fastcall dynmap_dump(__int64 a1)
{
__int64 v1; // r13
unsigned int i; // er12
__int64 v3; // rbx
unsigned int j; // ebp
int result; // eax

v1 = a1 + 16;
for ( i = 0; i != 256; ++i )
{
v3 = v1;
for ( j = 0; v3; ++j )
{
if ( !*(_QWORD *)v3 )
break;
result = fprintf(stderr, "map[%d][%d] = { %p, %p }\n", i, j, *(const void **)v3, *(const void **)(v3 + 8));
v3 = *(_QWORD *)(v3 + 16);
}
v1 += 24LL;
}
return result;
}

canonical_decompiled_code:
int __fastcall func6(__int64 a1)
{
__int64 v1; // r13
unsigned int i; // er12
__int64 v3; // rbx
unsigned int j; // ebp
int result; // eax

v1 = a1 + 16;
for ( i = 0; i != 256; ++i )
{
v3 = v1;
for ( j = 0; v3; ++j )
{
if ( !*(_QWORD *)v3 )
break;
result = fprintf(stderr, "map[%d][%d] = { %p, %p }\n", i, j, *(const void **)v3, *(const void **)(v3 + 8));
v3 = *(_QWORD *)(v3 + 16);
}
v1 += 24LL;
}
return result;
}

original_code:
void dynmap_dump(dynmap *map)
{
 int i;
 for(i = 0; i < 256; i++){
  pair *p;
  int j;
  for(j = 0, p = &map->pairs[i];
      p && p->key;
      p = p->next, j++)
  {
   fprintf(stderr, "map[%d][%d] = { %p, %p }\n",
     i, j, p->key, p->value);
  }
 }
}

canonical_original_code:
void dynmap_dump(struct dynmap *map)
{
 int i;
 for(i = 0; i < 256; i++){
  struct pair *p;
  int j;
  for(j = 0, p = &map->pairs[i];
      p && p->key;
      p = p->next, j++)
  {
   fprintf(stderr, "map[%d][%d] = { %p, %p }\n",
     i, j, p->key, p->value);
  }
 }
}

variable_types: j int


original_code:
static void warning_gnu(enum warning_fatality set)
{
 cc1_warning.gnu_addr_lbl =
 cc1_warning.gnu_expr_stmt =
 cc1_warning.gnu_typeof =
 cc1_warning.gnu_autotype =
 cc1_warning.gnu_attribute =
 cc1_warning.gnu_init_array_range =
 cc1_warning.gnu_case_range =
 cc1_warning.gnu_alignof_expr =
 cc1_warning.gnu_empty_init =
  set;
}

variable_types: enum warning_fatality { W_OFF=0, W_WARN=1, W_ERROR=2, W_NO_ERROR=3 }


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

if ( a2 == a1 )
result = fprintf(stderr, "[-W%s]\n", a3);
return result;
}

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

if ( a2 == a1 )
result = fprintf(stderr, "[-W%s]\n", a3);
return result;
}

original_code:
static void show_warn_option(
  const unsigned char *poffset,
  const unsigned char *pwarn,
  const char *arg)
{
 if(pwarn != poffset)
  return;
 fprintf(stderr, "[-W%s]\n", arg);
}

canonical_original_code:
static void show_warn_option(unsigned char *poffset, unsigned char *pwarn, char *arg)
{
 if(pwarn != poffset)
  return;
 fprintf(stderr, "[-W%s]\n", arg);
}

variable_types:
poffset
unsigned char *

variable_types:
pwarn
unsigned char *

variable_types:
arg
char *


decompiled_code:
int __fastcall show_warn_options(__int64 a1)
{
const char *v1; // rdx
char **v2; // rbx
int result; // eax
char **v4; // rbp
__int64 *v5; // rbx

v1 = warns;
if ( warns )
{
v2 = &warns;
do
{
result = show_warn_option((__int64)v2[1], a1, v1);
v2 += 2;
v1 = *v2;
}
while ( *v2 );
}
if ( warn_groups )
{
v4 = &off_8E0;
do
{
v5 = (__int64 *)(v4 - 3);
do
{
if ( !*v5 )
break;
result = show_warn_option(*v5++, a1, *(v4 - 4));
}
while ( v5 != (__int64 *)v4 );
v4 += 4;
}
while ( *(v4 - 4) );
}
return result;
}

canonical_decompiled_code:
int __fastcall func2(__int64 a1)
{
const char *v1; // rdx
char **v2; // rbx
int result; // eax
char **v4; // rbp
__int64 *v5; // rbx

v1 = warns;
if ( warns )
{
v2 = &warns;
do
{
result = func1((__int64)v2[1], a1, v1);
v2 += 2;
v1 = *v2;
}
while ( *v2 );
}
if ( warn_groups )
{
v4 = &off_8E0;
do
{
v5 = (__int64 *)(v4 - 3);
do
{
if ( !*v5 )
break;
result = func1(*v5++, a1, *(v4 - 4));
}
while ( v5 != (__int64 *)v4 );
v4 += 4;
}
while ( *(v4 - 4) );
}
return result;
}

original_code:
static void show_warn_options(const unsigned char *pwarn)
{
 struct warn_str *p;
 struct warn_str_group *p_group;
 for(p = warns; p->arg; p++)
  show_warn_option(p->offset, pwarn, p->arg);
 for(p_group = warn_groups; p_group->arg; p_group++){
  unsigned i;
  for(i = 0; i < (sizeof(p_group->offsets) / sizeof((p_group->offsets)[0])) && p_group->offsets[i]; i++){
   show_warn_option(p_group->offsets[i], pwarn, p_group->arg);
  }
 }
}

canonical_original_code:
static void show_warn_options(unsigned char *pwarn)
{
 struct warn_str *p;
 struct warn_str_group *p_group;
 for(p = warns; p->arg; p++)
  show_warn_option(p->offset, pwarn, p->arg);
 for(p_group = warn_groups; p_group->arg; p_group++){
  unsigned int i;
  for(i = 0; i < (sizeof(p_group->offsets) / sizeof((p_group->offsets)[0])) && p_group->offsets[i]; i++){
   show_warn_option(p_group->offsets[i], pwarn, p_group->arg);
  }
 }
}

variable_types: struct warn_str { char *arg; unsigned char *offset; } *

variable_types: struct warn_str_group { char *arg; unsigned char *offsets[3]; } *

variable_types:
i
unsigned int


decompiled_code:
__int64 __fastcall cc1_warn_type(__int64 a1, char *a2)
{
char v2; // bp
__int64 result; // rax
unsigned int v4; // ebx
__int64 v5; // [rsp+0h] [rbp-38h] BYREF

v2 = *a2;
result = 0xFFFFFFFFLL;
if ( *a2 )
{
v4 = 1;
if ( v2 == 2 )
{
parse_had_error = 1;
fold_had_error = 1;
v4 = 2;
}
if ( !a1 )
a1 = where_cc1_current(&v5);
if ( *((_BYTE *)&cc1_warning + 190) || !(unsigned int)where_in_sysheader(a1) || v4 == 2 && v2 != 2 )
result = v4;
else
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, char *a2)
{
char v2; // bp
__int64 result; // rax
unsigned int v4; // ebx
__int64 v5; // [rsp+0h] [rbp-38h] BYREF

v2 = *a2;
result = 0xFFFFFFFFLL;
if ( *a2 )
{
v4 = 1;
if ( v2 == 2 )
{
parse_had_error = 1;
fold_had_error = 1;
v4 = 2;
}
if ( !a1 )
a1 = where_cc1_current(&v5);
if ( *((_BYTE *)&cc1_warning + 190) || !(unsigned int)where_in_sysheader(a1) || v4 == 2 && v2 != 2 )
result = v4;
else
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int cc1_warn_type(const struct where *where, const unsigned char *pwarn)
{
 struct where backup;
 enum warn_type warn_type = VWARN_WARN;
 const enum warning_fatality fatality = *pwarn;
 switch(fatality){
  case W_OFF:
   return -1;
  case W_ERROR:
   fold_had_error = parse_had_error = 1;
   warn_type = VWARN_ERR;
   break;
  case W_NO_ERROR:
  case W_WARN:
   break;
 }
 if(!where)
  where = where_cc1_current(&backup);
 if(!cc1_warning.system_headers && where_in_sysheader(where)){
  if(fatality == W_ERROR){
   return -1;
  }else if(warn_type == VWARN_ERR){
  }else{
   return -1;
  }
 }
 return warn_type;
}

canonical_original_code:
int cc1_warn_type(struct where *where, unsigned char *pwarn)
{
 struct where backup;
 enum warn_type warn_type = VWARN_WARN;
 enum warning_fatality fatality = *pwarn;
 switch(fatality){
  case W_OFF:
   return -1;
  case W_ERROR:
   fold_had_error = parse_had_error = 1;
   warn_type = VWARN_ERR;
   break;
  case W_NO_ERROR:
  case W_WARN:
   break;
 }
 if(!where)
  where = where_cc1_current(&backup);
 if(!cc1_warning.system_headers && where_in_sysheader(where)){
  if(fatality == W_ERROR){
   return -1;
  }else if(warn_type == VWARN_ERR){
  }else{
   return -1;
  }
 }
 return warn_type;
}

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

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

user_defined_types: enum warning_fatality { W_OFF=0, W_WARN=1, W_ERROR=2, W_NO_ERROR=3 }


decompiled_code:
__int64 __fastcall cc1_warn_at_w(char *format, char *a2)
{
unsigned __int64 v3; // rsi
__int64 result; // rax

v3 = (unsigned int)cc1_warn_type((__int64)format, a2);
result = 0LL;
if ( (_DWORD)v3 != -1 )
{
vwarn(format, (__gnuc_va_list)v3);
result = 1LL;
if ( cc1_fopt[21] )
{
show_warn_options((__int64)a2);
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(char *format, char *a2)
{
unsigned __int64 v3; // rsi
__int64 result; // rax

v3 = (unsigned int)func4((__int64)format, a2);
result = 0LL;
if ( (_DWORD)v3 != -1 )
{
vwarn(format, (__gnuc_va_list)v3);
result = 1LL;
if ( cc1_fopt[21] )
{
func2((__int64)a2);
result = 1LL;
}
}
return result;
}

original_code:
int cc1_warn_at_w(
  const struct where *where, const unsigned char *pwarn,
  const char *fmt, ...)
{
 va_list l;
 int warn_type_i = cc1_warn_type(where, pwarn);
 enum warn_type warn_type;
 if(warn_type_i == -1)
  return 0;
 warn_type = warn_type_i;
 __builtin_va_start(l,fmt);
 vwarn(where, warn_type, fmt, l);
 __builtin_va_end(l);
 if(cc1_fopt.show_warning_option)
  show_warn_options(pwarn);
 return 1;
}

canonical_original_code:
int cc1_warn_at_w(struct where *where, unsigned char *pwarn, char *fmt, ...)
{
 __builtin_va_list l;
 int warn_type_i = cc1_warn_type(where, pwarn);
 enum warn_type warn_type;
 if(warn_type_i == -1)
  return 0;
 warn_type = warn_type_i;
 __builtin_va_start(l,fmt);
 vwarn(where, warn_type, fmt, l);
 __builtin_va_end(l);
 if(cc1_fopt.show_warning_option)
  show_warn_options(pwarn);
 return 1;
}

variable_types:
fmt
char *

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

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


original_code:
void warnings_set(enum warning_fatality to)
{
 memset(&cc1_warning, to, sizeof cc1_warning);
}


original_code:
static void warning_all(enum warning_fatality set)
{
 warnings_set(set);
 warning_gnu(W_OFF);
 cc1_warning.implicit_int =
 cc1_warning.truncation =
 cc1_warning.pad =
 cc1_warning.tenative_init =
 cc1_warning.shadow_global_user =
 cc1_warning.shadow_global_sysheaders =
 cc1_warning.shadow_compatible_local =
 cc1_warning.implicit_old_func =
 cc1_warning.bitfield_boundary =
 cc1_warning.vla =
 cc1_warning.init_missing_struct_zero =
 cc1_warning.pure_inline =
 cc1_warning.unused_param =
 cc1_warning.test_assign =
 cc1_warning.sign_compare =
 cc1_warning.unused_fnret =
 cc1_warning.binary_literal =
 cc1_warning.missing_prototype =
 cc1_warning.missing_variable_decls =
 cc1_warning.null_zero_literal =
 cc1_warning.enum_out_of_range =
 cc1_warning.enum_mismatch_int =
 cc1_warning.inline_failed =
 cc1_warning.switch_default =
 cc1_warning.switch_default_covered =
 cc1_warning.sym_never_read =
 cc1_warning.system_headers =
 cc1_warning.int_op_promotion =
 cc1_warning.overlength_strings =
 cc1_warning.aggregate_return =
 cc1_warning.switch_enum_even_when_default_lbl =
 cc1_warning.bitfield_promotion =
 cc1_warning.unused_comma_all =
  W_OFF;
}


decompiled_code:
void __fastcall warning_special(unsigned int a1, char a2)
{
if ( a1 == 2 )
{
warnings_set(a2);
}
else if ( a1 > 2 )
{
if ( a1 == 3 )
warning_gnu(a2);
}
else
{
warning_all(a2);
if ( a1 )
{
*((_BYTE *)&cc1_warning + 38) = a2;
*((_BYTE *)&cc1_warning + 125) = a2;
*((_BYTE *)&cc1_warning + 124) = a2;
*((_BYTE *)&cc1_warning + 30) = a2;
BYTE6(cc1_warning) = a2;
}
}
}

canonical_decompiled_code:
void __fastcall func8(unsigned int a1, char a2)
{
if ( a1 == 2 )
{
func6(a2);
}
else if ( a1 > 2 )
{
if ( a1 == 3 )
func0(a2);
}
else
{
func7(a2);
if ( a1 )
{
*((_BYTE *)&cc1_warning + 38) = a2;
*((_BYTE *)&cc1_warning + 125) = a2;
*((_BYTE *)&cc1_warning + 124) = a2;
*((_BYTE *)&cc1_warning + 30) = a2;
BYTE6(cc1_warning) = a2;
}
}
}

original_code:
static void warning_special(enum warning_special special, enum warning_fatality fatality)
{
 switch(special){
  case W_EVERYTHING:
   warnings_set(fatality);
   break;
  case W_ALL:
   warning_all(fatality);
   break;
  case W_EXTRA:
   warning_all(fatality);
   cc1_warning.implicit_int =
   cc1_warning.cast_qual =
   cc1_warning.init_missing_braces =
   cc1_warning.init_missing_struct =
   cc1_warning.unused_param =
    fatality;
   break;
  case W_GNU:
   warning_gnu(fatality);
   break;
 }
}

variable_types: enum warning_special { W_ALL=0, W_EXTRA=1, W_EVERYTHING=2, W_GNU=3 }


decompiled_code:
void __fastcall warning_pedantic(char a1)
{
*((_BYTE *)&cc1_warning + 129) = a1;
BYTE3(cc1_warning) = a1;
BYTE2(cc1_warning) = a1;
*((_BYTE *)&cc1_warning + 55) = a1;
*((_BYTE *)&cc1_warning + 154) = a1;
*((_BYTE *)&cc1_warning + 91) = a1;
*((_BYTE *)&cc1_warning + 101) = a1;
*((_BYTE *)&cc1_warning + 177) = a1;
*((_BYTE *)&cc1_warning + 187) = a1;
*((_BYTE *)&cc1_warning + 147) = a1;
*((_BYTE *)&cc1_warning + 146) = a1;
}

canonical_decompiled_code:
void __fastcall func9(char a1)
{
*((_BYTE *)&cc1_warning + 129) = a1;
BYTE3(cc1_warning) = a1;
BYTE2(cc1_warning) = a1;
*((_BYTE *)&cc1_warning + 55) = a1;
*((_BYTE *)&cc1_warning + 154) = a1;
*((_BYTE *)&cc1_warning + 91) = a1;
*((_BYTE *)&cc1_warning + 101) = a1;
*((_BYTE *)&cc1_warning + 177) = a1;
*((_BYTE *)&cc1_warning + 187) = a1;
*((_BYTE *)&cc1_warning + 147) = a1;
*((_BYTE *)&cc1_warning + 146) = a1;
}

original_code:
void warning_pedantic(enum warning_fatality set)
{
 cc1_warning.nonstd_arraysz =
 cc1_warning.nonstd_init =
 cc1_warning.x__func__init =
 cc1_warning.typedef_fnimpl =
 cc1_warning.flexarr_only =
 cc1_warning.decl_nodecl =
 cc1_warning.overlarge_enumerator_int =
 cc1_warning.attr_printf_voidp =
 cc1_warning.return_void =
 cc1_warning.binary_literal =
 cc1_warning.overlength_strings =
  set;
}


original_code:
void warning_init(void)
{
 warning_all(W_WARN);
 warning_pedantic(W_OFF);
 cc1_warning.typedef_redef =
 cc1_warning.c89_parse_trailingcomma =
 cc1_warning.unnamed_struct_memb_ext_tagged =
 cc1_warning.unnamed_struct_memb_ignored =
 cc1_warning.unnamed_struct_memb_ext_c11 =
 cc1_warning.c89_for_init =
 cc1_warning.mixed_code_decls =
 cc1_warning.c89_init_constexpr =
 cc1_warning.long_long =
 cc1_warning.c89_vla =
 cc1_warning.c89_compound_literal =
   W_WARN;
 cc1_warning.unused_param = W_OFF;
 cc1_warning.unused_var = W_OFF;
 cc1_warning.unused_function = W_OFF;
 cc1_warning.char_subscript = W_OFF;
 cc1_warning.int_op_promotion = W_OFF;
 cc1_warning.sign_compare = W_OFF;
}

canonical_original_code:
void warning_init()
{
 warning_all(W_WARN);
 warning_pedantic(W_OFF);
 cc1_warning.typedef_redef =
 cc1_warning.c89_parse_trailingcomma =
 cc1_warning.unnamed_struct_memb_ext_tagged =
 cc1_warning.unnamed_struct_memb_ignored =
 cc1_warning.unnamed_struct_memb_ext_c11 =
 cc1_warning.c89_for_init =
 cc1_warning.mixed_code_decls =
 cc1_warning.c89_init_constexpr =
 cc1_warning.long_long =
 cc1_warning.c89_vla =
 cc1_warning.c89_compound_literal =
   W_WARN;
 cc1_warning.unused_param = W_OFF;
 cc1_warning.unused_var = W_OFF;
 cc1_warning.unused_function = W_OFF;
 cc1_warning.char_subscript = W_OFF;
 cc1_warning.int_op_promotion = W_OFF;
 cc1_warning.sign_compare = W_OFF;
}


decompiled_code:
void warnings_upgrade()
{
char **v0; // rax
char *v1; // rdx

if ( warns )
{
v0 = &warns;
do
{
v1 = v0[1];
if ( *v1 == 1 )
*v1 = 2;
v0 += 2;
}
while ( *v0 );
}
}

original_code:
void warnings_upgrade(void)
{
 struct warn_str *p;
 for(p = warns; p->arg; p++)
  if(*p->offset == W_WARN)
   *p->offset = W_ERROR;
}

canonical_original_code:
void warnings_upgrade()
{
 struct warn_str *p;
 for(p = warns; p->arg; p++)
  if(*p->offset == W_WARN)
   *p->offset = W_ERROR;
}

user_defined_types: struct warn_str { char *arg; unsigned char *offset; }


decompiled_code:
const char *str_expr_val()
{
return "value";
}

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

original_code:
const char *str_expr_val(void)
{
 return "value";
}


decompiled_code:
void __fastcall stringlit_use(__int64 a1)
{
++*(_DWORD *)(a1 + 16);
}

canonical_decompiled_code:
void __fastcall func0(__int64 a1)
{
++*(_DWORD *)(a1 + 16);
}

original_code:
void stringlit_use(stringlit *s)
{
 s->use_cnt++;
}

canonical_original_code:
void stringlit_use(struct stringlit *s)
{
 s->use_cnt++;
}

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

user_defined_types: struct stringlit { char *lbl; struct cstring *cstr; unsigned int use_cnt; }

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


decompiled_code:
_BOOL8 __fastcall stringlit_empty(__int64 a1)
{
__int64 v1; // rdi
__int64 v2; // rdx
_BOOL8 result; // rax

v1 = *(_QWORD *)(a1 + 8);
v2 = *(_QWORD *)(v1 + 8);
result = 1LL;
if ( v2 )
{
result = 0LL;
if ( v2 == 1 )
result = (unsigned int)cstring_char_at(v1, 0LL) == 0;
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(__int64 a1)
{
__int64 v1; // rdi
__int64 v2; // rdx
_BOOL8 result; // rax

v1 = *(_QWORD *)(a1 + 8);
v2 = *(_QWORD *)(v1 + 8);
result = 1LL;
if ( v2 )
{
result = 0LL;
if ( v2 == 1 )
result = (unsigned int)cstring_char_at(v1, 0LL) == 0;
}
return result;
}

original_code:
int stringlit_empty(const stringlit *str)
{
 struct cstring *cstr = str->cstr;
 switch(cstr->count){
  case 0:
   return 1;
  case 1:
   return cstring_char_at(cstr, 0) == 0;
 }
 return 0;
}

canonical_original_code:
int stringlit_empty(struct stringlit *str)
{
 struct cstring *cstr = str->cstr;
 switch(cstr->count){
  case 0:
   return 1;
  case 1:
   return cstring_char_at(cstr, 0) == 0;
 }
 return 0;
}

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


decompiled_code:
const char *str_expr_str()
{
return "string";
}

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

original_code:
const char *str_expr_str(void)
{
 return "string";
}


original_code:
int std_from_str(const char *std, enum c_std *penu, int *gnu)
{
 if(!strcmp(std, "-ansi")){
  if(gnu)
   *gnu = 0;
  goto std_c90;
 }
 if(strncmp(std, "-std=", 5))
  return 1;
 std += 5;
 if(!strncmp(std, "gnu", 3)){
  if(gnu)
   *gnu = 1;
  std += 3;
 }else if(*std == 'c'){
  if(gnu)
   *gnu = 0;
  std++;
 }else{
  return 1;
 }
 if(!strcmp(std, "99")){
  *penu = STD_C99;
 }else if(!strcmp(std, "90")){
std_c90:
  *penu = STD_C90;
 }else if(!strcmp(std, "89")){
  *penu = STD_C89;
 }else if(!strcmp(std, "11")){
  *penu = STD_C11;
 }else if(!strcmp(std, "17") || !strcmp(std, "18")){
  *penu = STD_C18;
 }else if(!strcmp(std, "2x")){
  *penu = STD_C2X;
 }else{
  return 1;
 }
 return 0;
}

canonical_original_code:
int std_from_str(char *std, enum c_std *penu, int *gnu)
{
 if(!strcmp(std, "-ansi")){
  if(gnu)
   *gnu = 0;
  goto std_c90;
 }
 if(strncmp(std, "-std=", 5))
  return 1;
 std += 5;
 if(!strncmp(std, "gnu", 3)){
  if(gnu)
   *gnu = 1;
  std += 3;
 }else if(*std == 'c'){
  if(gnu)
   *gnu = 0;
  std++;
 }else{
  return 1;
 }
 if(!strcmp(std, "99")){
  *penu = STD_C99;
 }else if(!strcmp(std, "90")){
std_c90:
  *penu = STD_C90;
 }else if(!strcmp(std, "89")){
  *penu = STD_C89;
 }else if(!strcmp(std, "11")){
  *penu = STD_C11;
 }else if(!strcmp(std, "17") || !strcmp(std, "18")){
  *penu = STD_C18;
 }else if(!strcmp(std, "2x")){
  *penu = STD_C2X;
 }else{
  return 1;
 }
 return 0;
}

variable_types:
std
char *

variable_types:
gnu
int *


decompiled_code:
__int64 __fastcall macro_find(char *s2)
{
__int64 *v1; // rbx
__int64 v2; // rbp

v1 = (__int64 *)macros;
v2 = macros;
if ( macros )
{
while ( 1 )
{
v2 = *v1;
if ( !*v1 || !strcmp(*(const char **)(v2 + 32), s2) )
break;
++v1;
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *s2)
{
__int64 *v1; // rbx
__int64 v2; // rbp

v1 = (__int64 *)macros;
v2 = macros;
if ( macros )
{
while ( 1 )
{
v2 = *v1;
if ( !*v1 || !strcmp(*(const char **)(v2 + 32), s2) )
break;
++v1;
}
}
return v2;
}

original_code:
macro *macro_find(const char *sp)
{
 macro **i, *m; for(i = macros; i && (m = *i); i++)
  if(!strcmp(m->nam, sp))
   return m;
 return ((void *)0);
}

canonical_original_code:
struct macro *macro_find(char *sp)
{
 struct macro **i; struct macro *m; for(i = macros; i && (m = *i); i++)
  if(!strcmp(m->nam, sp))
   return m;
 return ((void *)0);
}

variable_types:
sp
char *

variable_types: struct macro { struct where { char *fname; unsigned int line; unsigned short chr; unsigned char is_sysh; } where; char *nam; enum { MACRO=0, FUNC=1, VARIADIC=2 } type; char **args; int blue; int use_cnt; int use_dump; int include_depth; } **

user_defined_types: struct macro { struct where where; char *nam; enum { MACRO=0, FUNC=1, VARIADIC=2 } type; char **args; int blue; int use_cnt; int use_dump; int include_depth; }


decompiled_code:
__int64 __fastcall macro_add(char *s2, char *a2, int a3)
{
if ( a2 )
a2 = (char *)ustrdup(a2);
return macro_add_nodup(s2, a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func2(char *s2, char *a2, int a3)
{
if ( a2 )
a2 = (char *)ustrdup(a2);
return func1(s2, a2, a3);
}

original_code:
macro *macro_add(const char *nam, const char *val, int depth)
{
 return macro_add_nodup(nam, val ? ustrdup(val) : ((void *)0), depth);
}

canonical_original_code:
struct macro *macro_add(char *nam, char *val, int depth)
{
 return macro_add_nodup(nam, val ? ustrdup(val) : ((void *)0), depth);
}

variable_types:
nam
char *

variable_types:
val
char *

variable_types: depth int

return_type: struct macro { struct where { char *fname; unsigned int line; unsigned short chr; unsigned char is_sysh; } where; char *nam; enum { MACRO=0, FUNC=1, VARIADIC=2 } type; char **args; int blue; int use_cnt; int use_dump; int include_depth; } *


decompiled_code:
__int64 macro_add_sprintf(char *s2, __int64 a2, ...)
{
char *v2; // rax
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a2);
v2 = (char *)ustrvprintf(a2, va);
return macro_add_nodup(s2, v2, 0);
}

canonical_decompiled_code:
__int64 func4(char *s2, __int64 a2, ...)
{
char *v2; // rax
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a2);
v2 = (char *)ustrvprintf(a2, va);
return func1(s2, v2, 0);
}

original_code:
macro *macro_add_sprintf(const char *nam, const char *fmt, ...)
{
 va_list l;
 char *buf;
 __builtin_va_start(l,fmt);
 buf = ustrvprintf(fmt, l);
 __builtin_va_end(l);
 return macro_add_nodup(nam, buf, 0);
}

canonical_original_code:
struct macro *macro_add_sprintf(char *nam, char *fmt, ...)
{
 __builtin_va_list l;
 char *buf;
 __builtin_va_start(l,fmt);
 buf = ustrvprintf(fmt, l);
 __builtin_va_end(l);
 return macro_add_nodup(nam, buf, 0);
}

variable_types:
buf
char *


original_code:
void macro_use(macro *m, int adj)
{
 m->use_cnt += adj;
 m->use_dump += adj;
}

canonical_original_code:
void macro_use(struct macro *m, int adj)
{
 m->use_cnt += adj;
 m->use_dump += adj;
}

variable_types: struct macro { struct where { char *fname; unsigned int line; unsigned short chr; unsigned char is_sysh; } where; char *nam; enum { MACRO=0, FUNC=1, VARIADIC=2 } type; char **args; int blue; int use_cnt; int use_dump; int include_depth; } *

variable_types: adj int


decompiled_code:
void __fastcall macros_dump(int a1)
{
_QWORD *v1; // rbp
__int64 v2; // rbx
const char *v3; // rax
__int64 v4; // r12
const char *v5; // rdx

v1 = (_QWORD *)macros;
if ( macros )
{
while ( 1 )
{
v2 = *v1;
if ( !*v1 )
break;
if ( *(_QWORD *)(v2 + 40) )
{
if ( a1 )
{
v3 = (const char *)where_str(*v1);
printf("%s: ", v3);
}
printf("#define %s", *(const char **)(v2 + 32));
if ( (unsigned int)(*(_DWORD *)(v2 + 48) - 1) <= 1 )
{
putchar(40);
v4 = *(_QWORD *)(v2 + 56);
if ( v4 )
{
while ( *(_QWORD *)v4 )
{
v5 = (const char *)&unk_4BA;
if ( *(_QWORD *)(v4 + 8) )
v5 = ", ";
printf("%s%s", *(const char **)v4, v5);
v4 += 8LL;
}
}
if ( *(_DWORD *)(v2 + 48) == 2 )
printf(", ...");
putchar(41);
}
printf(" %s\n", *(const char **)(v2 + 40));
}
++v1;
}
}
}

canonical_decompiled_code:
void __fastcall func7(int a1)
{
_QWORD *v1; // rbp
__int64 v2; // rbx
const char *v3; // rax
__int64 v4; // r12
const char *v5; // rdx

v1 = (_QWORD *)macros;
if ( macros )
{
while ( 1 )
{
v2 = *v1;
if ( !*v1 )
break;
if ( *(_QWORD *)(v2 + 40) )
{
if ( a1 )
{
v3 = (const char *)where_str(*v1);
printf("%s: ", v3);
}
printf("#define %s", *(const char **)(v2 + 32));
if ( (unsigned int)(*(_DWORD *)(v2 + 48) - 1) <= 1 )
{
putchar(40);
v4 = *(_QWORD *)(v2 + 56);
if ( v4 )
{
while ( *(_QWORD *)v4 )
{
v5 = (const char *)&unk_4BA;
if ( *(_QWORD *)(v4 + 8) )
v5 = ", ";
printf("%s%s", *(const char **)v4, v5);
v4 += 8LL;
}
}
if ( *(_DWORD *)(v2 + 48) == 2 )
printf(", ...");
putchar(41);
}
printf(" %s\n", *(const char **)(v2 + 40));
}
++v1;
}
}
}

original_code:
void macros_dump(int show_where)
{
 macro **i, *m; for(i = macros; i && (m = *i); i++){
  if(m->val){
   if(show_where)
    printf("%s: ", where_str(&m->where));
   printf("#define %s", m->nam);
   switch(m->type){
    case FUNC:
    case VARIADIC:
    {
     char **arg;
     putchar('(');
     for(arg = m->args; arg && *arg; arg++)
      printf("%s%s", *arg, arg[1] ? ", " : "");
     if(m->type == VARIADIC)
      printf(", ...");
     putchar(')');
     case MACRO:
     break;
    }
   }
   printf(" %s\n", m->val);
  }
 }
}

canonical_original_code:
void macros_dump(int show_where)
{
 struct macro **i; struct macro *m; for(i = macros; i && (m = *i); i++){
  if(m->val){
   if(show_where)
    printf("%s: ", where_str(&m->where));
   printf("#define %s", m->nam);
   switch(m->type){
    case FUNC:
    case VARIADIC:
    {
     char **arg;
     putchar('(');
     for(arg = m->args; arg && *arg; arg++)
      printf("%s%s", *arg, arg[1] ? ", " : "");
     if(m->type == VARIADIC)
      printf(", ...");
     putchar(')');
     case MACRO:
     break;
    }
   }
   printf(" %s\n", m->val);
  }
 }
}

variable_types:
arg
char **