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

repo: passedaway/mem

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
void *v3; // rbp
unsigned int v4; // ebx
__int64 v5; // rax
__int64 v6; // rax

v3 = malloc(0x1000uLL);
mgr = mem_init(v3, 1024LL);
mem_print(mgr);
puts("test malloc:");
v4 = test_malloc(0x32u);
printf("memory out at %d times. first size=%d end size=%d\n", v4, 50LL, 10 * v4 + 50);
mem_print(mgr);
v5 = qword_268;
*(_QWORD *)qword_268 = 0x6E6971676E616863LL;
strcpy((char *)(v5 + 8), "gZhao.1230@163.com");
v6 = qword_278;
*(_QWORD *)qword_278 = 0x6E696C406E696174LL;
strcpy((char *)(v6 + 8), "uxmint: /opt/broadcom/7851/a0");
mem_print(mgr);
mem_free("test.c", "main", 91LL, mgr, qword_268);
mem_print(mgr);
getchar();
mem_free("test.c", "main", 95LL, mgr, qword_278);
mem_print(mgr);
getchar();
printf("test free: num=%d\n", v4);
test_free(v4 + 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
unsigned int v4; // ebx
__int64 v5; // rax
__int64 v6; // rax

v3 = malloc(0x1000uLL);
mgr = mem_init(v3, 1024LL);
mem_print(mgr);
puts("test malloc:");
v4 = func1(0x32u);
printf("memory out at %d times. first size=%d end size=%d\n", v4, 50LL, 10 * v4 + 50);
mem_print(mgr);
v5 = qword_268;
*(_QWORD *)qword_268 = 0x6E6971676E616863LL;
strcpy((char *)(v5 + 8), "gZhao.1230@163.com");
v6 = qword_278;
*(_QWORD *)qword_278 = 0x6E696C406E696174LL;
strcpy((char *)(v6 + 8), "uxmint: /opt/broadcom/7851/a0");
mem_print(mgr);
mem_free("test.c", "main", 91LL, mgr, qword_268);
mem_print(mgr);
getchar();
mem_free("test.c", "main", 95LL, mgr, qword_278);
mem_print(mgr);
getchar();
printf("test free: num=%d\n", v4);
func0(v4 + 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

return_type: 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)
{
*(_DWORD *)a1 = 1;
*(_BYTE *)(a1 + 8) = 1;
return 0LL;
}

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)
{
*(_DWORD *)a1 = 1;
*(_BYTE *)(a1 + 8) = 0;
return 0LL;
}

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


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


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(_DWORD *a1, __int64 a2, unsigned __int64 a3, unsigned __int64 *a4)
{
unsigned __int64 v5; // rcx
__int64 result; // rax
char v7; // al
unsigned __int64 v8; // [rsp+0h] [rbp-10h]

if ( !a4 )
return 0LL;
v5 = *a4;
result = 0LL;
if ( v5 < a3 )
{
v7 = *(_BYTE *)(a2 + v5);
v8 = v5 + 1;
if ( (v7 & 0xA0) == 160 )
{
LABEL_7:
*a4 = v8;
result = 1LL;
}
else
{
switch ( v7 )
{
case -64:
callback_nil(a1);
goto LABEL_7;
case -62:
callback_false((__int64)a1);
goto LABEL_7;
case -61:
callback_true((__int64)a1);
goto LABEL_7;
case -54:
((void (__fastcall *)(__int64))callback_float)((__int64)a1);
goto LABEL_7;
case -52:
((void (__fastcall *)(__int64))callback_uint8)((__int64)a1);
goto LABEL_7;
case -51:
((void (__fastcall *)(__int64))callback_uint16)((__int64)a1);
goto LABEL_7;
case -48:
((void (__fastcall *)(__int64))callback_int8)((__int64)a1);
goto LABEL_7;
case -47:
((void (__fastcall *)(__int64))callback_int16)((__int64)a1);
goto LABEL_7;
default:
result = 0LL;
break;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(_DWORD *a1, __int64 a2, unsigned __int64 a3, unsigned __int64 *a4)
{
unsigned __int64 v5; // rcx
__int64 result; // rax
char v7; // al
unsigned __int64 v8; // [rsp+0h] [rbp-10h]

if ( !a4 )
return 0LL;
v5 = *a4;
result = 0LL;
if ( v5 < a3 )
{
v7 = *(_BYTE *)(a2 + v5);
v8 = v5 + 1;
if ( (v7 & 0xA0) == 160 )
{
LABEL_7:
*a4 = v8;
result = 1LL;
}
else
{
switch ( v7 )
{
case -64:
func0(a1);
goto LABEL_7;
case -62:
func2((__int64)a1);
goto LABEL_7;
case -61:
func1((__int64)a1);
goto LABEL_7;
case -54:
((void (__fastcall *)(__int64))callback_float)((__int64)a1);
goto LABEL_7;
case -52:
((void (__fastcall *)(__int64))callback_uint8)((__int64)a1);
goto LABEL_7;
case -51:
((void (__fastcall *)(__int64))callback_uint16)((__int64)a1);
goto LABEL_7;
case -48:
((void (__fastcall *)(__int64))callback_int8)((__int64)a1);
goto LABEL_7;
case -47:
((void (__fastcall *)(__int64))callback_int16)((__int64)a1);
goto LABEL_7;
default:
result = 0LL;
break;
}
}
}
return result;
}

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

return_type: void

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 *v2; // rax
__int64 result; // rax
char v4[136]; // [rsp+0h] [rbp-88h] BYREF

v0 = (char *)fl_get_choice_text();
v1 = *_ctype_b_loc();
v2 = v4;
while ( (v1[*v0] & 0x800) != 0 )
{
*v2++ = *v0;
*v2 = 0;
++v0;
}
result = (unsigned int)(1000 * atoi(v4));
psr_srate = result;
return result;
}

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

v0 = (char *)fl_get_choice_text();
v1 = *_ctype_b_loc();
v2 = v4;
while ( (v1[*v0] & 0x800) != 0 )
{
*v2++ = *v0;
*v2 = 0;
++v0;
}
result = (unsigned int)(1000 * atoi(v4));
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:
char set_side_choice()
{
const char *v0; // rax
bool v1; // zf

v0 = (const char *)fl_get_choice_text();
if ( v0 )
{
if ( !strcmp(v0, "A") )
{
side = 3160641;
}
else
{
v1 = strcmp(v0, "B") == 0;
LOBYTE(v0) = !v1;
if ( v1 )
side = 3160642;
}
}
else
{
side = 3160641;
}
return (char)v0;
}

canonical_decompiled_code:
char func6()
{
const char *v0; // rax
bool v1; // zf

v0 = (const char *)fl_get_choice_text();
if ( v0 )
{
if ( !strcmp(v0, "A") )
{
side = 3160641;
}
else
{
v1 = strcmp(v0, "B") == 0;
LOBYTE(v0) = !v1;
if ( v1 )
side = 3160642;
}
}
else
{
side = 3160641;
}
return (char)v0;
}

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; // rbx
__int64 v1; // rbp
__int64 v2; // rbp
__int64 v3; // rbp
__int64 v4; // rbp
__int64 v5; // rbp
__int64 v6; // rbp
__int64 v7; // rbp
__int64 v8; // rbp
__int64 v9; // rbp
__int64 v10; // rbp

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

canonical_decompiled_code:
_QWORD *func0()
{
_QWORD *v0; // rbx
__int64 v1; // rbp
__int64 v2; // rbp
__int64 v3; // rbp
__int64 v4; // rbp
__int64 v5; // rbp
__int64 v6; // rbp
__int64 v7; // rbp
__int64 v8; // rbp
__int64 v9; // rbp
__int64 v10; // rbp

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

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


decompiled_code:
_QWORD *create_form_receiver_start()
{
_QWORD *v0; // rbx
__int64 v1; // rbp
__int64 v2; // rbp
__int64 v3; // rbp
__int64 v4; // rbp
__int64 v5; // rbp
__int64 v6; // rbp
__int64 v7; // rbp
__int64 v8; // rbp
__int64 v9; // rbp
__int64 v10; // rbp
__int64 v11; // rbp
__int64 v12; // rbp

v0 = (_QWORD *)fl_malloc(112LL);
v0[2] = 0LL;
v0[1] = 0LL;
v0[3] = 0LL;
*v0 = fl_bgn_form(0LL, 518LL, 302LL);
v1 = fl_add_box(1LL, 0LL, 0LL, 518LL, 302LL, "Integrated RA Receiver Startup");
v0[4] = v1;
fl_set_object_color(v1, 9LL, 11LL);
fl_set_object_lcol(v1, 3LL);
fl_set_object_lsize(v1, 18LL);
fl_set_object_lalign(v1, 8194LL);
fl_set_object_lstyle(v1, 1LL);
v2 = fl_add_button(0LL, 380LL, 10LL, 120LL, 40LL, "Start RA Receiver");
v0[5] = v2;
fl_set_object_boxtype(v2, 7LL);
fl_set_object_lsize(v2, 12LL);
fl_set_object_lalign(v2, 0LL);
fl_set_object_lstyle(v2, 1LL);
fl_set_object_callback(v2, &start_receiver, 0LL);
v3 = fl_add_text(0LL, 25LL, 210LL, 450LL, 30LL, "Science Radio Laboratories http://www.science-radio-labs.com");
fl_set_object_boxtype(v3, 6LL);
fl_set_object_color(v3, 18LL, 16LL);
fl_set_object_lsize(v3, 12LL);
fl_set_object_lstyle(v3, 3LL);
v4 = fl_add_input(0LL, 10LL, 140LL, 290LL, 30LL, "License Key");
v0[6] = v4;
fl_set_object_boxtype(v4, 7LL);
fl_set_object_lsize(v4, 12LL);
fl_set_object_lalign(v4, 2LL);
fl_set_object_lstyle(v4, 1LL);
fl_set_object_callback(v4, &input_license_key, 0LL);
fl_set_object_return(v4, 4LL);
v5 = fl_add_input(0LL, 240LL, 80LL, 110LL, 30LL, "Longitude");
v0[7] = v5;
fl_set_object_boxtype(v5, 7LL);
fl_set_object_lsize(v5, 12LL);
fl_set_object_lalign(v5, 2LL);
fl_set_object_lstyle(v5, 1LL);
fl_set_object_callback(v5, &set_longitude, 0LL);
fl_set_object_return(v5, 4LL);
v6 = fl_add_button(0LL, 420LL, 255LL, 70LL, 30LL, "HELP");
v0[8] = v6;
fl_set_object_color(v6, 10LL, 11LL);
fl_set_object_lsize(v6, 12LL);
fl_set_object_lalign(v6, 0LL);
fl_set_object_lstyle(v6, 1LL);
fl_set_object_callback(v6, &show_help, 0LL);
v7 = fl_add_choice(1LL, 160LL, 10LL, 90LL, 30LL, "RA Mode");
v0[9] = v7;
fl_set_object_boxtype(v7, 7LL);
fl_set_object_lsize(v7, 12LL);
fl_set_object_lalign(v7, 2LL);
fl_set_object_lstyle(v7, 1LL);
fl_set_object_callback(v7, &set_ra_mode, 0LL);
fl_addto_choice(v7, "manual");
fl_set_choice_item_mode(v7, 1LL, 0LL);
fl_addto_choice(v7, "transit");
fl_set_choice_item_mode(v7, 2LL, 0LL);
fl_addto_choice(v7, "external");
fl_set_choice_item_mode(v7, 3LL, 0LL);
fl_set_choice(v7, 1LL);
v8 = fl_add_choice(1LL, 260LL, 10LL, 90LL, 30LL, "DEC Mode");
v0[10] = v8;
fl_set_object_boxtype(v8, 7LL);
fl_set_object_lsize(v8, 12LL);
fl_set_object_lalign(v8, 2LL);
fl_set_object_lstyle(v8, 1LL);
fl_set_object_callback(v8, &set_dec_mode, 0LL);
fl_addto_choice(v8, "manual");
fl_set_choice_item_mode(v8, 1LL, 0LL);
fl_addto_choice(v8, "external");
fl_set_choice_item_mode(v8, 2LL, 0LL);
fl_set_choice(v8, 1LL);
v9 = fl_add_button(0LL, 400LL, 120LL, 100LL, 40LL, "EXIT");
fl_set_object_boxtype(v9, 7LL);
fl_set_object_lsize(v9, 14LL);
fl_set_object_lalign(v9, 0LL);
fl_set_object_lstyle(v9, 1LL);
fl_set_object_callback(v9, &exit_receiver, 0LL);
v10 = fl_add_choice(1LL, 20LL, 10LL, 130LL, 30LL, "Bandwidth");
v0[11] = v10;
fl_set_object_boxtype(v10, 7LL);
fl_set_object_lsize(v10, 14LL);
fl_set_object_lalign(v10, 2LL);
fl_set_object_lstyle(v10, 1LL);
fl_set_object_callback(v10, &select_bandwidth, 0LL);
v11 = fl_add_choice(1LL, 20LL, 80LL, 80LL, 30LL, "Side");
v0[12] = v11;
fl_set_object_lsize(v11, 14LL);
fl_set_object_lalign(v11, 2LL);
fl_set_object_lstyle(v11, 1LL);
fl_set_object_callback(v11, &set_side_choice, 0LL);
fl_addto_choice(v11, "A");
fl_addto_choice(v11, "B");
fl_set_choice(v11, 1LL);
v12 = fl_add_choice(1LL, 110LL, 80LL, 120LL, 30LL, "Mode");
v0[13] = v12;
fl_set_object_lsize(v12, 14LL);
fl_set_object_lalign(v12, 2LL);
fl_set_object_lstyle(v12, 1LL);
fl_set_object_callback(v12, &select_single, 0LL);
fl_addto_choice(v12, "single");
fl_addto_choice(v12, "interferometer");
fl_set_choice(v12, 1LL);
fl_end_form();
*(_QWORD *)*v0 = v0;
return v0;
}

canonical_decompiled_code:
_QWORD *func0()
{
_QWORD *v0; // rbx
__int64 v1; // rbp
__int64 v2; // rbp
__int64 v3; // rbp
__int64 v4; // rbp
__int64 v5; // rbp
__int64 v6; // rbp
__int64 v7; // rbp
__int64 v8; // rbp
__int64 v9; // rbp
__int64 v10; // rbp
__int64 v11; // rbp
__int64 v12; // rbp

v0 = (_QWORD *)fl_malloc(112LL);
v0[2] = 0LL;
v0[1] = 0LL;
v0[3] = 0LL;
*v0 = fl_bgn_form(0LL, 518LL, 302LL);
v1 = fl_add_box(1LL, 0LL, 0LL, 518LL, 302LL, "Integrated RA Receiver Startup");
v0[4] = v1;
fl_set_object_color(v1, 9LL, 11LL);
fl_set_object_lcol(v1, 3LL);
fl_set_object_lsize(v1, 18LL);
fl_set_object_lalign(v1, 8194LL);
fl_set_object_lstyle(v1, 1LL);
v2 = fl_add_button(0LL, 380LL, 10LL, 120LL, 40LL, "Start RA Receiver");
v0[5] = v2;
fl_set_object_boxtype(v2, 7LL);
fl_set_object_lsize(v2, 12LL);
fl_set_object_lalign(v2, 0LL);
fl_set_object_lstyle(v2, 1LL);
fl_set_object_callback(v2, &start_receiver, 0LL);
v3 = fl_add_text(0LL, 25LL, 210LL, 450LL, 30LL, "Science Radio Laboratories http://www.science-radio-labs.com");
fl_set_object_boxtype(v3, 6LL);
fl_set_object_color(v3, 18LL, 16LL);
fl_set_object_lsize(v3, 12LL);
fl_set_object_lstyle(v3, 3LL);
v4 = fl_add_input(0LL, 10LL, 140LL, 290LL, 30LL, "License Key");
v0[6] = v4;
fl_set_object_boxtype(v4, 7LL);
fl_set_object_lsize(v4, 12LL);
fl_set_object_lalign(v4, 2LL);
fl_set_object_lstyle(v4, 1LL);
fl_set_object_callback(v4, &input_license_key, 0LL);
fl_set_object_return(v4, 4LL);
v5 = fl_add_input(0LL, 240LL, 80LL, 110LL, 30LL, "Longitude");
v0[7] = v5;
fl_set_object_boxtype(v5, 7LL);
fl_set_object_lsize(v5, 12LL);
fl_set_object_lalign(v5, 2LL);
fl_set_object_lstyle(v5, 1LL);
fl_set_object_callback(v5, &set_longitude, 0LL);
fl_set_object_return(v5, 4LL);
v6 = fl_add_button(0LL, 420LL, 255LL, 70LL, 30LL, "HELP");
v0[8] = v6;
fl_set_object_color(v6, 10LL, 11LL);
fl_set_object_lsize(v6, 12LL);
fl_set_object_lalign(v6, 0LL);
fl_set_object_lstyle(v6, 1LL);
fl_set_object_callback(v6, &show_help, 0LL);
v7 = fl_add_choice(1LL, 160LL, 10LL, 90LL, 30LL, "RA Mode");
v0[9] = v7;
fl_set_object_boxtype(v7, 7LL);
fl_set_object_lsize(v7, 12LL);
fl_set_object_lalign(v7, 2LL);
fl_set_object_lstyle(v7, 1LL);
fl_set_object_callback(v7, &set_ra_mode, 0LL);
fl_addto_choice(v7, "manual");
fl_set_choice_item_mode(v7, 1LL, 0LL);
fl_addto_choice(v7, "transit");
fl_set_choice_item_mode(v7, 2LL, 0LL);
fl_addto_choice(v7, "external");
fl_set_choice_item_mode(v7, 3LL, 0LL);
fl_set_choice(v7, 1LL);
v8 = fl_add_choice(1LL, 260LL, 10LL, 90LL, 30LL, "DEC Mode");
v0[10] = v8;
fl_set_object_boxtype(v8, 7LL);
fl_set_object_lsize(v8, 12LL);
fl_set_object_lalign(v8, 2LL);
fl_set_object_lstyle(v8, 1LL);
fl_set_object_callback(v8, &set_dec_mode, 0LL);
fl_addto_choice(v8, "manual");
fl_set_choice_item_mode(v8, 1LL, 0LL);
fl_addto_choice(v8, "external");
fl_set_choice_item_mode(v8, 2LL, 0LL);
fl_set_choice(v8, 1LL);
v9 = fl_add_button(0LL, 400LL, 120LL, 100LL, 40LL, "EXIT");
fl_set_object_boxtype(v9, 7LL);
fl_set_object_lsize(v9, 14LL);
fl_set_object_lalign(v9, 0LL);
fl_set_object_lstyle(v9, 1LL);
fl_set_object_callback(v9, &exit_receiver, 0LL);
v10 = fl_add_choice(1LL, 20LL, 10LL, 130LL, 30LL, "Bandwidth");
v0[11] = v10;
fl_set_object_boxtype(v10, 7LL);
fl_set_object_lsize(v10, 14LL);
fl_set_object_lalign(v10, 2LL);
fl_set_object_lstyle(v10, 1LL);
fl_set_object_callback(v10, &select_bandwidth, 0LL);
v11 = fl_add_choice(1LL, 20LL, 80LL, 80LL, 30LL, "Side");
v0[12] = v11;
fl_set_object_lsize(v11, 14LL);
fl_set_object_lalign(v11, 2LL);
fl_set_object_lstyle(v11, 1LL);
fl_set_object_callback(v11, &set_side_choice, 0LL);
fl_addto_choice(v11, "A");
fl_addto_choice(v11, "B");
fl_set_choice(v11, 1LL);
v12 = fl_add_choice(1LL, 110LL, 80LL, 120LL, 30LL, "Mode");
v0[13] = v12;
fl_set_object_lsize(v12, 14LL);
fl_set_object_lalign(v12, 2LL);
fl_set_object_lstyle(v12, 1LL);
fl_set_object_callback(v12, &select_single, 0LL);
fl_addto_choice(v12, "single");
fl_addto_choice(v12, "interferometer");
fl_set_choice(v12, 1LL);
fl_end_form();
*(_QWORD *)*v0 = v0;
return v0;
}

original_code:
FD_receiver_start *
create_form_receiver_start( void )
{
    FL_OBJECT *obj;
    FD_receiver_start *fdui = fl_malloc( sizeof *fdui );
    fdui->vdata = fdui->cdata = ((void *)0);
    fdui->ldata = 0;
    fdui->receiver_start = fl_bgn_form( FL_NO_BOX, 518, 302 );
    fdui->receiver_starter = obj = fl_add_box( FL_UP_BOX, 0, 0, 518, 302, "Integrated RA Receiver Startup" );
    fl_set_object_color( obj, FL_INDIANRED, FL_COL1 );
    fl_set_object_lcol( obj, FL_YELLOW );
    fl_set_object_lsize( obj, 18 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM | FL_ALIGN_INSIDE );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fdui->start_button = obj = fl_add_button( FL_NORMAL_BUTTON, 380, 10, 120, 40, "Start RA Receiver" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, start_receiver, 0 );
    obj = fl_add_text( FL_NORMAL_TEXT, 25, 210, 450, 30, "Science Radio Laboratories  http://www.science-radio-labs.com" );
    fl_set_object_boxtype( obj, FL_ROUNDED_BOX );
    fl_set_object_color( obj, FL_PALEGREEN, FL_MCOL );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lstyle( obj, FL_BOLDITALIC_STYLE );
    fdui->license_input = obj = fl_add_input( FL_NORMAL_INPUT, 10, 140, 290, 30, "License Key" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, input_license_key, 0 );
    fl_set_object_return( obj, 4U );
    fdui->longitude_input = obj = fl_add_input( FL_NORMAL_INPUT, 240, 80, 110, 30, "Longitude" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_longitude, 0 );
    fl_set_object_return( obj, 4U );
    fdui->help_button = obj = fl_add_button( FL_NORMAL_BUTTON, 420, 255, 70, 30, "HELP" );
    fl_set_object_color( obj, FL_SLATEBLUE, FL_COL1 );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, show_help, 0 );
    fdui->ra_choice = obj = fl_add_choice( FL_NORMAL_CHOICE2, 160, 10, 90, 30, "RA Mode" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_ra_mode, 0 );
    fl_addto_choice( obj, "manual" );
    fl_set_choice_item_mode( obj, 1, FL_PUP_NONE );
    fl_addto_choice( obj, "transit" );
    fl_set_choice_item_mode( obj, 2, FL_PUP_NONE );
    fl_addto_choice( obj, "external" );
    fl_set_choice_item_mode( obj, 3, FL_PUP_NONE );
    fl_set_choice( obj, 1 );
    fdui->dec_choice = obj = fl_add_choice( FL_NORMAL_CHOICE2, 260, 10, 90, 30, "DEC Mode" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_dec_mode, 0 );
    fl_addto_choice( obj, "manual" );
    fl_set_choice_item_mode( obj, 1, FL_PUP_NONE );
    fl_addto_choice( obj, "external" );
    fl_set_choice_item_mode( obj, 2, FL_PUP_NONE );
    fl_set_choice( obj, 1 );
    obj = fl_add_button( FL_NORMAL_BUTTON, 400, 120, 100, 40, "EXIT" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    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, exit_receiver, 0 );
    fdui->bw_choice = obj = fl_add_choice( FL_NORMAL_CHOICE2, 20, 10, 130, 30, "Bandwidth" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, select_bandwidth, 0 );
    fdui->side_choice = obj = fl_add_choice( FL_NORMAL_CHOICE2, 20, 80, 80, 30, "Side" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_side_choice, 0 );
    fl_addto_choice( obj, "A" );
    fl_addto_choice( obj, "B" );
    fl_set_choice( obj, 1 );
    fdui->rcvr_mode = obj = fl_add_choice( FL_NORMAL_CHOICE2, 110, 80, 120, 30, "Mode" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, select_single, 0 );
    fl_addto_choice( obj, "single" );
    fl_addto_choice( obj, "interferometer" );
    fl_set_choice( obj, 1 );
    fl_end_form( );
    fdui->receiver_start->fdui = fdui;
    return fdui;
}

canonical_original_code:
struct FD_receiver_start *create_form_receiver_start()
{
    struct FL_OBJECT_ *obj;
    struct FD_receiver_start *fdui = fl_malloc( sizeof *fdui );
    fdui->vdata = fdui->cdata = ((void *)0);
    fdui->ldata = 0;
    fdui->receiver_start = fl_bgn_form( FL_NO_BOX, 518, 302 );
    fdui->receiver_starter = obj = fl_add_box( FL_UP_BOX, 0, 0, 518, 302, "Integrated RA Receiver Startup" );
    fl_set_object_color( obj, FL_INDIANRED, FL_COL1 );
    fl_set_object_lcol( obj, FL_YELLOW );
    fl_set_object_lsize( obj, 18 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM | FL_ALIGN_INSIDE );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fdui->start_button = obj = fl_add_button( FL_NORMAL_BUTTON, 380, 10, 120, 40, "Start RA Receiver" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, start_receiver, 0 );
    obj = fl_add_text( FL_NORMAL_TEXT, 25, 210, 450, 30, "Science Radio Laboratories  http://www.science-radio-labs.com" );
    fl_set_object_boxtype( obj, FL_ROUNDED_BOX );
    fl_set_object_color( obj, FL_PALEGREEN, FL_MCOL );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lstyle( obj, FL_BOLDITALIC_STYLE );
    fdui->license_input = obj = fl_add_input( FL_NORMAL_INPUT, 10, 140, 290, 30, "License Key" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, input_license_key, 0 );
    fl_set_object_return( obj, 4U );
    fdui->longitude_input = obj = fl_add_input( FL_NORMAL_INPUT, 240, 80, 110, 30, "Longitude" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_longitude, 0 );
    fl_set_object_return( obj, 4U );
    fdui->help_button = obj = fl_add_button( FL_NORMAL_BUTTON, 420, 255, 70, 30, "HELP" );
    fl_set_object_color( obj, FL_SLATEBLUE, FL_COL1 );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_CENTER );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, show_help, 0 );
    fdui->ra_choice = obj = fl_add_choice( FL_NORMAL_CHOICE2, 160, 10, 90, 30, "RA Mode" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_ra_mode, 0 );
    fl_addto_choice( obj, "manual" );
    fl_set_choice_item_mode( obj, 1, FL_PUP_NONE );
    fl_addto_choice( obj, "transit" );
    fl_set_choice_item_mode( obj, 2, FL_PUP_NONE );
    fl_addto_choice( obj, "external" );
    fl_set_choice_item_mode( obj, 3, FL_PUP_NONE );
    fl_set_choice( obj, 1 );
    fdui->dec_choice = obj = fl_add_choice( FL_NORMAL_CHOICE2, 260, 10, 90, 30, "DEC Mode" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 12 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_dec_mode, 0 );
    fl_addto_choice( obj, "manual" );
    fl_set_choice_item_mode( obj, 1, FL_PUP_NONE );
    fl_addto_choice( obj, "external" );
    fl_set_choice_item_mode( obj, 2, FL_PUP_NONE );
    fl_set_choice( obj, 1 );
    obj = fl_add_button( FL_NORMAL_BUTTON, 400, 120, 100, 40, "EXIT" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    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, exit_receiver, 0 );
    fdui->bw_choice = obj = fl_add_choice( FL_NORMAL_CHOICE2, 20, 10, 130, 30, "Bandwidth" );
    fl_set_object_boxtype( obj, FL_EMBOSSED_BOX );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, select_bandwidth, 0 );
    fdui->side_choice = obj = fl_add_choice( FL_NORMAL_CHOICE2, 20, 80, 80, 30, "Side" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, set_side_choice, 0 );
    fl_addto_choice( obj, "A" );
    fl_addto_choice( obj, "B" );
    fl_set_choice( obj, 1 );
    fdui->rcvr_mode = obj = fl_add_choice( FL_NORMAL_CHOICE2, 110, 80, 120, 30, "Mode" );
    fl_set_object_lsize( obj, 14 );
    fl_set_object_lalign( obj, FL_ALIGN_BOTTOM );
    fl_set_object_lstyle( obj, FL_BOLD_STYLE );
    fl_set_object_callback( obj, select_single, 0 );
    fl_addto_choice( obj, "single" );
    fl_addto_choice( obj, "interferometer" );
    fl_set_choice( obj, 1 );
    fl_end_form( );
    fdui->receiver_start->fdui = fdui;
    return fdui;
}

