main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char v3; // bl
_QWORD *v4; // rax
_BYTE *v5; // rax
const char *v6; // rbx
const char *v8; // rbp
_QWORD *v9; // r12
void *v10; // rbx
_QWORD *i; // rbx
int v12; // ebp
char v13[88]; // [rsp+0h] [rbp-58h] BYREF

encrypt_flag = 1;
chksum_crc32gentab(argc, argv, envp);
if ( argc > 1 && !strcmp(argv[1], "-h") )
{
puts("\n***Atra-Hasis Steganography Tool***\n");
puts("Program default is to encrypt text:");
puts("to ENCODE with ENCRYPTION:\t ./AtraHasis [input image] [output image] [input text]");
puts("to DECODE with DECRYPTION:\t ./AtraHasis [input image]\n");
puts("User may choose to use plaintext instead with the [-u] flag.");
puts("to ENCODE with PLAINTEXT:\t ./AtraHasis -u [input image] [output image] [input text]");
puts("to DECODE with PLAINTEXT:\t ./AtraHasis -u [input image]\n");
return 0;
}
if ( (unsigned int)(argc - 2) > 3 || ((argc - 3) & 0xFFFFFFFD) == 0 && strcmp(argv[1], "-u") )
{
puts("\nINCORRECT ARGUMENT FORMAT");
puts("use [-h] for help.\n");
return 0;
}
if ( ((argc - 2) & 0xFFFFFFFD) != 0 )
{
encrypt_flag = 0;
v3 = 1;
}
else
{
printf("Enter password for this image: ");
fgets(v13, 63, stdin);
keygen(v13);
v3 = 0;
}
if ( argc > 3 )
{
putchar(10);
open_files((char *)argv[(char)(v3 + 3) - 2], (char *)argv[(char)(v3 + 3) - 1], (char *)argv[(char)(v3 + 3)]);
if ( fin && fout && ftext )
{
puts("ENCODING THIS MESSAGE...\n");
v8 = encode_msg();
v9 = collate();
v10 = get_header();
write_out(v10, 8u);
free(v10);
for ( i = process_chunk(); (unsigned int)chars_to_int((_DWORD *)i[1]) != 1229209940; i = process_chunk() )
{
write_body((__int64)i, 0LL);
free(i);
}
v12 = write_body((__int64)v9, (__int64)v8);
free(v9);
while ( (unsigned int)chars_to_int((_DWORD *)i[1]) == 1229209940 )
i = process_chunk();
write_body((__int64)i, 0LL);
free(i);
while ( (unsigned int)chars_to_int((_DWORD *)i[1]) != 1229278788 )
{
i = process_chunk();
write_body((__int64)i, 0LL);
free(i);
}
if ( v12 )
puts("MESSAGE ENCODED SUCCESSFULLY\n");
else
puts("MESSAGE ENCODING FAILED. Image was too small.\n");
goto LABEL_11;
}
LABEL_16:
puts("MESSAGE ENCODING FAILED. Argument files not valid.\n");
return 0;
}
putchar(10);
open_files((char *)argv[(char)(v3 + 1)], 0LL, 0LL);
if ( !fin )
goto LABEL_16;
puts("DECODING MESSAGE...");
v4 = collate();
v5 = (_BYTE *)read_code(v4);
v6 = (const char *)decode_msg(v5);
puts("\nSTART DECODED MESSAGE:");
printf("\n%s\n", v6);
puts("\n:END DECODED MESSAGE\n");
LABEL_11:
close_files();
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char v3; // bl
_QWORD *v4; // rax
_BYTE *v5; // rax
const char *v6; // rbx
const char *v8; // rbp
_QWORD *v9; // r12
void *v10; // rbx
_QWORD *i; // rbx
int v12; // ebp
char v13[88]; // [rsp+0h] [rbp-58h] BYREF

encrypt_flag = 1;
chksum_crc32gentab(argc, argv, envp);
if ( argc > 1 && !strcmp(argv[1], "-h") )
{
puts("\n***Atra-Hasis Steganography Tool***\n");
puts("Program default is to encrypt text:");
puts("to ENCODE with ENCRYPTION:\t ./AtraHasis [input image] [output image] [input text]");
puts("to DECODE with DECRYPTION:\t ./AtraHasis [input image]\n");
puts("User may choose to use plaintext instead with the [-u] flag.");
puts("to ENCODE with PLAINTEXT:\t ./AtraHasis -u [input image] [output image] [input text]");
puts("to DECODE with PLAINTEXT:\t ./AtraHasis -u [input image]\n");
return 0;
}
if ( (unsigned int)(argc - 2) > 3 || ((argc - 3) & 0xFFFFFFFD) == 0 && strcmp(argv[1], "-u") )
{
puts("\nINCORRECT ARGUMENT FORMAT");
puts("use [-h] for help.\n");
return 0;
}
if ( ((argc - 2) & 0xFFFFFFFD) != 0 )
{
encrypt_flag = 0;
v3 = 1;
}
else
{
printf("Enter password for this image: ");
fgets(v13, 63, stdin);
keygen(v13);
v3 = 0;
}
if ( argc > 3 )
{
putchar(10);
func3((char *)argv[(char)(v3 + 3) - 2], (char *)argv[(char)(v3 + 3) - 1], (char *)argv[(char)(v3 + 3)]);
if ( fin && fout && ftext )
{
puts("ENCODING THIS MESSAGE...\n");
v8 = func9();
v9 = func7();
v10 = func5();
func4(v10, 8u);
free(v10);
for ( i = func6(); (unsigned int)func0((_DWORD *)i[1]) != 1229209940; i = func6() )
{
func8((__int64)i, 0LL);
free(i);
}
v12 = func8((__int64)v9, (__int64)v8);
free(v9);
while ( (unsigned int)func0((_DWORD *)i[1]) == 1229209940 )
i = func6();
func8((__int64)i, 0LL);
free(i);
while ( (unsigned int)func0((_DWORD *)i[1]) != 1229278788 )
{
i = func6();
func8((__int64)i, 0LL);
free(i);
}
if ( v12 )
puts("MESSAGE ENCODED SUCCESSFULLY\n");
else
puts("MESSAGE ENCODING FAILED. Image was too small.\n");
goto LABEL_11;
}
LABEL_16:
puts("MESSAGE ENCODING FAILED. Argument files not valid.\n");
return 0;
}
putchar(10);
func3((char *)argv[(char)(v3 + 1)], 0LL, 0LL);
if ( !fin )
goto LABEL_16;
puts("DECODING MESSAGE...");
v4 = func7();
v5 = (_BYTE *)read_code(v4);
v6 = (const char *)func10(v5);
puts("\nSTART DECODED MESSAGE:");
printf("\n%s\n", v6);
puts("\n:END DECODED MESSAGE\n");
LABEL_11:
func2();
return 0;
}

