hexToBinary

decompiled_code:
__int64 __fastcall hexToBinary(_BYTE *a1, const char *a2)
{
__int64 result; // rax
__int64 v4; // rbx
char v5; // dl
int v6; // ecx
_BYTE *v7; // rdx

result = (unsigned int)strlen(a2) - 1;
if ( (int)result >= 0 )
{
v4 = (int)result;
do
{
v5 = a2[v4];
switch ( v5 )
{
case '0':
v6 = 0;
break;
case '1':
v6 = 1;
break;
case '2':
v6 = 2;
break;
case '3':
v6 = 3;
break;
case '4':
v6 = 4;
break;
case '5':
v6 = 5;
break;
case '6':
v6 = 6;
break;
case '7':
v6 = 7;
break;
case '8':
v6 = 8;
break;
case '9':
v6 = 9;
break;
case 'A':
case 'a':
v6 = 10;
break;
case 'B':
case 'b':
v6 = 11;
break;
case 'C':
case 'c':
v6 = 12;
break;
case 'D':
case 'd':
v6 = 13;
break;
case 'E':
case 'e':
v6 = 14;
break;
case 'F':
case 'f':
v6 = 15;
break;
default:
printf("error hex for char %c \n\n", (unsigned int)v5);
v6 = 0;
break;
}
v7 = a1;
LODWORD(result) = 0;
do
{
if ( _bittest(&v6, result) )
*v7 = 1;
else
*v7 = 0;
result = (unsigned int)(result + 1);
++v7;
}
while ( (_DWORD)result != 4 );
--v4;
a1 += 4;
}
while ( (int)v4 >= 0 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(_BYTE *a1, const char *a2)
{
__int64 result; // rax
__int64 v4; // rbx
char v5; // dl
int v6; // ecx
_BYTE *v7; // rdx

result = (unsigned int)strlen(a2) - 1;
if ( (int)result >= 0 )
{
v4 = (int)result;
do
{
v5 = a2[v4];
switch ( v5 )
{
case '0':
v6 = 0;
break;
case '1':
v6 = 1;
break;
case '2':
v6 = 2;
break;
case '3':
v6 = 3;
break;
case '4':
v6 = 4;
break;
case '5':
v6 = 5;
break;
case '6':
v6 = 6;
break;
case '7':
v6 = 7;
break;
case '8':
v6 = 8;
break;
case '9':
v6 = 9;
break;
case 'A':
case 'a':
v6 = 10;
break;
case 'B':
case 'b':
v6 = 11;
break;
case 'C':
case 'c':
v6 = 12;
break;
case 'D':
case 'd':
v6 = 13;
break;
case 'E':
case 'e':
v6 = 14;
break;
case 'F':
case 'f':
v6 = 15;
break;
default:
printf("error hex for char %c \n\n", (unsigned int)v5);
v6 = 0;
break;
}
v7 = a1;
LODWORD(result) = 0;
do
{
if ( _bittest(&v6, result) )
*v7 = 1;
else
*v7 = 0;
result = (unsigned int)(result + 1);
++v7;
}
while ( (_DWORD)result != 4 );
--v4;
a1 += 4;
}
while ( (int)v4 >= 0 );
}
return result;
}

original_code:
void hexToBinary(bit * array, char * hex){
 int i, j , index = 0;
 for(i = strlen(hex) - 1; i >= 0; i--)
 {
  u_int8_t num = 0;
  switch(hex[i]){
   case '0' : num = 0; break;
   case '1' : num = 1; break;
   case '2' : num = 2; break;
   case '3' : num = 3; break;
   case '4' : num = 4; break;
   case '5' : num = 5; break;
   case '6' : num = 6; break;
   case '7' : num = 7; break;
   case '8' : num = 8; break;
   case '9' : num = 9; break;
   case 'A' : num = 10; break;
   case 'B' : num = 11; break;
   case 'C' : num = 12; break;
   case 'D' : num = 13; break;
   case 'E' : num = 14; break;
   case 'F' : num = 15; break;
   case 'a' : num = 10; break;
   case 'b' : num = 11; break;
   case 'c' : num = 12; break;
   case 'd' : num = 13; break;
   case 'e' : num = 14; break;
   case 'f' : num = 15; break;
   default : printf("error hex for char %c \n\n" , hex[i]); break;
   }
  for(j = 0; j < 4; j++)
  {
   if(num & (1 << j))
    array[index] = 1;
   else
    array[index] = 0;
   index++;
  }
 }
}

canonical_original_code:
void hexToBinary(unsigned int *array, char *hex){
 int i; int j; int index = 0;
 for(i = strlen(hex) - 1; i >= 0; i--)
 {
  unsigned int num = 0;
  switch(hex[i]){
   case '0' : num = 0; break;
   case '1' : num = 1; break;
   case '2' : num = 2; break;
   case '3' : num = 3; break;
   case '4' : num = 4; break;
   case '5' : num = 5; break;
   case '6' : num = 6; break;
   case '7' : num = 7; break;
   case '8' : num = 8; break;
   case '9' : num = 9; break;
   case 'A' : num = 10; break;
   case 'B' : num = 11; break;
   case 'C' : num = 12; break;
   case 'D' : num = 13; break;
   case 'E' : num = 14; break;
   case 'F' : num = 15; break;
   case 'a' : num = 10; break;
   case 'b' : num = 11; break;
   case 'c' : num = 12; break;
   case 'd' : num = 13; break;
   case 'e' : num = 14; break;
   case 'f' : num = 15; break;
   default : printf("error hex for char %c \n\n" , hex[i]); break;
   }
  for(j = 0; j < 4; j++)
  {
   if(num & (1 << j))
    array[index] = 1;
   else
    array[index] = 0;
   index++;
  }
 }
}

variable_types:
array
unsigned int *


printHex

repo: parzio/crypto-secure-communication

original_code:
void printHex(bit * array, unsigned int length){
 int i,j;
 int num_of_hex = length / 4 + ((length % 4 != 0) ? 1 : 0);
 unsigned char buffer[num_of_hex];
 memset(buffer , 0 , num_of_hex * sizeof(char));
 for(i = 0; i < num_of_hex; i++)
 {
  for(j = 0; j < 4; j++)
  {
   int index = (i * 4) + j;
   if(index < length)
    buffer[i] |= (array[index] << j);
  }
 }
 char x;
 for(i = num_of_hex - 1; i >= 0 ; i--)
 {
  switch(buffer[i]){
   case 0 : x = '0'; break;
   case 1 : x = '1'; break;
   case 2 : x = '2'; break;
   case 3 : x = '3'; break;
   case 4 : x = '4'; break;
   case 5 : x = '5'; break;
   case 6 : x = '6'; break;
   case 7 : x = '7'; break;
   case 8 : x = '8'; break;
   case 9 : x = '9'; break;
   case 10 : x = 'A'; break;
   case 11 : x = 'B'; break;
   case 12 : x = 'C'; break;
   case 13 : x = 'D'; break;
   case 14 : x = 'E'; break;
   case 15 : x = 'F'; break;
   default : break;
   }
  printf("%c" , x);
 }
 printf("\n");
}

canonical_original_code:
void printHex(unsigned int *array, unsigned int length){
 int i; int j;
 int num_of_hex = length / 4 + ((length % 4 != 0) ? 1 : 0);
 unsigned char buffer[-1];
 memset(buffer , 0 , num_of_hex * sizeof(char));
 for(i = 0; i < num_of_hex; i++)
 {
  for(j = 0; j < 4; j++)
  {
   int index = (i * 4) + j;
   if(index < length)
    buffer[i] |= (array[index] << j);
  }
 }
 char x;
 for(i = num_of_hex - 1; i >= 0 ; i--)
 {
  switch(buffer[i]){
   case 0 : x = '0'; break;
   case 1 : x = '1'; break;
   case 2 : x = '2'; break;
   case 3 : x = '3'; break;
   case 4 : x = '4'; break;
   case 5 : x = '5'; break;
   case 6 : x = '6'; break;
   case 7 : x = '7'; break;
   case 8 : x = '8'; break;
   case 9 : x = '9'; break;
   case 10 : x = 'A'; break;
   case 11 : x = 'B'; break;
   case 12 : x = 'C'; break;
   case 13 : x = 'D'; break;
   case 14 : x = 'E'; break;
   case 15 : x = 'F'; break;
   default : break;
   }
  printf("%c" , x);
 }
 printf("\n");
}

variable_types:
length
unsigned int

variable_types: i int

variable_types: j int

variable_types:
buffer
unsigned char [-1]

variable_types: index int

variable_types: x char

return_type: void


arrayCopy

decompiled_code:
void __fastcall arrayCopy(__int64 a1, __int64 a2, int a3)
{
__int64 i; // rax

if ( a3 > 0 )
{
for ( i = 0LL; i != a3; ++i )
*(_BYTE *)(a2 + i) = *(_BYTE *)(a1 + i);
}
}

original_code:
void arrayCopy(bit * a , bit * b , int length){
 int i;
 for(i = 0; i < length; i++)
  b[i] = a[i];
}

canonical_original_code:
void arrayCopy(unsigned int *a, unsigned int *b, int length){
 int i;
 for(i = 0; i < length; i++)
  b[i] = a[i];
}

variable_types:
a
unsigned int *

variable_types:
b
unsigned int *

variable_types: length int


arrayEqual

decompiled_code:
__int64 __fastcall arrayEqual(__int64 a1, __int64 a2, int a3)
{
__int64 v3; // rax

if ( !a3 )
return 0LL;
v3 = 0LL;
while ( *(_BYTE *)(a1 + v3) == *(_BYTE *)(a2 + v3) )
{
if ( ++v3 == a3 )
return 0LL;
}
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, __int64 a2, int a3)
{
__int64 v3; // rax

if ( !a3 )
return 0LL;
v3 = 0LL;
while ( *(_BYTE *)(a1 + v3) == *(_BYTE *)(a2 + v3) )
{
if ( ++v3 == a3 )
return 0LL;
}
return 0xFFFFFFFFLL;
}

original_code:
int arrayEqual(bit *a1 , bit *a2 , unsigned int length){
 int i;
 for(i = 0; i < length; i++)
  if(a1[i] != a2[i])
   return -1;
 return 0;
}

canonical_original_code:
int arrayEqual(unsigned int *a1, unsigned int *a2, unsigned int length){
 int i;
 for(i = 0; i < length; i++)
  if(a1[i] != a2[i])
   return -1;
 return 0;
}

return_type: int


initFPRNG

decompiled_code:
void initFPRNG()
{
unsigned int v0; // eax

v0 = time(0LL);
srand(v0);
}

canonical_decompiled_code:
void func0()
{
unsigned int v0; // eax

v0 = time(0LL);
srand(v0);
}

original_code:
void initFPRNG(){
 srand(time(((void *)0)));
}


FPRNG

decompiled_code:
__int64 __fastcall FPRNG(__int64 a1, int a2)
{
__int64 v2; // r15
signed __int64 v3; // rax
void *v4; // rsp
void *v5; // rsp
__int64 i; // r15
__int64 result; // rax
__int64 v8; // rdx
char v9[32]; // [rsp+0h] [rbp-1F0h] BYREF
char v10[32]; // [rsp+20h] [rbp-1D0h] BYREF
char v11[64]; // [rsp+40h] [rbp-1B0h] BYREF
char v12[64]; // [rsp+80h] [rbp-170h] BYREF
char v13[128]; // [rsp+C0h] [rbp-130h] BYREF
char v14[176]; // [rsp+140h] [rbp-B0h] BYREF

v2 = 0LL;
v3 = 16 * ((unsigned __int64)(a2 + 15LL) >> 4);
v4 = alloca(v3);
v5 = alloca(v3);
do
{
v11[v2] = -(char)rand();
v12[v2++] = rand() / 0x3FFFFFFF;
}
while ( v2 != 64 );
for ( i = 0LL; i != 22; ++i )
{
v9[i] = -(char)rand();
v10[i] = rand() / 0x3FFFFFFF;
}
MAJ5_init(v13);
MAJ5_keyLoading(v13, v11, v9);
MAJ5_warmUpStream(v13, 100LL);
MAJ5_getStream(v13, v9, (unsigned int)a2);
MAJ5_delete(v13);
ALL5_init(v14);
ALL5_keyLoading(v14, v12, v10);
ALL5_warmUpStream(v14, 100LL);
ALL5_getStream(v14, v9, (unsigned int)a2);
result = ALL5_delete(v14);
if ( a2 > 0 )
{
result = 0LL;
do
{
*(_BYTE *)(a1 + result) = 0;
v8 = result++;
}
while ( v8 != a2 - 1 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, int a2)
{
__int64 v2; // r15
signed __int64 v3; // rax
void *v4; // rsp
void *v5; // rsp
__int64 i; // r15
__int64 result; // rax
__int64 v8; // rdx
char v9[32]; // [rsp+0h] [rbp-1F0h] BYREF
char v10[32]; // [rsp+20h] [rbp-1D0h] BYREF
char v11[64]; // [rsp+40h] [rbp-1B0h] BYREF
char v12[64]; // [rsp+80h] [rbp-170h] BYREF
char v13[128]; // [rsp+C0h] [rbp-130h] BYREF
char v14[176]; // [rsp+140h] [rbp-B0h] BYREF

v2 = 0LL;
v3 = 16 * ((unsigned __int64)(a2 + 15LL) >> 4);
v4 = alloca(v3);
v5 = alloca(v3);
do
{
v11[v2] = -(char)rand();
v12[v2++] = rand() / 0x3FFFFFFF;
}
while ( v2 != 64 );
for ( i = 0LL; i != 22; ++i )
{
v9[i] = -(char)rand();
v10[i] = rand() / 0x3FFFFFFF;
}
MAJ5_init(v13);
MAJ5_keyLoading(v13, v11, v9);
MAJ5_warmUpStream(v13, 100LL);
MAJ5_getStream(v13, v9, (unsigned int)a2);
MAJ5_delete(v13);
ALL5_init(v14);
ALL5_keyLoading(v14, v12, v10);
ALL5_warmUpStream(v14, 100LL);
ALL5_getStream(v14, v9, (unsigned int)a2);
result = ALL5_delete(v14);
if ( a2 > 0 )
{
result = 0LL;
do
{
*(_BYTE *)(a1 + result) = 0;
v8 = result++;
}
while ( v8 != a2 - 1 );
}
return result;
}

original_code:
void FPRNG(bit * result , int length){
 bit seed1[64] , seed2[64];
 bit init1[22] , init2[22];
 bit maj_buffer[length];
 bit all_buffer[length];
 int i;
 for(i = 0; i < 64; i++){
  seed1[i] = (int) rand() / (int) (2147483647/2);
  seed2[i] = (int) rand() / (int) (2147483647/2);
 }
 for(i = 0; i < 22; i++){
  init1[i] = (int) rand() / (int) (2147483647/2);
  init2[i] = (int) rand() / (int) (2147483647/2);
 }
 MAJ5 maj5;
 MAJ5_init(&maj5);
 MAJ5_keyLoading(&maj5 , seed1 , init1);
 MAJ5_warmUpStream(&maj5 , 100);
 MAJ5_getStream(&maj5, maj_buffer, (unsigned) length);
 MAJ5_delete(&maj5);
 ALL5 all5;
 ALL5_init(&all5);
 ALL5_keyLoading(&all5 , seed2 , init2);
 ALL5_warmUpStream(&all5 , 100);
 ALL5_getStream(&all5, all_buffer , (unsigned) length);
 ALL5_delete(&all5);
 for(i = 0; i < length; i++)
  result[i] = maj_buffer[i] ^ all_buffer[i];
}

canonical_original_code:
void FPRNG(unsigned int *result, int length){
 unsigned int seed1[64]; unsigned int seed2[64];
 unsigned int init1[22]; unsigned int init2[22];
 unsigned int maj_buffer[-1];
 unsigned int all_buffer[-1];
 int i;
 for(i = 0; i < 64; i++){
  seed1[i] = (int) rand() / (int) (2147483647/2);
  seed2[i] = (int) rand() / (int) (2147483647/2);
 }
 for(i = 0; i < 22; i++){
  init1[i] = (int) rand() / (int) (2147483647/2);
  init2[i] = (int) rand() / (int) (2147483647/2);
 }
 struct MAJ5 maj5;
 MAJ5_init(&maj5);
 MAJ5_keyLoading(&maj5 , seed1 , init1);
 MAJ5_warmUpStream(&maj5 , 100);
 MAJ5_getStream(&maj5, maj_buffer, (unsigned int) length);
 MAJ5_delete(&maj5);
 struct ALL5 all5;
 ALL5_init(&all5);
 ALL5_keyLoading(&all5 , seed2 , init2);
 ALL5_warmUpStream(&all5 , 100);
 ALL5_getStream(&all5, all_buffer , (unsigned int) length);
 ALL5_delete(&all5);
 for(i = 0; i < length; i++)
  result[i] = maj_buffer[i] ^ all_buffer[i];
}

variable_types:
result
unsigned int *

variable_types: struct MAJ5 { struct LFSR { unsigned int *reg; unsigned int *poly; unsigned int degree; } reg[5]; }

variable_types: struct ALL5 { struct LFSR { unsigned int *reg; unsigned int *poly; unsigned int degree; } reg[5]; }


SPRNG

original_code:
void SPRNG(bit * result , int length){
 int cicle = length + (24 - (length % 24));
 bit fseed[cicle * 2];
 bit resul[cicle];
 FPRNG(fseed , cicle * 2);
 int i , end = cicle/24 , p = 0;
 bit key[24] , block[24];
 for(i = 0; i < end; i++)
 {
  int ks = i * 48;
  int ke = ks + 24;
  int bs = ke;
  int be = bs + 24;
  int z = 0 , j;
  for(j = ks; j < ke; j++)
  {
   key[z] = fseed[j];
   z++;
  }
  z = 0;
  for(j = bs; j < be; j++)
  {
   block[z] = fseed[j];
   z++;
  }
  bunny24_encrypt(block , key);
  int rs = i * 24;
  int re = rs + 24;
  z = 0;
  for(j = rs; j < re; j++)
  {
   resul[j] = block[z];
   z++;
  }
 }
 for(i = 0; i < length; i++)
  result[i] = resul[i];
}

canonical_original_code:
void SPRNG(unsigned int *result, int length){
 int cicle = length + (24 - (length % 24));
 unsigned int fseed[-1];
 unsigned int resul[-1];
 FPRNG(fseed , cicle * 2);
 int i; int end = cicle/24; int p = 0;
 unsigned int key[24]; unsigned int block[24];
 for(i = 0; i < end; i++)
 {
  int ks = i * 48;
  int ke = ks + 24;
  int bs = ke;
  int be = bs + 24;
  int z = 0; int j;
  for(j = ks; j < ke; j++)
  {
   key[z] = fseed[j];
   z++;
  }
  z = 0;
  for(j = bs; j < be; j++)
  {
   block[z] = fseed[j];
   z++;
  }
  bunny24_encrypt(block , key);
  int rs = i * 24;
  int re = rs + 24;
  z = 0;
  for(j = rs; j < re; j++)
  {
   resul[j] = block[z];
   z++;
  }
 }
 for(i = 0; i < length; i++)
  result[i] = resul[i];
}

variable_types: cicle int

variable_types:
fseed
unsigned int [-1]

variable_types:
resul
unsigned int [-1]

variable_types: end int

variable_types: p int

variable_types:
key
unsigned int [24]

variable_types:
block
unsigned int [24]

variable_types: ks int

variable_types: ke int

variable_types: bs int

variable_types: be int

variable_types: z int

variable_types: rs int

variable_types: re int


spongeBunnyComputeHash

original_code:
void spongeBunnyComputeHash(byte * message , byte hash[160 / 8], int length){
 int i,j;
 memset(hash, 0, 160 / 8 * sizeof(byte));
 int bitLength = length * 8;
 bit bit_message[bitLength];
 for(i = 0; i < bitLength; i++)
  bit_message[i] = (message[i / 8] & (1 << i % 8)) ? 1 : 0;
 bit output[160];
 memset(output, 0, 160 * sizeof(bit));
 int rounds = bitLength/20;
 if(bitLength % 20 != 0)
  rounds++;
 bit input[rounds][20];
 for(i = 0; i < rounds-1; i++)
 {
  for(j = 0; j < 20; j++)
   input[i][j] = bit_message[i*20 +j];
 }
 if((bitLength % 20) == 0 )
 {
  for(j = 0; j < 20; j++)
   input[rounds-1][j] = bit_message[i*20 +j];
 }
 else
 {
  for(j = 0; j < bitLength % 20; j++)
   input[rounds-1][j] = bit_message[(rounds-1)*20 +j];
  for(j = bitLength % 20; j < 20; j++)
   input[rounds-1][j] = 0;
 }
 bit state[24];
 memset(&state, 0, 24 * sizeof(bit));
 for(i = 0;i < rounds; i++)
 {
  for(j = 0; j < 20; j++)
   state[j] ^= input[i][j];
  bunny24_encrypt(state, SPONGE_KEY);
 }
 int roundsSqueeze = 160/20;
 for(i = 0; i < roundsSqueeze; i++)
 {
  for(j = 0; j < 20; j++ )
   output[i*20 + j] = state[j];
  bunny24_encrypt(state, SPONGE_KEY);
 }
  for(i = 0; i < 160; i++)
   hash[i/8] |= (output[i] << (i % 8));
}

canonical_original_code:
void spongeBunnyComputeHash(unsigned int *message, unsigned int hash[-1], int length){
 int i; int j;
 memset(hash, 0, 160 / 8 * sizeof(byte));
 int bitLength = length * 8;
 unsigned int bit_message[-1];
 for(i = 0; i < bitLength; i++)
  bit_message[i] = (message[i / 8] & (1 << i % 8)) ? 1 : 0;
 unsigned int output[160];
 memset(output, 0, 160 * sizeof(bit));
 int rounds = bitLength/20;
 if(bitLength % 20 != 0)
  rounds++;
 unsigned int input[-1][20];
 for(i = 0; i < rounds-1; i++)
 {
  for(j = 0; j < 20; j++)
   input[i][j] = bit_message[i*20 +j];
 }
 if((bitLength % 20) == 0 )
 {
  for(j = 0; j < 20; j++)
   input[rounds-1][j] = bit_message[i*20 +j];
 }
 else
 {
  for(j = 0; j < bitLength % 20; j++)
   input[rounds-1][j] = bit_message[(rounds-1)*20 +j];
  for(j = bitLength % 20; j < 20; j++)
   input[rounds-1][j] = 0;
 }
 unsigned int state[24];
 memset(&state, 0, 24 * sizeof(bit));
 for(i = 0;i < rounds; i++)
 {
  for(j = 0; j < 20; j++)
   state[j] ^= input[i][j];
  bunny24_encrypt(state, SPONGE_KEY);
 }
 int roundsSqueeze = 160/20;
 for(i = 0; i < roundsSqueeze; i++)
 {
  for(j = 0; j < 20; j++ )
   output[i*20 + j] = state[j];
  bunny24_encrypt(state, SPONGE_KEY);
 }
  for(i = 0; i < 160; i++)
   hash[i/8] |= (output[i] << (i % 8));
}

variable_types:
message
unsigned int *

variable_types:
hash
unsigned int [-1]

variable_types: length int

variable_types: i int

variable_types: j int

variable_types: bitLength int

variable_types:
output
unsigned int [160]

variable_types: rounds int

variable_types:
input
unsigned int [-1][20]

variable_types:
state
unsigned int [24]

variable_types: roundsSqueeze int


original_code:
unsigned long long str2ll(const char *s)
{
 char *str = (char *)s;
 unsigned long long ret = 0;
 long long qen = 1, queue = 10;
 char *end = str + strlen(str) - 1;
 if( *str=='0' && (*(str+1) == 'x' || *(str+1)=='X'))
  str+=2;
 while(end >= str)
 {
  if(*end >= '0' && *end <= '9')
   ret += (*end-'0')*qen;
  else if( *end >= 'a' && *end <= 'f')
   ret += (*end-'a'+10)*qen;
  else if(*end>='A'&&*end<='F')
   ret += (*end-'A'+10)*qen;
  else
   return ret;
  end--;
  qen *= queue;
 }
 return ret;
}

canonical_original_code:
unsigned long long str2ll(char *s)
{
 char *str = (char *)s;
 unsigned long long ret = 0;
 long long qen = 1; long long queue = 10;
 char *end = str + strlen(str) - 1;
 if( *str=='0' && (*(str+1) == 'x' || *(str+1)=='X'))
  str+=2;
 while(end >= str)
 {
  if(*end >= '0' && *end <= '9')
   ret += (*end-'0')*qen;
  else if( *end >= 'a' && *end <= 'f')
   ret += (*end-'a'+10)*qen;
  else if(*end>='A'&&*end<='F')
   ret += (*end-'A'+10)*qen;
  else
   return ret;
  end--;
  qen *= queue;
 }
 return ret;
}

variable_types:
s
char *

variable_types:
str
char *

variable_types:
ret
unsigned long long

variable_types:
qen
long long

variable_types:
queue
long long

variable_types:
end
char *

return_type: unsigned long long


decompiled_code:
void *__fastcall bitmap_creat(unsigned __int64 a1)
{
void *v2; // rdi
void *result; // rax

v2 = bm;
if ( bm )
{
if ( qword_248 >= a1 )
goto LABEL_5;
free(bm);
}
printf("%s:need memory size %dM\n", "bitmap_creat", a1 >> 23);
bm = malloc(a1 >> 3);
v2 = bm;
if ( !bm )
{
printf("%s:cannot malloc %llu memory\n", "bitmap_creat", a1 >> 3);
exit(0);
}
LABEL_5:
result = memset(v2, 0, a1 >> 3);
qword_248 = a1;
return result;
}

canonical_decompiled_code:
void *__fastcall func1(unsigned __int64 a1)
{
void *v2; // rdi
void *result; // rax

v2 = bm;
if ( bm )
{
if ( qword_248 >= a1 )
goto LABEL_5;
free(bm);
}
printf("%s:need memory size %dM\n", "bitmap_creat", a1 >> 23);
bm = malloc(a1 >> 3);
v2 = bm;
if ( !bm )
{
printf("%s:cannot malloc %llu memory\n", "bitmap_creat", a1 >> 3);
exit(0);
}
LABEL_5:
result = memset(v2, 0, a1 >> 3);
qword_248 = a1;
return result;
}

original_code:
void bitmap_creat(unsigned long long max_length)
{
 if( !bm.data || (max_length > bm.len) )
 {
  if(bm.data)
   free(bm.data);
  printf("%s:need memory size %dM\n", __FUNCTION__, (int)(max_length>>23));
  bm.data = (unsigned char *)malloc(max_length>>3);
  if(bm.data == ((void *)0))
  {
   printf("%s:cannot malloc %llu memory\n", __FUNCTION__, max_length>>3);
   exit(0);
  }
  bm.len = max_length;
 }
 if( bm.data && (max_length <= bm.len) )
 {
  memset(bm.data, 0, max_length>>3);
  bm.len = max_length;
 }
}


decompiled_code:
__int64 __fastcall bitmap_set(unsigned __int64 a1)
{
unsigned int v1; // er8
char v2; // cl
_BYTE *v3; // rdi
int v4; // edx
int v5; // ecx

v1 = 0;
if ( qword_248 >= a1 )
{
v2 = a1;
v3 = (char *)bm + (a1 >> 3);
v4 = (unsigned __int8)*v3;
v5 = v2 & 7;
if ( !_bittest(&v4, v5) )
{
v1 = 1;
*v3 |= 1 << v5;
}
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int64 a1)
{
unsigned int v1; // er8
char v2; // cl
_BYTE *v3; // rdi
int v4; // edx
int v5; // ecx

v1 = 0;
if ( qword_248 >= a1 )
{
v2 = a1;
v3 = (char *)bm + (a1 >> 3);
v4 = (unsigned __int8)*v3;
v5 = v2 & 7;
if ( !_bittest(&v4, v5) )
{
v1 = 1;
*v3 |= 1 << v5;
}
}
return v1;
}

original_code:
int bitmap_set(unsigned long long offs)
{
 unsigned long long pos = offs/8;
 int bits = offs%8;
 unsigned char *data = (unsigned char *)(bm.data + pos);
 if(offs > bm.len)
  return 0;
 if( *data & (1<<bits))
  return 0;
 *data |= 1<<bits;
 return 1;
}

variable_types:
offs
unsigned long long

variable_types:
pos
unsigned long long

variable_types: bits int

variable_types:
data
unsigned char *


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

result = ((int)*((unsigned __int8 *)bm + (a1 >> 3)) >> (a1 & 7)) & 1;
if ( a2 )
*a2 = result;
return result;
}

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

result = ((int)*((unsigned __int8 *)bm + (a1 >> 3)) >> (a1 & 7)) & 1;
if ( a2 )
*a2 = result;
return result;
}

original_code:
int bitmap_get(unsigned long long offs, int *isIn)
{
 unsigned long long pos = offs/8;
 int bits = offs%8;
 unsigned char *data = (unsigned char *)(bm.data + pos);
 int ret = *data & 1<<bits?1:0;
 if(isIn)
  *isIn = ret;
 return ret;
}

variable_types:
isIn
int *

variable_types: ret int


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

v1 = str2ll(a1 + 1);
return bitmap_set(v1);
}

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

v1 = func0(a1 + 1);
return func2(v1);
}

original_code:
int bitmap_setstr(char *str)
{
 char *_s = str+1;
 unsigned long long tmp = str2ll(_s);
 return bitmap_set(tmp);
}

variable_types:
tmp
unsigned long long


decompiled_code:
__int64 __fastcall bitmap_getstr(__int64 a1, _DWORD *a2)
{
__int64 v2; // rax

v2 = str2ll(a1 + 1);
return bitmap_get(v2, a2);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, _DWORD *a2)
{
__int64 v2; // rax

v2 = func0(a1 + 1);
return func3(v2, a2);
}

original_code:
int bitmap_getstr(char *str, int *isIn)
{
 char *_s = str+1;
 unsigned long long tmp = str2ll(_s);
 return bitmap_get(tmp, isIn);
}


decompiled_code:
void bitmap_destroy()
{
if ( bm )
{
free(bm);
bm = 0LL;
qword_248 = 0LL;
}
}

canonical_decompiled_code:
void func6()
{
if ( bm )
{
free(bm);
bm = 0LL;
qword_248 = 0LL;
}
}

original_code:
void bitmap_destroy()
{
 if(bm.data)
 {
  free(bm.data);
  bm.data = 0;
  bm.len = 0;
 }
}


repo: passedaway/mem

original_code:
static inline void memnode_free(mem_node_t *mnode)
{
 mnode->seal = 0x5AA5A55A;
 mnode->type = 1;
}

canonical_original_code:
static inline void memnode_free(struct mem_node_s *mnode)
{
 mnode->seal = 0x5AA5A55A;
 mnode->type = 1;
}

variable_types: struct mem_node_s { union { struct queue_s { struct queue_s *prev; struct queue_s *next; } dirty_queue; struct queue_s free_queue; }; unsigned int seal; int size; int type; char *file_name; char *func_name; int line_num; void *data; } *

user_defined_types: struct mem_node_s { union { struct queue_s dirty_queue; struct queue_s free_queue; }; unsigned int seal; int size; int type; char *file_name; char *func_name; int line_num; void *data; }


original_code:
static inline mem_node_t *memnode_alloc(void *ptr, int size)
{
 mem_node_t *mnode = (mem_node_t*)ptr;
 memset(ptr, 0, sizeof(mem_node_t));
 mnode->type = 0;
 mnode->size = size;
 (mnode)->data = (unsigned char *)(mnode) + (int)&(((mem_node_t*)0)->data) + 4;
 mnode->seal = 0x5AA5A55A;
 return mnode;
}

canonical_original_code:
static inline struct mem_node_s *memnode_alloc(void *ptr, int size)
{
 struct mem_node_s *mnode = (mem_node_t*)ptr;
 memset(ptr, 0, sizeof(mem_node_t));
 mnode->type = 0;
 mnode->size = size;
 (mnode)->data = (unsigned char *)(mnode) + (int)&(((struct mem_node_s *)0)->data) + 4;
 mnode->seal = 0x5AA5A55A;
 return mnode;
}

variable_types:
ptr
void *

variable_types: size int

return_type: struct mem_node_s { union { struct queue_s { struct queue_s *prev; struct queue_s *next; } dirty_queue; struct queue_s free_queue; }; unsigned int seal; int size; int type; char *file_name; char *func_name; int line_num; void *data; } *


original_code:
static inline int outof_free_queue(mem_mgr_t *mgr, mem_node_t *outq)
{
 if( outq == mgr->head_free )
 {
  if( mgr->head_free->free_queue.next == (queue_t*)mgr->head_free )
  {
   mgr->head_free = ((void *)0);
   return 1;
  }
  else
   mgr->head_free = (mem_node_t*)outq->free_queue.next;
 }
 queue_out(&outq->free_queue);
 return 0;
}

canonical_original_code:
static inline int outof_free_queue(struct mem_mgr_s *mgr, struct mem_node_s *outq)
{
 if( outq == mgr->head_free )
 {
  if( mgr->head_free->free_queue.next == (struct queue_s *)mgr->head_free )
  {
   mgr->head_free = ((void *)0);
   return 1;
  }
  else
   mgr->head_free = (struct mem_node_s *)outq->free_queue.next;
 }
 queue_out(&outq->free_queue);
 return 0;
}

variable_types: struct mem_mgr_s { int total_size; int free_size; int alocate_size; struct mem_node_s { union { struct queue_s { struct queue_s *prev; struct queue_s *next; } dirty_queue; struct queue_s free_queue; }; unsigned int seal; int size; int type; char *file_name; char *func_name; int line_num; void *data; } *head_dirty; } *

variable_types:
outq
struct mem_node_s *

user_defined_types: struct mem_mgr_s { int total_size; int free_size; int alocate_size; struct mem_node_s *head_dirty; }


original_code:
mem_mgr_t *mem_init(void *ptr, int size)
{
 mem_mgr_t *mgr = ((void *)0);
 if( ptr == ((void *)0) || (size <= (sizeof(mem_mgr_t) + 512)) )
  return ((void *)0);
 mgr = (mem_mgr_t *)ptr;
 mgr->total_size = ((size+3) & (~0x3));
 mgr->free_size = ((size+3) & (~0x3)) - sizeof(mem_mgr_t) - 1 * sizeof(mem_node_t);
 mgr->alocate_size = 0;
 mgr->head_dirty = ((void *)0);
 mgr->head_free = ((void *)0);
 mgr->head_free = memnode_alloc((unsigned char *)ptr + sizeof(mem_mgr_t), mgr->free_size);
 mgr->head_free->type = 1;
 queue_init(&mgr->head_free->free_queue);
 g_mgr = mgr;
 return (mgr->head_free)?mgr:((void *)0);
}

canonical_original_code:
struct mem_mgr_s *mem_init(void *ptr, int size)
{
 struct mem_mgr_s *mgr = ((void *)0);
 if( ptr == ((void *)0) || (size <= (sizeof(mem_mgr_t) + 512)) )
  return ((void *)0);
 mgr = (struct mem_mgr_s *)ptr;
 mgr->total_size = ((size+3) & (~0x3));
 mgr->free_size = ((size+3) & (~0x3)) - sizeof(mem_mgr_t) - 1 * sizeof(mem_node_t);
 mgr->alocate_size = 0;
 mgr->head_dirty = ((void *)0);
 mgr->head_free = ((void *)0);
 mgr->head_free = memnode_alloc((unsigned char *)ptr + sizeof(mem_mgr_t), mgr->free_size);
 mgr->head_free->type = 1;
 queue_init(&mgr->head_free->free_queue);
 g_mgr = mgr;
 return (mgr->head_free)?mgr:((void *)0);
}

return_type: struct mem_mgr_s { int total_size; int free_size; int alocate_size; struct mem_node_s { union { struct queue_s { struct queue_s *prev; struct queue_s *next; } dirty_queue; struct queue_s free_queue; }; unsigned int seal; int size; int type; char *file_name; char *func_name; int line_num; void *data; } *head_dirty; } *


decompiled_code:
__int64 __fastcall mem_deinit(__int64 a1)
{
__int64 v1; // r12
__int64 v2; // rbp
__int64 v3; // rbx
__int64 result; // rax

v1 = a1;
if ( !a1 )
{
v1 = g_mgr;
if ( !g_mgr )
return 0xFFFFFFFFLL;
}
g_mgr = 0LL;
v2 = *(_QWORD *)(v1 + 16);
if ( v2 )
{
v3 = *(_QWORD *)(v1 + 16);
do
{
printf(
"MEM_LEAK AT:[%s][%s][%d] size=%d (0x%x) ptr=%p\n",
*(const char **)(v3 + 32),
*(const char **)(v3 + 40),
*(unsigned int *)(v3 + 48),
*(unsigned int *)(v3 + 20),
*(unsigned int *)(v3 + 20),
*(const void **)(v3 + 56));
v3 = *(_QWORD *)(v3 + 8);
}
while ( v2 != v3 );
}
result = 0LL;
*(_OWORD *)v1 = 0LL;
*(_OWORD *)(v1 + 16) = 0LL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
__int64 v1; // r12
__int64 v2; // rbp
__int64 v3; // rbx
__int64 result; // rax

v1 = a1;
if ( !a1 )
{
v1 = g_mgr;
if ( !g_mgr )
return 0xFFFFFFFFLL;
}
g_mgr = 0LL;
v2 = *(_QWORD *)(v1 + 16);
if ( v2 )
{
v3 = *(_QWORD *)(v1 + 16);
do
{
printf(
"MEM_LEAK AT:[%s][%s][%d] size=%d (0x%x) ptr=%p\n",
*(const char **)(v3 + 32),
*(const char **)(v3 + 40),
*(unsigned int *)(v3 + 48),
*(unsigned int *)(v3 + 20),
*(unsigned int *)(v3 + 20),
*(const void **)(v3 + 56));
v3 = *(_QWORD *)(v3 + 8);
}
while ( v2 != v3 );
}
result = 0LL;
*(_OWORD *)v1 = 0LL;
*(_OWORD *)(v1 + 16) = 0LL;
return result;
}

original_code:
int mem_deinit(mem_mgr_t *mgr)
{
 if( mgr == ((void *)0) )
  mgr = g_mgr;
 if( mgr == ((void *)0) )
  return -1;
 g_mgr = ((void *)0);
 if( mgr->head_dirty != ((void *)0) )
 {
  queue_t *head, *q;
  mem_node_t *tmp;
  head = &mgr->head_dirty->dirty_queue;
  q = head;
  do{
   tmp = (mem_node_t*)q;
   printf("MEM_LEAK AT:[%s][%s][%d] size=%d (0x%x) ptr=%p\n",
     tmp->file_name, tmp->func_name, tmp->line_num,
     tmp->size, tmp->size, tmp->data );
   q = q->next;
  }while( q != head );
 }
 memset(mgr, 0, sizeof(mem_mgr_t));
 return 0;
}

canonical_original_code:
int mem_deinit(struct mem_mgr_s *mgr)
{
 if( mgr == ((void *)0) )
  mgr = g_mgr;
 if( mgr == ((void *)0) )
  return -1;
 g_mgr = ((void *)0);
 if( mgr->head_dirty != ((void *)0) )
 {
  struct queue_s *head; struct queue_s *q;
  struct mem_node_s *tmp;
  head = &mgr->head_dirty->dirty_queue;
  q = head;
  do{
   tmp = (struct mem_node_s *)q;
   printf("MEM_LEAK AT:[%s][%s][%d] size=%d (0x%x) ptr=%p\n",
     tmp->file_name, tmp->func_name, tmp->line_num,
     tmp->size, tmp->size, tmp->data );
   q = q->next;
  }while( q != head );
 }
 memset(mgr, 0, sizeof(mem_mgr_t));
 return 0;
}

variable_types: struct queue_s { struct queue_s *prev; struct queue_s *next; } *


original_code:
void *mem_malloc(const char *file_name, const char *func_name, const int line_num, mem_mgr_t *mgr, int size)
{
 queue_t *q, *head;
 mem_node_t *mnode, *newnode;
 unsigned char *ptr;
 if( mgr == ((void *)0) )
  mgr = g_mgr;
 if( (size <= 0) || (mgr == ((void *)0)) )
  return ((void *)0);
 if ( mgr->free_size < size )
  return ((void *)0);
 size = ((size+3) & (~0x3));
 if( mgr->head_free )
  head = &mgr->head_free->free_queue;
 else
  return ((void *)0);
 q = head;
 while( q->next != head )
 {
  if( ((mem_node_t*)q)->size < size + sizeof(mem_node_t) )
   q = q->next;
  else
   break;
 }
 {
  mnode = (mem_node_t*)q;
  if( mnode->size < size + sizeof(mem_node_t))
  {
   return ((void *)0);
  }
 }
 ptr = (unsigned char*)mnode->data + mnode->size - size - sizeof(mem_node_t);
 newnode = memnode_alloc(ptr, size);
 newnode->type = 2;
 newnode->seal = 0x55AAAA55;
 newnode->file_name = file_name;
 newnode->func_name = func_name;
 newnode->line_num = line_num;
 mnode->size -= (size + sizeof(mem_node_t));
 if( mnode->size <= 0 )
 {
  if( mnode == mgr->head_free )
  {
   mgr->head_free = ((void *)0);
  }else{
   queue_out((queue_t*)mnode);
   memnode_free(mnode);
  }
 }
 if( mgr->head_dirty == ((void *)0) )
 {
  mgr->head_dirty = newnode;
  queue_init(&newnode->dirty_queue);
 }else
  queue_in(&mgr->head_dirty->dirty_queue, &newnode->dirty_queue);
 mgr->alocate_size += size;
 mgr->free_size -= (size+sizeof(mem_node_t));
 return newnode->data;
}

canonical_original_code:
void *mem_malloc(char *file_name, char *func_name, int line_num, struct mem_mgr_s *mgr, int size)
{
 struct queue_s *q; struct queue_s *head;
 struct mem_node_s *mnode; struct mem_node_s *newnode;
 unsigned char *ptr;
 if( mgr == ((void *)0) )
  mgr = g_mgr;
 if( (size <= 0) || (mgr == ((void *)0)) )
  return ((void *)0);
 if ( mgr->free_size < size )
  return ((void *)0);
 size = ((size+3) & (~0x3));
 if( mgr->head_free )
  head = &mgr->head_free->free_queue;
 else
  return ((void *)0);
 q = head;
 while( q->next != head )
 {
  if( ((struct mem_node_s *)q)->size < size + sizeof(mem_node_t) )
   q = q->next;
  else
   break;
 }
 {
  mnode = (struct mem_node_s *)q;
  if( mnode->size < size + sizeof(mem_node_t))
  {
   return ((void *)0);
  }
 }
 ptr = (unsigned char *)mnode->data + mnode->size - size - sizeof(mem_node_t);
 newnode = memnode_alloc(ptr, size);
 newnode->type = 2;
 newnode->seal = 0x55AAAA55;
 newnode->file_name = file_name;
 newnode->func_name = func_name;
 newnode->line_num = line_num;
 mnode->size -= (size + sizeof(mem_node_t));
 if( mnode->size <= 0 )
 {
  if( mnode == mgr->head_free )
  {
   mgr->head_free = ((void *)0);
  }else{
   queue_out((struct queue_s *)mnode);
   memnode_free(mnode);
  }
 }
 if( mgr->head_dirty == ((void *)0) )
 {
  mgr->head_dirty = newnode;
  queue_init(&newnode->dirty_queue);
 }else
  queue_in(&mgr->head_dirty->dirty_queue, &newnode->dirty_queue);
 mgr->alocate_size += size;
 mgr->free_size -= (size+sizeof(mem_node_t));
 return newnode->data;
}

variable_types:
ptr
unsigned char *

return_type: void *

user_defined_types: struct queue_s { struct queue_s *prev; struct queue_s *next; }


original_code:
void mem_print(mem_mgr_t *mgr)
{
 queue_t *q, *head;
 mem_node_t *tmp;
 if( mgr == ((void *)0) )
  return;
 printf("\n******************************************\n");
 printf("**************** mgr info ****************\n");
 printf("*\ttotal size = %d ( 0x%x )\n*\t"
   "free size = %d ( 0x%x )\n*\t"
   "alocate size = %d ( 0x%x )\n*\t"
   "ptr = %p\n",
   mgr->total_size, mgr->total_size,
   mgr->free_size, mgr->free_size,
   mgr->alocate_size, mgr->alocate_size,
   mgr);
 printf("**************** allocate ****************\n");
 {
  if( mgr->head_dirty != ((void *)0) )
  {
   head = &mgr->head_dirty->dirty_queue;
   q = head;
   do{
    tmp = (mem_node_t*)q;
    printf("*[%s][%s][%d] size=%d (0x%x) ptr=%p  start=%p end=%p\n",
      tmp->file_name, tmp->func_name, tmp->line_num, tmp->size,
      tmp->size, tmp->data ,
      tmp, (unsigned char *)tmp->data + tmp->size);
    q = q->next;
   }while( q != head );
  }else
  {
   printf("*\tNone\n");
  }
 }
 printf("****************   free   ****************\n");
 {
  if ( mgr->head_free != ((void *)0) )
  {
   head = &mgr->head_free->dirty_queue;
   q = head;
   do{
    tmp = (mem_node_t*)q;
    printf("*\tsize=%d (0x%x) ptr=%p start=%p end=%p\n",
      tmp->size, tmp->size, tmp->data,
      tmp, (unsigned char *)tmp->data + tmp->size);
    q = q->next;
   }while( q != head );
  }else{
   printf("*\tNone\n");
  }
 }
 printf("******************************************\n\n");
}

canonical_original_code:
void mem_print(struct mem_mgr_s *mgr)
{
 struct queue_s *q; struct queue_s *head;
 struct mem_node_s *tmp;
 if( mgr == ((void *)0) )
  return;
 printf("\n******************************************\n");
 printf("**************** mgr info ****************\n");
 printf("*\ttotal size = %d ( 0x%x )\n*\t"
   "free size = %d ( 0x%x )\n*\t"
   "alocate size = %d ( 0x%x )\n*\t"
   "ptr = %p\n",
   mgr->total_size, mgr->total_size,
   mgr->free_size, mgr->free_size,
   mgr->alocate_size, mgr->alocate_size,
   mgr);
 printf("**************** allocate ****************\n");
 {
  if( mgr->head_dirty != ((void *)0) )
  {
   head = &mgr->head_dirty->dirty_queue;
   q = head;
   do{
    tmp = (struct mem_node_s *)q;
    printf("*[%s][%s][%d] size=%d (0x%x) ptr=%p  start=%p end=%p\n",
      tmp->file_name, tmp->func_name, tmp->line_num, tmp->size,
      tmp->size, tmp->data ,
      tmp, (unsigned char *)tmp->data + tmp->size);
    q = q->next;
   }while( q != head );
  }else
  {
   printf("*\tNone\n");
  }
 }
 printf("****************   free   ****************\n");
 {
  if ( mgr->head_free != ((void *)0) )
  {
   head = &mgr->head_free->dirty_queue;
   q = head;
   do{
    tmp = (struct mem_node_s *)q;
    printf("*\tsize=%d (0x%x) ptr=%p start=%p end=%p\n",
      tmp->size, tmp->size, tmp->data,
      tmp, (unsigned char *)tmp->data + tmp->size);
    q = q->next;
   }while( q != head );
  }else{
   printf("*\tNone\n");
  }
 }
 printf("******************************************\n\n");
}


original_code:
void mem_dump(mem_mgr_t *mgr)
{
 int i = 0;
 char buf1[50], buf2[32], *ptr1, *ptr2;
 unsigned char *ptr;
 if( mgr == ((void *)0) )
  return ;
 printf("\n==================mem dump===================\n");
 printf("\ntotal_size = %d ( 0x%x) ptr = %p \n", mgr->total_size, mgr->total_size, mgr);
 ptr = (unsigned char *)mgr;
 ptr1 = buf1, ptr2 = buf2;
 memset(buf1, 0x20, sizeof(buf1));
 for(; i < mgr->total_size; i++)
 {
  ptr1 += sprintf(ptr1, "%02x ", *ptr);
  ptr2 += sprintf(ptr2, "%c", ((*ptr)>0x20 && (*ptr)<0x7F)?*ptr:'.');
  if( ((i+1) % 16) == 0 )
  {
   *ptr1 = 0, *ptr2 = 0;
   printf("%s| %s\n", buf1, buf2);
   ptr1 = buf1, ptr2 = buf2;
  }
  ptr++;
 }
 if( (ptr1 != buf1) || (ptr2 != buf2) )
 {
  while( ptr1 != buf1+sizeof(buf1) - 1)
   *ptr1 = ' ';
  *ptr1 = 0;
  printf("%s| %s\n", buf1, buf2);
 }
 printf("\n==================  over  ===================\n");
}

canonical_original_code:
void mem_dump(struct mem_mgr_s *mgr)
{
 int i = 0;
 char buf1[50]; char buf2[32]; char *ptr1; char *ptr2;
 unsigned char *ptr;
 if( mgr == ((void *)0) )
  return ;
 printf("\n==================mem dump===================\n");
 printf("\ntotal_size = %d ( 0x%x) ptr = %p \n", mgr->total_size, mgr->total_size, mgr);
 ptr = (unsigned char *)mgr;
 ptr1 = buf1, ptr2 = buf2;
 memset(buf1, 0x20, sizeof(buf1));
 for(; i < mgr->total_size; i++)
 {
  ptr1 += sprintf(ptr1, "%02x ", *ptr);
  ptr2 += sprintf(ptr2, "%c", ((*ptr)>0x20 && (*ptr)<0x7F)?*ptr:'.');
  if( ((i+1) % 16) == 0 )
  {
   *ptr1 = 0, *ptr2 = 0;
   printf("%s| %s\n", buf1, buf2);
   ptr1 = buf1, ptr2 = buf2;
  }
  ptr++;
 }
 if( (ptr1 != buf1) || (ptr2 != buf2) )
 {
  while( ptr1 != buf1+sizeof(buf1) - 1)
   *ptr1 = ' ';
  *ptr1 = 0;
  printf("%s| %s\n", buf1, buf2);
 }
 printf("\n==================  over  ===================\n");
}

variable_types: i int


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
void *v3; // rbp
__int64 v4; // rdx
unsigned int v5; // ebx
__int64 v6; // rax
__m128i v7; // xmm0
__int64 v8; // rdi
__m128i v9; // xmm0
__int64 v10; // rax
__m128i v11; // xmm0

v3 = malloc(0x1000uLL);
mgr = mem_init(v3, " free: num=%d\n", v4);
mem_print(mgr);
puts("test malloc:");
v5 = test_malloc_constprop_0();
printf("memory out at %d times. first size=%d end size=%d\n", v5, 50LL, 10 * v5 + 50);
mem_print(mgr);
v6 = qword_C8;
v7 = _mm_load_si128((const __m128i *)&LC4);
v8 = mgr;
*(_QWORD *)(qword_C8 + 16) = 0x632E333631403033LL;
strcpy((char *)(v6 + 24), "om");
*(__m128i *)v6 = v7;
v9 = _mm_load_si128((const __m128i *)&LC5);
v10 = qword_D8;
*(_WORD *)(qword_D8 + 36) = 48;
*(__m128i *)v10 = v9;
v11 = _mm_load_si128((const __m128i *)&LC6);
*(_DWORD *)(v10 + 32) = 1630482741;
*(__m128i *)(v10 + 16) = v11;
mem_print(v8);
mem_free("test.c", "main", 91LL, mgr, qword_C8);
mem_print(mgr);
getchar();
mem_free("test.c", "main", 95LL, mgr, qword_D8);
mem_print(mgr);
getchar();
printf("test free: num=%d\n", v5);
test_free_isra_0(v5 + 2);
mem_print(mgr);
mem_deinit(mgr);
free(v3);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
void *v3; // rbp
__int64 v4; // rdx
unsigned int v5; // ebx
__int64 v6; // rax
__m128i v7; // xmm0
__int64 v8; // rdi
__m128i v9; // xmm0
__int64 v10; // rax
__m128i v11; // xmm0

v3 = malloc(0x1000uLL);
mgr = mem_init(v3, " free: num=%d\n", v4);
mem_print(mgr);
puts("test malloc:");
v5 = func0();
printf("memory out at %d times. first size=%d end size=%d\n", v5, 50LL, 10 * v5 + 50);
mem_print(mgr);
v6 = qword_C8;
v7 = _mm_load_si128((const __m128i *)&LC4);
v8 = mgr;
*(_QWORD *)(qword_C8 + 16) = 0x632E333631403033LL;
strcpy((char *)(v6 + 24), "om");
*(__m128i *)v6 = v7;
v9 = _mm_load_si128((const __m128i *)&LC5);
v10 = qword_D8;
*(_WORD *)(qword_D8 + 36) = 48;
*(__m128i *)v10 = v9;
v11 = _mm_load_si128((const __m128i *)&LC6);
*(_DWORD *)(v10 + 32) = 1630482741;
*(__m128i *)(v10 + 16) = v11;
mem_print(v8);
mem_free("test.c", "main", 91LL, mgr, qword_C8);
mem_print(mgr);
getchar();
mem_free("test.c", "main", 95LL, mgr, qword_D8);
mem_print(mgr);
getchar();
printf("test free: num=%d\n", v5);
func1(v5 + 2);
mem_print(mgr);
mem_deinit(mgr);
free(v3);
return 0;
}

original_code:
int main(void)
{
 int num = 0;
 char *_ptr;
 _ptr = malloc(4096);
 mgr = mem_init(_ptr, 1024);
 mem_print(mgr);
 {
  printf("test malloc:\n");
  num = test_malloc(50);
  printf("memory out at %d times. first size=%d end size=%d\n", num, 50, 50+num*10);
  mem_print(mgr);
  strcpy(ptr[1], "changqingZhao.1230@163.com");
  strcpy(ptr[3], "tain@linuxmint: /opt/broadcom/7851/a0");
  mem_print(mgr);
 }
 mem_free("test.c", __FUNCTION__, 91, mgr, ptr[1]);
 mem_print(mgr);
 getchar();
 mem_free("test.c", __FUNCTION__, 95, mgr, ptr[3]);
 mem_print(mgr);
 getchar();
 {
  printf("test free: num=%d\n", num);
  test_free(num + 2);
  mem_print(mgr);
 }
 mem_deinit(mgr);
 free(_ptr);
 return 0;
}

canonical_original_code:
int main()
{
 int num = 0;
 char *_ptr;
 _ptr = malloc(4096);
 mgr = mem_init(_ptr, 1024);
 mem_print(mgr);
 {
  printf("test malloc:\n");
  num = test_malloc(50);
  printf("memory out at %d times. first size=%d end size=%d\n", num, 50, 50+num*10);
  mem_print(mgr);
  strcpy(ptr[1], "changqingZhao.1230@163.com");
  strcpy(ptr[3], "tain@linuxmint: /opt/broadcom/7851/a0");
  mem_print(mgr);
 }
 mem_free("test.c", __FUNCTION__, 91, mgr, ptr[1]);
 mem_print(mgr);
 getchar();
 mem_free("test.c", __FUNCTION__, 95, mgr, ptr[3]);
 mem_print(mgr);
 getchar();
 {
  printf("test free: num=%d\n", num);
  test_free(num + 2);
  mem_print(mgr);
 }
 mem_deinit(mgr);
 free(_ptr);
 return 0;
}

variable_types: num int


repo: pastjean/chinookpack

decompiled_code:
__int64 __fastcall callback_nil(_DWORD *a1)
{
*a1 = 0;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(_DWORD *a1)
{
*a1 = 0;
return 0LL;
}

original_code:
static inline int callback_nil(chinookpack_object* o, const char* buf, size_t* off)
{
  o->type = CHINOOKPACK_OBJECT_NIL; return 0;
}

canonical_original_code:
static inline int callback_nil(struct chinookpack_object *o, char *buf, unsigned long *off)
{
  o->type = CHINOOKPACK_OBJECT_NIL; return 0;
}

variable_types: struct chinookpack_object { enum chinookpack_object_type { CHINOOKPACK_OBJECT_NIL=0, CHINOOKPACK_OBJECT_BOOLEAN=1, CHINOOKPACK_OBJECT_UINT8=2, CHINOOKPACK_OBJECT_UINT16=3, CHINOOKPACK_OBJECT_INT8=4, CHINOOKPACK_OBJECT_INT16=5, CHINOOKPACK_OBJECT_FLOAT=6, CHINOOKPACK_OBJECT_RAW=7 } type; union chinookpack_object_union { _Bool boolean; unsigned long u64; long i64; double dec; struct chinookpack_object_raw { unsigned int size; char *ptr; } raw; } via; } *

variable_types:
buf
char *

variable_types:
off
unsigned long *

user_defined_types: struct chinookpack_object { enum chinookpack_object_type type; union chinookpack_object_union via; }

user_defined_types: union chinookpack_object_union { _Bool boolean; unsigned long u64; long i64; double dec; struct chinookpack_object_raw raw; }


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

*(_DWORD *)a1 = 1;
result = 0LL;
*(_BYTE *)(a1 + 8) = 1;
return result;
}

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

*(_DWORD *)a1 = 1;
result = 0LL;
*(_BYTE *)(a1 + 8) = 1;
return result;
}