variable_types: struct FD_receiver_start { 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; } *receiver_start; void *vdata; char *cdata; long ldata; struct FL_OBJECT_ *receiver_starter; struct FL_OBJECT_ *start_button; struct FL_OBJECT_ *license_input; struct FL_OBJECT_ *longitude_input; struct FL_OBJECT_ *help_button; struct FL_OBJECT_ *ra_choice; struct FL_OBJECT_ *dec_choice; struct FL_OBJECT_ *bw_choice; struct FL_OBJECT_ *side_choice; struct FL_OBJECT_ *rcvr_mode; } *

user_defined_types: struct FD_receiver_start { struct FL_FORM_ *receiver_start; void *vdata; char *cdata; long ldata; struct FL_OBJECT_ *receiver_starter; struct FL_OBJECT_ *start_button; struct FL_OBJECT_ *license_input; struct FL_OBJECT_ *longitude_input; struct FL_OBJECT_ *help_button; struct FL_OBJECT_ *ra_choice; struct FL_OBJECT_ *dec_choice; struct FL_OBJECT_ *bw_choice; struct FL_OBJECT_ *side_choice; struct FL_OBJECT_ *rcvr_mode; }


displayRoom

repo: pathawks/Castle

decompiled_code:
int __fastcall displayRoom(void *ptr)
{
char *v1; // rbx
char *v2; // rbx
int result; // eax

v1 = (char *)ptr;
do
{
fwrite(v1, 0x18uLL, 1uLL, stdout);
fputc(10, stdout);
v1 += 24;
}
while ( v1 != (char *)ptr + 432 );
v2 = (char *)ptr + 432;
do
{
fwrite(v2, 0x19uLL, 1uLL, stdout);
result = fputc(10, stdout);
v2 += 25;
}
while ( v2 != (char *)ptr + 557 );
return result;
}