original_code:
int main(int argc, char *argv[])
{
 unsigned char *header;
 char *msg, password[63];
 datachunk *chunk, *IDATchunk;
 char arg_offset = 0;
 int success = 0;
 encrypt_flag = 1;
 chksum_crc32gentab();
 if (argc >= 2 && !strcmp(argv[1],"-h"))
 {
  printf("\n***Atra-Hasis Steganography Tool***\n\n");
  printf("Program default is to encrypt text:\n");
  printf("to ENCODE with ENCRYPTION:\t ./AtraHasis [input image] [output image] [input text]\n");
  printf("to DECODE with DECRYPTION:\t ./AtraHasis [input image]\n\n");
  printf("User may choose to use plaintext instead with the [-u] flag.\n");
  printf("to ENCODE with PLAINTEXT:\t ./AtraHasis -u [input image] [output image] [input text]\n");
  printf("to DECODE with PLAINTEXT:\t ./AtraHasis -u [input image]\n\n");
  return 0;
 }
 else if(argc > 5 || argc < 2 || ((argc == 3 || argc == 5) && strcmp(argv[1],"-u")))
 {
  printf("\nINCORRECT ARGUMENT FORMAT\n");
  printf("use [-h] for help.\n\n");
  return 0;
 }
 if (argc == 2 || argc == 4)
 {
  printf("Enter password for this image: ");
  fgets(password, sizeof(password), stdin);
  keygen(password);
 }
 else
 {
  encrypt_flag = 0;
  arg_offset = 1;
 }
 if(argc <= 3)
 {
  printf("\n");
  open_files(argv[arg_offset+1], ((void *)0), ((void *)0));
  if (!fin)
  {
   printf("MESSAGE ENCODING FAILED. Argument files not valid.\n\n");
   return 0;
  }
  printf("DECODING MESSAGE...\n");
  IDATchunk = collate();
  msg = read_code(IDATchunk);
  msg = decode_msg(msg);
  printf("\nSTART DECODED MESSAGE:\n");
  printf("\n%s\n", msg);
  printf("\n:END DECODED MESSAGE\n\n");
 }
 else
 {
  printf("\n");
  open_files(argv[arg_offset+1], argv[arg_offset+2], argv[arg_offset+3]);
  if (!fin || !fout || !ftext)
  {
   printf("MESSAGE ENCODING FAILED. Argument files not valid.\n\n");
   return 0;
  }
  printf("ENCODING THIS MESSAGE...\n\n");
  msg = encode_msg();
  IDATchunk = collate();
  header = get_header();
  write_out(header, 8);
  free(header);
  chunk = process_chunk();
  while (chars_to_int(chunk->type) != 0x49444154)
  {
   write_body(chunk, ((void *)0));
   free(chunk);
   chunk = process_chunk();
  }
  success = write_body(IDATchunk, msg);
  free(IDATchunk);
  while (chars_to_int(chunk->type) == 0x49444154)
  {
   chunk = process_chunk();
  }
  write_body(chunk, ((void *)0));
  free(chunk);
  while (chars_to_int(chunk->type) != 0x49454e44)
  {
   chunk = process_chunk();
   write_body(chunk, ((void *)0));
   free(chunk);
  }
  if (success)
   printf("MESSAGE ENCODED SUCCESSFULLY\n\n");
  else
   printf("MESSAGE ENCODING FAILED. Image was too small.\n\n");
 }
 close_files();
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
 unsigned char *header;
 char *msg; char password[63];
 struct datachunk *chunk; struct datachunk *IDATchunk;
 char arg_offset = 0;
 int success = 0;
 encrypt_flag = 1;
 chksum_crc32gentab();
 if (argc >= 2 && !strcmp(argv[1],"-h"))
 {
  printf("\n***Atra-Hasis Steganography Tool***\n\n");
  printf("Program default is to encrypt text:\n");
  printf("to ENCODE with ENCRYPTION:\t ./AtraHasis [input image] [output image] [input text]\n");
  printf("to DECODE with DECRYPTION:\t ./AtraHasis [input image]\n\n");
  printf("User may choose to use plaintext instead with the [-u] flag.\n");
  printf("to ENCODE with PLAINTEXT:\t ./AtraHasis -u [input image] [output image] [input text]\n");
  printf("to DECODE with PLAINTEXT:\t ./AtraHasis -u [input image]\n\n");
  return 0;
 }
 else if(argc > 5 || argc < 2 || ((argc == 3 || argc == 5) && strcmp(argv[1],"-u")))
 {
  printf("\nINCORRECT ARGUMENT FORMAT\n");
  printf("use [-h] for help.\n\n");
  return 0;
 }
 if (argc == 2 || argc == 4)
 {
  printf("Enter password for this image: ");
  fgets(password, sizeof(password), stdin);
  keygen(password);
 }
 else
 {
  encrypt_flag = 0;
  arg_offset = 1;
 }
 if(argc <= 3)
 {
  printf("\n");
  open_files(argv[arg_offset+1], ((void *)0), ((void *)0));
  if (!fin)
  {
   printf("MESSAGE ENCODING FAILED. Argument files not valid.\n\n");
   return 0;
  }
  printf("DECODING MESSAGE...\n");
  IDATchunk = collate();
  msg = read_code(IDATchunk);
  msg = decode_msg(msg);
  printf("\nSTART DECODED MESSAGE:\n");
  printf("\n%s\n", msg);
  printf("\n:END DECODED MESSAGE\n\n");
 }
 else
 {
  printf("\n");
  open_files(argv[arg_offset+1], argv[arg_offset+2], argv[arg_offset+3]);
  if (!fin || !fout || !ftext)
  {
   printf("MESSAGE ENCODING FAILED. Argument files not valid.\n\n");
   return 0;
  }
  printf("ENCODING THIS MESSAGE...\n\n");
  msg = encode_msg();
  IDATchunk = collate();
  header = get_header();
  write_out(header, 8);
  free(header);
  chunk = process_chunk();
  while (chars_to_int(chunk->type) != 0x49444154)
  {
   write_body(chunk, ((void *)0));
   free(chunk);
   chunk = process_chunk();
  }
  success = write_body(IDATchunk, msg);
  free(IDATchunk);
  while (chars_to_int(chunk->type) == 0x49444154)
  {
   chunk = process_chunk();
  }
  write_body(chunk, ((void *)0));
  free(chunk);
  while (chars_to_int(chunk->type) != 0x49454e44)
  {
   chunk = process_chunk();
   write_body(chunk, ((void *)0));
   free(chunk);
  }
  if (success)
   printf("MESSAGE ENCODED SUCCESSFULLY\n\n");
  else
   printf("MESSAGE ENCODING FAILED. Image was too small.\n\n");
 }
 close_files();
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types:
password
char [63]


decompiled_code:
__int64 __fastcall chksum_crc32(_BYTE *a1, int a2)
{
unsigned __int64 v2; // rax
_BYTE *v3; // rsi

v2 = 0xFFFFFFFFLL;
if ( a2 )
{
v3 = &a1[a2];
do
v2 = (v2 >> 8) ^ (unsigned int)crc_tab[(unsigned __int8)(*a1++ ^ v2)];
while ( v3 != a1 );
}
return (unsigned int)~(_DWORD)v2;
}

canonical_decompiled_code:
__int64 __fastcall func0(_BYTE *a1, int a2)
{
unsigned __int64 v2; // rax
_BYTE *v3; // rsi

v2 = 0xFFFFFFFFLL;
if ( a2 )
{
v3 = &a1[a2];
do
v2 = (v2 >> 8) ^ (unsigned int)crc_tab[(unsigned __int8)(*a1++ ^ v2)];
while ( v3 != a1 );
}
return (unsigned int)~(_DWORD)v2;
}

original_code:
u_int32_t chksum_crc32 (unsigned char *block, unsigned int length)
{
 register unsigned long crc;
 unsigned long i;
 crc = 0xFFFFFFFF;
 for (i = 0; i < length; i++)
 {
  crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_tab[(crc ^ *block++) & 0xFF];
 }
 return (crc ^ 0xFFFFFFFF);
}

canonical_original_code:
unsigned int chksum_crc32(unsigned char *block, unsigned int length)
{
 register unsigned long crc;
 unsigned long i;
 crc = 0xFFFFFFFF;
 for (i = 0; i < length; i++)
 {
  crc = ((crc >> 8) & 0x00FFFFFF) ^ crc_tab[(crc ^ *block++) & 0xFF];
 }
 return (crc ^ 0xFFFFFFFF);
}

variable_types:
block
unsigned char *

variable_types:
length
unsigned int

variable_types:
crc
unsigned long

variable_types:
i
unsigned long

return_type: unsigned int


decompiled_code:
unsigned __int64 chksum_crc32gentab()
{
unsigned __int64 i; // rcx
unsigned __int64 result; // rax
int v2; // edx

for ( i = 0LL; i != 256; ++i )
{
result = i;
v2 = 8;
do
{
if ( (result & 1) != 0 )
result = (result >> 1) ^ 0xEDB88320;
else
result >>= 1;
--v2;
}
while ( v2 );
crc_tab[i] = result;
}
return result;
}

canonical_decompiled_code:
unsigned __int64 func1()
{
unsigned __int64 i; // rcx
unsigned __int64 result; // rax
int v2; // edx

for ( i = 0LL; i != 256; ++i )
{
result = i;
v2 = 8;
do
{
if ( (result & 1) != 0 )
result = (result >> 1) ^ 0xEDB88320;
else
result >>= 1;
--v2;
}
while ( v2 );
crc_tab[i] = result;
}
return result;
}

original_code:
void chksum_crc32gentab ()
{
 unsigned long crc, poly;
 int i, j;
 poly = 0xEDB88320L;
 for (i = 0; i < 256; i++)
 {
  crc = i;
  for (j = 8; j > 0; j--)
  {
   if (crc & 1)
   {
    crc = (crc >> 1) ^ poly;
   }
   else
   {
    crc >>= 1;
   }
  }
  crc_tab[i] = crc;
 }
}

canonical_original_code:
void chksum_crc32gentab()
{
 unsigned long crc; unsigned long poly;
 int i; int j;
 poly = 0xEDB88320L;
 for (i = 0; i < 256; i++)
 {
  crc = i;
  for (j = 8; j > 0; j--)
  {
   if (crc & 1)
   {
    crc = (crc >> 1) ^ poly;
   }
   else
   {
    crc >>= 1;
   }
  }
  crc_tab[i] = crc;
 }
}

variable_types:
poly
unsigned long

variable_types: i int

variable_types: j int

return_type: void


paeth

decompiled_code:
__int64 __fastcall paeth(unsigned int a1, unsigned int a2, unsigned int a3)
{
unsigned int v4; // esi
int v5; // ecx
unsigned int v6; // eax
unsigned int v7; // edx
unsigned int v8; // eax
unsigned int v9; // ecx
unsigned int v10; // er9

v4 = a3;
v5 = a2 - a3;
v6 = a1 + a2 - a3;
v7 = abs32(a1 - a3);
v8 = abs32(v6 - v4);
v9 = abs32(v5);
v10 = v8;
if ( v7 <= v8 )
v10 = v7;
if ( v9 > v10 )
{
if ( v7 <= v8 )
v4 = a2;
a1 = v4;
}
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int a1, unsigned int a2, unsigned int a3)
{
unsigned int v4; // esi
int v5; // ecx
unsigned int v6; // eax
unsigned int v7; // edx
unsigned int v8; // eax
unsigned int v9; // ecx
unsigned int v10; // er9

v4 = a3;
v5 = a2 - a3;
v6 = a1 + a2 - a3;
v7 = abs32(a1 - a3);
v8 = abs32(v6 - v4);
v9 = abs32(v5);
v10 = v8;
if ( v7 <= v8 )
v10 = v7;
if ( v9 > v10 )
{
if ( v7 <= v8 )
v4 = a2;
a1 = v4;
}
return a1;
}

original_code:
unsigned int paeth(unsigned int a, unsigned int b, unsigned int c)
{
 unsigned int p, pa, pb, pc;
 p = a + b - c;
 pa = abs(p-a);
 pb = abs(p-b);
 pc = abs(p-c);
 if ((pa <= pb) && (pa <= pc)) return a;
 else if (pb <= pc) return b;
 else return c;
}

canonical_original_code:
unsigned int paeth(unsigned int a, unsigned int b, unsigned int c)
{
 unsigned int p; unsigned int pa; unsigned int pb; unsigned int pc;
 p = a + b - c;
 pa = abs(p-a);
 pb = abs(p-b);
 pc = abs(p-c);
 if ((pa <= pb) && (pa <= pc)) return a;
 else if (pb <= pc) return b;
 else return c;
}

variable_types:
a
unsigned int

variable_types:
b
unsigned int

variable_types:
c
unsigned int

variable_types:
p
unsigned int

variable_types:
pa
unsigned int

variable_types:
pb
unsigned int

variable_types:
pc
unsigned int


filter

decompiled_code:
void filter()
{
;
}

canonical_decompiled_code:
void func3()
{
;
}

original_code:
void filter(unsigned char *prev, unsigned char *curr, int type)
{
 switch (type)
 {
  case 0:
   break;
  case 1:
   break;
  case 2:
   break;
  case 3:
   break;
  case 4:
   break;
  default:
   break;
 }
}

variable_types:
prev
unsigned char *

variable_types:
curr
unsigned char *

variable_types: type int


decompiled_code:
void __fastcall unfilter1(__int64 a1)
{
unsigned int v1; // eax

if ( (unsigned int)step > 4 )
{
v1 = 4;
do
{
*(_BYTE *)(a1 + v1) += *(_BYTE *)(a1 + v1 - 3);
++v1;
}
while ( (unsigned int)step > v1 );
}
}

canonical_decompiled_code:
void __fastcall func4(__int64 a1)
{
unsigned int v1; // eax

if ( (unsigned int)step > 4 )
{
v1 = 4;
do
{
*(_BYTE *)(a1 + v1) += *(_BYTE *)(a1 + v1 - 3);
++v1;
}
while ( (unsigned int)step > v1 );
}
}

original_code:
void unfilter1(unsigned char *curr)
{
 unsigned int pos;
 for (pos = 4; pos < step; pos++)
  curr[pos] += curr[pos-3];
}

variable_types:
pos
unsigned int


decompiled_code:
void __fastcall unfilter2(__int64 a1, __int64 a2)
{
unsigned int v2; // eax

if ( (unsigned int)step > 1 )
{
v2 = 1;
do
{
*(_BYTE *)(a2 + v2) += *(_BYTE *)(a1 + v2);
++v2;
}
while ( (unsigned int)step > v2 );
}
}

canonical_decompiled_code:
void __fastcall func5(__int64 a1, __int64 a2)
{
unsigned int v2; // eax

if ( (unsigned int)step > 1 )
{
v2 = 1;
do
{
*(_BYTE *)(a2 + v2) += *(_BYTE *)(a1 + v2);
++v2;
}
while ( (unsigned int)step > v2 );
}
}

original_code:
void unfilter2(unsigned char *prev, unsigned char *curr)
{
 unsigned int pos;
 for (pos = 1; pos < step; pos++)
  curr[pos] += prev[pos];
}


decompiled_code:
char __fastcall unfilter3(_BYTE *a1, _BYTE *a2)
{
int v2; // eax
unsigned int v3; // edx

a2[1] += a1[1] >> 1;
a2[2] += a1[2] >> 1;
LOBYTE(v2) = a1[3] >> 1;
a2[3] += v2;
if ( (unsigned int)step > 4 )
{
v3 = 4;
do
{
v2 = ((unsigned __int8)a1[v3] + (unsigned __int8)a2[v3 - 3]) >> 1;
a2[v3++] += v2;
}
while ( (unsigned int)step > v3 );
}
return v2;
}

canonical_decompiled_code:
char __fastcall func6(_BYTE *a1, _BYTE *a2)
{
int v2; // eax
unsigned int v3; // edx

a2[1] += a1[1] >> 1;
a2[2] += a1[2] >> 1;
LOBYTE(v2) = a1[3] >> 1;
a2[3] += v2;
if ( (unsigned int)step > 4 )
{
v3 = 4;
do
{
v2 = ((unsigned __int8)a1[v3] + (unsigned __int8)a2[v3 - 3]) >> 1;
a2[v3++] += v2;
}
while ( (unsigned int)step > v3 );
}
return v2;
}

original_code:
void unfilter3(unsigned char *prev, unsigned char *curr)
{
 unsigned int pos;
 curr[1] += prev[1]/2;
 curr[2] += prev[2]/2;
 curr[3] += prev[3]/2;
 for (pos = 4; pos < step; pos++)
  curr[pos] += (curr[pos-3]+prev[pos])/2;
}


decompiled_code:
__int64 __fastcall unfilter4(unsigned __int8 *a1, _BYTE *a2)
{
__int64 result; // rax
unsigned int v3; // ebx

a2[1] += paeth(0, a1[1], 0);
a2[2] += paeth(0, a1[2], 0);
result = paeth(0, a1[3], 0);
a2[3] += result;
if ( (unsigned int)step > 4 )
{
v3 = 4;
do
{
result = paeth((unsigned __int8)a2[v3 - 3], a1[v3], a1[v3 - 3]);
a2[v3++] += result;
}
while ( (unsigned int)step > v3 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(unsigned __int8 *a1, _BYTE *a2)
{
__int64 result; // rax
unsigned int v3; // ebx

a2[1] += func2(0, a1[1], 0);
a2[2] += func2(0, a1[2], 0);
result = func2(0, a1[3], 0);
a2[3] += result;
if ( (unsigned int)step > 4 )
{
v3 = 4;
do
{
result = func2((unsigned __int8)a2[v3 - 3], a1[v3], a1[v3 - 3]);
a2[v3++] += result;
}
while ( (unsigned int)step > v3 );
}
return result;
}

original_code:
void unfilter4(unsigned char *prev, unsigned char *curr)
{
 unsigned int pos;
 curr[1] += paeth(0, prev[1], 0);
 curr[2] += paeth(0, prev[2], 0);
 curr[3] += paeth(0, prev[3], 0);
 for (pos = 4; pos < step; pos++)
  curr[pos] += paeth(curr[pos-3], prev[pos], prev[pos-3]);
}


unfilter

decompiled_code:
void __fastcall unfilter(unsigned __int8 *a1, _BYTE *a2, int a3)
{
*a2 = 0;
if ( a3 == 3 )
{
unfilter3(a1, a2);
}
else if ( a3 > 3 )
{
if ( a3 == 4 )
unfilter4(a1, a2);
}
else if ( a3 == 1 )
{
unfilter1((__int64)a2);
}
else if ( a3 == 2 )
{
unfilter2((__int64)a1, (__int64)a2);
}
}

original_code:
void unfilter(unsigned char *prev, unsigned char *curr, int type)
{
 curr[0] = 0;
 switch (type)
 {
  case 0:
   break;
  case 1:
   unfilter1(curr);
   break;
  case 2:
   unfilter2(prev, curr);
   break;
  case 3:
   unfilter3(prev, curr);
   break;
  case 4:
   unfilter4(prev, curr);
   break;
  default:
   break;
 }
}


original_code:
int write_code(datachunk *chunk, char *msg)
{
 unsigned int size = chunk->sizenum;
 unsigned int count = 7;
 unsigned int x = 0;
 unsigned int msgloc = 0;
 unsigned int linepos, oldblksize;
 unsigned char prevline[sizeof(char)*step];
 unsigned char currline[sizeof(char)*step];
 unsigned char charmask = 0x01;
 unsigned char matchmask = 0xFE;
 char ch, shift, endflag;
 ch = msg[msgloc];
 endflag = ch == (-1);
 shift = 0;
 for (count = 7; count < size; count += step)
 {
  oldblksize = blksize;
  x = 0;
  for(linepos = 0; linepos < step; linepos++)
  {
   if ((linepos + count) == blksize+7)
   {
    blksize = 0x00000000;
    blksize = (chunk->body[linepos+count+2] << 8) + chunk->body[linepos+count+1];
    blksize += oldblksize + 5;
    count += 5;
    x++;
   }
   if (count+linepos < size)
    currline[linepos] = chunk->body[linepos + count];
  }
  unfilter(prevline, currline, currline[0]);
  blksize = oldblksize;
  count -= 5*x;
  for(linepos = 0; linepos < step; linepos++)
  {
   if ((linepos + count) == blksize+7)
   {
    blksize = 0x00000000;
    blksize = (chunk->body[count+linepos+2] << 8) + chunk->body[count+linepos+1];
    blksize += oldblksize + 5;
    count += 5;
   }
   if (count+linepos < size)
   {
    chunk->body[count+linepos] = currline[linepos];
    if (linepos)
    {
      chunk->body[count+linepos] &= matchmask;
     chunk->body[count+linepos] |= ((ch >> shift) & charmask);
     if (shift == 7)
     {
      if (!endflag)
      {
       ch = msg[++msgloc];
       endflag = ch == (-1);
      }
      shift = 0;
     }
     else
      shift++;
    }
   }
   prevline[linepos] = currline[linepos];
  }
 }
 return endflag;
}

canonical_original_code:
int write_code(struct datachunk *chunk, char *msg)
{
 unsigned int size = chunk->sizenum;
 unsigned int count = 7;
 unsigned int x = 0;
 unsigned int msgloc = 0;
 unsigned int linepos; unsigned int oldblksize;
 unsigned char prevline[-1];
 unsigned char currline[-1];
 unsigned char charmask = 0x01;
 unsigned char matchmask = 0xFE;
 char ch; char shift; char endflag;
 ch = msg[msgloc];
 endflag = ch == (-1);
 shift = 0;
 for (count = 7; count < size; count += step)
 {
  oldblksize = blksize;
  x = 0;
  for(linepos = 0; linepos < step; linepos++)
  {
   if ((linepos + count) == blksize+7)
   {
    blksize = 0x00000000;
    blksize = (chunk->body[linepos+count+2] << 8) + chunk->body[linepos+count+1];
    blksize += oldblksize + 5;
    count += 5;
    x++;
   }
   if (count+linepos < size)
    currline[linepos] = chunk->body[linepos + count];
  }
  unfilter(prevline, currline, currline[0]);
  blksize = oldblksize;
  count -= 5*x;
  for(linepos = 0; linepos < step; linepos++)
  {
   if ((linepos + count) == blksize+7)
   {
    blksize = 0x00000000;
    blksize = (chunk->body[count+linepos+2] << 8) + chunk->body[count+linepos+1];
    blksize += oldblksize + 5;
    count += 5;
   }
   if (count+linepos < size)
   {
    chunk->body[count+linepos] = currline[linepos];
    if (linepos)
    {
      chunk->body[count+linepos] &= matchmask;
     chunk->body[count+linepos] |= ((ch >> shift) & charmask);
     if (shift == 7)
     {
      if (!endflag)
      {
       ch = msg[++msgloc];
       endflag = ch == (-1);
      }
      shift = 0;
     }
     else
      shift++;
    }
   }
   prevline[linepos] = currline[linepos];
  }
 }
 return endflag;
}

variable_types: struct datachunk { unsigned char *size; unsigned char *type; unsigned char *body; unsigned char *crc; unsigned int sizenum; unsigned int typenum; } *

variable_types:
msg
char *

variable_types:
size
unsigned int

variable_types:
count
unsigned int

variable_types:
x
unsigned int

variable_types:
msgloc
unsigned int

variable_types:
linepos
unsigned int

variable_types:
oldblksize
unsigned int

variable_types:
prevline
unsigned char [-1]

variable_types:
currline
unsigned char [-1]

variable_types:
charmask
unsigned char

variable_types:
matchmask
unsigned char

variable_types: ch char

variable_types: shift char

variable_types: endflag char

return_type: int


repo: jkodumal/banshee

decompiled_code:
void term_reset_stats()
{
term_stats[0] = 0;
term_stats[1] = 0;
term_stats[2] = 0;
}

canonical_decompiled_code:
void func0()
{
term_stats[0] = 0;
term_stats[1] = 0;
term_stats[2] = 0;
}

original_code:
static void term_reset_stats(void)
{
  term_stats.fresh = 0;
  term_stats.fresh_small = 0;
  term_stats.fresh_large = 0;
}

canonical_original_code:
static void term_reset_stats()
{
  term_stats.fresh = 0;
  term_stats.fresh_small = 0;
  term_stats.fresh_large = 0;
}


decompiled_code:
__int64 __fastcall term_fresh(__int64 a1)
{
++term_stats[0];
return tv_fresh(term_sort_region, a1);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
++term_stats[0];
return tv_fresh(term_sort_region, a1);
}

original_code:
gen_e term_fresh(const char *name)
{
  term_stats.fresh++;
  return (gen_e)tv_fresh(term_sort_region,name);
}

canonical_original_code:
struct gen_e_ *term_fresh(char *name)
{
  term_stats.fresh++;
  return (struct gen_e_ *)tv_fresh(term_sort_region,name);
}

variable_types:
name
char *

return_type: struct gen_e_ { enum sort_kind { flowrow_sort=0, setif_sort=1, setst_sort=2, term_sort=3 } sort; } *


decompiled_code:
__int64 __fastcall term_fresh_large(__int64 a1)
{
++term_stats[2];
return tv_fresh_large(term_sort_region, a1);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
++term_stats[2];
return tv_fresh_large(term_sort_region, a1);
}

original_code:
gen_e term_fresh_large(const char *name)
{
  term_stats.fresh_large++;
  return (gen_e)tv_fresh_large(term_sort_region,name);
}

canonical_original_code:
struct gen_e_ *term_fresh_large(char *name)
{
  term_stats.fresh_large++;
  return (struct gen_e_ *)tv_fresh_large(term_sort_region,name);
}

user_defined_types: enum sort_kind { flowrow_sort=0, setif_sort=1, setst_sort=2, term_sort=3 }


decompiled_code:
__int64 __fastcall term_fresh_small(__int64 a1)
{
++term_stats[1];
return tv_fresh_small(term_sort_region, a1);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
++term_stats[1];
return tv_fresh_small(term_sort_region, a1);
}

original_code:
gen_e term_fresh_small(const char *name)
{
  term_stats.fresh_small++;
  return (gen_e)tv_fresh_small(term_sort_region,name);
}

canonical_original_code:
struct gen_e_ *term_fresh_small(char *name)
{
  term_stats.fresh_small++;
  return (struct gen_e_ *)tv_fresh_small(term_sort_region,name);
}


decompiled_code:
void *term_zero()
{
return &zero;
}

canonical_decompiled_code:
void *func5()
{
return &zero;
}

original_code:
gen_e term_zero(void)
{
  return (gen_e)&zero;
}

canonical_original_code:
struct gen_e_ *term_zero()
{
  return (gen_e)&zero;
}


decompiled_code:
void *term_one()
{
return &one;
}

canonical_decompiled_code:
void *func6()
{
return &one;
}

original_code:
gen_e term_one(void)
{
  return (gen_e)&one;
}

canonical_original_code:
struct gen_e_ *term_one()
{
  return (gen_e)&one;
}


decompiled_code:
void *term_wild()
{
return &wild;
}

canonical_decompiled_code:
void *func7()
{
return &wild;
}

original_code:
gen_e term_wild(void)
{
  return (gen_e)&wild;
}

canonical_original_code:
struct gen_e_ *term_wild()
{
  return (gen_e)&wild;
}


decompiled_code:
__int64 __fastcall term_constant(__int64 a1)
{
__int64 v1; // rbp
__int64 v2; // rbx
int v4[8]; // [rsp+8h] [rbp-20h] BYREF

v1 = _rc_rstrdup(banshee_nonptr_region, a1);
v4[0] = 4;
v4[1] = stamp_string(v1);
v2 = term_hash_find(term_sort_hash, v4, 2LL);
if ( !v2 )
{
v2 = _rc_ralloc_small0(term_constant_region, 16LL);
*(_DWORD *)v2 = 4;
*(_DWORD *)(v2 + 4) = stamp_fresh();
*(_QWORD *)(v2 + 8) = v1;
term_hash_insert(term_sort_hash, v2, v4, 2LL);
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
__int64 v1; // rbp
__int64 v2; // rbx
int v4[8]; // [rsp+8h] [rbp-20h] BYREF

v1 = _rc_rstrdup(banshee_nonptr_region, a1);
v4[0] = 4;
v4[1] = stamp_string(v1);
v2 = term_hash_find(term_sort_hash, v4, 2LL);
if ( !v2 )
{
v2 = _rc_ralloc_small0(term_constant_region, 16LL);
*(_DWORD *)v2 = 4;
*(_DWORD *)(v2 + 4) = stamp_fresh();
*(_QWORD *)(v2 + 8) = v1;
term_hash_insert(term_sort_hash, v2, v4, 2LL);
}
return v2;
}

original_code:
gen_e term_constant(const char *str)
{
  stamp st[2];
  gen_e result;
  char *name = (((void)0), __rc_rstrdup)(banshee_nonptr_region,str);
  ((void) (0));
  st[0] = 4;
  st[1] = stamp_string(name);
  if ( (result = term_hash_find(term_sort_hash,st,2)) == ((void *)0))
    {
      term_constant_ c = (sizeof(struct term_constant_) < (1 << (13 - 3)) ? (((void)0), __rc_ralloc_small0)((term_constant_region), sizeof(struct term_constant_)) : (((void)0), __rc_typed_ralloc)((term_constant_region), sizeof(struct term_constant_), 0));
      c->type = 4;
      c->st = stamp_fresh();
      c->name = name;
      result = (gen_e) c;
      term_hash_insert(term_sort_hash,result,st,2);
      return result;
    }
  else
    {
      return result;
    }
}

canonical_original_code:
struct gen_e_ *term_constant(char *str)
{
  int st[2];
  struct gen_e_ *result;
  char *name = (((void)0), __rc_rstrdup)(banshee_nonptr_region,str);
  ((void) (0));
  st[0] = 4;
  st[1] = stamp_string(name);
  if ( (result = term_hash_find(term_sort_hash,st,2)) == ((void *)0))
    {
      struct term_constant_ *c = (sizeof(struct term_constant_) < (1 << (13 - 3)) ? (((void)0), __rc_ralloc_small0)((term_constant_region), sizeof(struct term_constant_)) : (((void)0), __rc_typed_ralloc)((term_constant_region), sizeof(struct term_constant_), 0));
      c->type = 4;
      c->st = stamp_fresh();
      c->name = name;
      result = (struct gen_e_ *) c;
      term_hash_insert(term_sort_hash,result,st,2);
      return result;
    }
  else
    {
      return result;
    }
}

variable_types:
str
char *

variable_types:
st
int [2]

variable_types: struct gen_e_ { enum sort_kind { flowrow_sort=0, setif_sort=1, setst_sort=2, term_sort=3 } sort; } *

variable_types: struct term_constant_ { enum sort_kind { flowrow_sort=0, setif_sort=1, setst_sort=2, term_sort=3 } sort; int type; int st; char *name; } *

user_defined_types: struct term_constant_ { enum sort_kind sort; int type; int st; char *name; }


decompiled_code:
bool __fastcall term_is_initial_var(_DWORD *a1)
{
return *a1 == -1;
}

canonical_decompiled_code:
bool __fastcall func9(_DWORD *a1)
{
return *a1 == -1;
}

original_code:
bool term_is_initial_var(gen_e e)
{
  return ((gen_term)e)->type == -1;
}

canonical_original_code:
unsigned char term_is_initial_var(struct gen_e_ *e)
{
  return ((struct gen_term *)e)->type == -1;
}

return_type: unsigned char

user_defined_types: struct gen_term { enum sort_kind sort; int type; int st; }


decompiled_code:
__int64 __fastcall term_get_stamp(_DWORD *a1)
{
__int64 result; // rax

if ( *a1 == -1 )
result = *(unsigned int *)(term_get_ecr(a1) + 4);
else
result = (unsigned int)a1[1];
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(_DWORD *a1)
{
__int64 result; // rax

if ( *a1 == -1 )
result = *(unsigned int *)(func10(a1) + 4);
else
result = (unsigned int)a1[1];
return result;
}

original_code:
stamp term_get_stamp(gen_e e)
{
  if ( ((gen_term)e)->type == -1 )
    return ((gen_term)term_get_ecr(e))->st;
  else
    return ((gen_term)e)->st;
}

canonical_original_code:
int term_get_stamp(struct gen_e_ *e)
{
  if ( ((struct gen_term *)e)->type == -1 )
    return ((struct gen_term *)term_get_ecr(e))->st;
  else
    return ((struct gen_term *)e)->st;
}


decompiled_code:
bool __fastcall term_is_zero(_DWORD *a1)
{
return *(_DWORD *)term_get_ecr(a1) == 0;
}

canonical_decompiled_code:
bool __fastcall func13(_DWORD *a1)
{
return *(_DWORD *)func10(a1) == 0;
}

original_code:
bool term_is_zero(gen_e e)
{
  return ( ((gen_term)term_get_ecr(e))->type == 0);
}

canonical_original_code:
unsigned char term_is_zero(struct gen_e_ *e)
{
  return ( ((struct gen_term *)term_get_ecr(e))->type == 0);
}


decompiled_code:
bool __fastcall term_is_wild(_DWORD *a1)
{
return *(_DWORD *)term_get_ecr(a1) == 6;
}

canonical_decompiled_code:
bool __fastcall func14(_DWORD *a1)
{
return *(_DWORD *)func10(a1) == 6;
}

original_code:
bool term_is_wild(gen_e e)
{
  return ( ((gen_term)term_get_ecr(e))->type == 6);
}

canonical_original_code:
unsigned char term_is_wild(struct gen_e_ *e)
{
  return ( ((struct gen_term *)term_get_ecr(e))->type == 6);
}


decompiled_code:
bool __fastcall term_is_one(_DWORD *a1)
{
return *(_DWORD *)term_get_ecr(a1) == 1;
}

canonical_decompiled_code:
bool __fastcall func15(_DWORD *a1)
{
return *(_DWORD *)func10(a1) == 1;
}

original_code:
bool term_is_one(gen_e e)
{
  return ( ((gen_term)term_get_ecr(e))->type == 1);
}

canonical_original_code:
unsigned char term_is_one(struct gen_e_ *e)
{
  return ( ((struct gen_term *)term_get_ecr(e))->type == 1);
}


decompiled_code:
bool __fastcall term_is_var(_DWORD *a1)
{
return *(_DWORD *)term_get_ecr(a1) == -1;
}

canonical_decompiled_code:
bool __fastcall func16(_DWORD *a1)
{
return *(_DWORD *)func10(a1) == -1;
}

original_code:
bool term_is_var(gen_e e)
{
  return ( ((gen_term)term_get_ecr(e))->type == -1);
}

canonical_original_code:
unsigned char term_is_var(struct gen_e_ *e)
{
  return ( ((struct gen_term *)term_get_ecr(e))->type == -1);
}


decompiled_code:
_BOOL8 __fastcall term_is_bottom(_DWORD *a1)
{
bool v1; // dl
_BOOL8 result; // rax

v1 = term_is_zero(a1);
result = 1LL;
if ( !v1 )
result = term_is_var(a1);
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func17(_DWORD *a1)
{
bool v1; // dl
_BOOL8 result; // rax

v1 = func13(a1);
result = 1LL;
if ( !v1 )
result = func16(a1);
return result;
}

original_code:
static bool term_is_bottom(gen_e e)
{
  return (term_is_zero(e) || term_is_var(e));
}

canonical_original_code:
static unsigned char term_is_bottom(struct gen_e_ *e)
{
  return (term_is_zero(e) || term_is_var(e));
}


decompiled_code:
bool __fastcall term_is_constant(_DWORD *a1)
{
return *(_DWORD *)term_get_ecr(a1) == 4;
}

canonical_decompiled_code:
bool __fastcall func18(_DWORD *a1)
{
return *(_DWORD *)func10(a1) == 4;
}

original_code:
bool term_is_constant(gen_e e)
{
  return ( ((gen_term)term_get_ecr(e))->type == 4);
}

canonical_original_code:
unsigned char term_is_constant(struct gen_e_ *e)
{
  return ( ((struct gen_term *)term_get_ecr(e))->type == 4);
}


decompiled_code:
__int64 __fastcall term_get_constant_name(_DWORD *a1)
{
__int64 v1; // rbx
bool v2; // dl
__int64 result; // rax

v1 = term_get_ecr(a1);
v2 = term_is_constant((_DWORD *)v1);
result = 0LL;
if ( v2 )
result = *(_QWORD *)(v1 + 8);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func19(_DWORD *a1)
{
__int64 v1; // rbx
bool v2; // dl
__int64 result; // rax

v1 = func10(a1);
v2 = func18((_DWORD *)v1);
result = 0LL;
if ( v2 )
result = *(_QWORD *)(v1 + 8);
return result;
}

original_code:
char *term_get_constant_name(gen_e e)
{
  gen_e ecr = term_get_ecr(e);
  if(! term_is_constant(ecr))
    return ((void *)0);
  else
    return ((term_constant_)ecr)->name;
}

canonical_original_code:
char *term_get_constant_name(struct gen_e_ *e)
{
  struct gen_e_ *ecr = term_get_ecr(e);
  if(! term_is_constant(ecr))
    return ((void *)0);
  else
    return ((struct term_constant_ *)ecr)->name;
}

return_type: char *


decompiled_code:
bool __fastcall term_eq(_DWORD *a1, _DWORD *a2)
{
return eq(a1, a2);
}

canonical_decompiled_code:
bool __fastcall func20(_DWORD *a1, _DWORD *a2)
{
return func12(a1, a2);
}

original_code:
bool term_eq(gen_e e1, gen_e e2)
{
  return eq(e1,e2);
}

canonical_original_code:
unsigned char term_eq(struct gen_e_ *e1, struct gen_e_ *e2)
{
  return eq(e1,e2);
}


decompiled_code:
__int64 term_init()
{
__int64 result; // rax

term_rollback_info_region = newregion();
term_constant_region = newregion();
term_var_region = newregion();
term_sort_region = newregion();
result = make_term_hash(0LL);
term_sort_hash = result;
return result;
}

canonical_decompiled_code:
__int64 func27()
{
__int64 result; // rax

term_rollback_info_region = newregion();
term_constant_region = newregion();
term_var_region = newregion();
term_sort_region = newregion();
result = make_term_hash(0LL);
term_sort_hash = result;
return result;
}

original_code:
void term_init(void)
{
  term_rollback_info_region = newregion();
  term_constant_region = newregion();
  term_var_region = newregion();
  term_sort_region = newregion();
  term_sort_hash = make_term_hash(((void *)0));
}

canonical_original_code:
void term_init()
{
  term_rollback_info_region = newregion();
  term_constant_region = newregion();
  term_var_region = newregion();
  term_sort_region = newregion();
  term_sort_hash = make_term_hash(((void *)0));
}


decompiled_code:
__int64 term_reset()
{
term_hash_delete(term_sort_hash);
deleteregion(term_sort_region);
deleteregion(term_var_region);
deleteregion(term_constant_region);
deleteregion(term_rollback_info_region);
term_reset_stats();
return term_init();
}

canonical_decompiled_code:
__int64 func28()
{
term_hash_delete(term_sort_hash);
deleteregion(term_sort_region);
deleteregion(term_var_region);
deleteregion(term_constant_region);
deleteregion(term_rollback_info_region);
func0();
return func27();
}

original_code:
void term_reset(void)
{
  term_hash_delete(term_sort_hash);
  deleteregion(term_sort_region);
  deleteregion(term_var_region);
  deleteregion(term_constant_region);
  deleteregion(term_rollback_info_region);
  term_reset_stats();
  term_init();
}

canonical_original_code:
void term_reset()
{
  term_hash_delete(term_sort_hash);
  deleteregion(term_sort_region);
  deleteregion(term_var_region);
  deleteregion(term_constant_region);
  deleteregion(term_rollback_info_region);
  term_reset_stats();
  term_init();
}


decompiled_code:
__int64 term_set_fields()
{
return deserialize_set_obj(&term_current_rollback_info);
}

canonical_decompiled_code:
__int64 func37()
{
return deserialize_set_obj(&term_current_rollback_info);
}

original_code:
void term_set_fields(void)
{
  deserialize_set_obj((void **)&term_current_rollback_info);
}

canonical_original_code:
void term_set_fields()
{
  deserialize_set_obj((void **)&term_current_rollback_info);
}


eq

decompiled_code:
bool __fastcall eq(_DWORD *a1, _DWORD *a2)
{
int v2; // ebx

v2 = term_get_stamp(a1);
return v2 == (unsigned int)term_get_stamp(a2);
}

canonical_decompiled_code:
bool __fastcall func12(_DWORD *a1, _DWORD *a2)
{
int v2; // ebx

v2 = func11(a1);
return v2 == (unsigned int)func11(a2);
}

original_code:
static bool eq(gen_e e1, gen_e e2)
{
  return term_get_stamp(e1) == term_get_stamp(e2);
}

canonical_original_code:
static unsigned char eq(struct gen_e_ *e1, struct gen_e_ *e2)
{
  return term_get_stamp(e1) == term_get_stamp(e2);
}


decompiled_code:
__int64 __fastcall check2(int a1)
{
if ( a1 <= 0x1FFFFFFF )
return (unsigned int)a1;
_fail("stamp.c", 64LL, "check2", "Unable to create a stamp with regular index\n");
return check1();
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
if ( a1 <= 0x1FFFFFFF )
return (unsigned int)a1;
_fail("stamp.c", 64LL, "check2", "Unable to create a stamp with regular index\n");
return func1();
}

original_code:
static inline stamp check2(int i)
{
  if (i > bounds2)
    __fail("stamp.c", 64, __FUNCTION__, "Unable to create a stamp with regular index\n");
  return i;
}

canonical_original_code:
static inline int check2(int i)
{
  if (i > bounds2)
    __fail("stamp.c", 64, __FUNCTION__, "Unable to create a stamp with regular index\n");
  return i;
}

variable_types: i int


decompiled_code:
__int64 __fastcall check1(unsigned int a1)
{
if ( a1 != 0x80000000 )
return a1;
_fail("stamp.c", 57LL, "check1", "Unable to create stamp with small index\n");
return check3();
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int a1)
{
if ( a1 != 0x80000000 )
return a1;
_fail("stamp.c", 57LL, "check1", "Unable to create stamp with small index\n");
return func2();
}

original_code:
static inline stamp check1(int i)
{
  if (i <= bounds1)
    __fail("stamp.c", 57, __FUNCTION__, "Unable to create stamp with small index\n");
  return i;
}

canonical_original_code:
static inline int check1(int i)
{
  if (i <= bounds1)
    __fail("stamp.c", 57, __FUNCTION__, "Unable to create stamp with small index\n");
  return i;
}


decompiled_code:
__int64 __fastcall check3(unsigned int a1)
{
if ( a1 != 0x7FFFFFFF )
return a1;
_fail("stamp.c", 71LL, "check3", "Unable to create a stamp with large index\n");
return new_stamp_list();
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int a1)
{
if ( a1 != 0x7FFFFFFF )
return a1;
_fail("stamp.c", 71LL, "check3", "Unable to create a stamp with large index\n");
return func3();
}

original_code:
static inline stamp check3(int i)
{
  if (i >= bounds3)
    __fail("stamp.c", 71, __FUNCTION__, "Unable to create a stamp with large index\n");
  return i;
}

canonical_original_code:
static inline int check3(int i)
{
  if (i >= bounds3)
    __fail("stamp.c", 71, __FUNCTION__, "Unable to create a stamp with large index\n");
  return i;
}


decompiled_code:
__int64 stamp_fresh()
{
return check2(++count2);
}

canonical_decompiled_code:
__int64 func31()
{
return func0(++count2);
}

original_code:
stamp stamp_fresh(void)
{
  return (check2(++count2));
}

canonical_original_code:
int stamp_fresh()
{
  return (check2(++count2));
}


decompiled_code:
__int64 stamp_fresh_small()
{
return check1(--count1);
}

canonical_decompiled_code:
__int64 func32()
{
return func1(--count1);
}

original_code:
stamp stamp_fresh_small(void)
{
  return (check1(--count1));
}

canonical_original_code:
int stamp_fresh_small()
{
  return (check1(--count1));
}


decompiled_code:
__int64 stamp_fresh_large()
{
return check3(++count3);
}

canonical_decompiled_code:
__int64 func33()
{
return func2(++count3);
}

original_code:
stamp stamp_fresh_large(void)
{
  return (check3(++count3));
}

canonical_original_code:
int stamp_fresh_large()
{
  return (check3(++count3));
}


decompiled_code:
__int64 __fastcall stamp_string(__int64 a1)
{
unsigned int v2[3]; // [rsp+Ch] [rbp-Ch] BYREF

if ( !(unsigned __int8)hash_table_lookup(str_hash, a1, v2) )
{
v2[0] = stamp_fresh();
hash_table_insert(str_hash, a1, (int)v2[0]);
}
return v2[0];
}

canonical_decompiled_code:
__int64 __fastcall func34(__int64 a1)
{
unsigned int v2[3]; // [rsp+Ch] [rbp-Ch] BYREF

if ( !(unsigned __int8)hash_table_lookup(str_hash, a1, v2) )
{
v2[0] = func31();
hash_table_insert(str_hash, a1, (int)v2[0]);
}
return v2[0];
}

original_code:
stamp stamp_string(const char *str)
{
  int st;
  ((void) (0));
  if (! hash_table_lookup(str_hash,(hash_key)str, (hash_data *) &st))
    {
      st = stamp_fresh();
      (void)hash_table_insert(str_hash,(hash_key)str,(hash_data) st);
    }
  return st;
}

canonical_original_code:
int stamp_string(char *str)
{
  int st;
  ((void) (0));
  if (! hash_table_lookup(str_hash,(void *)str, (void **) &st))
    {
      st = stamp_fresh();
      (void)hash_table_insert(str_hash,(void *)str,(void *) st);
    }
  return st;
}

variable_types: st int


decompiled_code:
__int64 stamp_init()
{
__int64 result; // rax

count1 = 0;
count2 = 2000;
count3 = 0x1FFFFFFF;
result = make_persistent_string_hash_table(32LL, 0LL);
str_hash = result;
return result;
}

canonical_decompiled_code:
__int64 func35()
{
__int64 result; // rax

count1 = 0;
count2 = 2000;
count3 = 0x1FFFFFFF;
result = make_persistent_string_hash_table(32LL, 0LL);
str_hash = result;
return result;
}

original_code:
void stamp_init(void)
{
  count1 = 0;
  count2 = 2000;
  count3 = 536870911;
  str_hash = make_persistent_string_hash_table(32,
            0);
}

canonical_original_code:
void stamp_init()
{
  count1 = 0;
  count2 = 2000;
  count3 = 536870911;
  str_hash = make_persistent_string_hash_table(32,
            0);
}


decompiled_code:
__int64 stamp_reset()
{
return stamp_init();
}

canonical_decompiled_code:
__int64 func36()
{
return func35();
}

original_code:
void stamp_reset(void)
{
  stamp_init();
}

canonical_original_code:
void stamp_reset()
{
  stamp_init();
}


decompiled_code:
__int64 stamp_set_fields()
{
return deserialize_set_obj(&str_hash);
}

canonical_decompiled_code:
__int64 func40()
{
return deserialize_set_obj(&str_hash);
}

original_code:
void stamp_set_fields(void)
{
  deserialize_set_obj((void **)&str_hash);
}

canonical_original_code:
void stamp_set_fields()
{
  deserialize_set_obj((void **)&str_hash);
}


original_code:
unsigned long stamp_hash(hash_key key)
{
  unsigned long keyval = (unsigned long)key;
  keyval += (keyval << 12);
  keyval ^= (keyval >> 22);
  keyval += (keyval << 4);
  keyval ^= (keyval >> 9);
  keyval += (keyval << 10);
  keyval ^= (keyval >> 2);
  keyval += (keyval << 7);
  keyval ^= (keyval >> 12);
  return keyval;
}

canonical_original_code:
unsigned long stamp_hash(void *key)
{
  unsigned long keyval = (unsigned long)key;
  keyval += (keyval << 12);
  keyval ^= (keyval >> 22);
  keyval += (keyval << 4);
  keyval ^= (keyval >> 9);
  keyval += (keyval << 10);
  keyval ^= (keyval >> 2);
  keyval += (keyval << 7);
  keyval ^= (keyval >> 12);
  return keyval;
}

variable_types:
key
void *

variable_types:
keyval
unsigned long

return_type: unsigned long


decompiled_code:
bool __fastcall stamp_eq(__int64 a1, __int64 a2)
{
return a2 == a1;
}

canonical_decompiled_code:
bool __fastcall func44(__int64 a1, __int64 a2)
{
return a2 == a1;
}

original_code:
bool stamp_eq(hash_key s1, hash_key s2)
{
  return s1 == s2;
}

canonical_original_code:
unsigned char stamp_eq(void *s1, void *s2)
{
  return s1 == s2;
}


decompiled_code:
void sd_del_list()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code:
void sd_del_list(sd_list l)
{
}

canonical_original_code:
void sd_del_list(struct sd_list *l)
{
}

variable_types: struct sd_list { struct sd_list_pos { struct sd_list_pos *next; struct sd_list_pos *previous; } *first; struct sd_list_pos *null; struct sd_list_pos *last; } *

user_defined_types: struct sd_list { struct sd_list_pos *first; struct sd_list_pos *null; struct sd_list_pos *last; }


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

a2[1] = (__int64)a1;
result = *a1;
*a2 = *a1;
*(_QWORD *)(result + 8) = a2;
*a1 = (__int64)a2;
return result;
}

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

a2[1] = (__int64)a1;
result = *a1;
*a2 = *a1;
*(_QWORD *)(result + 8) = a2;
*a1 = (__int64)a2;
return result;
}

original_code:
void sd_insert_after(sd_list_pos where, sd_list_pos data)
{
  data->previous = where;
  data->next = where->next;
  where->next->previous = data;
  where->next = data;
}

canonical_original_code:
void sd_insert_after(struct sd_list_pos *where, struct sd_list_pos *data)
{
  data->previous = where;
  data->next = where->next;
  where->next->previous = data;
  where->next = data;
}

variable_types: struct sd_list_pos { struct sd_list_pos *next; struct sd_list_pos *previous; } *

variable_types:
data
struct sd_list_pos *


decompiled_code:
// attributes: thunk
__int64 __fastcall sd_add_first(__int64 *a1, __int64 *a2)
{
return sd_insert_after(a1, a2);
}

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

original_code:
void sd_add_first(sd_list l, sd_list_pos data)
{
  sd_insert_after((sd_list_pos)l, data);
}

canonical_original_code:
void sd_add_first(struct sd_list *l, struct sd_list_pos *data)
{
  sd_insert_after((struct sd_list_pos *)l, data);
}

user_defined_types: struct sd_list_pos { struct sd_list_pos *next; struct sd_list_pos *previous; }


decompiled_code:
__int64 __fastcall sd_remove(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_QWORD *)a1[1] = *a1;
*(_QWORD *)(result + 8) = a1[1];
return result;
}

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

result = *a1;
*(_QWORD *)a1[1] = *a1;
*(_QWORD *)(result + 8) = a1[1];
return result;
}

original_code:
void sd_remove(sd_list_pos what)
{
  what->previous->next = what->next;
  what->next->previous = what->previous;
}

canonical_original_code:
void sd_remove(struct sd_list_pos *what)
{
  what->previous->next = what->next;
  what->next->previous = what->previous;
}


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

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

original_code:
sd_list_pos sd_first(sd_list l)
{
  return l->first;
}

canonical_original_code:
struct sd_list_pos *sd_first(struct sd_list *l)
{
  return l->first;
}

variable_types: struct sd_list { struct sd_list_pos *first; struct sd_list_pos *null; struct sd_list_pos *last; } *

return_type: struct sd_list_pos { struct sd_list_pos *next; struct sd_list_pos *previous; } *


decompiled_code:
__int64 __fastcall sd_last(__int64 a1)
{
return *(_QWORD *)(a1 + 16);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
return *(_QWORD *)(a1 + 16);
}

original_code:
sd_list_pos sd_last(sd_list l)
{
  return l->last;
}

canonical_original_code:
struct sd_list_pos *sd_last(struct sd_list *l)
{
  return l->last;
}


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

v1 = *(_QWORD **)sd_first(a1);
if ( !v1 )
return 0LL;
v2 = 0LL;
do
{
++v2;
v1 = (_QWORD *)*v1;
}
while ( v1 );
return v2;
}

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

v1 = *(_QWORD **)func4(a1);
if ( !v1 )
return 0LL;
v2 = 0LL;
do
{
++v2;
v1 = (_QWORD *)*v1;
}
while ( v1 );
return v2;
}

original_code:
unsigned long sd_length(sd_list l)
{
  sd_list_pos scan;
  unsigned long len = 0;
  for (scan = sd_first((l)); !(!(scan)->next); scan = ((scan)->next)) len++;
  return len;
}

canonical_original_code:
unsigned long sd_length(struct sd_list *l)
{
  struct sd_list_pos *scan;
  unsigned long len = 0;
  for (scan = sd_first((l)); !(!(scan)->next); scan = ((scan)->next)) len++;
  return len;
}

variable_types:
len
unsigned long


hash

decompiled_code:
__int64 __fastcall hash(int a1, __int64 a2, int a3)
{
__int64 v3; // r8
__int64 v4; // rdx
unsigned int v5; // er9

if ( a3 <= 0 )
return 0;
v3 = (unsigned int)a3;
v4 = 0LL;
v5 = 0;
do
{
v5 = a1 & (v5 + primes[(int)v4 % 15] * abs32(*(_DWORD *)(a2 + 4 * v4)));
++v4;
}
while ( v4 != v3 );
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, __int64 a2, int a3)
{
__int64 v3; // r8
__int64 v4; // rdx
unsigned int v5; // er9

if ( a3 <= 0 )
return 0;
v3 = (unsigned int)a3;
v4 = 0LL;
v5 = 0;
do
{
v5 = a1 & (v5 + primes[(int)v4 % 15] * abs32(*(_DWORD *)(a2 + 4 * v4)));
++v4;
}
while ( v4 != v3 );
return v5;
}

original_code:
static int hash(int ub, stamp stamps[], int len)
{
  int i, n;
  n = 0;
  for (i = 0; i < len; i++)
    {
      n = (n + (primes[i % 15] * abs(stamps[i]))) & ub;
    }
  return n;
}

canonical_original_code:
static int hash(int ub, int stamps[], int len)
{
  int i; int n;
  n = 0;
  for (i = 0; i < len; i++)
    {
      n = (n + (primes[i % 15] * abs(stamps[i]))) & ub;
    }
  return n;
}

variable_types: ub int

variable_types:
stamps
int []

variable_types: len int

variable_types: n int


rehash

original_code:
static void rehash(hash_set hs)
{
  int *old_table;
  int old_capacity, i;
  old_table = hs->table;
  old_capacity = hs->capacity;
  hs->capacity *= 2;
  hs->ub = ((1<<++hs->size)-1);
  hs->table = (int *)calloc(hs->capacity, sizeof(int));
  ((void) (0));
  for (i = 0; i < old_capacity; i++)
    {
      reinsert(hs->table, hs->ub, old_table[i]);
    }
  free(old_table);
}

canonical_original_code:
static void rehash(struct hash_set *hs)
{
  int *old_table;
  int old_capacity; int i;
  old_table = hs->table;
  old_capacity = hs->capacity;
  hs->capacity *= 2;
  hs->ub = ((1<<++hs->size)-1);
  hs->table = (int *)calloc(hs->capacity, sizeof(int));
  ((void) (0));
  for (i = 0; i < old_capacity; i++)
    {
      reinsert(hs->table, hs->ub, old_table[i]);
    }
  free(old_table);
}

variable_types: struct hash_set { int *table; unsigned int ub; unsigned int capacity; unsigned int inserts; unsigned int size; } *


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

result = (unsigned int)(*(_DWORD *)(a1 + 28) + 1);
*(_DWORD *)(a1 + 28) = result;
if ( *(_DWORD *)(a1 + 24) == (_DWORD)result )
result = rehash(a1);
return result;
}

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

result = (unsigned int)(*(_DWORD *)(a1 + 28) + 1);
*(_DWORD *)(a1 + 28) = result;
if ( *(_DWORD *)(a1 + 24) == (_DWORD)result )
result = func1(a1);
return result;
}

