decompiled_code:
__int64 who_begins()
{
char v0; // al
__int64 result; // rax

printw("Do you want to play first ? y/N\n");
v0 = wgetch(stdscr);
if ( v0 == 121 )
{
printw("You choose to play first\n");
player(16);
result = 0LL;
}
else
{
if ( v0 == 78 )
{
printw("You choose to play after the IA\n");
comp_ia(16);
}
else
{
printw("Choose y or N please\n");
who_begins();
}
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 func2()
{
char v0; // al
__int64 result; // rax

printw("Do you want to play first ? y/N\n");
v0 = wgetch(stdscr);
if ( v0 == 121 )
{
printw("You choose to play first\n");
func1(16);
result = 0LL;
}
else
{
if ( v0 == 78 )
{
printw("You choose to play after the IA\n");
func0(16);
}
else
{
printw("Choose y or N please\n");
func2();
}
result = 0LL;
}
return result;
}

original_code:
int who_begins()
{
  char choice;
  printw("Do you want to play first ? y/N\n");
  choice = wgetch(stdscr);
  if (choice == 'y')
    {
      printw("You choose to play first\n");
      player(16);
    }
  else if (choice == 'N')
    {
      printw("You choose to play after the IA\n");
      comp_ia(16);
    }
  else
    {
      printw("Choose y or N please\n");
      who_begins();
    }
  return (0);
}

variable_types: choice char


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
initscr();
raw();
noecho();
who_begins();
endwin();
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
initscr();
raw();
noecho();
func2();
endwin();
return 0;
}

original_code:
int main(int ac, char **av)
{
  initscr();
  raw();
  noecho();
  who_begins();
  endwin();
  return (0);
}

variable_types: ac int

variable_types:
av
char **

return_type: int


sqroot

repo: theaudiobible/de-ess

original_code:
unsigned long long sqroot( unsigned long long num ) {
 unsigned long long l2, u, v, u2, n;
 if( 2 > num ) return( num );
 u = num;
 l2 = 0;
 while( u >>= 2 ) l2++;
 u = 1L << l2;
 v = u;
 u2 = u << l2;
 while( l2-- ) {
  v >>= 1;
  n = (u + u + v) << l2;
  n += u2;
  if( n <= num ) {
   u += v;
   u2 = n;
  }
 }
 return( u );
}

canonical_original_code:
unsigned long long sqroot(unsigned long long num) {
 unsigned long long l2; unsigned long long u; unsigned long long v; unsigned long long u2; unsigned long long n;
 if( 2 > num ) return( num );
 u = num;
 l2 = 0;
 while( u >>= 2 ) l2++;
 u = 1L << l2;
 v = u;
 u2 = u << l2;
 while( l2-- ) {
  v >>= 1;
  n = (u + u + v) << l2;
  n += u2;
  if( n <= num ) {
   u += v;
   u2 = n;
  }
 }
 return( u );
}

variable_types:
num
unsigned long long

variable_types:
u
unsigned long long

variable_types:
v
unsigned long long

variable_types:
n
unsigned long long

return_type: unsigned long long


filter

original_code:
int filter(short *x, short *y, int size, double *h) {
 double sum, divisor;
 int k, n, overflowed = 0;
 divisor = (double)0x7fff;
 for (n = 0; n < size; n++) {
  sum = 0;
  for (k = 0; k < 81; k++) {
   if (k > n) break;
   sum += h[k] * ((double)x[n - k])/divisor;
  }
  y[n] = (short)(sum * divisor);
 }
 if (overflowed) {
  return 0;
 } else {
  return !0;
 }
}

canonical_original_code:
int filter(short *x, short *y, int size, double *h) {
 double sum; double divisor;
 int k; int n; int overflowed = 0;
 divisor = (double)0x7fff;
 for (n = 0; n < size; n++) {
  sum = 0;
  for (k = 0; k < 81; k++) {
   if (k > n) break;
   sum += h[k] * ((double)x[n - k])/divisor;
  }
  y[n] = (short)(sum * divisor);
 }
 if (overflowed) {
  return 0;
 } else {
  return !0;
 }
}

variable_types:
x
short *

variable_types:
y
short *

variable_types: size int

variable_types:
h
double *

variable_types: sum double

variable_types: divisor double

variable_types: k int

variable_types: n int

variable_types: overflowed int


main

repo: thebyrd/libuv-env

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // rbp

v3 = uv_loop_new(argc, argv, envp);
puts("Now quititng.");
uv_run(v3, 0LL);
return 0;
}

original_code:
int
main () {
  uv_loop_t *loop = uv_loop_new();
  printf("Now quititng.\n");
  uv_run(loop, UV_RUN_DEFAULT);
  return 0;
}

canonical_original_code:
int main() {
  struct uv_loop_s *loop = uv_loop_new();
  printf("Now quititng.\n");
  uv_run(loop, UV_RUN_DEFAULT);
  return 0;
}

variable_types: struct uv_loop_s { void *data; unsigned int active_handles; void *handle_queue[2]; union { void *unused[2]; unsigned int count; } active_reqs; unsigned int stop_flag; unsigned long flags; int backend_fd; void *pending_queue[2]; void *watcher_queue[2]; struct uv__io_s { void (*cb)(struct uv_loop_s *loop, struct uv__io_s *w, unsigned int events); void *pending_queue[2]; void *watcher_queue[2]; unsigned int pevents; unsigned int events; int fd; } **watchers; unsigned int nwatchers; unsigned int nfds; void *wq[2]; union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } wq_mutex; struct uv_async_s { void *data; struct uv_loop_s *loop; enum uv_handle_type { UV_UNKNOWN_HANDLE=0, UV_ASYNC=1, UV_CHECK=2, UV_FS_EVENT=3, UV_FS_POLL=4, UV_HANDLE=5, UV_IDLE=6, UV_NAMED_PIPE=7, UV_POLL=8, UV_PREPARE=9, UV_PROCESS=10, UV_STREAM=11, UV_TCP=12, UV_TIMER=13, UV_TTY=14, UV_UDP=15, UV_SIGNAL=16, UV_FILE=17, UV_HANDLE_TYPE_MAX=18 } type; void (*close_cb)(struct uv_handle_s { void *data; struct uv_loop_s *loop; enum uv_handle_type { UV_UNKNOWN_HANDLE=0, UV_ASYNC=1, UV_CHECK=2, UV_FS_EVENT=3, UV_FS_POLL=4, UV_HANDLE=5, UV_IDLE=6, UV_NAMED_PIPE=7, UV_POLL=8, UV_PREPARE=9, UV_PROCESS=10, UV_STREAM=11, UV_TCP=12, UV_TIMER=13, UV_TTY=14, UV_UDP=15, UV_SIGNAL=16, UV_FILE=17, UV_HANDLE_TYPE_MAX=18 } type; void (*close_cb)(struct uv_handle_s *handle); void *handle_queue[2]; union { int fd; void *reserved[4]; } u; struct uv_handle_s *next_closing; unsigned int flags; } *handle); void *handle_queue[2]; union { int fd; void *reserved[4]; } u; struct uv_handle_s *next_closing; unsigned int flags; void (*async_cb)(struct uv_async_s *handle); void *queue[2]; int pending; } wq_async; union pthread_rwlock_t { struct __pthread_rwlock_arch_t { unsigned int __readers; unsigned int __writers; unsigned int __wrphase_futex; unsigned int __writers_futex; unsigned int __pad3; unsigned int __pad4; int __cur_writer; int __shared; char __rwelision; unsigned char __pad1[7]; unsigned long __pad2; unsigned int __flags; } __data; char __size[56]; long __align; } cloexec_lock; struct uv_handle_s *closing_handles; void *process_handles[2]; void *prepare_handles[2]; void *check_handles[2]; void *idle_handles[2]; void *async_handles[2]; void (*async_unused)(); struct uv__io_s async_io_watcher; int async_wfd; struct { void *min; unsigned int nelts; } timer_heap; unsigned long timer_counter; unsigned long time; int signal_pipefd[2]; struct uv__io_s signal_io_watcher; struct uv_signal_s { void *data; struct uv_loop_s *loop; enum uv_handle_type { UV_UNKNOWN_HANDLE=0, UV_ASYNC=1, UV_CHECK=2, UV_FS_EVENT=3, UV_FS_POLL=4, UV_HANDLE=5, UV_IDLE=6, UV_NAMED_PIPE=7, UV_POLL=8, UV_PREPARE=9, UV_PROCESS=10, UV_STREAM=11, UV_TCP=12, UV_TIMER=13, UV_TTY=14, UV_UDP=15, UV_SIGNAL=16, UV_FILE=17, UV_HANDLE_TYPE_MAX=18 } type; void (*close_cb)(struct uv_handle_s *handle); void *handle_queue[2]; union { int fd; void *reserved[4]; } u; struct uv_handle_s *next_closing; unsigned int flags; void (*signal_cb)(struct uv_signal_s *handle, int signum); int signum; struct { struct uv_signal_s *rbe_left; struct uv_signal_s *rbe_right; struct uv_signal_s *rbe_parent; int rbe_color; } tree_entry; unsigned int caught_signals; unsigned int dispatched_signals; } child_watcher; int emfile_fd; struct uv__io_s inotify_read_watcher; void *inotify_watchers; int inotify_fd; } *

user_defined_types: struct uv_loop_s { void *data; unsigned int active_handles; void *handle_queue[2]; union { void *unused[2]; unsigned int count; } active_reqs; unsigned int stop_flag; unsigned long flags; int backend_fd; void *pending_queue[2]; void *watcher_queue[2]; struct uv__io_s **watchers; unsigned int nwatchers; unsigned int nfds; void *wq[2]; union pthread_mutex_t wq_mutex; struct uv_async_s wq_async; union pthread_rwlock_t cloexec_lock; struct uv_handle_s *closing_handles; void *process_handles[2]; void *prepare_handles[2]; void *check_handles[2]; void *idle_handles[2]; void *async_handles[2]; void (*async_unused)(); struct uv__io_s async_io_watcher; int async_wfd; struct { void *min; unsigned int nelts; } timer_heap; unsigned long timer_counter; unsigned long time; int signal_pipefd[2]; struct uv__io_s signal_io_watcher; struct uv_signal_s child_watcher; int emfile_fd; struct uv__io_s inotify_read_watcher; void *inotify_watchers; int inotify_fd; }

user_defined_types: union pthread_mutex_t { struct __pthread_mutex_s __data; char __size[40]; long __align; }

user_defined_types: struct uv_async_s { void *data; struct uv_loop_s *loop; enum uv_handle_type type; void (*close_cb)(struct uv_handle_s *handle); void *handle_queue[2]; union { int fd; void *reserved[4]; } u; struct uv_handle_s *next_closing; unsigned int flags; void (*async_cb)(struct uv_async_s *handle); void *queue[2]; int pending; }

user_defined_types: union pthread_rwlock_t { struct __pthread_rwlock_arch_t __data; char __size[56]; long __align; }

user_defined_types: struct uv_signal_s { void *data; struct uv_loop_s *loop; enum uv_handle_type type; void (*close_cb)(struct uv_handle_s *handle); void *handle_queue[2]; union { int fd; void *reserved[4]; } u; struct uv_handle_s *next_closing; unsigned int flags; void (*signal_cb)(struct uv_signal_s *handle, int signum); int signum; struct { struct uv_signal_s *rbe_left; struct uv_signal_s *rbe_right; struct uv_signal_s *rbe_parent; int rbe_color; } tree_entry; unsigned int caught_signals; unsigned int dispatched_signals; }

user_defined_types: struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list __list; }

user_defined_types: struct uv_handle_s { void *data; struct uv_loop_s *loop; enum uv_handle_type type; void (*close_cb)(struct uv_handle_s *handle); void *handle_queue[2]; union { int fd; void *reserved[4]; } u; struct uv_handle_s *next_closing; unsigned int flags; }


popQueue

repo: thecelticone/aho-corasick