canonical_decompiled_code:
int __fastcall func7(void *ptr)
{
char *v1; // rbx
char *v2; // rbx
int result; // eax

v1 = (char *)ptr;
do
{
fwrite(v1, 0x18uLL, 1uLL, stdout);
fputc(10, stdout);
v1 += 24;
}
while ( v1 != (char *)ptr + 432 );
v2 = (char *)ptr + 432;
do
{
fwrite(v2, 0x19uLL, 1uLL, stdout);
result = fputc(10, stdout);
v2 += 25;
}
while ( v2 != (char *)ptr + 557 );
return result;
}

original_code:
void displayRoom( Room *map ) {
 for (int i = 0; i < 18; ++i) {
  fwrite(map->map[i], 24, 1, stdout);
  fputc('\n', stdout);
 }
 for (int i = 0; i < 5; ++i) {
  fwrite(map->description[i], 25, 1, stdout);
  fputc('\n', stdout);
 }
}

canonical_original_code:
void displayRoom(struct Room *map) {
 for (int i = 0; i < 18; ++i) {
  fwrite(map->map[i], 24, 1, stdout);
  fputc('\n', stdout);
 }
 for (int i = 0; i < 5; ++i) {
  fwrite(map->description[i], 25, 1, stdout);
  fputc('\n', stdout);
 }
}