original_code:
static void post_insert(hash_set hs)
{
  int capacity = hs->capacity;
  int inserts = ++hs->inserts;
  float percent_capacity = capacity * .85;
  if ( (float) inserts >= percent_capacity)
    {
      rehash(hs);
    }
}

canonical_original_code:
static void post_insert(struct hash_set *hs)
{
  int capacity = hs->capacity;
  int inserts = ++hs->inserts;
  float percent_capacity = capacity * .85;
  if ( (float) inserts >= percent_capacity)
    {
      rehash(hs);
    }
}

variable_types: capacity int

variable_types: inserts int

user_defined_types: struct hash_set { int *table; unsigned int ub; unsigned int capacity; unsigned int inserts; unsigned int size; }


walk

decompiled_code:
const void ***__fastcall walk(const void ***a1, const void *a2, int a3)
{
const void ***v3; // rbx
size_t v5; // r14
const void **v6; // rbp

v3 = a1;
if ( a1 )
{
v5 = 4LL * a3;
while ( 1 )
{
v6 = *v3;
if ( *(_DWORD *)*v3 == a3 && !memcmp(a2, v6[1], v5) )
break;
v3 = (const void ***)v3[1];
if ( !v3 )
return v3;
}
v3 = (const void ***)v6[2];
}
return v3;
}