decompiled_code:
__int64 __fastcall popQueue(_QWORD *a1)
{
__int64 v1; // r12

v1 = a1[1];
free(a1);
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func10(_QWORD *a1)
{
__int64 v1; // r12

v1 = a1[1];
free(a1);
return v1;
}

original_code:
Queue popQueue (Queue q) {
  Queue ptr1 = q;
  Queue ptr2 = q->next;
  free (ptr1);
  return ptr2;
}

canonical_original_code:
struct _queue *popQueue(struct _queue *q) {
  struct _queue *ptr1 = q;
  struct _queue *ptr2 = q->next;
  free (ptr1);
  return ptr2;
}

variable_types:
q
struct _queue *

variable_types: struct _queue { int elm; struct _queue *next; } *


topQueue

decompiled_code:
__int64 __fastcall topQueue(unsigned int *a1)
{
return *a1;
}

canonical_decompiled_code:
__int64 __fastcall func11(unsigned int *a1)
{
return *a1;
}

original_code:
int topQueue (Queue q) {
  return q->elm;
}

canonical_original_code:
int topQueue(struct _queue *q) {
  return q->elm;
}

user_defined_types: struct _queue { int elm; struct _queue *next; }


printQueue

decompiled_code:
int __fastcall printQueue(unsigned int *a1)
{
unsigned int *v1; // rbx
int result; // eax

if ( a1 )
{
v1 = a1;
for ( result = printf("%d ", *a1); ; result = printf("| %d ", *v1) )
{
v1 = (unsigned int *)*((_QWORD *)v1 + 1);
if ( !v1 )
break;
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func12(unsigned int *a1)
{
unsigned int *v1; // rbx
int result; // eax

if ( a1 )
{
v1 = a1;
for ( result = printf("%d ", *a1); ; result = printf("| %d ", *v1) )
{
v1 = (unsigned int *)*((_QWORD *)v1 + 1);
if ( !v1 )
break;
}
}
return result;
}

original_code:
void printQueue (Queue q) {
  Queue ptr = q;
  if (ptr != ((void *)0)) {
    printf("%d ", ptr->elm);
    ptr = ptr->next;
  }
  while (ptr != ((void *)0)) {
    printf("| %d ", ptr->elm);
    ptr = ptr->next;
  }
}

canonical_original_code:
void printQueue(struct _queue *q) {
  struct _queue *ptr = q;
  if (ptr != ((void *)0)) {
    printf("%d ", ptr->elm);
    ptr = ptr->next;
  }
  while (ptr != ((void *)0)) {
    printf("| %d ", ptr->elm);
    ptr = ptr->next;
  }
}

return_type: void


getFromList

decompiled_code:
__int64 __fastcall getFromList(unsigned int *a1, char a2)
{
while ( 1 )
{
if ( !a1 )
return 0xFFFFFFFFLL;
if ( *((_BYTE *)a1 + 4) == a2 )
break;
a1 = (unsigned int *)*((_QWORD *)a1 + 1);
}
return *a1;
}

canonical_decompiled_code:
__int64 __fastcall func15(unsigned int *a1, char a2)
{
while ( 1 )
{
if ( !a1 )
return 0xFFFFFFFFLL;
if ( *((_BYTE *)a1 + 4) == a2 )
break;
a1 = (unsigned int *)*((_QWORD *)a1 + 1);
}
return *a1;
}

original_code:
int getFromList(List list, char label) {
  List tmp = list;
  while (tmp != ((void *)0)) {
    if (tmp->letter == label) {
      return tmp->targetNode;
    }
    tmp = tmp->next;
  }
  return -1;
}

canonical_original_code:
int getFromList(struct _list *list, char label) {
  struct _list *tmp = list;
  while (tmp != ((void *)0)) {
    if (tmp->letter == label) {
      return tmp->targetNode;
    }
    tmp = tmp->next;
  }
  return -1;
}

variable_types: struct _list { int targetNode; char letter; struct _list *next; } *

variable_types: label char


printList

decompiled_code:
int __fastcall printList(unsigned int *a1)
{
unsigned int *v1; // rbx

if ( a1 )
{
v1 = a1;
do
{
printf("|node : %i; label : %c|", *v1, (unsigned int)*((char *)v1 + 4));
v1 = (unsigned int *)*((_QWORD *)v1 + 1);
}
while ( v1 );
}
return puts("X");
}

canonical_decompiled_code:
int __fastcall func16(unsigned int *a1)
{
unsigned int *v1; // rbx

if ( a1 )
{
v1 = a1;
do
{
printf("|node : %i; label : %c|", *v1, (unsigned int)*((char *)v1 + 4));
v1 = (unsigned int *)*((_QWORD *)v1 + 1);
}
while ( v1 );
}
return puts("X");
}

original_code:
void printList(List list) {
  while (list != ((void *)0)) {
    printf("|node : %i; label : %c|", list->targetNode, list->letter);
    list = list->next;
  }
  printf("X\n");
}

canonical_original_code:
void printList(struct _list *list) {
  while (list != ((void *)0)) {
    printf("|node : %i; label : %c|", list->targetNode, list->letter);
    list = list->next;
  }
  printf("X\n");
}

user_defined_types: struct _list { int targetNode; char letter; struct _list *next; }


repo: thedotcomchase/Hot-Fuzz

decompiled_code:
__int64 __fastcall get_field(char *s)
{
__int64 v1; // r13
char v2; // bl
char *v3; // rax
char *v4; // rbp
int v5; // er12
char *i; // rax
__int64 result; // rax
const unsigned __int16 **v8; // rax
__int64 v9; // rcx

v1 = cursor;
v2 = *(_BYTE *)cursor;
if ( *(_BYTE *)cursor == 32 )
{
v3 = (char *)(cursor + 1);
do
{
cursor = (__int64)v3;
v1 = (__int64)v3;
v2 = *v3++;
}
while ( v2 == 32 );
}
v4 = (char *)v1;
v5 = 0;
if ( !v2 )
{
LABEL_21:
fprintf(stderr, "unexpected end of line on line %d\n", (unsigned int)lineno);
exit(1);
}
while ( 1 )
{
if ( v5 > 0 || !strchr(s, v2) )
{
if ( v2 == 123 )
++v5;
else
v5 -= v2 == 125;
goto LABEL_8;
}
if ( v2 == 45 )
break;
if ( v2 != 40 || v4[1] == 36 )
goto LABEL_14;
LABEL_8:
cursor = (__int64)++v4;
v2 = *v4;
if ( !*v4 )
goto LABEL_21;
}
v8 = _ctype_b_loc();
v9 = v4[1];
if ( ((*v8)[v9] & 8) != 0 || (_BYTE)v9 == 45 )
goto LABEL_8;
LABEL_14:
peek = v2;
for ( i = v4 - 1; *i == 32; --i )
;
i[1] = 0;
result = v1;
++cursor;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *s)
{
__int64 v1; // r13
char v2; // bl
char *v3; // rax
char *v4; // rbp
int v5; // er12
char *i; // rax
__int64 result; // rax
const unsigned __int16 **v8; // rax
__int64 v9; // rcx

v1 = cursor;
v2 = *(_BYTE *)cursor;
if ( *(_BYTE *)cursor == 32 )
{
v3 = (char *)(cursor + 1);
do
{
cursor = (__int64)v3;
v1 = (__int64)v3;
v2 = *v3++;
}
while ( v2 == 32 );
}
v4 = (char *)v1;
v5 = 0;
if ( !v2 )
{
LABEL_21:
fprintf(stderr, "unexpected end of line on line %d\n", (unsigned int)lineno);
exit(1);
}
while ( 1 )
{
if ( v5 > 0 || !strchr(s, v2) )
{
if ( v2 == 123 )
++v5;
else
v5 -= v2 == 125;
goto LABEL_8;
}
if ( v2 == 45 )
break;
if ( v2 != 40 || v4[1] == 36 )
goto LABEL_14;
LABEL_8:
cursor = (__int64)++v4;
v2 = *v4;
if ( !*v4 )
goto LABEL_21;
}
v8 = _ctype_b_loc();
v9 = v4[1];
if ( ((*v8)[v9] & 8) != 0 || (_BYTE)v9 == 45 )
goto LABEL_8;
LABEL_14:
peek = v2;
for ( i = v4 - 1; *i == 32; --i )
;
i[1] = 0;
result = v1;
++cursor;
return result;
}

original_code:
char *get_field(char *term)
{
     char *result, *end;
     int level = 0;
     while (*cursor == ' ')
   cursor++;
     result = cursor;
     while (*cursor != '\0' &&
     (level > 0
      || ! strchr(term, *cursor)
      || cursor[0] == '-' && ((*__ctype_b_loc ())[(int) ((cursor[1]))] & (unsigned short int) _ISalnum)
      || cursor[0] == '-' && cursor[1] == '-'
      || cursor[0] == '(' && cursor[1] != '$')) {
   if (*cursor == '{')
        level++;
   else if (*cursor == '}')
        level--;
   cursor++;
     }
     if (*cursor == '\0') {
   fprintf(stderr, "unexpected end of line on line %d\n", lineno);
   exit(1);
     }
     peek = *cursor;
     end = cursor-1;
     while (*end == ' ')
   end--;
     end[1] = '\0';
     cursor++;
     return result;
}

canonical_original_code:
char *get_field(char *term)
{
     char *result; char *end;
     int level = 0;
     while (*cursor == ' ')
   cursor++;
     result = cursor;
     while (*cursor != '\0' &&
     (level > 0
      || ! strchr(term, *cursor)
      || cursor[0] == '-' && ((*__ctype_b_loc ())[(int) ((cursor[1]))] & (unsigned short) _ISalnum)
      || cursor[0] == '-' && cursor[1] == '-'
      || cursor[0] == '(' && cursor[1] != '$')) {
   if (*cursor == '{')
        level++;
   else if (*cursor == '}')
        level--;
   cursor++;
     }
     if (*cursor == '\0') {
   fprintf(stderr, "unexpected end of line on line %d\n", lineno);
   exit(1);
     }
     peek = *cursor;
     end = cursor-1;
     while (*end == ' ')
   end--;
     end[1] = '\0';
     cursor++;
     return result;
}

variable_types:
term
char *

variable_types:
result
char *

variable_types:
end
char *

variable_types: level int

return_type: char *


decompiled_code:
char *load_file()
{
unsigned int v0; // er12
char *result; // rax

while ( 1 )
{
result = fgets(line_0, 1024, stdin);
if ( !result )
break;
v0 = ++lineno;
cursor = (__int64)strchr(line_0, 123);
if ( !cursor )
{
fprintf(stderr, "Missing '{' on line %d\n", v0);
exit(1);
}
read_record();
}
return result;
}

canonical_decompiled_code:
char *func1()
{
unsigned int v0; // er12
char *result; // rax

while ( 1 )
{
result = fgets(line_0, 1024, stdin);
if ( !result )
break;
v0 = ++lineno;
cursor = (__int64)strchr(line_0, 123);
if ( !cursor )
{
fprintf(stderr, "Missing '{' on line %d\n", v0);
exit(1);
}
read_record();
}
return result;
}

original_code:
void load_file(void)
{
     static char line[1024];
     while (fgets(line, 1024, stdin) != ((void *)0)) {
   lineno++;
   cursor = strchr(line, '{');
   if (cursor == ((void *)0)) {
        fprintf(stderr, "Missing '{' on line %d\n", lineno);
        exit(1);
   }
   read_record();
     }
}

canonical_original_code:
void load_file()
{
     static char line[1024];
     while (fgets(line, 1024, stdin) != ((void *)0)) {
   lineno++;
   cursor = strchr(line, '{');
   if (cursor == ((void *)0)) {
        fprintf(stderr, "Missing '{' on line %d\n", lineno);
        exit(1);
   }
   read_record();
     }
}

variable_types:
line
char [1024]


lexico

original_code:
int lexico(char *s, char *t)
{
     char *a = s, *b = t;
     int withcase = 0;
     for (;;) {
   while (*a != '\0' && ! ((*__ctype_b_loc ())[(int) ((*a))] & (unsigned short int) _ISalnum) && *a != ' ') a++;
   while (*b != '\0' && ! ((*__ctype_b_loc ())[(int) ((*b))] & (unsigned short int) _ISalnum) && *b != ' ') b++;
   if (! ((*__ctype_b_loc ())[(int) ((*a))] & (unsigned short int) _ISalnum) && ! ((*__ctype_b_loc ())[(int) ((*b))] & (unsigned short int) _ISalnum))
        break;
   else if (! ((*__ctype_b_loc ())[(int) ((*a))] & (unsigned short int) _ISalnum))
        return -1;
   else if (! ((*__ctype_b_loc ())[(int) ((*b))] & (unsigned short int) _ISalnum))
        return 1;
   else if (tolower(*a) != tolower(*b))
        return tolower(*a) - tolower(*b);
   else if (withcase == 0)
        withcase = *a - *b;
   a++; b++;
     }
     if (withcase != 0) return withcase;
     return strcmp(s, t);
}

canonical_original_code:
int lexico(char *s, char *t)
{
     char *a = s; char *b = t;
     int withcase = 0;
     for (;;) {
   while (*a != '\0' && ! ((*__ctype_b_loc ())[(int) ((*a))] & (unsigned short) _ISalnum) && *a != ' ') a++;
   while (*b != '\0' && ! ((*__ctype_b_loc ())[(int) ((*b))] & (unsigned short) _ISalnum) && *b != ' ') b++;
   if (! ((*__ctype_b_loc ())[(int) ((*a))] & (unsigned short) _ISalnum) && ! ((*__ctype_b_loc ())[(int) ((*b))] & (unsigned short) _ISalnum))
        break;
   else if (! ((*__ctype_b_loc ())[(int) ((*a))] & (unsigned short) _ISalnum))
        return -1;
   else if (! ((*__ctype_b_loc ())[(int) ((*b))] & (unsigned short) _ISalnum))
        return 1;
   else if (tolower(*a) != tolower(*b))
        return tolower(*a) - tolower(*b);
   else if (withcase == 0)
        withcase = *a - *b;
   a++; b++;
     }
     if (withcase != 0) return withcase;
     return strcmp(s, t);
}

variable_types:
s
char *

variable_types:
t
char *

variable_types:
a
char *

variable_types:
b
char *

variable_types: withcase int


decompiled_code:
char *__fastcall setup_and_read(int a1, __int64 a2)
{
program = *(_QWORD *)a2;
if ( a1 > 3 )
usage();
if ( a1 > 1 && !freopen(*(const char **)(a2 + 8), "r", stdin) )
{
fprintf(stderr, "%s: can't read %s\n", (const char *)program, *(const char **)(a2 + 8));
exit(1);
}
if ( a1 == 3 && !freopen(*(const char **)(a2 + 16), "w", stdout) )
{
fprintf(stderr, "%s: can't write to %s\n", (const char *)program, *(const char **)(a2 + 16));
exit(1);
}
return load_file();
}

canonical_decompiled_code:
char *__fastcall func4(int a1, __int64 a2)
{
program = *(_QWORD *)a2;
if ( a1 > 3 )
func3();
if ( a1 > 1 && !freopen(*(const char **)(a2 + 8), "r", stdin) )
{
fprintf(stderr, "%s: can't read %s\n", (const char *)program, *(const char **)(a2 + 8));
exit(1);
}
if ( a1 == 3 && !freopen(*(const char **)(a2 + 16), "w", stdout) )
{
fprintf(stderr, "%s: can't write to %s\n", (const char *)program, *(const char **)(a2 + 16));
exit(1);
}
return func1();
}

original_code:
void setup_and_read(int argc, char *argv[])
{
     program = argv[0];
     if (argc > 3)
   usage();
     if (argc >= 2 && freopen(argv[1], "r", stdin) == ((void *)0)) {
   fprintf(stderr, "%s: can't read %s\n", program, argv[1]);
   exit(1);
     }
     if (argc >= 3 && freopen(argv[2], "w", stdout) == ((void *)0)) {
   fprintf(stderr, "%s: can't write to %s\n", program, argv[2]);
   exit(1);
     }
     load_file();
}

variable_types: argc int

variable_types:
argv
char *[]


usage

decompiled_code:
void __noreturn usage()
{
fprintf(stderr, "usage: %s [infile] [outfile]\n", (const char *)program);
exit(2);
}

canonical_decompiled_code:
void __noreturn func3()
{
fprintf(stderr, "usage: %s [infile] [outfile]\n", (const char *)program);
exit(2);
}

original_code:
void usage(void)
{
     fprintf(stderr, "usage: %s [infile] [outfile]\n", program);
     exit(2);
}

canonical_original_code:
void usage()
{
     fprintf(stderr, "usage: %s [infile] [outfile]\n", program);
     exit(2);
}


decompiled_code:
unsigned __int64 begin_frame()
{
int v0; // eax
unsigned __int64 result; // rax

v0 = level;
if ( level > 63 )
{
panic("begin_frame -- Nesting too deep");
v0 = level;
}
level = v0 + 1;
result = 4LL * (v0 + 1);
stack[result / 2] = 0LL;
dword_208[result] = 0;
return result * 4;
}

canonical_decompiled_code:
unsigned __int64 func0()
{
int v0; // eax
unsigned __int64 result; // rax

v0 = level;
if ( level > 63 )
{
panic("begin_frame -- Nesting too deep");
v0 = level;
}
level = v0 + 1;
result = 4LL * (v0 + 1);
stack[result / 2] = 0LL;
dword_208[result] = 0;
return result * 4;
}

original_code:
void begin_frame(void)
{
     if (level >= 64)
   panic("begin_frame -- Nesting too deep");
     level++;
     stack[level].b_chain = ((void *)0);
     stack[level].b_mark = 0;
}

canonical_original_code:
void begin_frame()
{
     if (level >= 64)
   panic("begin_frame -- Nesting too deep");
     level++;
     stack[level].b_chain = ((void *)0);
     stack[level].b_mark = 0;
}


decompiled_code:
__int64 end_frame()
{
int v0; // edi
__int64 result; // rax
_QWORD *v2; // rbx
_QWORD *v3; // rdx
__int64 v4; // rcx
int v5; // esi
__int64 v6; // rcx

v0 = level;
result = 16LL * level;
v2 = *(_QWORD **)((char *)stack + result);
if ( !v2 )
goto LABEL_11;
do
{
LABEL_2:
result = *(unsigned int *)v2;
if ( (int)result <= 0 )
goto LABEL_10;
v3 = (_QWORD *)v2[3];
v4 = (unsigned int)(result - 1);
v5 = 0;
result = (__int64)(v3 + 1);
v6 = (__int64)&v3[v4 + 1];
while ( *v3 )
{
v3 = (_QWORD *)result;
if ( result == v6 )
goto LABEL_8;
LABEL_5:
result += 8LL;
}
*v3 = err_type;
v5 = 1;
v3 = (_QWORD *)result;
if ( result != v6 )
goto LABEL_5;
LABEL_8:
if ( v5 )
{
result = (unsigned int)dword_208[4 * v0];
if ( !(_DWORD)result )
{
tc_error(*(unsigned int *)(v2[2] + 8LL), "Implicit parameters not completely determined", v3);
tc_e_etc("Expression: %z", v2[2]);
result = tc_e_end();
v2 = (_QWORD *)v2[1];
v0 = level;
if ( !v2 )
break;
goto LABEL_2;
}
}
LABEL_10:
v2 = (_QWORD *)v2[1];
}
while ( v2 );
LABEL_11:
level = v0 - 1;
return result;
}

canonical_decompiled_code:
__int64 func1()
{
int v0; // edi
__int64 result; // rax
_QWORD *v2; // rbx
_QWORD *v3; // rdx
__int64 v4; // rcx
int v5; // esi
__int64 v6; // rcx

v0 = level;
result = 16LL * level;
v2 = *(_QWORD **)((char *)stack + result);
if ( !v2 )
goto LABEL_11;
do
{
LABEL_2:
result = *(unsigned int *)v2;
if ( (int)result <= 0 )
goto LABEL_10;
v3 = (_QWORD *)v2[3];
v4 = (unsigned int)(result - 1);
v5 = 0;
result = (__int64)(v3 + 1);
v6 = (__int64)&v3[v4 + 1];
while ( *v3 )
{
v3 = (_QWORD *)result;
if ( result == v6 )
goto LABEL_8;
LABEL_5:
result += 8LL;
}
*v3 = err_type;
v5 = 1;
v3 = (_QWORD *)result;
if ( result != v6 )
goto LABEL_5;
LABEL_8:
if ( v5 )
{
result = (unsigned int)dword_208[4 * v0];
if ( !(_DWORD)result )
{
tc_error(*(unsigned int *)(v2[2] + 8LL), "Implicit parameters not completely determined", v3);
tc_e_etc("Expression: %z", v2[2]);
result = tc_e_end();
v2 = (_QWORD *)v2[1];
v0 = level;
if ( !v2 )
break;
goto LABEL_2;
}
}
LABEL_10:
v2 = (_QWORD *)v2[1];
}
while ( v2 );
LABEL_11:
level = v0 - 1;
return result;
}

original_code:
void end_frame(void)
{
     frame p;
     int j;
     for (p = stack[level].b_chain; p != ((void *)0); p = p->f_next) {
   int failed = 0;
   for (j = 0; j < p->f_nvars; j++) {
        if (p->f_var[j] == ((void *)0)) {
      failed = 1;
      p->f_var[j] = err_type;
        }
   }
   if (failed && ! stack[level].b_mark) {
        tc_error(p->f_cxt->x_loc,
   "Implicit parameters not completely determined");
        tc_e_etc("Expression: %z", p->f_cxt);
        tc_e_end();
   }
     }
     level--;
}

canonical_original_code:
void end_frame()
{
     struct frame *p;
     int j;
     for (p = stack[level].b_chain; p != ((void *)0); p = p->f_next) {
   int failed = 0;
   for (j = 0; j < p->f_nvars; j++) {
        if (p->f_var[j] == ((void *)0)) {
      failed = 1;
      p->f_var[j] = err_type;
        }
   }
   if (failed && ! stack[level].b_mark) {
        tc_error(p->f_cxt->x_loc,
   "Implicit parameters not completely determined");
        tc_e_etc("Expression: %z", p->f_cxt);
        tc_e_end();
   }
     }
     level--;
}

variable_types: struct frame { int f_nvars; struct frame *f_next; struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *f_cxt; struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def *s_glodef; struct para { struct blob *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type *type_d; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_d; } d_u; } *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema *schema_t; struct { struct type *t__mtype; struct frame *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } **f_var; } *

variable_types: j int

variable_types: failed int

user_defined_types: struct frame { int f_nvars; struct frame *f_next; struct blob *f_cxt; struct type **f_var; }

user_defined_types: struct type { enum kind_t t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema *schema_t; struct { struct type *t__mtype; struct frame *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; }

user_defined_types: struct def { enum kind_d d_kind; struct sym *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type *type_d; struct schema *schema_d; } d_u; }

user_defined_types: struct sym { int x_kind; struct tok *s_basename; struct tok *s_decor; struct def *s_glodef; struct para *s_def; struct sym *s_link; }

user_defined_types: struct schema { int z_ncomps; struct compnt *z_comp; }

user_defined_types: struct para { struct blob *p_text; int p_serial; char *p_file; enum mark p_flag; struct para *p_next; }


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

result = 4LL * level;
dword_208[result] = 1;
return result * 4;
}

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

result = 4LL * level;
dword_208[result] = 1;
return result * 4;
}

original_code:
void mark_error(void)
{
     stack[level].b_mark = 1;
}

canonical_original_code:
void mark_error()
{
     stack[level].b_mark = 1;
}


original_code:
frame mk_frame(int nvars)
{
     if (nvars == 0)
   return ((frame) ((void *)0));
     else {
   frame f = (frame) alloc(sizeof(struct frame));
   int i;
   f->f_nvars = nvars;
   f->f_next = ((void *)0);
   f->f_cxt = ((tree) ((void *)0));
   f->f_var = (type *) alloc(nvars * sizeof(type));
   for (i = 0; i < nvars; i++)
        f->f_var[i] = ((void *)0);
   return f;
     }
}

canonical_original_code:
struct frame *mk_frame(int nvars)
{
     if (nvars == 0)
   return ((frame) ((void *)0));
     else {
   struct frame *f = (frame) alloc(sizeof(struct frame));
   int i;
   f->f_nvars = nvars;
   f->f_next = ((void *)0);
   f->f_cxt = ((tree) ((void *)0));
   f->f_var = (struct type **) alloc(nvars * sizeof(type));
   for (i = 0; i < nvars; i++)
        f->f_var[i] = ((void *)0);
   return f;
     }
}

variable_types: nvars int

variable_types: i int

return_type: struct frame { int f_nvars; struct frame *f_next; struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *f_cxt; struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def *s_glodef; struct para { struct blob *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type *type_d; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_d; } d_u; } *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema *schema_t; struct { struct type *t__mtype; struct frame *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } **f_var; } *