variable_types: struct Room { char map[18][24]; char description[5][25]; char nav[18]; } *

variable_types: i int


SystemPause

decompiled_code:
int SystemPause()
{
int result; // eax

puts("\nPress Enter to continue...");
do
result = getchar();
while ( result != 10 );
return result;
}

canonical_decompiled_code:
int func9()
{
int result; // eax

puts("\nPress Enter to continue...");
do
result = getchar();
while ( result != 10 );
return result;
}

original_code:
void SystemPause() {
 puts("\nPress Enter to continue...");
 while (getchar() != '\n') {}
}


SystemClear

decompiled_code:
size_t SystemClear()
{
return fwrite("\x1B[2J\x1B[H", 1uLL, 7uLL, stdout);
}

canonical_decompiled_code:
size_t func10()
{
return fwrite("\x1B[2J\x1B[H", 1uLL, 7uLL, stdout);
}

original_code:
void SystemClear() {
 fputs("\033[2J\033[H", stdout);
}


addString

repo: patrickherrmann/BoggleOptimization

original_code:
void addString(Trie *node, char *string)
{
   int i = 0, childExists = 0;
   char letter;
   Trie *child;
   if (*string) {
      letter = tolower(*string);
      while (!childExists && i < node->childCount) {
         child = node->children + i++;
         if (child->letter == letter) {
            childExists = 1;
         }
      }
      if (!childExists) {
         node->children =
            realloc(node->children, sizeof(Trie) * (node->childCount + 1));
         child = node->children + node->childCount++;
         child->letter = letter;
         child->childCount = 0;
         child->children = ((void *)0);
         child->terminates = 0;
      }
      addString(child, string + 1);
   } else {
      node->terminates = 1;
   }
}