canonical_decompiled_code:
const void ***__fastcall func3(const void ***a1, const void *a2, int a3)
{
const void ***v3; // rbx
size_t v5; // r14
const void **v6; // rbp

v3 = a1;
if ( a1 )
{
v5 = 4LL * a3;
while ( 1 )
{
v6 = *v3;
if ( *(_DWORD *)*v3 == a3 && !memcmp(a2, v6[1], v5) )
break;
v3 = (const void ***)v3[1];
if ( !v3 )
return v3;
}
v3 = (const void ***)v6[2];
}
return v3;
}

original_code:
static gen_e walk(term_bucket b, stamp stamps[], int len)
{
  term_bucket cur;
  for(cur = b; cur; cur = cur->next)
    {
      if (len == cur->entry->length
   && (memcmp(stamps, cur->entry->stamps, sizeof(int)*len) == 0) )
 return cur->entry->e;
    }
  return ((void *)0);
}

canonical_original_code:
static struct gen_e_ *walk(struct term_bucket *b, int stamps[], int len)
{
  struct term_bucket *cur;
  for(cur = b; cur; cur = cur->next)
    {
      if (len == cur->entry->length
   && (memcmp(stamps, cur->entry->stamps, sizeof(int)*len) == 0) )
 return cur->entry->e;
    }
  return ((void *)0);
}