decompiled_code:
__int64 __fastcall new_frame(int a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rdx
__int64 v4; // rcx

result = mk_frame(a1);
if ( result )
{
v3 = level;
*(_QWORD *)(result + 16) = a2;
v3 *= 16LL;
v4 = *(__int64 *)((char *)stack + v3);
*(__int64 *)((char *)stack + v3) = result;
*(_QWORD *)(result + 8) = v4;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(int a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rdx
__int64 v4; // rcx

result = func3(a1);
if ( result )
{
v3 = level;
*(_QWORD *)(result + 16) = a2;
v3 *= 16LL;
v4 = *(__int64 *)((char *)stack + v3);
*(__int64 *)((char *)stack + v3) = result;
*(_QWORD *)(result + 8) = v4;
}
return result;
}

original_code:
frame new_frame(int nvars, tree cxt)
{
     frame f = mk_frame(nvars);
     if (f != ((frame) ((void *)0))) {
   f->f_cxt = cxt;
   f->f_next = stack[level].b_chain;
   stack[level].b_chain = f;
     }
     return f;
}

canonical_original_code:
struct frame *new_frame(int nvars, struct blob *cxt)
{
     struct frame *f = mk_frame(nvars);
     if (f != ((frame) ((void *)0))) {
   f->f_cxt = cxt;
   f->f_next = stack[level].b_chain;
   stack[level].b_chain = f;
     }
     return f;
}

variable_types:
cxt
struct blob *

user_defined_types: struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; }

user_defined_types: enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 }

user_defined_types: enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 }

user_defined_types: struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; }

user_defined_types: enum mark { UNTOUCHED=0, BUSY=1, DONE=2 }

user_defined_types: struct compnt { struct sym *z_name; struct type *z_type; }