canonical_original_code:
void addString(struct Trie *node, char *string)
{
   int i = 0; int childExists = 0;
   char letter;
   struct Trie *child;
   if (*string) {
      letter = tolower(*string);
      while (!childExists && i < node->childCount) {
         child = node->children + i++;
         if (child->letter == letter) {
            childExists = 1;
         }
      }
      if (!childExists) {
         node->children =
            realloc(node->children, sizeof(Trie) * (node->childCount + 1));
         child = node->children + node->childCount++;
         child->letter = letter;
         child->childCount = 0;
         child->children = ((void *)0);
         child->terminates = 0;
      }
      addString(child, string + 1);
   } else {
      node->terminates = 1;
   }
}

variable_types: struct Trie { char letter; int terminates; int score; int childCount; unsigned int foundInBoard; struct Trie *children; } *

variable_types:
string
char *

variable_types: childExists int

variable_types: letter char


destroyNode

original_code:
void destroyNode(Trie *node)
{
   int i;
   for (i = 0; i < node->childCount; i++)
      destroyNode(node->children + i);
   free(node->children);
}

canonical_original_code:
void destroyNode(struct Trie *node)
{
   int i;
   for (i = 0; i < node->childCount; i++)
      destroyNode(node->children + i);
   free(node->children);
}