variable_types: struct term_bucket { struct hash_entry { int length; int *stamps; struct gen_e_ *e; } *entry; struct term_bucket *next; } *

variable_types: struct term_bucket { struct hash_entry { int length; int *stamps; struct gen_e_ { enum sort_kind { flowrow_sort=0, setif_sort=1, setst_sort=2, term_sort=3 } sort; } *e; } *entry; struct term_bucket *next; } *

user_defined_types: struct term_bucket { struct hash_entry *entry; struct term_bucket *next; }


decompiled_code:
__int64 term_hash_init()
{
__int64 result; // rax

term_bucketptr_region = newregion();
term_bucket_region = newregion();
term_hash_region = newregion();
result = newregion();
hash_entry_region = result;
return result;
}

canonical_decompiled_code:
__int64 func11()
{
__int64 result; // rax

term_bucketptr_region = newregion();
term_bucket_region = newregion();
term_hash_region = newregion();
result = newregion();
hash_entry_region = result;
return result;
}

original_code:
void term_hash_init()
{
  term_bucketptr_region = newregion();
  term_bucket_region = newregion();
  term_hash_region = newregion();
  hash_entry_region = newregion();
}


decompiled_code:
__int64 term_hash_reset()
{
deleteregion(term_bucketptr_region);
deleteregion(term_bucket_region);
deleteregion(term_hash_region);
deleteregion(hash_entry_region);
return term_hash_init();
}

canonical_decompiled_code:
__int64 func12()
{
deleteregion(term_bucketptr_region);
deleteregion(term_bucket_region);
deleteregion(term_hash_region);
deleteregion(hash_entry_region);
return func11();
}

original_code:
void term_hash_reset()
{
  deleteregion(term_bucketptr_region);
  deleteregion(term_bucket_region);
  deleteregion(term_hash_region);
  deleteregion(hash_entry_region);
  term_hash_init();
}


bclearb

decompiled_code:
int *__fastcall bclearb(int *a1)
{
memset(a1 + 2, 0, 8LL * *a1);
return a1;
}

canonical_decompiled_code:
int *__fastcall func1(int *a1)
{
memset(a1 + 2, 0, 8LL * *a1);
return a1;
}

original_code:
bitset bclearb(bitset b)
{
  memset(b->bitset, 0, b->bsize * sizeof(b->bitset[0]));
  return b;
}

canonical_original_code:
struct { int bsize; long bitset[]; } *bclearb(struct { int bsize; long bitset[]; } *b)
{
  memset(b->bitset, 0, b->bsize * sizeof(b->bitset[0]));
  return b;
}

variable_types:
b
struct { int bsize; long bitset[]; } *

return_type: struct { int bsize; long bitset[]; } *


bunionb

original_code:
bitset bunionb(bitset b1, bitset b2)
{
  int i, bsize = b1->bsize;
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 85, __extension__ __PRETTY_FUNCTION__); }));
  for (i = 0; i < bsize; i++) b1->bitset[i] |= b2->bitset[i];
  return b1;
}

canonical_original_code:
struct { int bsize; long bitset[]; } *bunionb(struct { int bsize; long bitset[]; } *b1, struct { int bsize; long bitset[]; } *b2)
{
  int i; int bsize = b1->bsize;
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 85, __extension__ __PRETTY_FUNCTION__); }));
  for (i = 0; i < bsize; i++) b1->bitset[i] |= b2->bitset[i];
  return b1;
}

variable_types: i int

variable_types: bsize int


bintersectionb

decompiled_code:
int *__fastcall bintersectionb(int *a1, __int64 a2)
{
int v2; // edx
__int64 v3; // rax

v2 = *a1;
if ( a1[1] != *(_DWORD *)(a2 + 4) )
_assert_fail("b1->size == b2->size", "bitset.c", 0x6Au, "bintersectionb");
v3 = 1LL;
if ( v2 > 0 )
{
do
{
*(_QWORD *)&a1[2 * v3] &= *(_QWORD *)(a2 + 8 * v3);
++v3;
}
while ( v3 != v2 + 1 );
}
return a1;
}

original_code:
bitset bintersectionb(bitset b1, bitset b2)
{
  int i, bsize = b1->bsize;
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 106, __extension__ __PRETTY_FUNCTION__); }));
  for (i = 0; i < bsize; i++) b1->bitset[i] &= b2->bitset[i];
  return b1;
}

canonical_original_code:
struct { int bsize; long bitset[]; } *bintersectionb(struct { int bsize; long bitset[]; } *b1, struct { int bsize; long bitset[]; } *b2)
{
  int i; int bsize = b1->bsize;
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 106, __extension__ __PRETTY_FUNCTION__); }));
  for (i = 0; i < bsize; i++) b1->bitset[i] &= b2->bitset[i];
  return b1;
}


bdifferenceb

decompiled_code:
int *__fastcall bdifferenceb(int *a1, __int64 a2)
{
int v2; // edx
__int64 v3; // rax

v2 = *a1;
if ( a1[1] != *(_DWORD *)(a2 + 4) )
_assert_fail("b1->size == b2->size", "bitset.c", 0x7Fu, "bdifferenceb");
v3 = 1LL;
if ( v2 > 0 )
{
do
{
*(_QWORD *)&a1[2 * v3] &= ~*(_QWORD *)(a2 + 8 * v3);
++v3;
}
while ( v3 != v2 + 1 );
}
return a1;
}

original_code:
bitset bdifferenceb(bitset b1, bitset b2)
{
  int i, bsize = b1->bsize;
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 127, __extension__ __PRETTY_FUNCTION__); }));
  for (i = 0; i < bsize; i++) b1->bitset[i] &= ~b2->bitset[i];
  return b1;
}

canonical_original_code:
struct { int bsize; long bitset[]; } *bdifferenceb(struct { int bsize; long bitset[]; } *b1, struct { int bsize; long bitset[]; } *b2)
{
  int i; int bsize = b1->bsize;
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 127, __extension__ __PRETTY_FUNCTION__); }));
  for (i = 0; i < bsize; i++) b1->bitset[i] &= ~b2->bitset[i];
  return b1;
}


bassignb

original_code:
bitset bassignb(bitset b1, bitset b2)
{
  int i, bsize = b1->bsize;
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 160, __extension__ __PRETTY_FUNCTION__); }));
  for (i = 0; i < bsize; i++) b1->bitset[i] = b2->bitset[i];
  return b1;
}

canonical_original_code:
struct { int bsize; long bitset[]; } *bassignb(struct { int bsize; long bitset[]; } *b1, struct { int bsize; long bitset[]; } *b2)
{
  int i; int bsize = b1->bsize;
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 160, __extension__ __PRETTY_FUNCTION__); }));
  for (i = 0; i < bsize; i++) b1->bitset[i] = b2->bitset[i];
  return b1;
}


decompiled_code:
__int64 __fastcall bitset_inp(int *a1, __int64 a2)
{
int v2; // eax
__int64 v3; // rdx

v2 = *a1;
if ( a1[1] != *(_DWORD *)(a2 + 4) )
_assert_fail("b1->size == b2->size", "bitset.c", 0xB1u, "bitset_inp");
v3 = 1LL;
if ( v2 <= 0 )
return 1LL;
while ( (*(_QWORD *)&a1[2 * v3] & ~*(_QWORD *)(a2 + 8 * v3)) == 0LL )
{
if ( ++v3 == v2 + 1 )
return 1LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func12(int *a1, __int64 a2)
{
int v2; // eax
__int64 v3; // rdx

v2 = *a1;
if ( a1[1] != *(_DWORD *)(a2 + 4) )
_assert_fail("b1->size == b2->size", "bitset.c", 0xB1u, "bitset_inp");
v3 = 1LL;
if ( v2 <= 0 )
return 1LL;
while ( (*(_QWORD *)&a1[2 * v3] & ~*(_QWORD *)(a2 + 8 * v3)) == 0LL )
{
if ( ++v3 == v2 + 1 )
return 1LL;
}
return 0LL;
}

original_code:
bool bitset_inp(bitset b1, bitset b2)
{
  int i, bsize = b1->bsize;
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 177, __extension__ __PRETTY_FUNCTION__); }));
  for (i = 0; i < bsize; i++)
    if (b1->bitset[i] & ~b2->bitset[i]) return 0;
  return 1;
}