original_code:
static inline int callback_true(chinookpack_object* o, const char* buf, size_t* off)
{
  o->type = CHINOOKPACK_OBJECT_BOOLEAN; o->via.boolean = 1; return 0;
}

canonical_original_code:
static inline int callback_true(struct chinookpack_object *o, char *buf, unsigned long *off)
{
  o->type = CHINOOKPACK_OBJECT_BOOLEAN; o->via.boolean = 1; return 0;
}

user_defined_types: enum chinookpack_object_type { CHINOOKPACK_OBJECT_NIL=0, CHINOOKPACK_OBJECT_BOOLEAN=1, CHINOOKPACK_OBJECT_UINT8=2, CHINOOKPACK_OBJECT_UINT16=3, CHINOOKPACK_OBJECT_INT8=4, CHINOOKPACK_OBJECT_INT16=5, CHINOOKPACK_OBJECT_FLOAT=6, CHINOOKPACK_OBJECT_RAW=7 }

user_defined_types: struct chinookpack_object_raw { unsigned int size; char *ptr; }


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

*(_DWORD *)a1 = 1;
result = 0LL;
*(_BYTE *)(a1 + 8) = 0;
return result;
}

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

*(_DWORD *)a1 = 1;
result = 0LL;
*(_BYTE *)(a1 + 8) = 0;
return result;
}