decompiled_code:
__int64 __fastcall index_list(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
__int64 result; // rax

if ( a1 )
{
v2 = a1;
do
{
index_add(**(_QWORD ***)(v2 + 16), a2);
result = *(_QWORD *)(v2 + 16);
v2 = *(_QWORD *)(result + 8);
}
while ( v2 );
}
return result;
}

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

if ( a1 )
{
v2 = a1;
do
{
func0(**(_QWORD ***)(v2 + 16), a2);
result = *(_QWORD *)(v2 + 16);
v2 = *(_QWORD *)(result + 8);
}
while ( v2 );
}
return result;
}

original_code:
static void index_list(tree t, para p)
{
     tree u;
     for (u = t; u != ((tree) ((void *)0)); u = (u)->x_slot[1])
   index_add((sym) (u)->x_slot[0], p);
}

canonical_original_code:
static void index_list(struct blob *t, struct para *p)
{
     struct blob *u;
     for (u = t; u != ((tree) ((void *)0)); u = (u)->x_slot[1])
   index_add((sym) (u)->x_slot[0], p);
}

variable_types: struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *

variable_types: struct para { struct blob *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *


decompiled_code:
void __fastcall check_para(__int64 a1, _QWORD *a2)
{
int v3; // esi
int v4; // eax
__int64 v5; // rbp
__int64 v6; // rdx
__int64 v7; // rax
__int64 v8; // r12
__int64 v9; // rax
__int64 v10; // r8
__int64 v11; // rbp
__int64 v12; // rcx
__int64 v13; // rax
__int64 v14; // rax
int v15; // edx
__int64 v16; // [rsp+0h] [rbp-20h]

if ( a1 )
{
v3 = *(_DWORD *)(a1 + 24);
if ( v3 != 1 )
{
if ( v3 == 2 )
return;
if ( v3 )
{
bad_tag("check_para");
return;
}
v4 = level_1;
v5 = file_name;
if ( level_1 > 63 )
{
panic("check_para -- Nesting too deep");
v4 = level_1;
}
v6 = 2LL * v4;
level_1 = v4 + 1;
qword_688[v6] = (__int64)a2;
active_0[v6] = a1;
v7 = mark_temp();
v8 = v7;
if ( !debugging )
{
v9 = *(_QWORD *)(a1 + 16);
*(_DWORD *)(a1 + 24) = 1;
file_name = v9;
LABEL_10:
tc_para(*(_QWORD *)a1);
--level_1;
clear_temp(v8);
*(_QWORD *)a1 = 0LL;
*(_DWORD *)(a1 + 24) = 2;
file_name = v5;
return;
}
if ( dcode[0] )
{
grind(stdout, "Mark: %x\n", v7);
v14 = *(_QWORD *)(a1 + 16);
v15 = debugging;
*(_DWORD *)(a1 + 24) = 1;
file_name = v14;
if ( !v15 )
goto LABEL_10;
}
else
{
v13 = *(_QWORD *)(a1 + 16);
*(_DWORD *)(a1 + 24) = 1;
file_name = v13;
}
if ( dcode[3] )
grind(stdout, "Processing para %d [level %d]\n", *(unsigned int *)(a1 + 8), (unsigned int)level_1);
goto LABEL_10;
}
v10 = node(2LL, 0LL, 363LL, a2, 0LL);
v11 = 2LL * level_1;
do
{
v12 = *(_QWORD *)(v11 * 8 + 1656);
if ( v12 )
v10 = node(2LL, 0LL, 363LL, v12, v10);
v11 -= 2LL;
}
while ( active_0[v11] != a1 );
v16 = v10;
tc_error(*(unsigned int *)(*(_QWORD *)a1 + 8LL), "Cyclic dependency involving %n", a2);
tc_e_etc("Cycle: %l//, //", v16);
tc_e_end();
}
}

canonical_decompiled_code:
void __fastcall func2(__int64 a1, _QWORD *a2)
{
int v3; // esi
int v4; // eax
__int64 v5; // rbp
__int64 v6; // rdx
__int64 v7; // rax
__int64 v8; // r12
__int64 v9; // rax
__int64 v10; // r8
__int64 v11; // rbp
__int64 v12; // rcx
__int64 v13; // rax
__int64 v14; // rax
int v15; // edx
__int64 v16; // [rsp+0h] [rbp-20h]

if ( a1 )
{
v3 = *(_DWORD *)(a1 + 24);
if ( v3 != 1 )
{
if ( v3 == 2 )
return;
if ( v3 )
{
bad_tag("check_para");
return;
}
v4 = level_1;
v5 = file_name;
if ( level_1 > 63 )
{
panic("check_para -- Nesting too deep");
v4 = level_1;
}
v6 = 2LL * v4;
level_1 = v4 + 1;
qword_688[v6] = (__int64)a2;
active_0[v6] = a1;
v7 = mark_temp();
v8 = v7;
if ( !debugging )
{
v9 = *(_QWORD *)(a1 + 16);
*(_DWORD *)(a1 + 24) = 1;
file_name = v9;
LABEL_10:
tc_para(*(_QWORD *)a1);
--level_1;
clear_temp(v8);
*(_QWORD *)a1 = 0LL;
*(_DWORD *)(a1 + 24) = 2;
file_name = v5;
return;
}
if ( dcode[0] )
{
grind(stdout, "Mark: %x\n", v7);
v14 = *(_QWORD *)(a1 + 16);
v15 = debugging;
*(_DWORD *)(a1 + 24) = 1;
file_name = v14;
if ( !v15 )
goto LABEL_10;
}
else
{
v13 = *(_QWORD *)(a1 + 16);
*(_DWORD *)(a1 + 24) = 1;
file_name = v13;
}
if ( dcode[3] )
grind(stdout, "Processing para %d [level %d]\n", *(unsigned int *)(a1 + 8), (unsigned int)level_1);
goto LABEL_10;
}
v10 = node(2LL, 0LL, 363LL, a2, 0LL);
v11 = 2LL * level_1;
do
{
v12 = *(_QWORD *)(v11 * 8 + 1656);
if ( v12 )
v10 = node(2LL, 0LL, 363LL, v12, v10);
v11 -= 2LL;
}
while ( active_0[v11] != a1 );
v16 = v10;
tc_error(*(unsigned int *)(*(_QWORD *)a1 + 8LL), "Cyclic dependency involving %n", a2);
tc_e_etc("Cycle: %l//, //", v16);
tc_e_end();
}
}

original_code:
static void check_para(para p, sym cxt)
{
     int i;
     tree c;
     univ mark;
     char *save_file = file_name;
     static int level = 0;
     static context active[64];
     if (p == ((void *)0)) return;
     switch (p->p_flag) {
     case UNTOUCHED:
   if (level >= 64)
        panic("check_para -- Nesting too deep");
   active[level].w_para = p;
   active[level].w_cxt = cxt;
   level++;
   mark = mark_temp();
   if ((debugging && dcode['a' - 'a'])) grind(stdout, "Mark: %x\n", mark);
   p->p_flag = BUSY;
   file_name = p->p_file;
   if ((debugging && dcode['d' - 'a']))
        grind(stdout, "Processing para %d [level %d]\n",
       (int) p->p_serial, level);
   tc_para(p->p_text);
   level--;
   clear_temp(mark);
   p->p_flag = DONE;
   p->p_text = ((void *)0);
   file_name = save_file;
   break;
     case BUSY:
   c = node(2,0,363,(tree) cxt,((tree) ((void *)0))); i = level;
   do {
        i--;
        if (active[i].w_cxt != ((void *)0))
      c = node(2,0,363,(tree) active[i].w_cxt,c);
   } while (active[i].w_para != p);
   tc_error(p->p_text->x_loc,
     "Cyclic dependency involving %n", cxt);
   tc_e_etc("Cycle: %l//, //", c);
   tc_e_end();
   break;
     case DONE:
   break;
     default:
   bad_tag("check_para", (int) p->p_flag);
     }
}

canonical_original_code:
static void check_para(struct para *p, struct sym *cxt)
{
     int i;
     struct blob *c;
     void *mark;
     char *save_file = file_name;
     static int level = 0;
     static struct context active[64];
     if (p == ((void *)0)) return;
     switch (p->p_flag) {
     case UNTOUCHED:
   if (level >= 64)
        panic("check_para -- Nesting too deep");
   active[level].w_para = p;
   active[level].w_cxt = cxt;
   level++;
   mark = mark_temp();
   if ((debugging && dcode['a' - 'a'])) grind(stdout, "Mark: %x\n", mark);
   p->p_flag = BUSY;
   file_name = p->p_file;
   if ((debugging && dcode['d' - 'a']))
        grind(stdout, "Processing para %d [level %d]\n",
       (int) p->p_serial, level);
   tc_para(p->p_text);
   level--;
   clear_temp(mark);
   p->p_flag = DONE;
   p->p_text = ((void *)0);
   file_name = save_file;
   break;
     case BUSY:
   c = node(2,0,363,(struct blob *) cxt,((tree) ((void *)0))); i = level;
   do {
        i--;
        if (active[i].w_cxt != ((void *)0))
      c = node(2,0,363,(struct blob *) active[i].w_cxt,c);
   } while (active[i].w_para != p);
   tc_error(p->p_text->x_loc,
     "Cyclic dependency involving %n", cxt);
   tc_e_etc("Cycle: %l//, //", c);
   tc_e_end();
   break;
     case DONE:
   break;
     default:
   bad_tag("check_para", (int) p->p_flag);
     }
}

variable_types:
mark
void *

variable_types: level int

variable_types: struct context { struct para { struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *w_para; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *s_glodef; struct para *s_def; struct sym *s_link; } *w_cxt; } [64]

user_defined_types: struct context { struct para *w_para; struct sym *w_cxt; }


decompiled_code:
__int64 __fastcall store_para(int a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rbx
__int64 v4; // rax
__int64 result; // rax
__int64 v6; // rdx

v2 = perm_alloc(40LL);
*(_QWORD *)v2 = a2;
v3 = v2;
*(_DWORD *)(v2 + 8) = a1;
v4 = file_name;
*(_DWORD *)(v3 + 24) = 0;
*(_QWORD *)(v3 + 16) = v4;
*(_QWORD *)(v3 + 32) = 0LL;
make_index_constprop_0((int **)v3);
result = spec_file;
if ( spec_file )
{
do
{
v6 = result;
result = *(_QWORD *)(result + 32);
}
while ( result );
*(_QWORD *)(v6 + 32) = v3;
}
else
{
spec_file = v3;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(int a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rbx
__int64 v4; // rax
__int64 result; // rax
__int64 v6; // rdx

v2 = perm_alloc(40LL);
*(_QWORD *)v2 = a2;
v3 = v2;
*(_DWORD *)(v2 + 8) = a1;
v4 = file_name;
*(_DWORD *)(v3 + 24) = 0;
*(_QWORD *)(v3 + 16) = v4;
*(_QWORD *)(v3 + 32) = 0LL;
func4((int **)v3);
result = spec_file;
if ( spec_file )
{
do
{
v6 = result;
result = *(_QWORD *)(result + 32);
}
while ( result );
*(_QWORD *)(v6 + 32) = v3;
}
else
{
spec_file = v3;
}
return result;
}

original_code:
static void store_para(int n, tree t)
{
     para p = (para) perm_alloc(sizeof(struct para)), q;
     p->p_text = t;
     p->p_serial = n;
     p->p_file = file_name;
     p->p_flag = UNTOUCHED;
     p->p_next = ((void *)0);
     make_index(p);
     if (spec_file == ((void *)0))
   spec_file = p;
     else {
   q = spec_file;
   while (q->p_next != ((void *)0)) q = q->p_next;
   q->p_next = p;
     }
}

canonical_original_code:
static void store_para(int n, struct blob *t)
{
     struct para *p = (para) perm_alloc(sizeof(struct para)); struct para *q;
     p->p_text = t;
     p->p_serial = n;
     p->p_file = file_name;
     p->p_flag = UNTOUCHED;
     p->p_next = ((void *)0);
     make_index(p);
     if (spec_file == ((void *)0))
   spec_file = p;
     else {
   q = spec_file;
   while (q->p_next != ((void *)0)) q = q->p_next;
   q->p_next = p;
     }
}

variable_types: n int

variable_types: struct para { struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *


decompiled_code:
int __fastcall do_para(_DWORD *a1)
{
int result; // eax
__int64 v2; // rdx

result = para_count_2;
v2 = (unsigned int)++para_count_2;
if ( vflag && debugging )
{
if ( dcode[3] )
{
grind(stdout, "Paragraph %d:\n", v2);
if ( (unsigned int)(*a1 - 315) <= 1 && (!debugging || !dcode[3]) )
{
LABEL_10:
result = fflush(stdout);
if ( sflag )
return result;
goto LABEL_4;
}
}
else if ( (unsigned int)(*a1 - 315) <= 1 )
{
goto LABEL_10;
}
grind(stdout, "%z\n\n", a1);
goto LABEL_10;
}
if ( sflag )
return result;
LABEL_4:
if ( dflag )
return store_para(para_count_2, (__int64)a1);
tc_para(a1);
return clear_temp(0LL);
}

canonical_decompiled_code:
int __fastcall func6(_DWORD *a1)
{
int result; // eax
__int64 v2; // rdx

result = para_count_2;
v2 = (unsigned int)++para_count_2;
if ( vflag && debugging )
{
if ( dcode[3] )
{
grind(stdout, "Paragraph %d:\n", v2);
if ( (unsigned int)(*a1 - 315) <= 1 && (!debugging || !dcode[3]) )
{
LABEL_10:
result = fflush(stdout);
if ( sflag )
return result;
goto LABEL_4;
}
}
else if ( (unsigned int)(*a1 - 315) <= 1 )
{
goto LABEL_10;
}
grind(stdout, "%z\n\n", a1);
goto LABEL_10;
}
if ( sflag )
return result;
LABEL_4:
if ( dflag )
return func5(para_count_2, (__int64)a1);
tc_para(a1);
return clear_temp(0LL);
}

original_code:
void do_para(tree t)
{
     static int para_count = 0;
     para_count++;
     if (vflag && debugging) {
   if ((debugging && dcode['d' - 'a'])) grind(stdout, "Paragraph %d:\n", para_count);
          if ((t->x_kind != 316 && t->x_kind != 315)
       || (debugging && dcode['d' - 'a']))
        grind(stdout, "%z\n\n", t);
   (void) fflush(stdout);
     }
     if (sflag) return;
     if (dflag)
   store_para(para_count, t);
     else {
   tc_para(t);
   clear_temp((univ) ((void *)0));
     }
}

canonical_original_code:
void do_para(struct blob *t)
{
     static int para_count = 0;
     para_count++;
     if (vflag && debugging) {
   if ((debugging && dcode['d' - 'a'])) grind(stdout, "Paragraph %d:\n", para_count);
          if ((t->x_kind != 316 && t->x_kind != 315)
       || (debugging && dcode['d' - 'a']))
        grind(stdout, "%z\n\n", t);
   (void) fflush(stdout);
     }
     if (sflag) return;
     if (dflag)
   store_para(para_count, t);
     else {
   tc_para(t);
   clear_temp((univ) ((void *)0));
     }
}


decompiled_code:
void check_file()
{
__int64 i; // rbx

if ( !sflag )
{
for ( i = spec_file; i; i = *(_QWORD *)(i + 32) )
check_para(i, 0LL);
}
}

canonical_decompiled_code:
void func7()
{
__int64 i; // rbx

if ( !sflag )
{
for ( i = spec_file; i; i = *(_QWORD *)(i + 32) )
func2(i, 0LL);
}
}

original_code:
void check_file(void)
{
     para p;
     if (sflag) return;
     for (p = spec_file; p != ((void *)0); p = p->p_next)
   check_para(p, (sym) ((void *)0));
}

canonical_original_code:
void check_file()
{
     struct para *p;
     if (sflag) return;
     for (p = spec_file; p != ((void *)0); p = p->p_next)
   check_para(p, (sym) ((void *)0));
}


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

result = a1[3];
if ( !result )
{
check_para(a1[4], a1);
result = a1[3];
}
return result;
}

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

result = a1[3];
if ( !result )
{
func2(a1[4], a1);
result = a1[3];
}
return result;
}

original_code:
def global_def(sym x)
{
     if (x->s_glodef == ((void *)0))
   check_para(x->s_def, x);
     return x->s_glodef;
}

canonical_original_code:
struct def *global_def(struct sym *x)
{
     if (x->s_glodef == ((void *)0))
   check_para(x->s_def, x);
     return x->s_glodef;
}

variable_types:
x
struct sym *

return_type: struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def *s_glodef; struct para { struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *


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

if ( a2 )
{
if ( a1 )
check_types(*(_QWORD *)(a1 + 40), *(_QWORD *)(a2 + 40), *(_QWORD *)(a1 + 8), a4, *(unsigned int *)(a4 + 8));
result = push_def(a2, a3);
}
return result;
}

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

if ( a2 )
{
if ( a1 )
check_types(*(_QWORD *)(a1 + 40), *(_QWORD *)(a2 + 40), *(_QWORD *)(a1 + 8), a4, *(unsigned int *)(a4 + 8));
result = push_def(a2, a3);
}
return result;
}

original_code:
static void project_fun(def d1, def d2, env v, tree cxt)
{
     if (d2 == ((void *)0)) return;
     if (d1 != ((void *)0))
   check_types(d1->d_u.type_d, d2->d_u.type_d, d1->d_name,
        cxt, cxt->x_loc);
     push_def(d2, v);
}

canonical_original_code:
static void project_fun(struct def *d1, struct def *d2, struct env *v, struct blob *cxt)
{
     if (d2 == ((void *)0)) return;
     if (d1 != ((void *)0))
   check_types(d1->d_u.type_d, d2->d_u.type_d, d1->d_name,
        cxt, cxt->x_loc);
     push_def(d2, v);
}

variable_types: struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def *s_glodef; struct para { struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *

variable_types: struct env { struct env *e_next; int e_ndefs; int e_partial; struct def *e_defs; } *


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

if ( a1 )
{
if ( a2 )
check_types(*(_QWORD *)(a1 + 40), *(_QWORD *)(a2 + 40), *(_QWORD *)(a1 + 8), a4, *(unsigned int *)(a4 + 8));
*(_QWORD *)(a1 + 40) = super_expand(*(_QWORD *)(a1 + 40), 0LL);
result = push_def(a1, a3);
}
else
{
*(_QWORD *)(a2 + 40) = super_expand(*(_QWORD *)(a2 + 40), 0LL);
result = push_def(a2, a3);
}
return result;
}

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

if ( a1 )
{
if ( a2 )
check_types(*(_QWORD *)(a1 + 40), *(_QWORD *)(a2 + 40), *(_QWORD *)(a1 + 8), a4, *(unsigned int *)(a4 + 8));
*(_QWORD *)(a1 + 40) = super_expand(*(_QWORD *)(a1 + 40), 0LL);
result = push_def(a1, a3);
}
else
{
*(_QWORD *)(a2 + 40) = super_expand(*(_QWORD *)(a2 + 40), 0LL);
result = push_def(a2, a3);
}
return result;
}