canonical_original_code:
unsigned char bitset_inp(struct { int bsize; long bitset[]; } *b1, struct { int bsize; long bitset[]; } *b2)
{
  int i; int bsize = b1->bsize;
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 177, __extension__ __PRETTY_FUNCTION__); }));
  for (i = 0; i < bsize; i++)
    if (b1->bitset[i] & ~b2->bitset[i]) return 0;
  return 1;
}


decompiled_code:
bool __fastcall bitset_eqp(int *a1, __int64 a2)
{
if ( a1[1] != *(_DWORD *)(a2 + 4) )
_assert_fail("b1->size == b2->size", "bitset.c", 0xBAu, "bitset_eqp");
return memcmp(a1 + 2, (const void *)(a2 + 8), 8LL * *a1) == 0;
}

canonical_decompiled_code:
bool __fastcall func13(int *a1, __int64 a2)
{
if ( a1[1] != *(_DWORD *)(a2 + 4) )
_assert_fail("b1->size == b2->size", "bitset.c", 0xBAu, "bitset_eqp");
return memcmp(a1 + 2, (const void *)(a2 + 8), 8LL * *a1) == 0;
}

original_code:
bool bitset_eqp(bitset b1, bitset b2)
{
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 186, __extension__ __PRETTY_FUNCTION__); }));
  return memcmp(b1->bitset, b2->bitset, b1->bsize * sizeof(b1->bitset[0])) == 0;
}

canonical_original_code:
unsigned char bitset_eqp(struct { int bsize; long bitset[]; } *b1, struct { int bsize; long bitset[]; } *b2)
{
  ((void) sizeof ((b1->size == b2->size) ? 1 : 0), __extension__ ({ if (b1->size == b2->size) ; else __assert_fail ("b1->size == b2->size", "bitset.c", 186, __extension__ __PRETTY_FUNCTION__); }));
  return memcmp(b1->bitset, b2->bitset, b1->bsize * sizeof(b1->bitset[0])) == 0;
}


bemptyp

decompiled_code:
__int64 __fastcall bemptyp(int *a1)
{
_QWORD *v1; // rax

if ( *a1 <= 0 )
return 1LL;
v1 = a1 + 2;
while ( !*v1 )
{
if ( ++v1 == (_QWORD *)&a1[2 * (*a1 - 1) + 4] )
return 1LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func14(int *a1)
{
_QWORD *v1; // rax

if ( *a1 <= 0 )
return 1LL;
v1 = a1 + 2;
while ( !*v1 )
{
if ( ++v1 == (_QWORD *)&a1[2 * (*a1 - 1) + 4] )
return 1LL;
}
return 0LL;
}

original_code:
bool bemptyp(bitset b)
{
  int i, bsize = b->bsize;
  for (i = 0; i < bsize; i++) if (b->bitset[i]) return 0;
  return 1;
}

canonical_original_code:
unsigned char bemptyp(struct { int bsize; long bitset[]; } *b)
{
  int i; int bsize = b->bsize;
  for (i = 0; i < bsize; i++) if (b->bitset[i]) return 0;
  return 1;
}


vfail

decompiled_code:
void __fastcall __noreturn vfail(char *format, __gnuc_va_list arg)
{
vfprintf(stderr, format, arg);
fflush(stderr);
fflush(stdout);
abort();
}

canonical_decompiled_code:
void __fastcall __noreturn func0(char *format, __gnuc_va_list arg)
{
vfprintf(stderr, format, arg);
fflush(stderr);
fflush(stdout);
abort();
}

original_code:
static void vfail(const char *fmt, va_list args)
{
  vfprintf(stderr, fmt, args);
  fflush(stderr);
  fflush(stdout);
  abort();
  while (1);
}

canonical_original_code:
static void vfail(char *fmt, __builtin_va_list args)
{
  vfprintf(stderr, fmt, args);
  fflush(stderr);
  fflush(stdout);
  abort();
  while (1);
}

variable_types:
fmt
char *


xmalloc

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

result = malloc(a1);
if ( !result )
abort();
return result;
}

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

result = malloc(a1);
if ( !result )
abort();
return result;
}

original_code:
void *xmalloc(size_t size)
{
  void *x = malloc(size);
  if (!x) abort();
  return x;
}

canonical_original_code:
void *xmalloc(unsigned long size)
{
  void *x = malloc(size);
  if (!x) abort();
  return x;
}

variable_types:
size
unsigned long

variable_types:
x
void *

return_type: void *


xrealloc

decompiled_code:
void *__fastcall xrealloc(void *a1, size_t a2)
{
void *result; // rax

result = realloc(a1, a2);
if ( !result )
abort();
return result;
}

canonical_decompiled_code:
void *__fastcall func2(void *a1, size_t a2)
{
void *result; // rax

result = realloc(a1, a2);
if ( !result )
abort();
return result;
}

original_code:
void *xrealloc(void *p, size_t newsize)
{
  void *x = realloc(p, newsize);
  if (!x) abort();
  return x;
}

canonical_original_code:
void *xrealloc(void *p, unsigned long newsize)
{
  void *x = realloc(p, newsize);
  if (!x) abort();
  return x;
}

variable_types:
p
void *

variable_types:
newsize
unsigned long


decompiled_code:
__int64 __fastcall align_to(__int64 a1, unsigned __int64 a2)
{
return a2 * (int)((a2 + a1 - 1) / a2);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, unsigned __int64 a2)
{
return a2 * (int)((a2 + a1 - 1) / a2);
}

original_code:
unsigned long align_to(unsigned long n, unsigned long alignment)
{
  int count = (n + alignment - 1) / alignment;
  return count * alignment;
}

variable_types:
n
unsigned long

variable_types:
alignment
unsigned long

variable_types: count int


gcd