original_code:
static inline int callback_false(chinookpack_object* o, const char* buf, size_t* off)
{
  o->type = CHINOOKPACK_OBJECT_BOOLEAN; o->via.boolean = 0; return 0;
}

canonical_original_code:
static inline int callback_false(struct chinookpack_object *o, char *buf, unsigned long *off)
{
  o->type = CHINOOKPACK_OBJECT_BOOLEAN; o->via.boolean = 0; return 0;
}


decompiled_code:
__int64 __fastcall callback_uint8(__int64 a1, __int64 a2, __int64 *a3)
{
__int64 v3; // rax
__int64 result; // rax

*(_QWORD *)(a1 + 8) = 0LL;
v3 = *a3;
*(_DWORD *)a1 = 2;
*(_QWORD *)(a1 + 8) = *(unsigned __int8 *)(a2 + v3);
result = 0LL;
++*a3;
return result;
}

original_code:
static inline int callback_uint8(chinookpack_object* o, const char* buf, size_t* off)
{
  o->type = CHINOOKPACK_OBJECT_UINT8;
  o->via.u64 = 0;
  o->via.u64 = buf[*off] & 0xff;
  (*off) +=1;
  return 0;
}

canonical_original_code:
static inline int callback_uint8(struct chinookpack_object *o, char *buf, unsigned long *off)
{
  o->type = CHINOOKPACK_OBJECT_UINT8;
  o->via.u64 = 0;
  o->via.u64 = buf[*off] & 0xff;
  (*off) +=1;
  return 0;
}