original_code:
static void implies_fun(def d1, def d2, env v, tree cxt)
{
     if (d1 == ((void *)0)) {
   d2->d_u.type_d = super_expand(d2->d_u.type_d, ((frame) ((void *)0)));
   push_def(d2, v);
     }
     else {
   if (d2 != ((void *)0))
        (void) check_types(d1->d_u.type_d, d2->d_u.type_d, d1->d_name,
      cxt, cxt->x_loc);
   d1->d_u.type_d = super_expand(d1->d_u.type_d, ((frame) ((void *)0)));
   push_def(d1, v);
     }
}

canonical_original_code:
static void implies_fun(struct def *d1, struct def *d2, struct env *v, struct blob *cxt)
{
     if (d1 == ((void *)0)) {
   d2->d_u.type_d = super_expand(d2->d_u.type_d, ((frame) ((void *)0)));
   push_def(d2, v);
     }
     else {
   if (d2 != ((void *)0))
        (void) check_types(d1->d_u.type_d, d2->d_u.type_d, d1->d_name,
      cxt, cxt->x_loc);
   d1->d_u.type_d = super_expand(d1->d_u.type_d, ((frame) ((void *)0)));
   push_def(d1, v);
     }
}

user_defined_types: struct env { struct env *e_next; int e_ndefs; int e_partial; struct def *e_defs; }


decompiled_code:
__int64 __fastcall and_fun(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
if ( !a1 )
return push_def(a2, a3);
if ( a2 )
check_types(*(_QWORD *)(a1 + 40), *(_QWORD *)(a2 + 40), *(_QWORD *)(a1 + 8), a4, *(unsigned int *)(a4 + 8));
return push_def(a1, a3);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
if ( !a1 )
return push_def(a2, a3);
if ( a2 )
check_types(*(_QWORD *)(a1 + 40), *(_QWORD *)(a2 + 40), *(_QWORD *)(a1 + 8), a4, *(unsigned int *)(a4 + 8));
return push_def(a1, a3);
}

original_code:
static void and_fun(def d1, def d2, env v, tree cxt)
{
     if (d1 == ((void *)0))
   push_def(d2, v);
     else if (d2 == ((void *)0))
   push_def(d1, v);
     else {
   (void) check_types(d1->d_u.type_d, d2->d_u.type_d, d1->d_name,
        cxt, cxt->x_loc);
   push_def(d1, v);
     }
}

canonical_original_code:
static void and_fun(struct def *d1, struct def *d2, struct env *v, struct blob *cxt)
{
     if (d1 == ((void *)0))
   push_def(d2, v);
     else if (d2 == ((void *)0))
   push_def(d1, v);
     else {
   (void) check_types(d1->d_u.type_d, d2->d_u.type_d, d1->d_name,
        cxt, cxt->x_loc);
   push_def(d1, v);
     }
}