decompiled_code:
unsigned __int64 __fastcall gcd(unsigned __int64 a1, unsigned __int64 a2)
{
unsigned __int64 v2; // rax
unsigned __int64 i; // rcx

v2 = a1;
for ( i = a1; a2; v2 = i )
{
i = a2;
a2 = v2 % a2;
}
return i;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func6(unsigned __int64 a1, unsigned __int64 a2)
{
unsigned __int64 v2; // rax
unsigned __int64 i; // rcx

v2 = a1;
for ( i = a1; a2; v2 = i )
{
i = a2;
a2 = v2 % a2;
}
return i;
}

original_code:
unsigned long gcd(unsigned long x, unsigned long y)
{
  unsigned long z;
  for (;;)
    {
      if (y == 0)
 return x;
      z = x % y; x = y; y = z;
    }
}

variable_types:
x
unsigned long

variable_types:
y
unsigned long

variable_types:
z
unsigned long


lcm

decompiled_code:
unsigned __int64 __fastcall lcm(unsigned __int64 a1, unsigned __int64 a2)
{
return a2 * a1 / gcd(a1, a2);
}

canonical_decompiled_code:
unsigned __int64 __fastcall func7(unsigned __int64 a1, unsigned __int64 a2)
{
return a2 * a1 / func6(a1, a2);
}

original_code:
unsigned long lcm(unsigned long x, unsigned long y)
{
  return (x * y) / gcd(x, y);
}


decompiled_code:
char *__fastcall ptr_to_ascii(const void *a1)
{
int v1; // eax

v1 = snprintf(addr_1, 0x13uLL, "%p", a1);
if ( v1 == -1 || v1 > 18 )
_fail(
"utils.c",
0xF3u,
(__int64)"ptr_to_ascii",
"Unable to convert ptr to ascii (need %d bytes, have %d)\n",
(unsigned int)v1,
19LL);
return addr_1;
}

canonical_decompiled_code:
char *__fastcall func14(const void *a1)
{
int v1; // eax

v1 = snprintf(addr_1, 0x13uLL, "%p", a1);
if ( v1 == -1 || v1 > 18 )
func8(
"utils.c",
0xF3u,
(__int64)"ptr_to_ascii",
"Unable to convert ptr to ascii (need %d bytes, have %d)\n",
(unsigned int)v1,
19LL);
return addr_1;
}

original_code:
char *ptr_to_ascii(void *ptr) {
  static char addr[((int) (3 + sizeof(void *)*2))];
  int nchars;
  nchars = snprintf(addr, ((int) (3 + sizeof(void *)*2)), "%p", ptr);
  if (nchars == -1 || nchars >= ((int) (3 + sizeof(void *)*2)))
    __fail("utils.c", 243, __FUNCTION__, "Unable to convert ptr to ascii (need %d bytes, have %d)\n", nchars, ((int) (3 + sizeof(void *)*2)));
  return addr;
}

canonical_original_code:
char *ptr_to_ascii(void *ptr) {
  static char addr[-1];
  int nchars;
  nchars = snprintf(addr, ((int) (3 + sizeof(void *)*2)), "%p", ptr);
  if (nchars == -1 || nchars >= ((int) (3 + sizeof(void *)*2)))
    __fail("utils.c", 243, __FUNCTION__, "Unable to convert ptr to ascii (need %d bytes, have %d)\n", nchars, ((int) (3 + sizeof(void *)*2)));
  return addr;
}

variable_types:
ptr
void *

variable_types:
addr
char [-1]

variable_types: nchars int


decompiled_code:
unsigned __int64 __fastcall ptr_hash(unsigned __int64 a1)
{
return a1 >> 3;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func15(unsigned __int64 a1)
{
return a1 >> 3;
}

original_code:
unsigned long ptr_hash(void *ptr)
{
  return (unsigned long) ptr >> 3;
}


decompiled_code:
bool __fastcall ptr_eq(__int64 a1, __int64 a2)
{
return a2 == a1;
}

canonical_decompiled_code:
bool __fastcall func16(__int64 a1, __int64 a2)
{
return a2 == a1;
}

original_code:
bool ptr_eq(void *ptr1, void *ptr2)
{
  return ptr1 == ptr2;
}

canonical_original_code:
unsigned char ptr_eq(void *ptr1, void *ptr2)
{
  return ptr1 == ptr2;
}


decompiled_code:
__int64 __fastcall string_hash(char *a1)
{
char v1; // al
__int64 v2; // rcx

if ( !a1 )
return 0LL;
v1 = *a1;
if ( !*a1 )
return 0LL;
v2 = 0LL;
do
{
++a1;
v2 = 33 * v2 + v1 + 720;
v1 = *a1;
}
while ( *a1 );
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func17(char *a1)
{
char v1; // al
__int64 v2; // rcx

if ( !a1 )
return 0LL;
v1 = *a1;
if ( !*a1 )
return 0LL;
v2 = 0LL;
do
{
++a1;
v2 = 33 * v2 + v1 + 720;
v1 = *a1;
}
while ( *a1 );
return v2;
}

original_code:
unsigned long string_hash(const char *str)
{
  const char *c;
  unsigned long h;
  c = str;
  h = 0;
  if (!c)
    return 0;
  while (*c)
    h = 33*h + 720 + *c++;
  return h;
}

canonical_original_code:
unsigned long string_hash(char *str)
{
  char *c;
  unsigned long h;
  c = str;
  h = 0;
  if (!c)
    return 0;
  while (*c)
    h = 33*h + 720 + *c++;
  return h;
}

variable_types:
str
char *

variable_types:
c
char *

variable_types:
h
unsigned long


decompiled_code:
bool __fastcall string_eq(const char *a1, const char *a2)
{
bool result; // al

if ( a1 && a2 )
result = strcmp(a1, a2) == 0;
else
result = 0;
return result;
}

canonical_decompiled_code:
bool __fastcall func18(const char *a1, const char *a2)
{
bool result; // al

if ( a1 && a2 )
result = strcmp(a1, a2) == 0;
else
result = 0;
return result;
}

original_code:
bool string_eq(const char *s1, const char *s2)
{
  if (!s1 || !s2)
    return 0;
  return !strcmp(s1, s2);
}

canonical_original_code:
unsigned char string_eq(char *s1, char *s2)
{
  if (!s1 || !s2)
    return 0;
  return !strcmp(s1, s2);
}


decompiled_code:
__int64 __fastcall ptr_cmp(__int64 a1, __int64 a2)
{
return a1 - a2;
}

canonical_decompiled_code:
__int64 __fastcall func19(__int64 a1, __int64 a2)
{
return a1 - a2;
}

original_code:
int ptr_cmp(void *ptr1, void *ptr2)
{
  return (char *) ptr1 - (char *) ptr2;
}


min

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

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

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

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

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

variable_types: a int

variable_types: b int


max

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

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

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

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

original_code: int max(int a, int b) { if (a < b) return b; else return a; }


decompiled_code:
__int64 banshee_serialize_end()
{
return serialize_end();
}

canonical_decompiled_code:
__int64 func5()
{
return serialize_end();
}

original_code:
void banshee_serialize_end()
{
  serialize_end();
}


decompiled_code:
__int64 banshee_deserialize_end()
{
return deserialize_end();
}

canonical_decompiled_code:
__int64 func7()
{
return deserialize_end();
}

original_code:
void banshee_deserialize_end(void)
{
  deserialize_end();
}

canonical_original_code:
void banshee_deserialize_end()
{
  deserialize_end();
}


decompiled_code:
__int64 gen_e_set_fields()
{
return 1LL;
}

canonical_decompiled_code:
__int64 func2()
{
return 1LL;
}

original_code:
bool gen_e_set_fields(void *obj)
{
  return 1;
}

canonical_original_code:
unsigned char gen_e_set_fields(void *obj)
{
  return 1;
}

variable_types:
obj
void *


original_code:
static unsigned long state_hash(hash_key key)
{
  unsigned long keyval = (unsigned long)key;
  keyval += (keyval << 12);
  keyval ^= (keyval >> 22);
  keyval += (keyval << 4);
  keyval ^= (keyval >> 9);
  keyval += (keyval << 10);
  keyval ^= (keyval >> 2);
  keyval += (keyval << 7);
  keyval ^= (keyval >> 12);
  return keyval;
}

canonical_original_code:
static unsigned long state_hash(void *key)
{
  unsigned long keyval = (unsigned long)key;
  keyval += (keyval << 12);
  keyval ^= (keyval >> 22);
  keyval += (keyval << 4);
  keyval ^= (keyval >> 9);
  keyval += (keyval << 10);
  keyval ^= (keyval >> 2);
  keyval += (keyval << 7);
  keyval ^= (keyval >> 12);
  return keyval;
}

variable_types:
key
void *

variable_types:
keyval
unsigned long


decompiled_code:
bool __fastcall state_eq(__int64 a1, __int64 a2)
{
return a2 == a1;
}

canonical_decompiled_code:
bool __fastcall func1(__int64 a1, __int64 a2)
{
return a2 == a1;
}

original_code:
static bool state_eq(hash_key state1, hash_key state2)
{
  return state1 == state2;
}

canonical_original_code:
static unsigned char state_eq(void *state1, void *state2)
{
  return state1 == state2;
}


decompiled_code:
void *regexp_calloc()
{
return calloc(1uLL, 0x30uLL);
}

canonical_decompiled_code:
void *func2()
{
return calloc(1uLL, 0x30uLL);
}

original_code:
static regexp regexp_calloc() {
  return (regexp) calloc (1, sizeof(struct regexp_));
}

canonical_original_code:
static struct regexp_ *regexp_calloc() {
  return (struct regexp_ *) calloc (1, sizeof(struct regexp_));
}

return_type: struct regexp_ { unsigned char length; unsigned char *expr; unsigned char necessary[32]; } *


decompiled_code:
void *__fastcall regexp_alloc_str(unsigned __int8 a1)
{
return malloc(a1);
}

canonical_decompiled_code:
void *__fastcall func3(unsigned __int8 a1)
{
return malloc(a1);
}

original_code:
static letter* regexp_alloc_str(unsigned char length) {
  return (unsigned char *) malloc (sizeof(letter) * length);
}

canonical_original_code:
static unsigned char *regexp_alloc_str(unsigned char length) {
  return (unsigned char *) malloc (sizeof(letter) * length);
}

variable_types:
length
unsigned char

return_type: unsigned char *


decompiled_code:
__int64 __fastcall regexp_print_subexpr(__int64 a1, unsigned __int8 a2, unsigned __int8 a3)
{
unsigned __int8 v5; // bp
__int64 v6; // rbx
unsigned __int64 v7; // r13
int v8; // edi
__int64 result; // rax

v5 = a2;
if ( a2 >= a3 )
{
LABEL_5:
v6 = v5;
result = *(_QWORD *)(a1 + 8);
if ( *(_BYTE *)(result + v5) != 1 )
return result;
}
else
{
v6 = a2;
v7 = a2 + (unsigned __int64)(unsigned __int8)(a3 - 1 - a2) + 1;
while ( 1 )
{
v5 = v6;
v8 = *(unsigned __int8 *)(*(_QWORD *)(a1 + 8) + v6);
if ( v8 == 1 )
break;
putchar(v8);
v5 = ++v6;
if ( v6 == v7 )
goto LABEL_5;
}
}
putchar(40);
regexp_print_subexpr(a1, (unsigned __int8)(v5 + 2), (unsigned __int8)(*(_BYTE *)(*(_QWORD *)(a1 + 8) + v6 + 1) + v5));
putchar(41);
putchar(42);
return regexp_print_subexpr(a1, (unsigned __int8)(v5 + *(_BYTE *)(*(_QWORD *)(a1 + 8) + v6 + 1) + 1), a3);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, unsigned __int8 a2, unsigned __int8 a3)
{
unsigned __int8 v5; // bp
__int64 v6; // rbx
unsigned __int64 v7; // r13
int v8; // edi
__int64 result; // rax

v5 = a2;
if ( a2 >= a3 )
{
LABEL_5:
v6 = v5;
result = *(_QWORD *)(a1 + 8);
if ( *(_BYTE *)(result + v5) != 1 )
return result;
}
else
{
v6 = a2;
v7 = a2 + (unsigned __int64)(unsigned __int8)(a3 - 1 - a2) + 1;
while ( 1 )
{
v5 = v6;
v8 = *(unsigned __int8 *)(*(_QWORD *)(a1 + 8) + v6);
if ( v8 == 1 )
break;
putchar(v8);
v5 = ++v6;
if ( v6 == v7 )
goto LABEL_5;
}
}
putchar(40);
func4(a1, (unsigned __int8)(v5 + 2), (unsigned __int8)(*(_BYTE *)(*(_QWORD *)(a1 + 8) + v6 + 1) + v5));
putchar(41);
putchar(42);
return func4(a1, (unsigned __int8)(v5 + *(_BYTE *)(*(_QWORD *)(a1 + 8) + v6 + 1) + 1), a3);
}

original_code:
static void regexp_print_subexpr(regexp r, unsigned char start,
     unsigned char end) {
  while (start < end && r->expr[start] != STAR) {
    putchar(r->expr[start]);
    start++;
  }
  if (r->expr[start] == STAR) {
    putchar('(');
    regexp_print_subexpr(r, start + 2, start + r->expr[start + 1]);
    putchar(')');
    putchar('*');
    regexp_print_subexpr(r, start + r->expr[start+1] + 1, end);
  }
}

canonical_original_code:
static void regexp_print_subexpr(struct regexp_ *r, unsigned char start, unsigned char end) {
  while (start < end && r->expr[start] != STAR) {
    putchar(r->expr[start]);
    start++;
  }
  if (r->expr[start] == STAR) {
    putchar('(');
    regexp_print_subexpr(r, start + 2, start + r->expr[start + 1]);
    putchar(')');
    putchar('*');
    regexp_print_subexpr(r, start + r->expr[start+1] + 1, end);
  }
}

variable_types: struct regexp_ { unsigned char length; unsigned char *expr; unsigned char necessary[32]; } *

variable_types:
start
unsigned char

variable_types:
end
unsigned char


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

v0 = regexp_calloc();
*(_BYTE *)v0 = 0;
v1 = regexp_alloc_str(1u);
v0[1] = v1;
*v1 = 0;
return v0;
}

original_code:
regexp regexp_empty() {
  regexp result = regexp_calloc();
  result->length = 0;
  result->expr = regexp_alloc_str(1);
  result->expr[0] = 0;
  return result;
}

canonical_original_code:
struct regexp_ *regexp_empty() {
  struct regexp_ *result = regexp_calloc();
  result->length = 0;
  result->expr = regexp_alloc_str(1);
  result->expr[0] = 0;
  return result;
}

user_defined_types: struct regexp_ { unsigned char length; unsigned char *expr; unsigned char necessary[32]; }


decompiled_code:
__int64 __fastcall regexp_fast_disinclusion(__int64 a1, __int64 a2)
{
return 2 * (unsigned int)(memcmp((const void *)(a1 + 16), (const void *)(a2 + 16), 0x20uLL) > 0) - 1;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, __int64 a2)
{
return 2 * (unsigned int)(memcmp((const void *)(a1 + 16), (const void *)(a2 + 16), 0x20uLL) > 0) - 1;
}

original_code:
int regexp_fast_disinclusion(regexp r1, regexp r2) {
  if (memcmp(r1->necessary, r2->necessary, sizeof(unsigned char) * 32) > 0) {
    return 1;
  }
  return -1;
}

canonical_original_code:
int regexp_fast_disinclusion(struct regexp_ *r1, struct regexp_ *r2) {
  if (memcmp(r1->necessary, r2->necessary, sizeof(unsigned char) * 32) > 0) {
    return 1;
  }
  return -1;
}


decompiled_code:
int __fastcall regexp_print_expr(unsigned __int8 *a1)
{
regexp_print_subexpr((__int64)a1, 0, *a1);
return fflush(stdout);
}

canonical_decompiled_code:
int __fastcall func10(unsigned __int8 *a1)
{
func4((__int64)a1, 0, *a1);
return fflush(stdout);
}

original_code:
void regexp_print_expr(regexp r) {
  regexp_print_subexpr(r, 0, r->length);
  fflush(stdout);
}

canonical_original_code:
void regexp_print_expr(struct regexp_ *r) {
  regexp_print_subexpr(r, 0, r->length);
  fflush(stdout);
}


decompiled_code:
int __fastcall regexp_print_necessary(__int64 a1)
{
__int64 v1; // rbx
unsigned int v2; // ebp
__int64 v3; // rax

printf("Necessary characters in %s:\n", *(const char **)(a1 + 8));
v1 = 0LL;
do
{
v2 = v1++;
v3 = bfx(a1 + 16, v1, 1LL);
if ( v3 )
LODWORD(v3) = printf("%c (%d) \n", v2, v2);
}
while ( v1 != 256 );
return v3;
}

canonical_decompiled_code:
int __fastcall func11(__int64 a1)
{
__int64 v1; // rbx
unsigned int v2; // ebp
__int64 v3; // rax

printf("Necessary characters in %s:\n", *(const char **)(a1 + 8));
v1 = 0LL;
do
{
v2 = v1++;
v3 = bfx(a1 + 16, v1, 1LL);
if ( v3 )
LODWORD(v3) = printf("%c (%d) \n", v2, v2);
}
while ( v1 != 256 );
return v3;
}

original_code:
void regexp_print_necessary(regexp r) {
  int i;
  printf("Necessary characters in %s:\n", r->expr);
  for (i = 0; i < 256; i++) {
    if (bfx(r->necessary, i+1, 1)) {
      printf("%c (%d) \n",i, i);
    }
  }
}

canonical_original_code:
void regexp_print_necessary(struct regexp_ *r) {
  int i;
  printf("Necessary characters in %s:\n", r->expr);
  for (i = 0; i < 256; i++) {
    if (bfx(r->necessary, i+1, 1)) {
      printf("%c (%d) \n",i, i);
    }
  }
}

variable_types: i int


member

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

LODWORD(result) = *(_DWORD *)(a1 + 4LL * a3);
if ( !(_DWORD)result )
return 0LL;
while ( a4 != (_DWORD)result )
{
a3 = a2 & (a3 + 5189);
result = *(unsigned int *)(a1 + 4LL * a3);
if ( !(_DWORD)result )
return result;
}
return 1LL;
}

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

LODWORD(result) = *(_DWORD *)(a1 + 4LL * a3);
if ( !(_DWORD)result )
return 0LL;
while ( a4 != (_DWORD)result )
{
a3 = a2 & (a3 + 5189);
result = *(unsigned int *)(a1 + 4LL * a3);
if ( !(_DWORD)result )
return result;
}
return 1LL;
}

original_code:
static bool member(int *table, int ub, int i, int value)
{
  while (table[i] != empty_key)
    {
      if (table[i] == value)
 return 1;
      else
 i = ub & (i + prime_2);
    }
  return 0;
}

canonical_original_code:
static unsigned char member(int *table, int ub, int i, int value)
{
  while (table[i] != empty_key)
    {
      if (table[i] == value)
 return 1;
      else
 i = ub & (i + prime_2);
    }
  return 0;
}

variable_types:
table
int *

variable_types: ub int

variable_types: value int


reinsert