original_code:
static inline int callback_uint16(chinookpack_object* o, const char* buf, size_t* off)
{
  o->type = CHINOOKPACK_OBJECT_UINT16;
  o->via.u64 = 0;
  o->via.u64 = (buf[*off]<<8) & 0xff00;
  o->via.u64 = (buf[*off+1]) & 0xff;
  (*off) +=2;
  return 0;
}

canonical_original_code:
static inline int callback_uint16(struct chinookpack_object *o, char *buf, unsigned long *off)
{
  o->type = CHINOOKPACK_OBJECT_UINT16;
  o->via.u64 = 0;
  o->via.u64 = (buf[*off]<<8) & 0xff00;
  o->via.u64 = (buf[*off+1]) & 0xff;
  (*off) +=2;
  return 0;
}


decompiled_code:
__int64 __fastcall callback_int8(__int64 a1, __int64 a2, __int64 *a3)
{
__int64 v3; // rax
__int64 result; // rax

*(_QWORD *)(a1 + 8) = 0LL;
v3 = *a3;
*(_DWORD *)a1 = 4;
*(_QWORD *)(a1 + 8) = *(unsigned __int8 *)(a2 + v3);
result = 0LL;
++*a3;
return result;
}

original_code:
static inline int callback_int8(chinookpack_object* o, const char* buf, size_t* off)
{
  o->type = CHINOOKPACK_OBJECT_INT8;
  o->via.i64 = 0;
  o->via.i64 = buf[*off] & 0xff;
  (*off) +=1;
  return 0;
}