decompiled_code:
__int64 __fastcall or_fun(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v6; // rdi
__int64 result; // rax
__int64 v8; // rax

if ( a1 )
{
v6 = *(_QWORD *)(a1 + 40);
if ( a2 )
{
if ( !(unsigned int)check_types(v6, *(_QWORD *)(a2 + 40), *(_QWORD *)(a1 + 8), a4, *(unsigned int *)(a4 + 8)) )
return push_def(a1, a3);
v8 = type_union(*(_QWORD *)(a1 + 40), 0LL, *(_QWORD *)(a2 + 40), 0LL);
}
else
{
v8 = super_expand(v6, 0LL);
}
*(_QWORD *)(a1 + 40) = v8;
result = push_def(a1, a3);
}
else
{
*(_QWORD *)(a2 + 40) = super_expand(*(_QWORD *)(a2 + 40), 0LL);
result = push_def(a2, a3);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v6; // rdi
__int64 result; // rax
__int64 v8; // rax

if ( a1 )
{
v6 = *(_QWORD *)(a1 + 40);
if ( a2 )
{
if ( !(unsigned int)check_types(v6, *(_QWORD *)(a2 + 40), *(_QWORD *)(a1 + 8), a4, *(unsigned int *)(a4 + 8)) )
return push_def(a1, a3);
v8 = type_union(*(_QWORD *)(a1 + 40), 0LL, *(_QWORD *)(a2 + 40), 0LL);
}
else
{
v8 = super_expand(v6, 0LL);
}
*(_QWORD *)(a1 + 40) = v8;
result = push_def(a1, a3);
}
else
{
*(_QWORD *)(a2 + 40) = super_expand(*(_QWORD *)(a2 + 40), 0LL);
result = push_def(a2, a3);
}
return result;
}

original_code:
static void or_fun(def d1, def d2, env v, tree cxt)
{
     if (d1 == ((void *)0)) {
   d2->d_u.type_d = super_expand(d2->d_u.type_d, ((frame) ((void *)0)));
   push_def(d2, v);
     }
     else if (d2 == ((void *)0)) {
   d1->d_u.type_d = super_expand(d1->d_u.type_d, ((frame) ((void *)0)));
   push_def(d1, v);
     }
     else {
   if (check_types(d1->d_u.type_d, d2->d_u.type_d, d1->d_name,
     cxt, cxt->x_loc))
        d1->d_u.type_d = type_union(d1->d_u.type_d, ((frame) ((void *)0)), d2->d_u.type_d, ((frame) ((void *)0)));
   push_def(d1, v);
     }
}

canonical_original_code:
static void or_fun(struct def *d1, struct def *d2, struct env *v, struct blob *cxt)
{
     if (d1 == ((void *)0)) {
   d2->d_u.type_d = super_expand(d2->d_u.type_d, ((frame) ((void *)0)));
   push_def(d2, v);
     }
     else if (d2 == ((void *)0)) {
   d1->d_u.type_d = super_expand(d1->d_u.type_d, ((frame) ((void *)0)));
   push_def(d1, v);
     }
     else {
   if (check_types(d1->d_u.type_d, d2->d_u.type_d, d1->d_name,
     cxt, cxt->x_loc))
        d1->d_u.type_d = type_union(d1->d_u.type_d, ((frame) ((void *)0)), d2->d_u.type_d, ((frame) ((void *)0)));
   push_def(d1, v);
     }
}


original_code:
bool open_sref(tree t, env e, def *d, frame *f)
{
     if ((*d = get_schema((tok) t->x_slot[0], t->x_loc)) == ((void *)0))
   return 0;
     *f = mk_frame((*d)->d_nparams);
     get_params("Schema", mk_symbol((tok) t->x_slot[0], empty),
  t->x_slot[2], e, *f, t->x_loc);
     return 1;
}

canonical_original_code:
int open_sref(struct blob *t, struct env *e, struct def **d, struct frame **f)
{
     if ((*d = get_schema((struct tok *) t->x_slot[0], t->x_loc)) == ((void *)0))
   return 0;
     *f = mk_frame((*d)->d_nparams);
     get_params("Schema", mk_symbol((struct tok *) t->x_slot[0], empty),
  t->x_slot[2], e, *f, t->x_loc);
     return 1;
}

variable_types: struct env { struct env *e_next; int e_ndefs; int e_partial; struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def *s_glodef; struct para { struct blob *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *e_defs; } *

variable_types:
d
struct def **

variable_types:
f
struct frame **


decompiled_code:
void __fastcall check_rename(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v5; // r13
_QWORD *v6; // r12
__int64 v7; // r15

if ( a3 )
{
v5 = a3;
do
{
while ( 1 )
{
v6 = *(_QWORD **)(*(_QWORD *)(**(_QWORD **)(v5 + 16) + 16LL) + 8LL);
if ( *(int *)a1 > 0 )
break;
LABEL_9:
tc_error(*(unsigned int *)(a4 + 8), "Renamed component %n does not exist", v6);
tc_e_etc("Expression: %z", a4);
tc_e_end();
v5 = *(_QWORD *)(*(_QWORD *)(v5 + 16) + 8LL);
if ( !v5 )
return;
}
v7 = 0LL;
while ( v6 != (_QWORD *)paint(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 16 * v7), a2) )
{
if ( *(_DWORD *)a1 <= (int)++v7 )
goto LABEL_9;
}
v5 = *(_QWORD *)(*(_QWORD *)(v5 + 16) + 8LL);
}
while ( v5 );
}
}

original_code:
void check_rename(schema s, tok dec, tree rename, tree cxt)
{
     tree r;
     int i;
     for (r = rename; r != ((tree) ((void *)0)); r = (r)->x_slot[1]) {
   sym x = (sym) (r)->x_slot[0]->x_slot[1];
   for (i = 0; i < s->z_ncomps; i++)
        if (paint(s->z_comp[i].z_name, dec) == x)
      goto ok;
   tc_error(cxt->x_loc, "Renamed component %n does not exist", x);
   tc_e_etc("Expression: %z", cxt);
   tc_e_end();
     ok:
   ;
     }
}

canonical_original_code:
void check_rename(struct schema *s, struct tok *dec, struct blob *rename, struct blob *cxt)
{
     struct blob *r;
     int i;
     for (r = rename; r != ((tree) ((void *)0)); r = (r)->x_slot[1]) {
   struct sym *x = (sym) (r)->x_slot[0]->x_slot[1];
   for (i = 0; i < s->z_ncomps; i++)
        if (paint(s->z_comp[i].z_name, dec) == x)
      goto ok;
   tc_error(cxt->x_loc, "Renamed component %n does not exist", x);
   tc_e_etc("Expression: %z", cxt);
   tc_e_end();
     ok:
   ;
     }
}

variable_types: struct schema { int z_ncomps; struct compnt { struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *s_glodef; struct para { struct blob *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *z_name; struct type *z_type; } *z_comp; } *

variable_types:
dec
struct tok *

variable_types:
rename
struct blob *

variable_types: struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *s_glodef; struct para { struct blob *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *


original_code:
sym get_rename(sym x, tok dec, tree rename)
{
     tree r;
     sym xx = paint(x, dec);
     for (r = rename; r != ((tree) ((void *)0)); r = (r)->x_slot[1])
   if ((sym) (r)->x_slot[0]->x_slot[1] == xx)
        return ((sym) (r)->x_slot[0]->x_slot[0]);
     return xx;
}

canonical_original_code:
struct sym *get_rename(struct sym *x, struct tok *dec, struct blob *rename)
{
     struct blob *r;
     struct sym *xx = paint(x, dec);
     for (r = rename; r != ((tree) ((void *)0)); r = (r)->x_slot[1])
   if ((sym) (r)->x_slot[0]->x_slot[1] == xx)
        return ((sym) (r)->x_slot[0]->x_slot[0]);
     return xx;
}

return_type: struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *s_glodef; struct para { struct blob *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *


original_code:
void do_sref(tree t, env e, env v)
{
     tok dec = (tok) t->x_slot[1];
     tree renames = t->x_slot[3];
     def d;
     schema s;
     frame params;
     int i;
     if (t->x_kind != 358) bad_tag("do_sref", t->x_kind);
     if (! open_sref(t, e, &d, &params)) {
   v->e_partial = 1;
   return;
     }
     s = d->d_u.schema_d;
     check_rename(d->d_u.schema_d, dec, renames, t);
     for (i = 0; i < s->z_ncomps; i++)
   merge_def(VAR, get_rename(s->z_comp[i].z_name, dec, renames),
      seal(s->z_comp[i].z_type, params), v, t, t->x_loc);
}

canonical_original_code:
void do_sref(struct blob *t, struct env *e, struct env *v)
{
     struct tok *dec = (tok) t->x_slot[1];
     struct blob *renames = t->x_slot[3];
     struct def *d;
     struct schema *s;
     struct frame *params;
     int i;
     if (t->x_kind != 358) bad_tag("do_sref", t->x_kind);
     if (! open_sref(t, e, &d, &params)) {
   v->e_partial = 1;
   return;
     }
     s = d->d_u.schema_d;
     check_rename(d->d_u.schema_d, dec, renames, t);
     for (i = 0; i < s->z_ncomps; i++)
   merge_def(VAR, get_rename(s->z_comp[i].z_name, dec, renames),
      seal(s->z_comp[i].z_type, params), v, t, t->x_loc);
}

variable_types:
v
struct env *

variable_types: struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym { int x_kind; struct tok *s_basename; struct tok *s_decor; struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *s_glodef; struct para { struct blob *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *

variable_types: struct frame { int f_nvars; struct frame *f_next; struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *f_cxt; struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def *s_glodef; struct para { struct blob *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type *type_d; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_d; } d_u; } *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema *schema_t; struct { struct type *t__mtype; struct frame *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } **f_var; } *

variable_types: i int


decompiled_code:
__int64 __fastcall tc_sexp(__int64 a1, __int64 a2)
{
__int64 j; // r12
__int64 v4; // rbx
__int64 v5; // rax
_QWORD *v6; // rbx
__int64 v7; // rcx
__int64 v8; // rdx
const char *v9; // r8
__int64 i; // rbx
__int64 v11; // rax
__int64 v12; // rbx

switch ( *(_DWORD *)a1 )
{
case 0x116:
v7 = empty;
v8 = prime;
v9 = "sequential composition";
return compose(a1, a2, v8, v7, v9);
case 0x119:
j = tc_sexp(**(_QWORD **)(a1 + 16));
for ( i = *(_QWORD *)(*(_QWORD *)(a1 + 16) + 8LL); i; i = *(_QWORD *)(*(_QWORD *)(i + 16) + 8LL) )
hide_var(**(_QWORD **)(i + 16), 0LL, j, a1, *(unsigned int *)(a1 + 8));
return j;
case 0x128:
v7 = query;
v8 = pling;
v9 = "piping";
return compose(a1, a2, v8, v7, v9);
case 0x12A:
return precond_isra_0(*(_QWORD *)(a1 + 16));
case 0x12B:
return binary_sexp(project_fun, a1, a2);
case 0x166:
j = new_env(a2);
do_sref(a1, a2, j);
return j;
case 0x168:
return tc_schema(**(_QWORD **)(a1 + 16));
case 0x17B:
v11 = tc_sexp(**(_QWORD **)(a1 + 16));
v12 = *(_QWORD *)(v11 + 16);
for ( j = v11; v12; v12 = *(_QWORD *)(v12 + 32) )
*(_QWORD *)(v12 + 40) = super_expand(*(_QWORD *)(v12 + 40), 0LL);
return j;
case 0x17C:
return binary_sexp(and_fun, a1, a2);
case 0x17D:
return binary_sexp(or_fun, a1, a2);
case 0x17E:
case 0x17F:
return binary_sexp(implies_fun, a1, a2);
case 0x180:
case 0x181:
case 0x182:
v4 = tc_schema(**(_QWORD **)(a1 + 16));
v5 = tc_sexp(*(_QWORD *)(*(_QWORD *)(a1 + 16) + 8LL));
v6 = *(_QWORD **)(v4 + 16);
for ( j = v5; v6; v6 = (_QWORD *)v6[4] )
hide_var(v6[1], v6[5], j, a1, *(unsigned int *)(a1 + 8));
return j;
default:
j = 0LL;
bad_tag("get_sexp");
return j;
}
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2)
{
__int64 j; // r12
__int64 v4; // rbx
__int64 v5; // rax
_QWORD *v6; // rbx
__int64 v7; // rcx
__int64 v8; // rdx
const char *v9; // r8
__int64 i; // rbx
__int64 v11; // rax
__int64 v12; // rbx

switch ( *(_DWORD *)a1 )
{
case 0x116:
v7 = empty;
v8 = prime;
v9 = "sequential composition";
return func10(a1, a2, v8, v7, v9);
case 0x119:
j = func8(**(_QWORD **)(a1 + 16));
for ( i = *(_QWORD *)(*(_QWORD *)(a1 + 16) + 8LL); i; i = *(_QWORD *)(*(_QWORD *)(i + 16) + 8LL) )
hide_var(**(_QWORD **)(i + 16), 0LL, j, a1, *(unsigned int *)(a1 + 8));
return j;
case 0x128:
v7 = query;
v8 = pling;
v9 = "piping";
return func10(a1, a2, v8, v7, v9);
case 0x12A:
return func11(*(_QWORD *)(a1 + 16));
case 0x12B:
return func9(project_fun, a1, a2);
case 0x166:
j = new_env(a2);
func7(a1, a2, j);
return j;
case 0x168:
return tc_schema(**(_QWORD **)(a1 + 16));
case 0x17B:
v11 = func8(**(_QWORD **)(a1 + 16));
v12 = *(_QWORD *)(v11 + 16);
for ( j = v11; v12; v12 = *(_QWORD *)(v12 + 32) )
*(_QWORD *)(v12 + 40) = super_expand(*(_QWORD *)(v12 + 40), 0LL);
return j;
case 0x17C:
return func9(and_fun, a1, a2);
case 0x17D:
return func9(or_fun, a1, a2);
case 0x17E:
case 0x17F:
return func9(implies_fun, a1, a2);
case 0x180:
case 0x181:
case 0x182:
v4 = tc_schema(**(_QWORD **)(a1 + 16));
v5 = func8(*(_QWORD *)(*(_QWORD *)(a1 + 16) + 8LL));
v6 = *(_QWORD **)(v4 + 16);
for ( j = v5; v6; v6 = (_QWORD *)v6[4] )
hide_var(v6[1], v6[5], j, a1, *(unsigned int *)(a1 + 8));
return j;
default:
j = 0LL;
bad_tag("get_sexp");
return j;
}
}

original_code:
env tc_sexp(tree t, env e)
{
     env e1, e2;
     tree u;
     def d;
     switch (t->x_kind) {
     case 360:
   return tc_schema(t->x_slot[0], e);
     case 358:
   e1 = new_env(e);
   do_sref(t, e, e1);
   return e1;
     case 379:
   e1 = tc_sexp(t->x_slot[0], e);
   for (d = e1->e_defs; d != ((void *)0); d = d->d_next)
        d->d_u.type_d = super_expand(d->d_u.type_d, ((frame) ((void *)0)));
   return e1;
     case 380: return binary_sexp(and_fun, t, e);
     case 381: return binary_sexp(or_fun, t, e);
     case 382: case 383:
      return binary_sexp(implies_fun, t, e);
     case 299: return binary_sexp(project_fun, t, e);
     case 278:
   return compose(t, e, prime, empty, "sequential composition");
     case 296:
   return compose(t, e, pling, query, "piping");
     case 281:
   e1 = tc_sexp(t->x_slot[0], e);
   for (u = t->x_slot[1]; u != ((tree) ((void *)0)); u = (u)->x_slot[1])
        hide_var((sym) (u)->x_slot[0], (type) ((void *)0), e1, t, t->x_loc);
   return e1;
     case 385: case 384: case 386:
   e2 = tc_schema(t->x_slot[0], e);
   e1 = tc_sexp(t->x_slot[1], e);
   for (d = e2->e_defs; d != ((void *)0); d = d->d_next)
        hide_var(d->d_name, d->d_u.type_d, e1, t, t->x_loc);
   return e1;
     case 298:
   return precond(t, e);
     default:
   bad_tag("get_sexp", t->x_kind);
   return ((void *)0);
     }
}

canonical_original_code:
struct env *tc_sexp(struct blob *t, struct env *e)
{
     struct env *e1; struct env *e2;
     struct blob *u;
     struct def *d;
     switch (t->x_kind) {
     case 360:
   return tc_schema(t->x_slot[0], e);
     case 358:
   e1 = new_env(e);
   do_sref(t, e, e1);
   return e1;
     case 379:
   e1 = tc_sexp(t->x_slot[0], e);
   for (d = e1->e_defs; d != ((void *)0); d = d->d_next)
        d->d_u.type_d = super_expand(d->d_u.type_d, ((frame) ((void *)0)));
   return e1;
     case 380: return binary_sexp(and_fun, t, e);
     case 381: return binary_sexp(or_fun, t, e);
     case 382: case 383:
      return binary_sexp(implies_fun, t, e);
     case 299: return binary_sexp(project_fun, t, e);
     case 278:
   return compose(t, e, prime, empty, "sequential composition");
     case 296:
   return compose(t, e, pling, query, "piping");
     case 281:
   e1 = tc_sexp(t->x_slot[0], e);
   for (u = t->x_slot[1]; u != ((tree) ((void *)0)); u = (u)->x_slot[1])
        hide_var((sym) (u)->x_slot[0], (type) ((void *)0), e1, t, t->x_loc);
   return e1;
     case 385: case 384: case 386:
   e2 = tc_schema(t->x_slot[0], e);
   e1 = tc_sexp(t->x_slot[1], e);
   for (d = e2->e_defs; d != ((void *)0); d = d->d_next)
        hide_var(d->d_name, d->d_u.type_d, e1, t, t->x_loc);
   return e1;
     case 298:
   return precond(t, e);
     default:
   bad_tag("get_sexp", t->x_kind);
   return ((void *)0);
     }
}

variable_types:
t
struct blob *

variable_types:
e
struct env *

variable_types: struct env { struct env *e_next; int e_ndefs; int e_partial; struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def *s_glodef; struct para { struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *e_defs; } *


original_code:
static env binary_sexp(mergeop f, tree t, env e)
{
     env e1 = sort_env(tc_sexp(t->x_slot[0], e));
     env e2 = sort_env(tc_sexp(t->x_slot[1], e));
     env ee = new_env(e);
     def d1, d2;
     d1 = pop_def(e1);
     d2 = pop_def(e2);
     while (d1 != ((void *)0) || d2 != ((void *)0)) {
   int c = (d1 == ((void *)0) ? 1 : d2 == ((void *)0) ? -1
     : my_compare(&d1, &d2));
   if (c < 0) {
        (*f)(d1, (def) ((void *)0), ee, t);
        d1 = pop_def(e1);
   }
   else if (c > 0) {
        (*f)((def) ((void *)0), d2, ee, t);
        d2 = pop_def(e2);
   }
   else {
        (*f)(d1, d2, ee, t);
        d1 = pop_def(e1);
        d2 = pop_def(e2);
   }
     }
     return ee;
}

canonical_original_code:
static struct env *binary_sexp(void (*f)(struct def *d1, struct def *d2, struct env *vars, struct blob *cxt), struct blob *t, struct env *e)
{
     struct env *e1 = sort_env(tc_sexp(t->x_slot[0], e));
     struct env *e2 = sort_env(tc_sexp(t->x_slot[1], e));
     struct env *ee = new_env(e);
     struct def *d1; struct def *d2;
     d1 = pop_def(e1);
     d2 = pop_def(e2);
     while (d1 != ((void *)0) || d2 != ((void *)0)) {
   int c = (d1 == ((void *)0) ? 1 : d2 == ((void *)0) ? -1
     : my_compare(&d1, &d2));
   if (c < 0) {
        (*f)(d1, (def) ((void *)0), ee, t);
        d1 = pop_def(e1);
   }
   else if (c > 0) {
        (*f)((def) ((void *)0), d2, ee, t);
        d2 = pop_def(e2);
   }
   else {
        (*f)(d1, d2, ee, t);
        d1 = pop_def(e1);
        d2 = pop_def(e2);
   }
     }
     return ee;
}

variable_types: void (*)(struct def *d1, struct def *d2, struct env *vars, struct blob *cxt)

variable_types: c int

return_type: struct env { struct env *e_next; int e_ndefs; int e_partial; struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def *s_glodef; struct para { struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *e_defs; } *


compose

original_code:
static env compose(tree t, env e, tok ldec, tok rdec, char *kind)
{
     env e1 = tc_sexp(t->x_slot[0], e);
     env e2 = tc_sexp(t->x_slot[1], e);
     env ee = new_env(e);
     def q;
     for (;;) {
   def d = pop_def(e1);
   if (d == ((void *)0))
        break;
   else if (d->d_name->s_decor != ldec)
        push_def(d, ee);
   else {
        sym rname = mk_symbol(d->d_name->s_basename, rdec);
        type rtype = del_var(rname, e2);
        if (rtype == ((void *)0))
      push_def(d, ee);
        else if (! unify(d->d_u.type_d, rtype)) {
      tc_error(t->x_loc, "Type mismatch in %s", kind);
      tc_e_etc("Expression: %z", t);
      tc_e_etc("Type of %n in LHS: %t", d->d_name, d->d_u.type_d);
      tc_e_etc("Type of %n in RHS: %t", rname, rtype);
      tc_e_end();
        }
   }
     }
     for (q = e2->e_defs; q != ((void *)0); q = q->d_next)
   merge_def(VAR, q->d_name, q->d_u.type_d, ee, t, t->x_loc);
     return ee;
}

canonical_original_code:
static struct env *compose(struct blob *t, struct env *e, struct tok *ldec, struct tok *rdec, char *kind)
{
     struct env *e1 = tc_sexp(t->x_slot[0], e);
     struct env *e2 = tc_sexp(t->x_slot[1], e);
     struct env *ee = new_env(e);
     struct def *q;
     for (;;) {
   struct def *d = pop_def(e1);
   if (d == ((void *)0))
        break;
   else if (d->d_name->s_decor != ldec)
        push_def(d, ee);
   else {
        struct sym *rname = mk_symbol(d->d_name->s_basename, rdec);
        struct type *rtype = del_var(rname, e2);
        if (rtype == ((void *)0))
      push_def(d, ee);
        else if (! unify(d->d_u.type_d, rtype)) {
      tc_error(t->x_loc, "Type mismatch in %s", kind);
      tc_e_etc("Expression: %z", t);
      tc_e_etc("Type of %n in LHS: %t", d->d_name, d->d_u.type_d);
      tc_e_etc("Type of %n in RHS: %t", rname, rtype);
      tc_e_end();
        }
   }
     }
     for (q = e2->e_defs; q != ((void *)0); q = q->d_next)
   merge_def(VAR, q->d_name, q->d_u.type_d, ee, t, t->x_loc);
     return ee;
}

variable_types:
ldec
struct tok *

variable_types:
rdec
struct tok *

variable_types:
kind
char *

variable_types: struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def *s_glodef; struct para { struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *type_d; struct schema *schema_d; } d_u; } *

variable_types: struct type { enum kind_t { GIVENT=0, TYPEVAR=1, POWERT=2, CPRODUCT=3, SPRODUCT=4, MOLECULE=5, ABBREV=6 } t_kind; union { struct def { enum kind_d { GSET=0, VAR=1, SCHEMA=2, GENCONST=3, DATACONS=4, LETVAR=5 } d_kind; struct sym { int x_kind; struct tok { int x_kind; char *l_chars; int l_value; int l_prio; int l_toknum; char *l_pname; struct sym *l_sym; struct tok *l_link; struct tok *l_prefix; struct tok *l_root; } *s_basename; struct tok *s_decor; struct def *s_glodef; struct para { struct blob { int x_kind; int x_arity; int x_loc; struct blob **x_slot; } *p_text; int p_serial; char *p_file; enum mark { UNTOUCHED=0, BUSY=1, DONE=2 } p_flag; struct para *p_next; } *s_def; struct sym *s_link; } *d_name; int d_nparams; int d_abbrev; struct def *d_next; union { struct type *type_d; struct schema { int z_ncomps; struct compnt { struct sym *z_name; struct type *z_type; } *z_comp; } *schema_d; } d_u; } *given_t; int typevar_t; struct type *base_t; struct { int t__nfields; struct type **t__field; } cproduct_t; struct schema *schema_t; struct { struct type *t__mtype; struct frame { int f_nvars; struct frame *f_next; struct blob *f_cxt; struct type **f_var; } *t__mframe; } molecule_t; struct { struct def *t__def; struct frame *t__params; } abbrev_t; } t_u; } *


decompiled_code:
__int64 mark_temp()
{
return qword_540;
}

canonical_decompiled_code:
__int64 func1()
{
return qword_540;
}

original_code:
univ mark_temp(void)
{
     return (univ) temp_chain.c_free;
}

canonical_original_code:
void *mark_temp()
{
     return (void *) temp_chain.c_free;
}

return_type: void *


decompiled_code:
void begin_perm()
{
current_chain = &perm_chain;
}

canonical_decompiled_code:
void func2()
{
current_chain = &perm_chain;
}

original_code:
void begin_perm(void)
{
     current_chain = &perm_chain;
}


decompiled_code:
void end_perm()
{
current_chain = &temp_chain;
}

canonical_decompiled_code:
void func3()
{
current_chain = &temp_chain;
}

original_code:
void end_perm(void)
{
     current_chain = &temp_chain;
}


decompiled_code:
int alloc_stats()
{
unsigned int v0; // eax
__int64 v1; // rdx
__int64 v2; // rcx
__int64 v3; // r8

chunk_count_isra_0((_QWORD *)free_chain);
chunk_count_isra_0((_QWORD *)temp_chain);
v0 = chunk_count_isra_0((_QWORD *)perm_chain);
return printf("Storage stats: perm = %d, temp = %d, free = %d blocks of %d\n", v0, v1, v2, v3);
}

canonical_decompiled_code:
int func4()
{
unsigned int v0; // eax
__int64 v1; // rdx
__int64 v2; // rcx
__int64 v3; // r8

func0((_QWORD *)free_chain);
func0((_QWORD *)temp_chain);
v0 = func0((_QWORD *)perm_chain);
return printf("Storage stats: perm = %d, temp = %d, free = %d blocks of %d\n", v0, v1, v2, v3);
}

original_code:
void alloc_stats(void)
{
     (void) printf(
       "Storage stats: perm = %d, temp = %d, free = %d blocks of %d\n",
       chunk_count(&perm_chain), chunk_count(&temp_chain),
       chunk_count(&free_chain), 65536);
}

canonical_original_code:
void alloc_stats()
{
     (void) printf(
       "Storage stats: perm = %d, temp = %d, free = %d blocks of %d\n",
       chunk_count(&perm_chain), chunk_count(&temp_chain),
       chunk_count(&free_chain), 65536);
}


decompiled_code:
void __fastcall clear_temp(unsigned __int64 a1)
{
__int64 v1; // rcx
int v2; // er8
_QWORD *v3; // rdx
unsigned __int64 v4; // rax
_QWORD *v5; // rsi

v1 = temp_chain;
v2 = debugging;
v3 = (_QWORD *)temp_chain;
if ( !a1 )
goto LABEL_22;
while ( (unsigned __int64)v3 >= a1 || (unsigned __int64)(v3 + 0x2000) < a1 )
v3 = (_QWORD *)*v3;
if ( debugging && dcode[18] )
{
v4 = a1;
v5 = v3;
if ( v3 )
{
do
{
for ( ; v4 < (unsigned __int64)(v5 + 0x2000); *(_QWORD *)(v4 - 8) = 2863311530LL )
v4 += 8LL;
v5 = (_QWORD *)*v5;
v4 = (unsigned __int64)(v5 + 1);
}
while ( v5 );
goto LABEL_8;
}
}
else if ( v3 )
{
LABEL_8:
v1 = *v3;
*v3 = 0LL;
goto LABEL_9;
}
LABEL_22:
temp_chain = 0LL;
v3 = 0LL;
LABEL_9:
if ( v1 )
{
if ( free_chain )
*(_QWORD *)qword_518 = v1;
else
free_chain = v1;
qword_518 = qword_538;
}
qword_538 = (__int64)v3;
qword_540 = a1;
if ( v2 )
{
if ( dcode[0] )
alloc_stats();
}
}

canonical_decompiled_code:
void __fastcall func5(unsigned __int64 a1)
{
__int64 v1; // rcx
int v2; // er8
_QWORD *v3; // rdx
unsigned __int64 v4; // rax
_QWORD *v5; // rsi

v1 = temp_chain;
v2 = debugging;
v3 = (_QWORD *)temp_chain;
if ( !a1 )
goto LABEL_22;
while ( (unsigned __int64)v3 >= a1 || (unsigned __int64)(v3 + 0x2000) < a1 )
v3 = (_QWORD *)*v3;
if ( debugging && dcode[18] )
{
v4 = a1;
v5 = v3;
if ( v3 )
{
do
{
for ( ; v4 < (unsigned __int64)(v5 + 0x2000); *(_QWORD *)(v4 - 8) = 2863311530LL )
v4 += 8LL;
v5 = (_QWORD *)*v5;
v4 = (unsigned __int64)(v5 + 1);
}
while ( v5 );
goto LABEL_8;
}
}
else if ( v3 )
{
LABEL_8:
v1 = *v3;
*v3 = 0LL;
goto LABEL_9;
}
LABEL_22:
temp_chain = 0LL;
v3 = 0LL;
LABEL_9:
if ( v1 )
{
if ( free_chain )
*(_QWORD *)qword_518 = v1;
else
free_chain = v1;
qword_518 = qword_538;
}
qword_538 = (__int64)v3;
qword_540 = a1;
if ( v2 )
{
if ( dcode[0] )
func4();
}
}

original_code:
void clear_temp(univ mark)
{
     chunk *p, *r;
     if (mark == ((void *)0))
   p = ((void *)0);
     else {
   p = temp_chain.c_front;
   while ((addr) mark <= (addr) p
   || (addr) mark > (addr) p + 65536)
        p = p->next;
     }
     if ((debugging && dcode['s' - 'a'])) {
   char *q = mark;
   r = p;
   while (r != ((void *)0)) {
        while (q < (char *) r + 65536) {
      *((long *) q) = 0xaaaaaaaa;
      q = q + sizeof(long);
        }
        r = r->next;
        q = (char *) r + sizeof(chunk);
   }
     }
     if (p == ((void *)0)) {
   r = temp_chain.c_front;
   temp_chain.c_front = ((void *)0);
     }
     else {
   r = p->next;
   p->next = ((void *)0);
     }
     if (r != ((void *)0)) {
   if (free_chain.c_front == ((void *)0))
        free_chain.c_front = r;
   else
        free_chain.c_back->next = r;
   free_chain.c_back = temp_chain.c_back;
     }
     temp_chain.c_back = p;
     temp_chain.c_free = (char *) mark;
   if ((debugging && dcode['a' - 'a']))
        alloc_stats();
}

canonical_original_code:
void clear_temp(void *mark)
{
     struct chunk *p; struct chunk *r;
     if (mark == ((void *)0))
   p = ((void *)0);
     else {
   p = temp_chain.c_front;
   while ((unsigned long) mark <= (unsigned long) p
   || (unsigned long) mark > (unsigned long) p + 65536)
        p = p->next;
     }
     if ((debugging && dcode['s' - 'a'])) {
   char *q = mark;
   r = p;
   while (r != ((void *)0)) {
        while (q < (char *) r + 65536) {
      *((long *) q) = 0xaaaaaaaa;
      q = q + sizeof(long);
        }
        r = r->next;
        q = (char *) r + sizeof(chunk);
   }
     }
     if (p == ((void *)0)) {
   r = temp_chain.c_front;
   temp_chain.c_front = ((void *)0);
     }
     else {
   r = p->next;
   p->next = ((void *)0);
     }
     if (r != ((void *)0)) {
   if (free_chain.c_front == ((void *)0))
        free_chain.c_front = r;
   else
        free_chain.c_back->next = r;
   free_chain.c_back = temp_chain.c_back;
     }
     temp_chain.c_back = p;
     temp_chain.c_free = (char *) mark;
   if ((debugging && dcode['a' - 'a']))
        alloc_stats();
}

variable_types:
mark
void *

variable_types:
p
struct chunk { struct chunk *next; } *

variable_types:
r
struct chunk { struct chunk *next; } *

variable_types:
q
char *


decompiled_code:
void *__fastcall alloc_mem(int a1, int a2, const char *a3)
{
void *v4; // r12

v4 = malloc(a2 * (__int64)a1);
if ( !v4 )
panic("out of memory in %s", a3);
return v4;
}

canonical_decompiled_code:
void *__fastcall func6(int a1, int a2, const char *a3)
{
void *v4; // r12

v4 = malloc(a2 * (__int64)a1);
if ( !v4 )
panic("out of memory in %s", a3);
return v4;
}

original_code:
univ alloc_mem(int n_items, int size, char *cxt)
{
     univ p = malloc(n_items * (size_t) size);
     if (p == ((void *)0)) panic("out of memory in %s", cxt);
     return p;
}

canonical_original_code:
void *alloc_mem(int n_items, int size, char *cxt)
{
     void *p = malloc(n_items * (size_t) size);
     if (p == ((void *)0)) panic("out of memory in %s", cxt);
     return p;
}

variable_types: size int

variable_types:
cxt
char *

variable_types:
p
void *


decompiled_code:
__int64 __fastcall u_occur(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v6; // r14
__int64 result; // rax
__int64 v8; // rcx
__int64 v9; // r14
__int64 v10; // rdx
__int64 v11; // r14

while ( 2 )
{
switch ( *(_DWORD *)a3 )
{
case 0:
goto LABEL_5;
case 1:
v8 = *(int *)(a3 + 8);
a3 = *(_QWORD *)(*(_QWORD *)(a4 + 24) + 8 * v8);
if ( a3 )
{
a4 = 0LL;
continue;
}
if ( a2 == a4 && (_DWORD)v8 == *(_DWORD *)(a1 + 8) )
LABEL_20:
result = 1LL;
else
LABEL_5:
result = 0LL;
return result;
case 2:
goto LABEL_7;
case 3:
v9 = 0LL;
if ( *(int *)(a3 + 8) <= 0 )
goto LABEL_5;
while ( !(unsigned int)u_occur(a1, a2, *(_QWORD *)(*(_QWORD *)(a3 + 16) + 8 * v9), a4) )
{
if ( *(_DWORD *)(a3 + 8) <= (int)++v9 )
goto LABEL_5;
}
goto LABEL_20;
case 4:
v10 = *(_QWORD *)(a3 + 8);
v11 = 0LL;
if ( *(int *)v10 <= 0 )
goto LABEL_5;
while ( !(unsigned int)u_occur(a1, a2, *(_QWORD *)(*(_QWORD *)(v10 + 8) + 16 * v11 + 8), a4) )
{
v10 = *(_QWORD *)(a3 + 8);
if ( *(_DWORD *)v10 <= (int)++v11 )
goto LABEL_5;
}
goto LABEL_20;
case 5:
a4 = *(_QWORD *)(a3 + 16);
LABEL_7:
a3 = *(_QWORD *)(a3 + 8);
continue;
case 6:
v6 = 0LL;
if ( *(int *)(*(_QWORD *)(a3 + 8) + 16LL) <= 0 )
goto LABEL_5;
while ( !(unsigned int)u_occur(a1, a2, *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a3 + 16) + 24LL) + 8 * v6), a4) )
{
if ( *(_DWORD *)(*(_QWORD *)(a3 + 8) + 16LL) <= (int)++v6 )
goto LABEL_5;
}
goto LABEL_20;
default:
bad_tag("u_occur");
return 0LL;
}
}
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 v6; // r14
__int64 result; // rax
__int64 v8; // rcx
__int64 v9; // r14
__int64 v10; // rdx
__int64 v11; // r14

while ( 2 )
{
switch ( *(_DWORD *)a3 )
{
case 0:
goto LABEL_5;
case 1:
v8 = *(int *)(a3 + 8);
a3 = *(_QWORD *)(*(_QWORD *)(a4 + 24) + 8 * v8);
if ( a3 )
{
a4 = 0LL;
continue;
}
if ( a2 == a4 && (_DWORD)v8 == *(_DWORD *)(a1 + 8) )
LABEL_20:
result = 1LL;
else
LABEL_5:
result = 0LL;
return result;
case 2:
goto LABEL_7;
case 3:
v9 = 0LL;
if ( *(int *)(a3 + 8) <= 0 )
goto LABEL_5;
while ( !(unsigned int)func0(a1, a2, *(_QWORD *)(*(_QWORD *)(a3 + 16) + 8 * v9), a4) )
{
if ( *(_DWORD *)(a3 + 8) <= (int)++v9 )
goto LABEL_5;
}
goto LABEL_20;
case 4:
v10 = *(_QWORD *)(a3 + 8);
v11 = 0LL;
if ( *(int *)v10 <= 0 )
goto LABEL_5;
while ( !(unsigned int)func0(a1, a2, *(_QWORD *)(*(_QWORD *)(v10 + 8) + 16 * v11 + 8), a4) )
{
v10 = *(_QWORD *)(a3 + 8);
if ( *(_DWORD *)v10 <= (int)++v11 )
goto LABEL_5;
}
goto LABEL_20;
case 5:
a4 = *(_QWORD *)(a3 + 16);
LABEL_7:
a3 = *(_QWORD *)(a3 + 8);
continue;
case 6:
v6 = 0LL;
if ( *(int *)(*(_QWORD *)(a3 + 8) + 16LL) <= 0 )
goto LABEL_5;
while ( !(unsigned int)func0(a1, a2, *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a3 + 16) + 24LL) + 8 * v6), a4) )
{
if ( *(_DWORD *)(*(_QWORD *)(a3 + 8) + 16LL) <= (int)++v6 )
goto LABEL_5;
}
goto LABEL_20;
default:
bad_tag("u_occur");
return 0LL;
}
}
}