user_defined_types: struct Trie { char letter; int terminates; int score; int childCount; unsigned int foundInBoard; struct Trie *children; }


TrieDestroy

decompiled_code:
void __fastcall TrieDestroy(void *ptr)
{
destroyNode((__int64)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func10(void *ptr)
{
func9((__int64)ptr);
free(ptr);
}

original_code:
void TrieDestroy(Trie *trie)
{
   destroyNode(trie);
   free(trie);
}

canonical_original_code:
void TrieDestroy(struct Trie *trie)
{
   destroyNode(trie);
   free(trie);
}


TrieGetChild

decompiled_code:
char *__fastcall TrieGetChild(__int64 a1, char a2)
{
int v3; // ecx
int v4; // esi
int v5; // eax
char *v6; // rdx

v3 = *(_DWORD *)(a1 + 12) - 1;
if ( v3 < 0 )
return 0LL;
v4 = 0;
do
{
v5 = (v4 + v3) / 2;
v6 = (char *)(*(_QWORD *)(a1 + 24) + 32LL * v5);
if ( *v6 >= a2 )
{
if ( *v6 <= a2 )
return v6;
v3 = v5 - 1;
}
else
{
v4 = v5 + 1;
}
}
while ( v4 <= v3 );
return 0LL;
}

original_code:
Trie *TrieGetChild(Trie *trie, char letter)
{
   int min, max, mid;
   char childLetter;
   min = 0;
   max = trie->childCount - 1;
   while (max >= min) {
      mid = (min + max) / 2;
      childLetter = trie->children[mid].letter;
      if (childLetter < letter)
         min = mid + 1;
      else if (childLetter > letter)
         max = mid - 1;
      else
         return trie->children + mid;
   }
   return ((void *)0);
}

canonical_original_code:
struct Trie *TrieGetChild(struct Trie *trie, char letter)
{
   int min; int max; int mid;
   char childLetter;
   min = 0;
   max = trie->childCount - 1;
   while (max >= min) {
      mid = (min + max) / 2;
      childLetter = trie->children[mid].letter;
      if (childLetter < letter)
         min = mid + 1;
      else if (childLetter > letter)
         max = mid - 1;
      else
         return trie->children + mid;
   }
   return ((void *)0);
}

variable_types:
trie
struct Trie *

variable_types: min int

variable_types: max int

variable_types: mid int

variable_types: childLetter char

return_type: struct Trie { char letter; int terminates; int score; int childCount; unsigned int foundInBoard; struct Trie *children; } *


newBoard

decompiled_code:
_DWORD *newBoard()
{
_DWORD *result; // rax

result = freeList;
if ( freeList )
freeList = (void *)*((_QWORD *)freeList + 4);
else
result = malloc(0x28uLL);
result[5] = 0;
result[4] = 0;
return result;
}

canonical_decompiled_code:
_DWORD *func1()
{
_DWORD *result; // rax

result = freeList;
if ( freeList )
freeList = (void *)*((_QWORD *)freeList + 4);
else
result = malloc(0x28uLL);
result[5] = 0;
result[4] = 0;
return result;
}

original_code:
static Board *newBoard()
{
   Board *new;
   if (freeList) {
      new = freeList;
      freeList = new->next;
   } else {
      new = malloc(sizeof(Board));
   }
   new->score = 0;
   new->wordCount = 0;
   return new;
}

canonical_original_code:
static struct Board *newBoard()
{
   struct Board *new;
   if (freeList) {
      new = freeList;
      freeList = new->next;
   } else {
      new = malloc(sizeof(Board));
   }
   new->score = 0;
   new->wordCount = 0;
   return new;
}

variable_types: struct Board { char letters[4][4]; int wordCount; int score; unsigned long id; struct Board *next; } *


WordScore

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

switch ( a1 )
{
case 0:
case 1:
case 2:
result = 0LL;
break;
case 3:
case 4:
result = 1LL;
break;
case 5:
result = 2LL;
break;
case 6:
result = 3LL;
break;
case 7:
result = 5LL;
break;
default:
result = 11LL;
break;
}
return result;
}

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

switch ( a1 )
{
case 0:
case 1:
case 2:
result = 0LL;
break;
case 3:
case 4:
result = 1LL;
break;
case 5:
result = 2LL;
break;
case 6:
result = 3LL;
break;
case 7:
result = 5LL;
break;
default:
result = 11LL;
break;
}
return result;
}