canonical_original_code:
static inline int callback_int8(struct chinookpack_object *o, char *buf, unsigned long *off)
{
  o->type = CHINOOKPACK_OBJECT_INT8;
  o->via.i64 = 0;
  o->via.i64 = buf[*off] & 0xff;
  (*off) +=1;
  return 0;
}


original_code:
static inline int callback_int16(chinookpack_object* o, const char* buf, size_t* off)
{
  o->type = CHINOOKPACK_OBJECT_INT16;
  o->via.i64 = 0;
  o->via.i64 = (buf[*off]<<8) & 0xff00;
  o->via.i64 = (buf[*off+1*sizeof(char)]) & 0xff;
  (*off) +=2;
  return 0;
}

canonical_original_code:
static inline int callback_int16(struct chinookpack_object *o, char *buf, unsigned long *off)
{
  o->type = CHINOOKPACK_OBJECT_INT16;
  o->via.i64 = 0;
  o->via.i64 = (buf[*off]<<8) & 0xff00;
  o->via.i64 = (buf[*off+1*sizeof(char)]) & 0xff;
  (*off) +=2;
  return 0;
}


decompiled_code:
__int64 __fastcall chinookpack_unpack_next(__int64 a1, __int64 a2, unsigned __int64 a3, __int64 *a4)
{
unsigned int v4; // er8
__int64 v6; // rax
int v7; // edx
__int64 v8; // rax
__int64 v10[2]; // [rsp+0h] [rbp-10h] BYREF

if ( !a4 )
return 0LL;
v4 = 0;
v6 = *a4;
if ( *a4 < a3 )
{
v7 = *(unsigned __int8 *)(a2 + v6);
v8 = v6 + 1;
v10[0] = v8;
if ( (v7 & 0xA0) != 160 )
{
switch ( v7 )
{
case 192:
((void (__fastcall *)(__int64, __int64, __int64 *))callback_nil)(a1, a2, v10);
goto LABEL_6;
case 194:
((void (__fastcall *)(__int64, __int64, __int64 *))callback_false)(a1, a2, v10);
goto LABEL_6;
case 195:
((void (__fastcall *)(__int64, __int64, __int64 *))callback_true)(a1, a2, v10);
goto LABEL_6;
case 202:
callback_float(a1, a2, v10);
goto LABEL_6;
case 204:
callback_uint8(a1, a2, v10);
goto LABEL_6;
case 205:
callback_uint16(a1, a2, v10);
goto LABEL_6;
case 208:
callback_int8(a1, a2, v10);
goto LABEL_6;
case 209:
callback_int16(a1, a2, v10);
LABEL_6:
v8 = v10[0];
break;
default:
return 0LL;
}
}
*a4 = v8;
v4 = 1;
}
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2, unsigned __int64 a3, __int64 *a4)
{
unsigned int v4; // er8
__int64 v6; // rax
int v7; // edx
__int64 v8; // rax
__int64 v10[2]; // [rsp+0h] [rbp-10h] BYREF

if ( !a4 )
return 0LL;
v4 = 0;
v6 = *a4;
if ( *a4 < a3 )
{
v7 = *(unsigned __int8 *)(a2 + v6);
v8 = v6 + 1;
v10[0] = v8;
if ( (v7 & 0xA0) != 160 )
{
switch ( v7 )
{
case 192:
((void (__fastcall *)(__int64, __int64, __int64 *))callback_nil)(a1, a2, v10);
goto LABEL_6;
case 194:
((void (__fastcall *)(__int64, __int64, __int64 *))callback_false)(a1, a2, v10);
goto LABEL_6;
case 195:
((void (__fastcall *)(__int64, __int64, __int64 *))callback_true)(a1, a2, v10);
goto LABEL_6;
case 202:
func7(a1, a2, v10);
goto LABEL_6;
case 204:
func3(a1, a2, v10);
goto LABEL_6;
case 205:
func4(a1, a2, v10);
goto LABEL_6;
case 208:
func5(a1, a2, v10);
goto LABEL_6;
case 209:
func6(a1, a2, v10);
LABEL_6:
v8 = v10[0];
break;
default:
return 0LL;
}
}
*a4 = v8;
v4 = 1;
}
return v4;
}

original_code:
_Bool chinookpack_unpack_next(chinookpack_unpacked* result,
  const char* buf, size_t len, size_t* off){
 size_t noff = 0;
 if(off != ((void *)0)) { noff = *off; }
  else { return 0;}
 if(len <= noff) {
  return 0;
 }
  char header = 0;
  header = buf[noff];
  noff+=1;
  if( (0xa0 & header) == 0xa0){
    goto ENDOF_CHINOOK_PACK_UNPACK_NEXT;
  }
  callback_interface callback_pointer = ((void *)0);
  switch( (header & 0xff) ){
    case 0xc0:
      callback_pointer = callback_nil;
      break;
    case 0xc3:
      callback_pointer = callback_true;
      break;
    case 0xc2:
      callback_pointer = callback_false;
      break;
    case 0xcc:
      callback_pointer = callback_uint8;
      break;
    case 0xcd:
      callback_pointer = callback_uint16;
      break;
    case 0xd0:
      callback_pointer = callback_int8;
      break;
    case 0xd1:
      callback_pointer = callback_int16;
      break;
    case 0xca:
      callback_pointer = callback_float;
      break;
    default:
      return 0;
  }
  if(callback_pointer != ((void *)0)){
    callback_pointer(&(result->data),buf,&noff);
  }
ENDOF_CHINOOK_PACK_UNPACK_NEXT:
 if(off != ((void *)0)) { *off = noff; }
  return 1;
}

canonical_original_code:
_Bool chinookpack_unpack_next(struct chinookpackpack_unpacked *result, char *buf, unsigned long len, unsigned long *off){
 unsigned long noff = 0;
 if(off != ((void *)0)) { noff = *off; }
  else { return 0;}
 if(len <= noff) {
  return 0;
 }
  char header = 0;
  header = buf[noff];
  noff+=1;
  if( (0xa0 & header) == 0xa0){
    goto ENDOF_CHINOOK_PACK_UNPACK_NEXT;
  }
  int (*callback_pointer)(struct chinookpack_object *, char *, unsigned long *) = ((void *)0);
  switch( (header & 0xff) ){
    case 0xc0:
      callback_pointer = callback_nil;
      break;
    case 0xc3:
      callback_pointer = callback_true;
      break;
    case 0xc2:
      callback_pointer = callback_false;
      break;
    case 0xcc:
      callback_pointer = callback_uint8;
      break;
    case 0xcd:
      callback_pointer = callback_uint16;
      break;
    case 0xd0:
      callback_pointer = callback_int8;
      break;
    case 0xd1:
      callback_pointer = callback_int16;
      break;
    case 0xca:
      callback_pointer = callback_float;
      break;
    default:
      return 0;
  }
  if(callback_pointer != ((void *)0)){
    callback_pointer(&(result->data),buf,&noff);
  }
ENDOF_CHINOOK_PACK_UNPACK_NEXT:
 if(off != ((void *)0)) { *off = noff; }
  return 1;
}

variable_types: struct chinookpackpack_unpacked { struct chinookpack_object { enum chinookpack_object_type { CHINOOKPACK_OBJECT_NIL=0, CHINOOKPACK_OBJECT_BOOLEAN=1, CHINOOKPACK_OBJECT_UINT8=2, CHINOOKPACK_OBJECT_UINT16=3, CHINOOKPACK_OBJECT_INT8=4, CHINOOKPACK_OBJECT_INT16=5, CHINOOKPACK_OBJECT_FLOAT=6, CHINOOKPACK_OBJECT_RAW=7 } type; union chinookpack_object_union { _Bool boolean; unsigned long u64; long i64; double dec; struct chinookpack_object_raw { unsigned int size; char *ptr; } raw; } via; } data; } *

variable_types:
len
unsigned long

variable_types:
noff
unsigned long

variable_types: header char

variable_types: int (*)(struct chinookpack_object { enum chinookpack_object_type { CHINOOKPACK_OBJECT_NIL=0, CHINOOKPACK_OBJECT_BOOLEAN=1, CHINOOKPACK_OBJECT_UINT8=2, CHINOOKPACK_OBJECT_UINT16=3, CHINOOKPACK_OBJECT_INT8=4, CHINOOKPACK_OBJECT_INT16=5, CHINOOKPACK_OBJECT_FLOAT=6, CHINOOKPACK_OBJECT_RAW=7 } type; union chinookpack_object_union { _Bool boolean; unsigned long u64; long i64; double dec; struct chinookpack_object_raw { unsigned int size; char *ptr; } raw; } via; } *, char *, unsigned long *)

user_defined_types: struct chinookpackpack_unpacked { struct chinookpack_object data; }


decompiled_code:
_QWORD *tt_suite_new()
{
_QWORD *result; // rax

result = malloc(0x10uLL);
*result = 0LL;
result[1] = 0LL;
return result;
}

canonical_decompiled_code:
_QWORD *func0()
{
_QWORD *result; // rax

result = malloc(0x10uLL);
*result = 0LL;
result[1] = 0LL;
return result;
}

original_code:
tt_suite* tt_suite_new(){
  tt_suite* suite = malloc(sizeof(tt_suite));
  suite->head = ((void *)0);
  suite->tail = ((void *)0);
  return suite;
}

canonical_original_code:
struct tt_Suite *tt_suite_new(){
  struct tt_Suite *suite = malloc(sizeof(tt_suite));
  suite->head = ((void *)0);
  suite->tail = ((void *)0);
  return suite;
}

variable_types: struct tt_Suite { struct tt_Test { char *name; void (*test)(); struct tt_Test *next; } *head; struct tt_Test *tail; } *

user_defined_types: struct tt_Suite { struct tt_Test *head; struct tt_Test *tail; }


original_code:
int tt_run(tt_suite* suite,int argc, char** argv){
  int total = 0,
      passed = 0,
      failed = 0;
  for(tt_test* t = suite->head; t != ((void *)0); t = t->next){
    total++;
    test_failed = 0;
    printf("Running: %s ", t->name);
    t->test();
    if(test_failed){
      failed++;
      printf("%sx%s\n","\033[031m","\033[0m");
    }else{
      passed++;
      printf("%so%s\n","\033[032m","\033[0m");
    }
  }
  char* cpassed = passed > 0 ? "\033[032m" : "\033[0m";
  char* cfailed = failed > 0 ? "\033[031m" : "\033[0m";
  printf("Test run \n" "total: %i, %spassed: %i, %sfailed: %i %s\n",total,cpassed,passed,cfailed,failed,"\033[0m");
  return failed != 0;
}

canonical_original_code:
int tt_run(struct tt_Suite *suite, int argc, char **argv){
  int total = 0; int passed = 0; int failed = 0;
  for(struct tt_Test *t = suite->head; t != ((void *)0); t = t->next){
    total++;
    test_failed = 0;
    printf("Running: %s ", t->name);
    t->test();
    if(test_failed){
      failed++;
      printf("%sx%s\n","\033[031m","\033[0m");
    }else{
      passed++;
      printf("%so%s\n","\033[032m","\033[0m");
    }
  }
  char *cpassed = passed > 0 ? "\033[032m" : "\033[0m";
  char *cfailed = failed > 0 ? "\033[031m" : "\033[0m";
  printf("Test run \n" "total: %i, %spassed: %i, %sfailed: %i %s\n",total,cpassed,passed,cfailed,failed,"\033[0m");
  return failed != 0;
}

variable_types: argc int

variable_types:
argv
char **

variable_types: total int

variable_types: passed int

variable_types: failed int

variable_types: struct tt_Test { char *name; void (*test)(); struct tt_Test *next; } *

variable_types:
cpassed
char *

variable_types:
cfailed
char *


repo: patchvonbraun/IRA

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

result = fl_get_button();
tracking = result;
return result;
}

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

result = fl_get_button();
tracking = result;
return result;
}

original_code:
void set_tracking( FL_OBJECT * ob,
         long data )
{
    tracking = fl_get_button (ob);
}

canonical_original_code:
void set_tracking(struct FL_OBJECT_ *ob, long data)
{
    tracking = fl_get_button (ob);
}

variable_types: struct FL_OBJECT_ { struct FL_FORM_ { void *fdui; void *u_vdata; char *u_cdata; long u_ldata; char *label; unsigned long window; int x; int handle_dec_x; int hotx; double w_hr; struct FL_OBJECT_ *first; struct FL_OBJECT_ *last; struct FL_OBJECT_ *focusobj; void (*form_callback)(struct FL_OBJECT_ *, void *); void (*activate_callback)(struct FL_FORM_ *, void *); void (*deactivate_callback)(struct FL_FORM_ *, void *); void *form_cb_data; void *activate_data; void *deactivate_data; int (*key_callback)(struct FL_FORM_ *, void *); int (*push_callback)(struct FL_FORM_ *, void *); int (*crossing_callback)(struct FL_FORM_ *, void *); int (*motion_callback)(struct FL_FORM_ *, void *); int (*all_callback)(struct FL_FORM_ *, void *); unsigned long compress_mask; unsigned long evmask; int (*close_callback)(struct FL_FORM_ *, void *); void *close_data; struct FL_pixmap_ { unsigned long pixmap; unsigned long win; struct Visual { struct _XExtData { int number; struct _XExtData *next; int (*free_private)(struct _XExtData *extension); char *private_data; } *ext_data; unsigned long visualid; int class; unsigned long red_mask; int bits_per_rgb; int map_entries; } *visual; int x; int depth; unsigned long dbl_background; unsigned long pixel; } *flpixmap; unsigned long icon_pixmap; unsigned long icon_mask; int deactivated; int use_pixmap; int frozen; int visible; int wm_border; unsigned int prop; int num_auto_objects; int needs_full_redraw; int sort_of_modal; struct FL_FORM_ *parent; struct FL_FORM_ *child; struct FL_OBJECT_ *parent_obj; int attached; void (*pre_attach)(struct FL_FORM_ *); void *attach_data; int in_redraw; } *form; void *u_vdata; char *u_cdata; long u_ldata; int objclass; int type; int boxtype; int x; double fl1; int bw; unsigned long col1; char *label; unsigned long lcol; int align; int lsize; long *shortcut; int (*handle)(struct FL_OBJECT_ *, int, int, int, int, void *); void (*object_callback)(struct FL_OBJECT_ *, long); long argument; void *spec; int (*prehandle)(struct FL_OBJECT_ *, int, int, int, int, void *); int (*posthandle)(struct FL_OBJECT_ *, int, int, int, int, void *); void (*set_return)(struct FL_OBJECT_ *, unsigned int); unsigned int resize; unsigned int nwgravity; unsigned int segravity; struct FL_OBJECT_ *prev; struct FL_OBJECT_ *next; struct FL_OBJECT_ *parent; struct FL_OBJECT_ *child; struct FL_OBJECT_ *nc; struct FL_pixmap_ *flpixmap; int use_pixmap; int returned; unsigned int how_return; int double_buffer; int pushed; int focus; int belowmouse; int active; int input; int wantkey; int radio; int automatic; int redraw; int visible; int is_under; int clip; unsigned long click_timeout; void *c_vdata; char *c_cdata; long c_ldata; unsigned long dbl_background; char *tooltip; int tipID; int group_id; int want_motion; int want_update; } *