original_code:
static bool u_occur(type v, frame f1, type t, frame f2)
{
     type w;
     int i;
     switch (t->t_kind) {
     case GIVENT:
   return 0;
     case TYPEVAR:
   if ((w = f2->f_var[t->t_u.typevar_t]) != ((void *)0))
        return u_occur(v, f1, w, ((frame) ((void *)0)));
   else
        return (f1 == f2 && v->t_u.typevar_t == t->t_u.typevar_t);
     case POWERT:
   return u_occur(v, f1, t->t_u.base_t, f2);
     case CPRODUCT:
   for (i = 0; i < t->t_u.cproduct_t.t__nfields; i++)
        if (u_occur(v, f1, t->t_u.cproduct_t.t__field[i], f2))
      return 1;
   return 0;
     case SPRODUCT:
   for (i = 0; i < t->t_u.schema_t->z_ncomps; i++)
        if (u_occur(v, f1, t->t_u.schema_t->z_comp[i].z_type, f2))
      return 1;
   return 0;
     case MOLECULE:
   return u_occur(v, f1, t->t_u.molecule_t.t__mtype, t->t_u.molecule_t.t__mframe);
     case ABBREV:
   for (i = 0; i < t->t_u.abbrev_t.t__def->d_nparams; i++)
        if (u_occur(v, f1, t->t_u.abbrev_t.t__params->f_var[i], f2))
      return 1;
   return 0;
     default:
   bad_tag("u_occur", t->t_kind);
   return 0;
     }
}