original_code:
int WordScore(int wordLength)
{
   switch (wordLength) {
      case 0:
      case 1:
      case 2: return 0;
      case 3:
      case 4: return 1;
      case 5: return 2;
      case 6: return 3;
      case 7: return 5;
      default: return 11;
   }
}

variable_types: wordLength int


BoardWordCount

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

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

original_code:
int BoardWordCount(Board *board)
{
   return board->wordCount;
}

canonical_original_code:
int BoardWordCount(struct Board *board)
{
   return board->wordCount;
}

user_defined_types: struct Board { char letters[4][4]; int wordCount; int score; unsigned long id; struct Board *next; }


BoardScore

decompiled_code:
__int64 __fastcall BoardScore(__int64 a1)
{
return *(unsigned int *)(a1 + 20);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1)
{
return *(unsigned int *)(a1 + 20);
}

original_code:
int BoardScore(Board *board)
{
   return board->score;
}

canonical_original_code:
int BoardScore(struct Board *board)
{
   return board->score;
}


BoardGarbageCollect

decompiled_code:
void BoardGarbageCollect()
{
_QWORD *v0; // rbx
void *v1; // rdi

v0 = freeList;
if ( freeList )
{
do
{
v1 = v0;
v0 = (_QWORD *)v0[4];
free(v1);
freeList = v0;
}
while ( v0 );
}
}

canonical_decompiled_code:
void func11()
{
_QWORD *v0; // rbx
void *v1; // rdi

v0 = freeList;
if ( freeList )
{
do
{
v1 = v0;
v0 = (_QWORD *)v0[4];
free(v1);
freeList = v0;
}
while ( v0 );
}
}

original_code:
void BoardGarbageCollect()
{
   Board *temp;
   while (freeList) {
      temp = freeList->next;
      free(freeList);
      freeList = temp;
   }
}

canonical_original_code:
void BoardGarbageCollect()
{
   struct Board *temp;
   while (freeList) {
      temp = freeList->next;
      free(freeList);
      freeList = temp;
   }
}


newNode

decompiled_code:
void *newNode()
{
void *result; // rax

result = freeNodes;
if ( !freeNodes )
return malloc(0x20uLL);
freeNodes = (void *)*((_QWORD *)freeNodes + 2);
return result;
}

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

result = freeNodes;
if ( !freeNodes )
return malloc(0x20uLL);
freeNodes = (void *)*((_QWORD *)freeNodes + 2);
return result;
}

original_code:
static PointTree *newNode()
{
   PointTree *new;
   if (freeNodes) {
      new = freeNodes;
      freeNodes = new->sib;
   } else {
      new = malloc(sizeof(PointTree));
   }
   return new;
}

canonical_original_code:
static struct PointTree *newNode()
{
   struct PointTree *new;
   if (freeNodes) {
      new = freeNodes;
      freeNodes = new->sib;
   } else {
      new = malloc(sizeof(PointTree));
   }
   return new;
}

variable_types: struct PointTree { int row; int col; struct PointTree *parent; struct PointTree *sib; struct PointTree *child; } *


PointTreeInit

decompiled_code:
_DWORD *PointTreeInit()
{
_DWORD *result; // rax

result = newNode();
*result = -1;
result[1] = -1;
*((_QWORD *)result + 1) = 0LL;
*((_QWORD *)result + 2) = 0LL;
*((_QWORD *)result + 3) = 0LL;
return result;
}

canonical_decompiled_code:
_DWORD *func2()
{
_DWORD *result; // rax

result = func1();
*result = -1;
result[1] = -1;
*((_QWORD *)result + 1) = 0LL;
*((_QWORD *)result + 2) = 0LL;
*((_QWORD *)result + 3) = 0LL;
return result;
}

original_code:
PointTree *PointTreeInit()
{
   PointTree *root = newNode();
   root->row = -1;
   root->col = -1;
   root->parent = ((void *)0);
   root->sib = ((void *)0);
   root->child = ((void *)0);
   return root;
}

canonical_original_code:
struct PointTree *PointTreeInit()
{
   struct PointTree *root = newNode();
   root->row = -1;
   root->col = -1;
   root->parent = ((void *)0);
   root->sib = ((void *)0);
   root->child = ((void *)0);
   return root;
}

return_type: struct PointTree { int row; int col; struct PointTree *parent; struct PointTree *sib; struct PointTree *child; } *


PointTreeGarbageCollect

decompiled_code:
void PointTreeGarbageCollect()
{
_QWORD *v0; // rbx
void *v1; // rdi

v0 = freeNodes;
if ( freeNodes )
{
do
{
v1 = v0;
v0 = (_QWORD *)v0[2];
free(v1);
freeNodes = v0;
}
while ( v0 );
}
}

canonical_decompiled_code:
void func4()
{
_QWORD *v0; // rbx
void *v1; // rdi

v0 = freeNodes;
if ( freeNodes )
{
do
{
v1 = v0;
v0 = (_QWORD *)v0[2];
free(v1);
freeNodes = v0;
}
while ( v0 );
}
}

original_code:
void PointTreeGarbageCollect()
{
   PointTree *temp;
   while (freeNodes) {
      temp = freeNodes->sib;
      free(freeNodes);
      freeNodes = temp;
   }
}

canonical_original_code:
void PointTreeGarbageCollect()
{
   struct PointTree *temp;
   while (freeNodes) {
      temp = freeNodes->sib;
      free(freeNodes);
      freeNodes = temp;
   }
}

user_defined_types: struct PointTree { int row; int col; struct PointTree *parent; struct PointTree *sib; struct PointTree *child; }


PointTreeAdd