variable_types: data long

user_defined_types: struct FL_OBJECT_ { struct FL_FORM_ *form; void *u_vdata; char *u_cdata; long u_ldata; int objclass; int type; int boxtype; int x; double fl1; int bw; unsigned long col1; char *label; unsigned long lcol; int align; int lsize; long *shortcut; int (*handle)(struct FL_OBJECT_ *, int, int, int, int, void *); void (*object_callback)(struct FL_OBJECT_ *, long); long argument; void *spec; int (*prehandle)(struct FL_OBJECT_ *, int, int, int, int, void *); int (*posthandle)(struct FL_OBJECT_ *, int, int, int, int, void *); void (*set_return)(struct FL_OBJECT_ *, unsigned int); unsigned int resize; unsigned int nwgravity; unsigned int segravity; struct FL_OBJECT_ *prev; struct FL_OBJECT_ *next; struct FL_OBJECT_ *parent; struct FL_OBJECT_ *child; struct FL_OBJECT_ *nc; struct FL_pixmap_ *flpixmap; int use_pixmap; int returned; unsigned int how_return; int double_buffer; int pushed; int focus; int belowmouse; int active; int input; int wantkey; int radio; int automatic; int redraw; int visible; int is_under; int clip; unsigned long click_timeout; void *c_vdata; char *c_cdata; long c_ldata; unsigned long dbl_background; char *tooltip; int tipID; int group_id; int want_motion; int want_update; }

user_defined_types: struct FL_FORM_ { void *fdui; void *u_vdata; char *u_cdata; long u_ldata; char *label; unsigned long window; int x; int handle_dec_x; int hotx; double w_hr; struct FL_OBJECT_ *first; struct FL_OBJECT_ *last; struct FL_OBJECT_ *focusobj; void (*form_callback)(struct FL_OBJECT_ *, void *); void (*activate_callback)(struct FL_FORM_ *, void *); void (*deactivate_callback)(struct FL_FORM_ *, void *); void *form_cb_data; void *activate_data; void *deactivate_data; int (*key_callback)(struct FL_FORM_ *, void *); int (*push_callback)(struct FL_FORM_ *, void *); int (*crossing_callback)(struct FL_FORM_ *, void *); int (*motion_callback)(struct FL_FORM_ *, void *); int (*all_callback)(struct FL_FORM_ *, void *); unsigned long compress_mask; unsigned long evmask; int (*close_callback)(struct FL_FORM_ *, void *); void *close_data; struct FL_pixmap_ *flpixmap; unsigned long icon_pixmap; unsigned long icon_mask; int deactivated; int use_pixmap; int frozen; int visible; int wm_border; unsigned int prop; int num_auto_objects; int needs_full_redraw; int sort_of_modal; struct FL_FORM_ *parent; struct FL_FORM_ *child; struct FL_OBJECT_ *parent_obj; int attached; void (*pre_attach)(struct FL_FORM_ *); void *attach_data; int in_redraw; }

user_defined_types: struct FL_pixmap_ { unsigned long pixmap; unsigned long win; struct Visual *visual; int x; int depth; unsigned long dbl_background; unsigned long pixel; }

user_defined_types: struct Visual { struct _XExtData *ext_data; unsigned long visualid; int class; unsigned long red_mask; int bits_per_rgb; int map_entries; }


decompiled_code:
void set_latitude()
{
const char *v0; // rax

v0 = (const char *)fl_get_input();
latitude = atof(v0);
}

canonical_decompiled_code:
void func1()
{
const char *v0; // rax

v0 = (const char *)fl_get_input();
latitude = atof(v0);
}

original_code:
void set_latitude( FL_OBJECT * ob,
         long data )
{
    latitude = atof(fl_get_input(ob));
}

canonical_original_code:
void set_latitude(struct FL_OBJECT_ *ob, long data)
{
    latitude = atof(fl_get_input(ob));
}

user_defined_types: struct _XExtData { int number; struct _XExtData *next; int (*free_private)(struct _XExtData *extension); char *private_data; }


decompiled_code:
void set_tracking_ra()
{
const char *v0; // rax

v0 = (const char *)fl_get_input();
ra = atof(v0);
}

canonical_decompiled_code:
void func2()
{
const char *v0; // rax

v0 = (const char *)fl_get_input();
ra = atof(v0);
}

original_code:
void set_tracking_ra( FL_OBJECT * ob,
         long data )
{
    ra = atof(fl_get_input(ob));
}

canonical_original_code:
void set_tracking_ra(struct FL_OBJECT_ *ob, long data)
{
    ra = atof(fl_get_input(ob));
}


decompiled_code:
void set_tracking_dec()
{
const char *v0; // rax

v0 = (const char *)fl_get_input();
decln = atof(v0);
}

canonical_decompiled_code:
void func3()
{
const char *v0; // rax

v0 = (const char *)fl_get_input();
decln = atof(v0);
}

original_code:
void set_tracking_dec( FL_OBJECT * ob,
         long data )
{
   decln = atof(fl_get_input(ob));
}

canonical_original_code:
void set_tracking_dec(struct FL_OBJECT_ *ob, long data)
{
   decln = atof(fl_get_input(ob));
}


decompiled_code:
int do_help()
{
char *v0; // rdx
char v2[520]; // [rsp+0h] [rbp-208h] BYREF

v0 = getenv("RCVR_HELP_PREFIX");
if ( !v0 )
v0 = "/usr/local";
sprintf(v2, "firefox -remote \"openURL(file:%s/share/doc/ira/ira_dtracker.html)\"", v0);
return system(v2);
}

canonical_decompiled_code:
int func4()
{
char *v0; // rdx
char v2[520]; // [rsp+0h] [rbp-208h] BYREF

v0 = getenv("RCVR_HELP_PREFIX");
if ( !v0 )
v0 = "/usr/local";
sprintf(v2, "firefox -remote \"openURL(file:%s/share/doc/ira/ira_dtracker.html)\"", v0);
return system(v2);
}

original_code:
void do_help (FL_OBJECT *ob, long data)
{
 char helpbuf[512];
 char *prefix = "/usr/local";
 char *p;
 if ((p = getenv ("RCVR_HELP_PREFIX")) != ((void *)0))
 {
  prefix = p;
 }
 sprintf (helpbuf,
  "firefox -remote \"openURL(file:%s/share/doc/ira/ira_dtracker.html)\"", prefix);
 system (helpbuf);
}

canonical_original_code:
void do_help(struct FL_OBJECT_ *ob, long data)
{
 char helpbuf[512];
 char *prefix = "/usr/local";
 char *p;
 if ((p = getenv ("RCVR_HELP_PREFIX")) != ((void *)0))
 {
  prefix = p;
 }
 sprintf (helpbuf,
  "firefox -remote \"openURL(file:%s/share/doc/ira/ira_dtracker.html)\"", prefix);
 system (helpbuf);
}

variable_types:
helpbuf
char [512]

variable_types:
prefix
char *

variable_types:
p
char *


decompiled_code:
__int64 select_bandwidth()
{
const char *v0; // rax
double v1; // xmm0_8
__int64 result; // rax

v0 = (const char *)fl_get_choice_text();
v1 = atof(v0);
result = (unsigned int)(int)v1;
bandwidth = (int)v1;
return result;
}

canonical_decompiled_code:
__int64 func0()
{
const char *v0; // rax
double v1; // xmm0_8
__int64 result; // rax

v0 = (const char *)fl_get_choice_text();
v1 = atof(v0);
result = (unsigned int)(int)v1;
bandwidth = (int)v1;
return result;
}

original_code:
void select_bandwidth(FL_OBJECT *ob, long data)
{
 const char *str;
 double fbw;
 str = fl_get_choice_text (ob);
 fbw = atof (str);
 bandwidth = (int)fbw;
}

canonical_original_code:
void select_bandwidth(struct FL_OBJECT_ *ob, long data)
{
 char *str;
 double fbw;
 str = fl_get_choice_text (ob);
 fbw = atof (str);
 bandwidth = (int)fbw;
}

variable_types:
str
char *

variable_types: fbw double


decompiled_code:
bool select_single()
{
const char *v0; // rax
bool v1; // zf
bool result; // al

v0 = (const char *)fl_get_choice_text();
if ( !strcmp(v0, "dual") )
single = 0;
if ( !strcmp(v0, "single") )
single = 1;
if ( !strcmp(v0, "interferometer") )
single = 2;
if ( !strcmp(v0, "split") )
single = 3;
v1 = strcmp(v0, "uhd") == 0;
result = !v1;
if ( v1 )
single = 4;
return result;
}

canonical_decompiled_code:
bool func1()
{
const char *v0; // rax
bool v1; // zf
bool result; // al

v0 = (const char *)fl_get_choice_text();
if ( !strcmp(v0, "dual") )
single = 0;
if ( !strcmp(v0, "single") )
single = 1;
if ( !strcmp(v0, "interferometer") )
single = 2;
if ( !strcmp(v0, "split") )
single = 3;
v1 = strcmp(v0, "uhd") == 0;
result = !v1;
if ( v1 )
single = 4;
return result;
}

original_code:
void select_single(FL_OBJECT *ob, long data)
{
 const char *str;
 str = fl_get_choice_text (ob);
 if (strcmp (str, "dual") == 0)
 {
  single = 0;
 }
 if (strcmp (str, "single") == 0)
 {
  single = 1;
 }
 if (strcmp (str, "interferometer") == 0)
 {
  single = 2;
 }
 if (strcmp (str, "split") == 0)
 {
  single = 3;
 }
 if (strcmp (str, "uhd") == 0)
 {
  single = 4;
 }
}

canonical_original_code:
void select_single(struct FL_OBJECT_ *ob, long data)
{
 char *str;
 str = fl_get_choice_text (ob);
 if (strcmp (str, "dual") == 0)
 {
  single = 0;
 }
 if (strcmp (str, "single") == 0)
 {
  single = 1;
 }
 if (strcmp (str, "interferometer") == 0)
 {
  single = 2;
 }
 if (strcmp (str, "split") == 0)
 {
  single = 3;
 }
 if (strcmp (str, "uhd") == 0)
 {
  single = 4;
 }
}


decompiled_code:
__int64 select_psr_srate()
{
char *v0; // rbx
const unsigned __int16 *v1; // rsi
char *i; // rax
__int64 v3; // rcx
__int64 result; // rax
char v5[136]; // [rsp+0h] [rbp-88h] BYREF

v0 = (char *)fl_get_choice_text();
v1 = *_ctype_b_loc();
for ( i = v5; ; *i = 0 )
{
v3 = *v0;
if ( (v1[v3] & 0x800) == 0 )
break;
*i = v3;
++v0;
++i;
}
result = (unsigned int)(1000 * atoi(v5));
psr_srate = result;
return result;
}

canonical_decompiled_code:
__int64 func3()
{
char *v0; // rbx
const unsigned __int16 *v1; // rsi
char *i; // rax
__int64 v3; // rcx
__int64 result; // rax
char v5[136]; // [rsp+0h] [rbp-88h] BYREF

v0 = (char *)fl_get_choice_text();
v1 = *_ctype_b_loc();
for ( i = v5; ; *i = 0 )
{
v3 = *v0;
if ( (v1[v3] & 0x800) == 0 )
break;
*i = v3;
++v0;
++i;
}
result = (unsigned int)(1000 * atoi(v5));
psr_srate = result;
return result;
}

original_code:
void
select_psr_srate (FL_OBJECT *ob, long data)
{
 char *str;
 char numbuf[128], *np, *p;
 str = (char *)fl_get_choice_text (ob);
 p = str;
 np = numbuf;
 while (((*__ctype_b_loc ())[(int) ((*p))] & (unsigned short int) _ISdigit))
 {
  *np = *p;
  np++;
  *np = '\0';
  p++;
 }
 psr_srate = atoi(numbuf) * 1000;
}

canonical_original_code:
void select_psr_srate(struct FL_OBJECT_ *ob, long data)
{
 char *str;
 char numbuf[128]; char *np; char *p;
 str = (char *)fl_get_choice_text (ob);
 p = str;
 np = numbuf;
 while (((*__ctype_b_loc ())[(int) ((*p))] & (unsigned short) _ISdigit))
 {
  *np = *p;
  np++;
  *np = '\0';
  p++;
 }
 psr_srate = atoi(numbuf) * 1000;
}

variable_types:
numbuf
char [128]

variable_types:
np
char *


decompiled_code:
char *input_license_key()
{
const char *v0; // rax

v0 = (const char *)fl_get_input();
return strcpy(&license_key, v0);
}

canonical_decompiled_code:
char *func4()
{
const char *v0; // rax

v0 = (const char *)fl_get_input();
return strcpy(&license_key, v0);
}

original_code:
void
input_license_key (FL_OBJECT *ob, long data)
{
 strcpy (license_key, fl_get_input (ob));
}

canonical_original_code:
void input_license_key(struct FL_OBJECT_ *ob, long data)
{
 strcpy (license_key, fl_get_input (ob));
}


decompiled_code:
void set_longitude()
{
const char *v0; // rax

v0 = (const char *)fl_get_input();
longitude = atof(v0);
}

canonical_decompiled_code:
void func5()
{
const char *v0; // rax

v0 = (const char *)fl_get_input();
longitude = atof(v0);
}

original_code:
void
set_longitude (FL_OBJECT *ob, long data)
{
 longitude = atof (fl_get_input (ob));
}

canonical_original_code:
void set_longitude(struct FL_OBJECT_ *ob, long data)
{
 longitude = atof (fl_get_input (ob));
}


decompiled_code:
unsigned __int8 *set_side_choice()
{
unsigned __int8 *result; // rax
int v1; // edx

result = (unsigned __int8 *)fl_get_choice_text();
if ( result && ((v1 = *result, v1 != 65) || result[1]) )
{
if ( v1 == 66 && !result[1] )
side = 3160642;
}
else
{
side = 3160641;
}
return result;
}

canonical_decompiled_code:
unsigned __int8 *func6()
{
unsigned __int8 *result; // rax
int v1; // edx

result = (unsigned __int8 *)fl_get_choice_text();
if ( result && ((v1 = *result, v1 != 65) || result[1]) )
{
if ( v1 == 66 && !result[1] )
side = 3160642;
}
else
{
side = 3160641;
}
return result;
}

original_code:
void
set_side_choice (FL_OBJECT *ob, long data)
{
 const char *str;
 if ((str = fl_get_choice_text (ob)) != ((void *)0))
 {
  if (strcmp (str, "A") == 0)
  {
   strcpy (side, "A:0");
  }
  else if (strcmp (str, "B") == 0)
  {
   strcpy (side, "B:0");
  }
 }
 else
 {
  strcpy (side, "A:0");
 }
}

canonical_original_code:
void set_side_choice(struct FL_OBJECT_ *ob, long data)
{
 char *str;
 if ((str = fl_get_choice_text (ob)) != ((void *)0))
 {
  if (strcmp (str, "A") == 0)
  {
   strcpy (side, "A:0");
  }
  else if (strcmp (str, "B") == 0)
  {
   strcpy (side, "B:0");
  }
 }
 else
 {
  strcpy (side, "A:0");
 }
}