decompiled_code:
__int64 __fastcall reinsert(__int64 a1, int a2, int a3)
{
__int64 result; // rax
int *v6; // rcx
int v7; // edx

result = a2 & (unsigned int)(83 * a3);
v6 = (int *)(a1 + 4LL * (int)result);
v7 = *v6;
if ( *v6 )
{
while ( a3 != v7 )
{
result = a2 & (unsigned int)(result + 5189);
v6 = (int *)(a1 + 4LL * (int)result);
v7 = *v6;
if ( !*v6 )
goto LABEL_4;
}
}
else
{
LABEL_4:
*v6 = a3;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, int a2, int a3)
{
__int64 result; // rax
int *v6; // rcx
int v7; // edx

result = a2 & (unsigned int)(83 * a3);
v6 = (int *)(a1 + 4LL * (int)result);
v7 = *v6;
if ( *v6 )
{
while ( a3 != v7 )
{
result = a2 & (unsigned int)(result + 5189);
v6 = (int *)(a1 + 4LL * (int)result);
v7 = *v6;
if ( !*v6 )
goto LABEL_4;
}
}
else
{
LABEL_4:
*v6 = a3;
}
return result;
}

original_code:
static inline void reinsert(int *table, int ub, int value)
{
  int i;
  i = ub & (prime_1 * value);
  while (table[i] != empty_key)
    {
      if (table[i] == value)
 return;
      else
 i = ub & (i + prime_2);
    }
  table[i] = value;
}


decompiled_code:
__int64 __fastcall member_or_insert(__int64 a1, int a2, int a3, int a4)
{
int *v6; // rcx
int v7; // eax
__int64 result; // rax

v6 = (int *)(a1 + 4LL * a3);
v7 = *v6;
if ( *v6 )
{
while ( a4 != v7 )
{
a3 = a2 & (a3 + 5189);
v6 = (int *)(a1 + 4LL * a3);
v7 = *v6;
if ( !*v6 )
goto LABEL_4;
}
result = 1LL;
}
else
{
LABEL_4:
*v6 = a4;
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, int a2, int a3, int a4)
{
int *v6; // rcx
int v7; // eax
__int64 result; // rax

v6 = (int *)(a1 + 4LL * a3);
v7 = *v6;
if ( *v6 )
{
while ( a4 != v7 )
{
a3 = a2 & (a3 + 5189);
v6 = (int *)(a1 + 4LL * a3);
v7 = *v6;
if ( !*v6 )
goto LABEL_4;
}
result = 1LL;
}
else
{
LABEL_4:
*v6 = a4;
result = 0LL;
}
return result;
}

original_code:
static bool member_or_insert(int *table, int ub, int i, int value)
{
  while (table[i] != empty_key)
    {
      if (table[i] == value)
 return 1;
      else
 i = ub & (i + prime_2);
    }
  table[i] = value;
  return 0;
}

canonical_original_code:
static unsigned char member_or_insert(int *table, int ub, int i, int value)
{
  while (table[i] != empty_key)
    {
      if (table[i] == value)
 return 1;
      else
 i = ub & (i + prime_2);
    }
  table[i] = value;
  return 0;
}


rehash

original_code:
static void rehash(hash_set hs)
{
  int *old_table;
  int old_capacity, i;
  old_table = hs->table;
  old_capacity = hs->capacity;
  hs->capacity *= 2;
  hs->ub = ((1<<++hs->size)-1);
  hs->table = (int *)calloc(hs->capacity, sizeof(int));
  ((void) (0));
  for (i = 0; i < old_capacity; i++)
    {
      reinsert(hs->table, hs->ub, old_table[i]);
    }
  free(old_table);
}

canonical_original_code:
static void rehash(struct hash_set *hs)
{
  int *old_table;
  int old_capacity; int i;
  old_table = hs->table;
  old_capacity = hs->capacity;
  hs->capacity *= 2;
  hs->ub = ((1<<++hs->size)-1);
  hs->table = (int *)calloc(hs->capacity, sizeof(int));
  ((void) (0));
  for (i = 0; i < old_capacity; i++)
    {
      reinsert(hs->table, hs->ub, old_table[i]);
    }
  free(old_table);
}

variable_types: struct hash_set { int *table; unsigned int ub; unsigned int capacity; unsigned int inserts; unsigned int size; } *


original_code:
static void post_insert(hash_set hs)
{
  int capacity = hs->capacity;
  int inserts = ++hs->inserts;
  float percent_capacity = capacity * .85;
  if ( (float) inserts >= percent_capacity)
    {
      rehash(hs);
    }
}

canonical_original_code:
static void post_insert(struct hash_set *hs)
{
  int capacity = hs->capacity;
  int inserts = ++hs->inserts;
  float percent_capacity = capacity * .85;
  if ( (float) inserts >= percent_capacity)
    {
      rehash(hs);
    }
}

variable_types: capacity int

variable_types: inserts int


decompiled_code:
__int64 __fastcall hs_num_items(__int64 a1)
{
return *(unsigned int *)(a1 + 16);
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
return *(unsigned int *)(a1 + 16);
}

original_code:
int hs_num_items(hash_set hs)
{
  return hs->inserts;
}

canonical_original_code:
int hs_num_items(struct hash_set *hs)
{
  return hs->inserts;
}


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

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

original_code:
int *hs_list_items(hash_set hs)
{
  return hs->table;
}

canonical_original_code:
int *hs_list_items(struct hash_set *hs)
{
  return hs->table;
}

return_type: int *


original_code:
bool hs_query(hash_set hs, int entry)
{
  int hash;
  int ub = hs->ub;
  hash = ub & (prime_1 * abs(entry));
  return member(hs->table, ub, hash, entry);
}

canonical_original_code:
unsigned char hs_query(struct hash_set *hs, int entry)
{
  int hash;
  int ub = hs->ub;
  hash = ub & (prime_1 * abs(entry));
  return member(hs->table, ub, hash, entry);
}

variable_types: entry int

variable_types: hash int


decompiled_code:
__int64 __fastcall hs_member(__int64 a1, int a2)
{
unsigned int v2; // eax
unsigned int v3; // ebp

v2 = member_or_insert(*(_QWORD *)a1, *(_DWORD *)(a1 + 8), *(_DWORD *)(a1 + 8) & (83 * abs32(a2)), a2);
v3 = 1;
if ( !(_BYTE)v2 )
{
v3 = v2;
post_insert(a1);
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, int a2)
{
unsigned int v2; // eax
unsigned int v3; // ebp

v2 = func2(*(_QWORD *)a1, *(_DWORD *)(a1 + 8), *(_DWORD *)(a1 + 8) & (83 * abs32(a2)), a2);
v3 = 1;
if ( !(_BYTE)v2 )
{
v3 = v2;
func4(a1);
}
return v3;
}

original_code:
bool hs_member(hash_set hs, int entry)
{
  int hash;
  int ub = hs->ub;
  hash = ub & (prime_1 * abs(entry));
  if (member_or_insert(hs->table, ub, hash, entry))
    return 1;
  else
    {
      post_insert(hs);
      return 0;
    }
}

canonical_original_code:
unsigned char hs_member(struct hash_set *hs, int entry)
{
  int hash;
  int ub = hs->ub;
  hash = ub & (prime_1 * abs(entry));
  if (member_or_insert(hs->table, ub, hash, entry))
    return 1;
  else
    {
      post_insert(hs);
      return 0;
    }
}


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

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

original_code:
void hs_delete(hash_set hs)
{
  free(hs->table);
}

canonical_original_code:
void hs_delete(struct hash_set *hs)
{
  free(hs->table);
}


decompiled_code:
__int64 bounds_init()
{
__int64 result; // rax

added_edge_info_region = newregion();
result = newregion();
bounds_region = result;
return result;
}

canonical_decompiled_code:
__int64 func19()
{
__int64 result; // rax

added_edge_info_region = newregion();
result = newregion();
bounds_region = result;
return result;
}

original_code:
void bounds_init()
{
  added_edge_info_region = newregion();
  bounds_region = newregion();
}


decompiled_code:
__int64 bounds_reset()
{
deleteregion(bounds_region);
deleteregion(added_edge_info_region);
return bounds_init();
}

canonical_decompiled_code:
__int64 func20()
{
deleteregion(bounds_region);
deleteregion(added_edge_info_region);
return func19();
}

original_code:
void bounds_reset()
{
  deleteregion(bounds_region);
  deleteregion(added_edge_info_region);
  bounds_init();
}


decompiled_code:
__int64 __fastcall tv_combine(__int64 a1)
{
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
return a1;
}

original_code:
static gen_e tv_combine(const gen_e e1,const gen_e e2)
{
  return e1;
}

canonical_original_code:
static struct gen_e_ *tv_combine(struct gen_e_ *e1, struct gen_e_ *e2)
{
  return e1;
}


decompiled_code:
__int64 is_empty_annotation()
{
return 1LL;
}

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

original_code:
bool is_empty_annotation(annotation a) {
  return 1;
}

canonical_original_code:
unsigned char is_empty_annotation(struct annotation_ *a) {
  return 1;
}

variable_types:
a
struct annotation_ {  } *


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

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

original_code:
annotation get_empty_annotation(void) {
  return ((void *)0);
}

canonical_original_code:
struct annotation_ *get_empty_annotation() {
  return ((void *)0);
}

return_type: struct annotation_ {  } *


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

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

original_code:
annotation concat_annotation(annotation a1, annotation a2) {
  return ((void *)0);
}

canonical_original_code:
struct annotation_ *concat_annotation(struct annotation_ *a1, struct annotation_ *a2) {
  return ((void *)0);
}


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

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

original_code:
annotation star_annotation(annotation a) {
  return ((void *)0);
}

canonical_original_code:
struct annotation_ *star_annotation(struct annotation_ *a) {
  return ((void *)0);
}

variable_types:
a
struct annotation_ *


decompiled_code:
__int64 subsumed_by_annotation()
{
return 1LL;
}

canonical_decompiled_code:
__int64 func5()
{
return 1LL;
}

original_code:
bool subsumed_by_annotation(annotation a1, annotation a2) {
  return 1;
}

canonical_original_code:
unsigned char subsumed_by_annotation(struct annotation_ *a1, struct annotation_ *a2) {
  return 1;
}


decompiled_code:
void print_annotation()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

original_code:
void print_annotation(annotation a) {
}

canonical_original_code:
void print_annotation(struct annotation_ *a) {
}


bfi

decompiled_code:
unsigned __int64 __fastcall bfi(__int64 a1, __int64 a2, char a3, __int64 a4)
{
unsigned __int64 v4; // rsi
char v5; // r8
char v6; // r9
_DWORD *v7; // rsi
unsigned __int64 result; // rax
__int64 v9; // [rsp+0h] [rbp-8h]

v4 = a2 - 1;
v5 = (v4 & 0xF8) - a3 + 32 - v4;
v6 = v4 - (v4 & 0xF8);
v7 = (_DWORD *)(a1 + (v4 >> 3));
LODWORD(v9) = *v7;
result = v9 ^ ((unsigned __int64)(0xFFFFFFFFLL << v5 << v6) >> v6) & (v9 ^ (a4 << v5));
*v7 = result;
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func0(__int64 a1, __int64 a2, char a3, __int64 a4)
{
unsigned __int64 v4; // rsi
char v5; // r8
char v6; // r9
_DWORD *v7; // rsi
unsigned __int64 result; // rax
__int64 v9; // [rsp+0h] [rbp-8h]

v4 = a2 - 1;
v5 = (v4 & 0xF8) - a3 + 32 - v4;
v6 = v4 - (v4 & 0xF8);
v7 = (_DWORD *)(a1 + (v4 >> 3));
LODWORD(v9) = *v7;
result = v9 ^ ((unsigned __int64)(0xFFFFFFFFLL << v5 << v6) >> v6) & (v9 ^ (a4 << v5));
*v7 = result;
return result;
}

original_code:
void
bfi(unsigned char *cptr, unsigned long bit_offset, unsigned long bit_len, long value)
{
   unsigned long l;
   unsigned long mask = 0xffffffff;
   unsigned long byte_offset;
   unsigned long pre_shift;
   unsigned long post_shift;
   byte_offset = (bit_offset-1)/8;
   pre_shift = bit_offset - byte_offset*8 - 1;
   post_shift = 32 - bit_len - pre_shift;
   value <<= post_shift;
   mask <<= post_shift;
   mask <<= pre_shift;
   mask >>= pre_shift;
   value &= mask;
   memmove((unsigned char *)&l, &cptr[byte_offset], 4);
   l = (l & (~mask)) | value;
   memmove(&cptr[byte_offset], (unsigned char *)&l, 4);
}

variable_types:
cptr
unsigned char *

variable_types: value long

variable_types:
l
unsigned long

variable_types:
mask
unsigned long


bfx

original_code:
unsigned long
bfx(const unsigned char *cptr, unsigned long bit_offset, unsigned long bit_len)
{
   unsigned long l;
   unsigned long byte_offset;
   unsigned long left_shift;
   unsigned long right_shift;
   byte_offset = (bit_offset-1)/8;
   left_shift = bit_offset - byte_offset*8 - 1;
   right_shift = 32 - bit_len;
   memmove((unsigned char *)&l, &cptr[byte_offset], 4);
   return ( l << left_shift ) >> right_shift;
}

canonical_original_code:
unsigned long bfx(unsigned char *cptr, unsigned long bit_offset, unsigned long bit_len)
{
   unsigned long l;
   unsigned long byte_offset;
   unsigned long left_shift;
   unsigned long right_shift;
   byte_offset = (bit_offset-1)/8;
   left_shift = bit_offset - byte_offset*8 - 1;
   right_shift = 32 - bit_len;
   memmove((unsigned char *)&l, &cptr[byte_offset], 4);
   return ( l << left_shift ) >> right_shift;
}


decompiled_code:
__int64 __fastcall dd_remove(__int64 *a1)
{
__int64 result; // rax

result = *a1;
*(_QWORD *)a1[1] = *a1;
*(_QWORD *)(result + 8) = a1[1];
a1[1] = 0LL;
*a1 = 0LL;
a1[2] = 0LL;
return result;
}

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

result = *a1;
*(_QWORD *)a1[1] = *a1;
*(_QWORD *)(result + 8) = a1[1];
a1[1] = 0LL;
*a1 = 0LL;
a1[2] = 0LL;
return result;
}

original_code:
void dd_remove(dd_list_pos what)
{
  what->previous->next = what->next;
  what->next->previous = what->previous;
  what->next = what->previous = ((void *)0);
  what->data = ((void *)0);
}

canonical_original_code:
void dd_remove(struct dd_list_pos *what)
{
  what->previous->next = what->next;
  what->next->previous = what->previous;
  what->next = what->previous = ((void *)0);
  what->data = ((void *)0);
}

variable_types: struct dd_list_pos { struct dd_list_pos *next; struct dd_list_pos *previous; void *data; } *


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

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

original_code:
dd_list_pos dd_first(dd_list l)
{
  return l->first;
}

canonical_original_code:
struct dd_list_pos *dd_first(struct dd_list *l)
{
  return l->first;
}

variable_types: struct dd_list { struct dd_list_pos *first; struct dd_list_pos *null; struct dd_list_pos *last; } *

return_type: struct dd_list_pos { struct dd_list_pos *next; struct dd_list_pos *previous; void *data; } *


decompiled_code:
__int64 __fastcall dd_last(__int64 a1)
{
return *(_QWORD *)(a1 + 16);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
return *(_QWORD *)(a1 + 16);
}

original_code:
dd_list_pos dd_last(dd_list l)
{
  return l->last;
}

canonical_original_code:
struct dd_list_pos *dd_last(struct dd_list *l)
{
  return l->last;
}

user_defined_types: struct dd_list { struct dd_list_pos *first; struct dd_list_pos *null; struct dd_list_pos *last; }

user_defined_types: struct dd_list_pos { struct dd_list_pos *next; struct dd_list_pos *previous; void *data; }


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

v1 = *(_QWORD **)dd_first(a1);
if ( !v1 )
return 0LL;
v2 = 0LL;
do
{
++v2;
v1 = (_QWORD *)*v1;
}
while ( v1 );
return v2;
}

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

v1 = *(_QWORD **)func1(a1);
if ( !v1 )
return 0LL;
v2 = 0LL;
do
{
++v2;
v1 = (_QWORD *)*v1;
}
while ( v1 );
return v2;
}

original_code:
unsigned long dd_length(dd_list l)
{
  dd_list_pos scan;
  unsigned long len = 0;
  for (scan = dd_first((l)); !(!(scan)->next); scan = ((scan)->next)) len++;
  return len;
}

canonical_original_code:
unsigned long dd_length(struct dd_list *l)
{
  struct dd_list_pos *scan;
  unsigned long len = 0;
  for (scan = dd_first((l)); !(!(scan)->next); scan = ((scan)->next)) len++;
  return len;
}

variable_types: struct dd_list { struct dd_list_pos { struct dd_list_pos *next; struct dd_list_pos *previous; void *data; } *first; struct dd_list_pos *null; struct dd_list_pos *last; } *

variable_types:
len
unsigned long


decompiled_code:
__int64 __fastcall jcoll_accum(__int64 a1)
{
return gen_e_list_cons(a1, jf_accum);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
return gen_e_list_cons(a1, jf_accum);
}

original_code:
static void jcoll_accum(void *e) {
 gen_e_list_cons((gen_e) e, jf_accum);
}

canonical_original_code:
static void jcoll_accum(void *e) {
 gen_e_list_cons((struct gen_e_ *) e, jf_accum);
}

variable_types:
e
void *


decompiled_code:
__int64 banshee_region_persistence_init()
{
__int64 result; // rax

region_init();
banshee_ptr_region = newregion();
banshee_nonptr_region = newregion();
result = make_hash_table(permanent, 32LL, &ptr_hash, &ptr_eq);
extra_regions = result;
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

region_init();
banshee_ptr_region = newregion();
banshee_nonptr_region = newregion();
result = make_hash_table(permanent, 32LL, &ptr_hash, &ptr_eq);
extra_regions = result;
return result;
}

original_code:
void banshee_region_persistence_init()
{
  region_init();
  banshee_ptr_region = newregion();
  banshee_nonptr_region = newregion();
  extra_regions = make_hash_table(permanent, 32, ptr_hash, ptr_eq);
}


freeToken

decompiled_code:
void __fastcall freeToken(void **a1)
{
void *v2; // rdi
void **v3; // rbx

v2 = *a1;
if ( v2 )
{
v3 = a1 + 1;
do
{
free(v2);
v2 = *v3++;
}
while ( v2 );
}
}

canonical_decompiled_code:
void __fastcall func0(void **a1)
{
void *v2; // rdi
void **v3; // rbx

v2 = *a1;
if ( v2 )
{
v3 = a1 + 1;
do
{
free(v2);
v2 = *v3++;
}
while ( v2 );
}
}

original_code:
void freeToken(char **arr)
{
 int i = 0;
 while (arr[i] != ((void *)0))
  {
   free(arr[i]);
   i++;
  }
}

variable_types:
arr
char **

variable_types: i int