canonical_original_code:
static int u_occur(struct type *v, struct frame *f1, struct type *t, struct frame *f2)
{
     struct type *w;
     int i;
     switch (t->t_kind) {
     case GIVENT:
   return 0;
     case TYPEVAR:
   if ((w = f2->f_var[t->t_u.typevar_t]) != ((void *)0))
        return u_occur(v, f1, w, ((frame) ((void *)0)));
   else
        return (f1 == f2 && v->t_u.typevar_t == t->t_u.typevar_t);
     case POWERT:
   return u_occur(v, f1, t->t_u.base_t, f2);
     case CPRODUCT:
   for (i = 0; i < t->t_u.cproduct_t.t__nfields; i++)
        if (u_occur(v, f1, t->t_u.cproduct_t.t__field[i], f2))
      return 1;
   return 0;
     case SPRODUCT:
   for (i = 0; i < t->t_u.schema_t->z_ncomps; i++)
        if (u_occur(v, f1, t->t_u.schema_t->z_comp[i].z_type, f2))
      return 1;
   return 0;
     case MOLECULE:
   return u_occur(v, f1, t->t_u.molecule_t.t__mtype, t->t_u.molecule_t.t__mframe);
     case ABBREV:
   for (i = 0; i < t->t_u.abbrev_t.t__def->d_nparams; i++)
        if (u_occur(v, f1, t->t_u.abbrev_t.t__params->f_var[i], f2))
      return 1;
   return 0;
     default:
   bad_tag("u_occur", t->t_kind);
   return 0;
     }
}

variable_types:
t
struct type *

variable_types: i int


bind

decompiled_code:
__int64 __fastcall bind(__int64 a1, __int64 a2, __int64 a3)
{
__int64 result; // rax

if ( debugging && dcode[20] )
grind(stdout, "Bind: %x to %t\n", *(_QWORD *)(a2 + 24) + 8LL * *(int *)(a1 + 8), a3);
result = *(_QWORD *)(a2 + 24);
*(_QWORD *)(result + 8LL * *(int *)(a1 + 8)) = a3;
return result;
}

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

if ( debugging && dcode[20] )
grind(stdout, "Bind: %x to %t\n", *(_QWORD *)(a2 + 24) + 8LL * *(int *)(a1 + 8), a3);
result = *(_QWORD *)(a2 + 24);
*(_QWORD *)(result + 8LL * *(int *)(a1 + 8)) = a3;
return result;
}

original_code:
static void bind(type v, frame f, type t)
{
     if ((debugging && dcode['u' - 'a']))
   (void) grind(stdout, "Bind: %x to %t\n", &f->f_var[v->t_u.typevar_t], t);
     f->f_var[v->t_u.typevar_t] = t;
}

canonical_original_code:
static void bind(struct type *v, struct frame *f, struct type *t)
{
     if ((debugging && dcode['u' - 'a']))
   (void) grind(stdout, "Bind: %x to %t\n", &f->f_var[v->t_u.typevar_t], t);
     f->f_var[v->t_u.typevar_t] = t;
}

variable_types:
f
struct frame *