decompiled_code:
char set_ra_mode()
{
const char *v0; // rax
bool v1; // zf
char result; // al
const char *v3; // rax

v0 = (const char *)fl_get_choice_text();
strcpy(&ra_mode, v0);
v1 = strcmp(&ra_mode, "external") == 0;
result = !v1;
if ( v1 )
{
v3 = (const char *)fl_show_fselector("Select RA Control File", ".", "*.*", "ra_control_file");
result = sprintf(&ra_mode, "external %s", v3);
}
return result;
}

canonical_decompiled_code:
char func8()
{
const char *v0; // rax
bool v1; // zf
char result; // al
const char *v3; // rax

v0 = (const char *)fl_get_choice_text();
strcpy(&ra_mode, v0);
v1 = strcmp(&ra_mode, "external") == 0;
result = !v1;
if ( v1 )
{
v3 = (const char *)fl_show_fselector("Select RA Control File", ".", "*.*", "ra_control_file");
result = sprintf(&ra_mode, "external %s", v3);
}
return result;
}

original_code:
void
set_ra_mode (FL_OBJECT *ob, long data)
{
 strcpy (ra_mode, fl_get_choice_text (ob));
 if (strcmp (ra_mode, "external") == 0)
 {
  sprintf (ra_mode, "external %s",
   (char *)fl_show_fselector ("Select RA Control File",".", "*.*","ra_control_file"));
 }
}

canonical_original_code:
void set_ra_mode(struct FL_OBJECT_ *ob, long data)
{
 strcpy (ra_mode, fl_get_choice_text (ob));
 if (strcmp (ra_mode, "external") == 0)
 {
  sprintf (ra_mode, "external %s",
   (char *)fl_show_fselector ("Select RA Control File",".", "*.*","ra_control_file"));
 }
}


decompiled_code:
char set_dec_mode()
{
const char *v0; // rax
bool v1; // zf
char result; // al
const char *v3; // rax

v0 = (const char *)fl_get_choice_text();
strcpy(&dec_mode, v0);
v1 = strcmp(&dec_mode, "external") == 0;
result = !v1;
if ( v1 )
{
v3 = (const char *)fl_show_fselector("Select DEC Control File", ".", "*.*", "dec_control_file");
result = sprintf(&dec_mode, "external %s", v3);
}
return result;
}

canonical_decompiled_code:
char func9()
{
const char *v0; // rax
bool v1; // zf
char result; // al
const char *v3; // rax

v0 = (const char *)fl_get_choice_text();
strcpy(&dec_mode, v0);
v1 = strcmp(&dec_mode, "external") == 0;
result = !v1;
if ( v1 )
{
v3 = (const char *)fl_show_fselector("Select DEC Control File", ".", "*.*", "dec_control_file");
result = sprintf(&dec_mode, "external %s", v3);
}
return result;
}

original_code:
void
set_dec_mode (FL_OBJECT *ob, long data)
{
 strcpy (dec_mode, fl_get_choice_text (ob));
 if (strcmp (dec_mode, "external") == 0)
 {
  sprintf (dec_mode, "external %s",
   (char *)fl_show_fselector ("Select DEC Control File",".", "*.*","dec_control_file"));
 }
}

canonical_original_code:
void set_dec_mode(struct FL_OBJECT_ *ob, long data)
{
 strcpy (dec_mode, fl_get_choice_text (ob));
 if (strcmp (dec_mode, "external") == 0)
 {
  sprintf (dec_mode, "external %s",
   (char *)fl_show_fselector ("Select DEC Control File",".", "*.*","dec_control_file"));
 }
}


decompiled_code:
_BYTE *set_rxa_cor()
{
_BYTE *result; // rax

result = (_BYTE *)fl_get_input();
if ( result )
{
if ( *result )
result = (_BYTE *)_isoc99_sscanf(result, "%lf", &rxa_cor);
}
return result;
}

canonical_decompiled_code:
_BYTE *func11()
{
_BYTE *result; // rax

result = (_BYTE *)fl_get_input();
if ( result )
{
if ( *result )
result = (_BYTE *)_isoc99_sscanf(result, "%lf", &rxa_cor);
}
return result;
}

original_code:
void
set_rxa_cor (FL_OBJECT *ob, long data)
{
 const char *p;
 p = fl_get_input (ob);
 if (p != ((void *)0) && *p != '\0')
 {
  sscanf (p, "%lf", &rxa_cor);
 }
}

canonical_original_code:
void set_rxa_cor(struct FL_OBJECT_ *ob, long data)
{
 char *p;
 p = fl_get_input (ob);
 if (p != ((void *)0) && *p != '\0')
 {
  sscanf (p, "%lf", &rxa_cor);
 }
}


decompiled_code:
_BYTE *set_rxb_cor()
{
_BYTE *result; // rax

result = (_BYTE *)fl_get_input();
if ( result )
{
if ( *result )
result = (_BYTE *)_isoc99_sscanf(result, "%lf", &rxb_cor);
}
return result;
}

canonical_decompiled_code:
_BYTE *func12()
{
_BYTE *result; // rax

result = (_BYTE *)fl_get_input();
if ( result )
{
if ( *result )
result = (_BYTE *)_isoc99_sscanf(result, "%lf", &rxb_cor);
}
return result;
}

original_code:
void
set_rxb_cor (FL_OBJECT *ob, long data)
{
 const char *p;
 p = fl_get_input (ob);
 if (p != ((void *)0) && *p != '\0')
 {
  sscanf (p, "%lf", &rxb_cor);
 }
}

canonical_original_code:
void set_rxb_cor(struct FL_OBJECT_ *ob, long data)
{
 char *p;
 p = fl_get_input (ob);
 if (p != ((void *)0) && *p != '\0')
 {
  sscanf (p, "%lf", &rxb_cor);
 }
}


decompiled_code:
int show_help()
{
char *v0; // rdx
char v2[520]; // [rsp+0h] [rbp-208h] BYREF

v0 = getenv("RCVR_HELP_PREFIX");
if ( !v0 )
v0 = "/usr/local";
sprintf(v2, "firefox -remote \"openURL(file:%s/share/doc/ira/ira_start.html)\"", v0);
return system(v2);
}

canonical_decompiled_code:
int func7()
{
char *v0; // rdx
char v2[520]; // [rsp+0h] [rbp-208h] BYREF

v0 = getenv("RCVR_HELP_PREFIX");
if ( !v0 )
v0 = "/usr/local";
sprintf(v2, "firefox -remote \"openURL(file:%s/share/doc/ira/ira_start.html)\"", v0);
return system(v2);
}

original_code:
void
show_help (FL_OBJECT *ob, long data)
{
 char helpbuf[512];
 char *prefix = "/usr/local";
 char *p;
 if ((p = getenv ("RCVR_HELP_PREFIX")) != ((void *)0))
 {
  prefix = p;
 }
 sprintf (helpbuf,
  "firefox -remote \"openURL(file:%s/share/doc/ira/ira_start.html)\"", prefix);
 system (helpbuf);
}

canonical_original_code:
void show_help(struct FL_OBJECT_ *ob, long data)
{
 char helpbuf[512];
 char *prefix = "/usr/local";
 char *p;
 if ((p = getenv ("RCVR_HELP_PREFIX")) != ((void *)0))
 {
  prefix = p;
 }
 sprintf (helpbuf,
  "firefox -remote \"openURL(file:%s/share/doc/ira/ira_start.html)\"", prefix);
 system (helpbuf);
}


julday

original_code:
static long julday(int mm, int id, int iyyy)
{
  long jul;
  int ja, jy=iyyy, jm;
  if (jy == 0)
  if (jy < 0) ++jy;
  if (mm > 2)
  {
    jm = mm + 1;
  }
  else
  {
    --jy;
    jm = mm + 13;
  }
  jul = (long) (floor(365.25*jy)+floor(30.6001*jm)+id+1720995);
  if (id+31L*(mm+12L*iyyy) >= (15+31L*(10+12L*1582)))
  {
    ja = (int) (0.01*jy);
    jul += (long) (2-ja+(int) (0.25*(double)ja));
  }
  return jul ;
}

canonical_original_code:
static long julday(int mm, int id, int iyyy)
{
  long jul;
  int ja; int jy = iyyy; int jm;
  if (jy == 0)
  if (jy < 0) ++jy;
  if (mm > 2)
  {
    jm = mm + 1;
  }
  else
  {
    --jy;
    jm = mm + 13;
  }
  jul = (long) (floor(365.25*jy)+floor(30.6001*jm)+id+1720995);
  if (id+31L*(mm+12L*iyyy) >= (15+31L*(10+12L*1582)))
  {
    ja = (int) (0.01*jy);
    jul += (long) (2-ja+(int) (0.25*(double)ja));
  }
  return jul ;
}

variable_types: mm int

variable_types: id int

variable_types: iyyy int

variable_types: jul long

variable_types: ja int

variable_types: jy int

variable_types: jm int

return_type: long


original_code:
static double r_ascension(double jultime)
    {
    double ra;
    ra=sidereal(jultime);
    ra-=24.0*floor(ra/24.0);
    return(ra/24.0);
    }

variable_types: jultime double

variable_types: ra double

return_type: double


original_code:
double tm_to_ra(struct tm *tm_time, double *jultime)
{
  double dayfrac ;
  *jultime = julday((tm_time->tm_mon + 1), tm_time->tm_mday,
                   (tm_time->tm_year + 1900)) ;
  dayfrac = (double) tm_time->tm_sec / 86400.0 +
            (double) tm_time->tm_min / 1440.0 +
            (double) tm_time->tm_hour / 24.0 ;
  *jultime += dayfrac - 0.5 ;
  return r_ascension(*jultime) ;
}

canonical_original_code:
double tm_to_ra(struct tm *tm_time, double *jultime)
{
  double dayfrac;
  *jultime = julday((tm_time->tm_mon + 1), tm_time->tm_mday,
                   (tm_time->tm_year + 1900)) ;
  dayfrac = (double) tm_time->tm_sec / 86400.0 +
            (double) tm_time->tm_min / 1440.0 +
            (double) tm_time->tm_hour / 24.0 ;
  *jultime += dayfrac - 0.5 ;
  return r_ascension(*jultime) ;
}

variable_types: struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long tm_gmtoff; char *tm_zone; } *

variable_types:
jultime
double *

variable_types: dayfrac double


decompiled_code:
_QWORD *create_form_dtracker()
{
_QWORD *v0; // rax
_QWORD *v1; // r12
__int64 v2; // rbp
__int64 v3; // rax
__int64 v4; // rbp
__int64 v5; // rax
__int64 v6; // rbp
__int64 v7; // rax
__int64 v8; // rbp
__int64 v9; // rax
__int64 v10; // rbp
__int64 v11; // rax
__int64 v12; // rbp
__int64 v13; // rbp
__int64 v14; // rax
__int64 v15; // rbp
__int64 v16; // rbp
__int64 v17; // rax
__int64 v18; // rbp

v0 = (_QWORD *)fl_malloc(88LL);
v0[2] = 0LL;
v1 = v0;
v0[1] = 0LL;
v0[3] = 0LL;
*v0 = fl_bgn_form(0LL, 435LL, 307LL);
v2 = fl_add_box(1LL, 0LL, 0LL, 435LL, 307LL, "Doppler Tracker");
fl_set_object_color(v2, 9LL, 11LL);
fl_set_object_lalign(v2, 1LL);
v3 = fl_add_checkbutton(1LL, 20LL, 10LL, 140LL, 30LL, "Track Doppler");
v1[4] = v3;
v4 = v3;
fl_set_object_lsize(v3, 14LL);
fl_set_object_lstyle(v4, 1LL);
fl_set_object_callback(v4, &set_tracking, 0LL);
v5 = fl_add_input(0LL, 130LL, 50LL, 150LL, 30LL, "Current Latitude");
v1[5] = v5;
v6 = v5;
fl_set_object_lsize(v5, 14LL);
fl_set_object_lstyle(v6, 1LL);
fl_set_object_callback(v6, &set_latitude, 0LL);
fl_set_object_return(v6, 4LL);
v7 = fl_add_input(0LL, 130LL, 100LL, 150LL, 30LL, "Tracking RA");
v1[6] = v7;
v8 = v7;
fl_set_object_lsize(v7, 14LL);
fl_set_object_lstyle(v8, 1LL);
fl_set_object_callback(v8, &set_tracking_ra, 0LL);
fl_set_object_return(v8, 4LL);
v9 = fl_add_input(0LL, 130LL, 150LL, 150LL, 30LL, "Tracking DEC");
v1[7] = v9;
v10 = v9;
fl_set_object_lsize(v9, 14LL);
fl_set_object_lstyle(v10, 1LL);
fl_set_object_callback(v10, &set_tracking_dec, 0LL);
fl_set_object_return(v10, 4LL);
v11 = fl_add_text(0LL, 130LL, 200LL, 150LL, 30LL, &unk_40A);
v1[8] = v11;
v12 = v11;
fl_set_object_boxtype(v11, 7LL);
fl_set_object_color(v12, 21LL, 16LL);
fl_set_object_lsize(v12, 14LL);
fl_set_object_lstyle(v12, 1LL);
v13 = fl_add_text(0LL, 20LL, 200LL, 80LL, 30LL, "LMST");
fl_set_object_color(v13, 9LL, 16LL);
fl_set_object_lsize(v13, 14LL);
fl_set_object_lalign(v13, 8200LL);
v14 = fl_add_text(0LL, 130LL, 240LL, 150LL, 30LL, &unk_40A);
v1[9] = v14;
v15 = v14;
fl_set_object_boxtype(v14, 7LL);
fl_set_object_color(v15, 21LL, 16LL);
v16 = fl_add_text(0LL, 10LL, 240LL, 90LL, 30LL, "CORRECTION");
fl_set_object_color(v16, 9LL, 16LL);
fl_set_object_lsize(v16, 12LL);
v17 = fl_add_button(0LL, 320LL, 270LL, 90LL, 30LL, "HELP");
v1[10] = v17;
v18 = v17;
fl_set_object_color(v17, 10LL, 11LL);
fl_set_object_lsize(v18, 14LL);
fl_set_object_lalign(v18, 0LL);
fl_set_object_lstyle(v18, 1LL);
fl_set_object_callback(v18, &do_help, 0LL);
fl_end_form();
*(_QWORD *)*v1 = v1;
return v1;
}