decompiled_code:
__int64 __fastcall PointTreeAdd(__int64 a1, int a2, int a3)
{
_QWORD *v4; // rdx
__int64 result; // rax
__int64 v6; // rcx

v4 = newNode();
v4[1] = *(_QWORD *)a1;
v4[3] = 0LL;
v4[2] = 0LL;
*(_DWORD *)v4 = a2;
*((_DWORD *)v4 + 1) = a3;
result = *(_QWORD *)(*(_QWORD *)a1 + 24LL);
if ( result )
{
do
{
v6 = result;
result = *(_QWORD *)(result + 16);
}
while ( result );
*(_QWORD *)(v6 + 16) = v4;
}
else
{
*(_QWORD *)(*(_QWORD *)a1 + 24LL) = v4;
}
*(_QWORD *)a1 = v4;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, int a2, int a3)
{
_QWORD *v4; // rdx
__int64 result; // rax
__int64 v6; // rcx

v4 = func1();
v4[1] = *(_QWORD *)a1;
v4[3] = 0LL;
v4[2] = 0LL;
*(_DWORD *)v4 = a2;
*((_DWORD *)v4 + 1) = a3;
result = *(_QWORD *)(*(_QWORD *)a1 + 24LL);
if ( result )
{
do
{
v6 = result;
result = *(_QWORD *)(result + 16);
}
while ( result );
*(_QWORD *)(v6 + 16) = v4;
}
else
{
*(_QWORD *)(*(_QWORD *)a1 + 24LL) = v4;
}
*(_QWORD *)a1 = v4;
return result;
}

original_code:
void PointTreeAdd(PointTree **tree, int row, int col)
{
   PointTree *new = newNode(), *child;
   new->parent = *tree;
   new->child = ((void *)0);
   new->sib = ((void *)0);
   new->row = row;
   new->col = col;
   if (!(*tree)->child) {
      (*tree)->child = new;
   } else {
      child = (*tree)->child;
      while (child->sib)
         child = child->sib;
      child->sib = new;
   }
   *tree = new;
}

canonical_original_code:
void PointTreeAdd(struct PointTree **tree, int row, int col)
{
   struct PointTree *new = newNode(); struct PointTree *child;
   new->parent = *tree;
   new->child = ((void *)0);
   new->sib = ((void *)0);
   new->row = row;
   new->col = col;
   if (!(*tree)->child) {
      (*tree)->child = new;
   } else {
      child = (*tree)->child;
      while (child->sib)
         child = child->sib;
      child->sib = new;
   }
   *tree = new;
}

variable_types: struct PointTree { int row; int col; struct PointTree *parent; struct PointTree *sib; struct PointTree *child; } **

variable_types: row int

variable_types: col int


PointTreePathContains

decompiled_code:
__int64 __fastcall PointTreePathContains(__int64 a1, int a2, int a3)
{
if ( !a1 )
return 0LL;
do
{
if ( *(_DWORD *)a1 == a2 && *(_DWORD *)(a1 + 4) == a3 )
return 1LL;
a1 = *(_QWORD *)(a1 + 8);
}
while ( a1 );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, int a2, int a3)
{
if ( !a1 )
return 0LL;
do
{
if ( *(_DWORD *)a1 == a2 && *(_DWORD *)(a1 + 4) == a3 )
return 1LL;
a1 = *(_QWORD *)(a1 + 8);
}
while ( a1 );
return 0LL;
}

original_code:
int PointTreePathContains(PointTree *tree, int row, int col)
{
   int found = 0;
   while (!found && tree) {
      if (tree->row == row && tree->col == col)
         found = 1;
      else
         tree = tree->parent;
   }
   return found;
}

canonical_original_code:
int PointTreePathContains(struct PointTree *tree, int row, int col)
{
   int found = 0;
   while (!found && tree) {
      if (tree->row == row && tree->col == col)
         found = 1;
      else
         tree = tree->parent;
   }
   return found;
}

variable_types: found int


getPixel

repo: patrickherrmann/Mandelbrot

decompiled_code:
__int64 __fastcall getPixel(__int64 a1, int a2, int a3)
{
return *(_QWORD *)a1 + 3 * (a2 + (__int64)(*(_DWORD *)(a1 + 8) * a3));
}

original_code:
pixel_t *getPixel(bitmap_t *bitmap, int x, int y) {
    return bitmap->pixels + y * bitmap->width + x;
}

canonical_original_code:
struct pixel_t *getPixel(struct bitmap_t *bitmap, int x, int y) {
    return bitmap->pixels + y * bitmap->width + x;
}

variable_types: struct bitmap_t { struct pixel_t *pixels; int width; int height; } *

variable_types: x int

variable_types: y int

return_type: struct pixel_t { unsigned char r; unsigned char g; unsigned char b; } *


resample

original_code:
void resample(bitmap_t *image, bitmap_t *resampled, int boxSize) {
    int r, g, b;
    int x, y, ix, iy, bs2 = boxSize * boxSize;
    pixel_t *p;
    for (y = 0; y < resampled->height; y++) {
        for (x = 0; x < resampled->width; x++) {
            r = g = b = 0;
            for (iy = 0; iy < boxSize; iy++) {
                for (ix = 0; ix < boxSize; ix++) {
                    p = getPixel(image, x * boxSize + ix, y * boxSize + iy);
                    r += p->r;
                    g += p->g;
                    b += p->b;
                }
            }
            p = getPixel(resampled, x, y);
            p->r = r / bs2;
            p->g = g / bs2;
            p->b = b / bs2;
        }
    }
}

canonical_original_code:
void resample(struct bitmap_t *image, struct bitmap_t *resampled, int boxSize) {
    int r; int g; int b;
    int x; int y; int ix; int iy; int bs2 = boxSize * boxSize;
    struct pixel_t *p;
    for (y = 0; y < resampled->height; y++) {
        for (x = 0; x < resampled->width; x++) {
            r = g = b = 0;
            for (iy = 0; iy < boxSize; iy++) {
                for (ix = 0; ix < boxSize; ix++) {
                    p = getPixel(image, x * boxSize + ix, y * boxSize + iy);
                    r += p->r;
                    g += p->g;
                    b += p->b;
                }
            }
            p = getPixel(resampled, x, y);
            p->r = r / bs2;
            p->g = g / bs2;
            p->b = b / bs2;
        }
    }
}

variable_types: struct bitmap_t { struct pixel_t { unsigned char r; unsigned char g; unsigned char b; } *pixels; int width; int height; } *

variable_types:
resampled
struct bitmap_t *

variable_types: boxSize int

variable_types: r int

variable_types: g int

variable_types: b int

variable_types: ix int

variable_types: iy int

user_defined_types: struct bitmap_t { struct pixel_t *pixels; int width; int height; }


bitmapGC

decompiled_code:
void __fastcall bitmapGC(void *ptr)
{
free(*(void **)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func3(void *ptr)
{
free(*(void **)ptr);
free(ptr);
}

original_code:
void bitmapGC(bitmap_t *bitmap) {
    free(bitmap->pixels);
    free(bitmap);
}

canonical_original_code:
void bitmapGC(struct bitmap_t *bitmap) {
    free(bitmap->pixels);
    free(bitmap);
}

user_defined_types: struct pixel_t { unsigned char r; unsigned char g; unsigned char b; }