canonical_decompiled_code:
_QWORD *func0()
{
_QWORD *v0; // rax
_QWORD *v1; // r12
__int64 v2; // rbp
__int64 v3; // rax
__int64 v4; // rbp
__int64 v5; // rax
__int64 v6; // rbp
__int64 v7; // rax
__int64 v8; // rbp
__int64 v9; // rax
__int64 v10; // rbp
__int64 v11; // rax
__int64 v12; // rbp
__int64 v13; // rbp
__int64 v14; // rax
__int64 v15; // rbp
__int64 v16; // rbp
__int64 v17; // rax
__int64 v18; // rbp

v0 = (_QWORD *)fl_malloc(88LL);
v0[2] = 0LL;
v1 = v0;
v0[1] = 0LL;
v0[3] = 0LL;
*v0 = fl_bgn_form(0LL, 435LL, 307LL);
v2 = fl_add_box(1LL, 0LL, 0LL, 435LL, 307LL, "Doppler Tracker");
fl_set_object_color(v2, 9LL, 11LL);
fl_set_object_lalign(v2, 1LL);
v3 = fl_add_checkbutton(1LL, 20LL, 10LL, 140LL, 30LL, "Track Doppler");
v1[4] = v3;
v4 = v3;
fl_set_object_lsize(v3, 14LL);
fl_set_object_lstyle(v4, 1LL);
fl_set_object_callback(v4, &set_tracking, 0LL);
v5 = fl_add_input(0LL, 130LL, 50LL, 150LL, 30LL, "Current Latitude");
v1[5] = v5;
v6 = v5;
fl_set_object_lsize(v5, 14LL);
fl_set_object_lstyle(v6, 1LL);
fl_set_object_callback(v6, &set_latitude, 0LL);
fl_set_object_return(v6, 4LL);
v7 = fl_add_input(0LL, 130LL, 100LL, 150LL, 30LL, "Tracking RA");
v1[6] = v7;
v8 = v7;
fl_set_object_lsize(v7, 14LL);
fl_set_object_lstyle(v8, 1LL);
fl_set_object_callback(v8, &set_tracking_ra, 0LL);
fl_set_object_return(v8, 4LL);
v9 = fl_add_input(0LL, 130LL, 150LL, 150LL, 30LL, "Tracking DEC");
v1[7] = v9;
v10 = v9;
fl_set_object_lsize(v9, 14LL);
fl_set_object_lstyle(v10, 1LL);
fl_set_object_callback(v10, &set_tracking_dec, 0LL);
fl_set_object_return(v10, 4LL);
v11 = fl_add_text(0LL, 130LL, 200LL, 150LL, 30LL, &unk_40A);
v1[8] = v11;
v12 = v11;
fl_set_object_boxtype(v11, 7LL);
fl_set_object_color(v12, 21LL, 16LL);
fl_set_object_lsize(v12, 14LL);
fl_set_object_lstyle(v12, 1LL);
v13 = fl_add_text(0LL, 20LL, 200LL, 80LL, 30LL, "LMST");
fl_set_object_color(v13, 9LL, 16LL);
fl_set_object_lsize(v13, 14LL);
fl_set_object_lalign(v13, 8200LL);
v14 = fl_add_text(0LL, 130LL, 240LL, 150LL, 30LL, &unk_40A);
v1[9] = v14;
v15 = v14;
fl_set_object_boxtype(v14, 7LL);
fl_set_object_color(v15, 21LL, 16LL);
v16 = fl_add_text(0LL, 10LL, 240LL, 90LL, 30LL, "CORRECTION");
fl_set_object_color(v16, 9LL, 16LL);
fl_set_object_lsize(v16, 12LL);
v17 = fl_add_button(0LL, 320LL, 270LL, 90LL, 30LL, "HELP");
v1[10] = v17;
v18 = v17;
fl_set_object_color(v17, 10LL, 11LL);
fl_set_object_lsize(v18, 14LL);
fl_set_object_lalign(v18, 0LL);
fl_set_object_lstyle(v18, 1LL);
fl_set_object_callback(v18, &do_help, 0LL);
fl_end_form();
*(_QWORD *)*v1 = v1;
return v1;
}

original_code:
FD_dtracker *
create_form_dtracker( void )
{
    FL_OBJECT *obj;
    FD_dtracker *fdui = fl_malloc( sizeof *fdui );
    fdui->vdata = fdui->cdata = ((void *)0);
    fdui->ldata = 0;
    fdui->dtracker = fl_bgn_form( FL_NO_BOX, 435, 307 );
    obj = fl_add_box( FL_UP_BOX, 0, 0, 435, 307, "Doppler Tracker" );
    fl_set_object_color( obj, FL_INDIANRED, FL_COL1 );
    fl_set_object_lalign( obj, FL_ALIGN_TOP );
    fdui->track_set = obj = fl_add_checkbutton( FL_PUSH_BUTTON, 20, 10, 140, 30, "Track Doppler" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_tracking, 0 );
    fdui->latitude = obj = fl_add_input( FL_NORMAL_INPUT, 130, 50, 150, 30, "Current Latitude" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_latitude, 0 );
    fl_set_object_return( obj, 4U );
    fdui->tracked_ra = obj = fl_add_input( FL_NORMAL_INPUT, 130, 100, 150, 30, "Tracking RA" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_tracking_ra, 0 );
    fl_set_object_return( obj, 4U );
    fdui->tracking_dec = obj = fl_add_input( FL_NORMAL_INPUT, 130, 150, 150, 30, "Tracking DEC" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_tracking_dec, 0 );
    fl_set_object_return( obj, 4U );
    fdui->current_lmst = obj = fl_add_text( FL_NORMAL_TEXT, 130, 200, 150, 30, "" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_color( obj, FL_DARKCYAN, FL_MCOL );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    obj = fl_add_text( FL_NORMAL_TEXT, 20, 200, 80, 30, "LMST" );
    fl_set_object_color( obj, FL_INDIANRED, FL_MCOL );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lalign( obj, FL_ALIGN_RIGHT | FL_ALIGN_INSIDE );
    fdui->current_doppler = obj = fl_add_text( FL_NORMAL_TEXT, 130, 240, 150, 30, "" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_color( obj, FL_DARKCYAN, FL_MCOL );
    obj = fl_add_text( FL_NORMAL_TEXT, 10, 240, 90, 30, "CORRECTION" );
    fl_set_object_color( obj, FL_INDIANRED, FL_MCOL );
    fl_set_object_lsize( obj, 12 );
    fdui->help_button = obj = fl_add_button( FL_NORMAL_BUTTON, 320, 270, 90, 30, "HELP" );
    fl_set_object_color( obj, FL_SLATEBLUE, FL_COL1 );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, do_help, 0 );
    fl_end_form( );
    fdui->dtracker->fdui = fdui;
    return fdui;
}

canonical_original_code:
struct FD_dtracker *create_form_dtracker()
{
    struct FL_OBJECT_ *obj;
    struct FD_dtracker *fdui = fl_malloc( sizeof *fdui );
    fdui->vdata = fdui->cdata = ((void *)0);
    fdui->ldata = 0;
    fdui->dtracker = fl_bgn_form( FL_NO_BOX, 435, 307 );
    obj = fl_add_box( FL_UP_BOX, 0, 0, 435, 307, "Doppler Tracker" );
    fl_set_object_color( obj, FL_INDIANRED, FL_COL1 );
    fl_set_object_lalign( obj, FL_ALIGN_TOP );
    fdui->track_set = obj = fl_add_checkbutton( FL_PUSH_BUTTON, 20, 10, 140, 30, "Track Doppler" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_tracking, 0 );
    fdui->latitude = obj = fl_add_input( FL_NORMAL_INPUT, 130, 50, 150, 30, "Current Latitude" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_latitude, 0 );
    fl_set_object_return( obj, 4U );
    fdui->tracked_ra = obj = fl_add_input( FL_NORMAL_INPUT, 130, 100, 150, 30, "Tracking RA" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_tracking_ra, 0 );
    fl_set_object_return( obj, 4U );
    fdui->tracking_dec = obj = fl_add_input( FL_NORMAL_INPUT, 130, 150, 150, 30, "Tracking DEC" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_tracking_dec, 0 );
    fl_set_object_return( obj, 4U );
    fdui->current_lmst = obj = fl_add_text( FL_NORMAL_TEXT, 130, 200, 150, 30, "" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_color( obj, FL_DARKCYAN, FL_MCOL );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    obj = fl_add_text( FL_NORMAL_TEXT, 20, 200, 80, 30, "LMST" );
    fl_set_object_color( obj, FL_INDIANRED, FL_MCOL );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lalign( obj, FL_ALIGN_RIGHT | FL_ALIGN_INSIDE );
    fdui->current_doppler = obj = fl_add_text( FL_NORMAL_TEXT, 130, 240, 150, 30, "" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_color( obj, FL_DARKCYAN, FL_MCOL );
    obj = fl_add_text( FL_NORMAL_TEXT, 10, 240, 90, 30, "CORRECTION" );
    fl_set_object_color( obj, FL_INDIANRED, FL_MCOL );
    fl_set_object_lsize( obj, 12 );
    fdui->help_button = obj = fl_add_button( FL_NORMAL_BUTTON, 320, 270, 90, 30, "HELP" );
    fl_set_object_color( obj, FL_SLATEBLUE, FL_COL1 );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, do_help, 0 );
    fl_end_form( );
    fdui->dtracker->fdui = fdui;
    return fdui;
}

variable_types: struct FL_OBJECT_ { struct FL_FORM_ { void *fdui; void *u_vdata; char *u_cdata; long u_ldata; char *label; unsigned long window; int x; int handle_dec_x; int hotx; double w_hr; struct FL_OBJECT_ *first; struct FL_OBJECT_ *last; struct FL_OBJECT_ *focusobj; void (*form_callback)(struct FL_OBJECT_ *, void *); void (*activate_callback)(struct FL_FORM_ *, void *); void (*deactivate_callback)(struct FL_FORM_ *, void *); void *form_cb_data; void *activate_data; void *deactivate_data; int (*key_callback)(struct FL_FORM_ *, void *); int (*push_callback)(struct FL_FORM_ *, void *); int (*crossing_callback)(struct FL_FORM_ *, void *); int (*motion_callback)(struct FL_FORM_ *, void *); int (*all_callback)(struct FL_FORM_ *, void *); unsigned long compress_mask; unsigned long evmask; int (*close_callback)(struct FL_FORM_ *, void *); void *close_data; struct FL_pixmap_ { unsigned long pixmap; unsigned long win; struct Visual { struct _XExtData { int number; struct _XExtData *next; int (*free_private)(struct _XExtData *extension); char *private_data; } *ext_data; unsigned long visualid; int class; unsigned long red_mask; int bits_per_rgb; int map_entries; } *visual; int x; int depth; unsigned long dbl_background; unsigned long pixel; } *flpixmap; unsigned long icon_pixmap; unsigned long icon_mask; int deactivated; int use_pixmap; int frozen; int visible; int wm_border; unsigned int prop; int num_auto_objects; int needs_full_redraw; int sort_of_modal; struct FL_FORM_ *parent; struct FL_FORM_ *child; struct FL_OBJECT_ *parent_obj; int attached; void (*pre_attach)(struct FL_FORM_ *); void *attach_data; int in_redraw; } *form; void *u_vdata; char *u_cdata; long u_ldata; int objclass; int type; int boxtype; int x; double fl1; int bw; unsigned long col1; char *label; unsigned long lcol; int align; int lsize; long *shortcut; int (*handle)(struct FL_OBJECT_ *, int, int, int, int, void *); void (*object_callback)(struct FL_OBJECT_ *, long); long argument; void *spec; int (*prehandle)(struct FL_OBJECT_ *, int, int, int, int, void *); int (*posthandle)(struct FL_OBJECT_ *, int, int, int, int, void *); void (*set_return)(struct FL_OBJECT_ *, unsigned int); unsigned int resize; unsigned int nwgravity; unsigned int segravity; struct FL_OBJECT_ *prev; struct FL_OBJECT_ *next; struct FL_OBJECT_ *parent; struct FL_OBJECT_ *child; struct FL_OBJECT_ *nc; struct FL_pixmap_ *flpixmap; int use_pixmap; int returned; unsigned int how_return; int double_buffer; int pushed; int focus; int belowmouse; int active; int input; int wantkey; int radio; int automatic; int redraw; int visible; int is_under; int clip; unsigned long click_timeout; void *c_vdata; char *c_cdata; long c_ldata; unsigned long dbl_background; char *tooltip; int tipID; int group_id; int want_motion; int want_update; } *

variable_types: struct FD_dtracker { struct FL_FORM_ { void *fdui; void *u_vdata; char *u_cdata; long u_ldata; char *label; unsigned long window; int x; int handle_dec_x; int hotx; double w_hr; struct FL_OBJECT_ { struct FL_FORM_ *form; void *u_vdata; char *u_cdata; long u_ldata; int objclass; int type; int boxtype; int x; double fl1; int bw; unsigned long col1; char *label; unsigned long lcol; int align; int lsize; long *shortcut; int (*handle)(struct FL_OBJECT_ *, int, int, int, int, void *); void (*object_callback)(struct FL_OBJECT_ *, long); long argument; void *spec; int (*prehandle)(struct FL_OBJECT_ *, int, int, int, int, void *); int (*posthandle)(struct FL_OBJECT_ *, int, int, int, int, void *); void (*set_return)(struct FL_OBJECT_ *, unsigned int); unsigned int resize; unsigned int nwgravity; unsigned int segravity; struct FL_OBJECT_ *prev; struct FL_OBJECT_ *next; struct FL_OBJECT_ *parent; struct FL_OBJECT_ *child; struct FL_OBJECT_ *nc; struct FL_pixmap_ { unsigned long pixmap; unsigned long win; struct Visual { struct _XExtData { int number; struct _XExtData *next; int (*free_private)(struct _XExtData *extension); char *private_data; } *ext_data; unsigned long visualid; int class; unsigned long red_mask; int bits_per_rgb; int map_entries; } *visual; int x; int depth; unsigned long dbl_background; unsigned long pixel; } *flpixmap; int use_pixmap; int returned; unsigned int how_return; int double_buffer; int pushed; int focus; int belowmouse; int active; int input; int wantkey; int radio; int automatic; int redraw; int visible; int is_under; int clip; unsigned long click_timeout; void *c_vdata; char *c_cdata; long c_ldata; unsigned long dbl_background; char *tooltip; int tipID; int group_id; int want_motion; int want_update; } *first; struct FL_OBJECT_ *last; struct FL_OBJECT_ *focusobj; void (*form_callback)(struct FL_OBJECT_ *, void *); void (*activate_callback)(struct FL_FORM_ *, void *); void (*deactivate_callback)(struct FL_FORM_ *, void *); void *form_cb_data; void *activate_data; void *deactivate_data; int (*key_callback)(struct FL_FORM_ *, void *); int (*push_callback)(struct FL_FORM_ *, void *); int (*crossing_callback)(struct FL_FORM_ *, void *); int (*motion_callback)(struct FL_FORM_ *, void *); int (*all_callback)(struct FL_FORM_ *, void *); unsigned long compress_mask; unsigned long evmask; int (*close_callback)(struct FL_FORM_ *, void *); void *close_data; struct FL_pixmap_ *flpixmap; unsigned long icon_pixmap; unsigned long icon_mask; int deactivated; int use_pixmap; int frozen; int visible; int wm_border; unsigned int prop; int num_auto_objects; int needs_full_redraw; int sort_of_modal; struct FL_FORM_ *parent; struct FL_FORM_ *child; struct FL_OBJECT_ *parent_obj; int attached; void (*pre_attach)(struct FL_FORM_ *); void *attach_data; int in_redraw; } *dtracker; void *vdata; char *cdata; long ldata; struct FL_OBJECT_ *track_set; struct FL_OBJECT_ *latitude; struct FL_OBJECT_ *tracked_ra; struct FL_OBJECT_ *tracking_dec; struct FL_OBJECT_ *current_lmst; struct FL_OBJECT_ *current_doppler; struct FL_OBJECT_ *help_button; } *

user_defined_types: struct FD_dtracker { struct FL_FORM_ *dtracker; void *vdata; char *cdata; long ldata; struct FL_OBJECT_ *track_set; struct FL_OBJECT_ *latitude; struct FL_OBJECT_ *tracked_ra; struct FL_OBJECT_ *tracking_dec; struct FL_OBJECT_ *current_lmst; struct FL_OBJECT_ *current_doppler; struct FL_OBJECT_ *help_button; }