decompiled_code:
__int64 __fastcall tcp_rcv_dat(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4)
{
ID_CHECK(a1);
NUL_CHECK(a2);
LEN_CHECK(a3);
TMO_CHECK(a4);
return 4294967279LL;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4)
{
ID_CHECK(a1);
NUL_CHECK(a2);
LEN_CHECK(a3);
TMO_CHECK(a4);
return 4294967279LL;
}

original_code:
ER tcp_rcv_dat(ID cepid, VP data, INT len, TMO tmout)
{
 ID_CHECK(cepid);
 NUL_CHECK(data);
 LEN_CHECK(len);
 TMO_CHECK(tmout);
 return (-17);
}

canonical_original_code:
int tcp_rcv_dat(int cepid, void *data, int len, int tmout)
{
 ID_CHECK(cepid);
 NUL_CHECK(data);
 LEN_CHECK(len);
 TMO_CHECK(tmout);
 return (-17);
}


repo: monaka/B-Free

decompiled_code:
__int64 __fastcall tcp_get_buf(__int64 a1, __int64 a2, unsigned int a3)
{
ID_CHECK(a1);
TMO_CHECK(a3);
return 4294967279LL;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1, __int64 a2, unsigned int a3)
{
ID_CHECK(a1);
TMO_CHECK(a3);
return 4294967279LL;
}

original_code:
ER tcp_get_buf(ID cepid, VP *p_buf, TMO tmout)
{
 ID_CHECK(cepid);
 TMO_CHECK(tmout);
 p_buf = (0);
 return (-17);
}

canonical_original_code:
int tcp_get_buf(int cepid, void **p_buf, int tmout)
{
 ID_CHECK(cepid);
 TMO_CHECK(tmout);
 p_buf = (0);
 return (-17);
}

variable_types: cepid int

variable_types: tmout int

return_type: int


decompiled_code:
__int64 __fastcall tcp_snd_buf(__int64 a1, unsigned int a2)
{
ID_CHECK(a1);
LEN_CHECK(a2);
return 4294967279LL;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, unsigned int a2)
{
ID_CHECK(a1);
LEN_CHECK(a2);
return 4294967279LL;
}

original_code:
ER tcp_snd_buf(ID cepid, INT len)
{
 ID_CHECK(cepid);
 LEN_CHECK(len);
 return (-17);
}

canonical_original_code:
int tcp_snd_buf(int cepid, int len)
{
 ID_CHECK(cepid);
 LEN_CHECK(len);
 return (-17);
}

variable_types: len int


decompiled_code:
__int64 __fastcall tcp_rcv_buf(__int64 a1, __int64 a2, unsigned int a3)
{
ID_CHECK(a1);
TMO_CHECK(a3);
return 4294967279LL;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, __int64 a2, unsigned int a3)
{
ID_CHECK(a1);
TMO_CHECK(a3);
return 4294967279LL;
}

original_code:
ER tcp_rcv_buf(ID cepid, VP *p_buf, TMO tmout)
{
 ID_CHECK(cepid);
 TMO_CHECK(tmout);
 return (-17);
}

canonical_original_code:
int tcp_rcv_buf(int cepid, void **p_buf, int tmout)
{
 ID_CHECK(cepid);
 TMO_CHECK(tmout);
 return (-17);
}


decompiled_code:
__int64 __fastcall tcp_rel_buf(__int64 a1, unsigned int a2)
{
ID_CHECK(a1);
LEN_CHECK(a2);
return 4294967279LL;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, unsigned int a2)
{
ID_CHECK(a1);
LEN_CHECK(a2);
return 4294967279LL;
}

original_code:
ER tcp_rel_buf(ID cepid, INT len)
{
 ID_CHECK(cepid);
 LEN_CHECK(len);
 return (-17);
}

canonical_original_code:
int tcp_rel_buf(int cepid, int len)
{
 ID_CHECK(cepid);
 LEN_CHECK(len);
 return (-17);
}


decompiled_code:
__int64 __fastcall tcp_snd_oob(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4)
{
ID_CHECK(a1);
NUL_CHECK(a2);
LEN_CHECK(a3);
TMO_CHECK(a4);
return 4294967279LL;
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1, __int64 a2, unsigned int a3, unsigned int a4)
{
ID_CHECK(a1);
NUL_CHECK(a2);
LEN_CHECK(a3);
TMO_CHECK(a4);
return 4294967279LL;
}

original_code:
ER tcp_snd_oob(ID cepid, VP data, INT len, TMO tmout)
{
 ID_CHECK(cepid);
 NUL_CHECK(data);
 LEN_CHECK(len);
 TMO_CHECK(tmout);
 return (-17);
}

canonical_original_code:
int tcp_snd_oob(int cepid, void *data, int len, int tmout)
{
 ID_CHECK(cepid);
 NUL_CHECK(data);
 LEN_CHECK(len);
 TMO_CHECK(tmout);
 return (-17);
}

variable_types:
data
void *


decompiled_code:
__int64 __fastcall tcp_rcv_oob(__int64 a1, __int64 a2, unsigned int a3)
{
ID_CHECK(a1);
NUL_CHECK(a2);
LEN_CHECK(a3);
return 4294967279LL;
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1, __int64 a2, unsigned int a3)
{
ID_CHECK(a1);
NUL_CHECK(a2);
LEN_CHECK(a3);
return 4294967279LL;
}

original_code:
ER tcp_rcv_oob(ID cepid, VP data, INT len)
{
 ID_CHECK(cepid);
 NUL_CHECK(data);
 LEN_CHECK(len);
 return (-17);
}

canonical_original_code:
int tcp_rcv_oob(int cepid, void *data, int len)
{
 ID_CHECK(cepid);
 NUL_CHECK(data);
 LEN_CHECK(len);
 return (-17);
}


original_code:
ER tcp_can_cep(ID cepid, FN fncd)
{
 ID_CHECK(cepid);
 switch (fncd) {
  case (-0x205):
   break;
  case (-0x206):
   break;
  case (-0x208):
   break;
  case (-0x209):
   break;
  case (-0x20a):
   break;
  case (-0x20b):
   break;
  case (-0x20d):
   break;
  case (-0x20f):
   break;
  case (0):
   break;
  default:
   return (-63);
 }
 return (-17);
}

canonical_original_code:
int tcp_can_cep(int cepid, short fncd)
{
 ID_CHECK(cepid);
 switch (fncd) {
  case (-0x205):
   break;
  case (-0x206):
   break;
  case (-0x208):
   break;
  case (-0x209):
   break;
  case (-0x20a):
   break;
  case (-0x20b):
   break;
  case (-0x20d):
   break;
  case (-0x20f):
   break;
  case (0):
   break;
  default:
   return (-63);
 }
 return (-17);
}

variable_types: fncd short


decompiled_code:
__int64 __fastcall tcp_set_opt(__int64 a1, __int64 a2, __int64 a3, unsigned int a4)
{
ID_CHECK(a1);
NUL_CHECK(a3);
LEN_CHECK(a4);
return 4294967279LL;
}

canonical_decompiled_code:
__int64 __fastcall func19(__int64 a1, __int64 a2, __int64 a3, unsigned int a4)
{
ID_CHECK(a1);
NUL_CHECK(a3);
LEN_CHECK(a4);
return 4294967279LL;
}

original_code:
ER tcp_set_opt(ID cepid, INT optname, VP optval, INT optlen)
{
 ID_CHECK(cepid);
 NUL_CHECK(optval);
 LEN_CHECK(optlen);
 return (-17);
}

canonical_original_code:
int tcp_set_opt(int cepid, int optname, void *optval, int optlen)
{
 ID_CHECK(cepid);
 NUL_CHECK(optval);
 LEN_CHECK(optlen);
 return (-17);
}

variable_types: optname int

variable_types:
optval
void *

variable_types: optlen int


decompiled_code:
__int64 __fastcall tcp_get_opt(__int64 a1, __int64 a2, __int64 a3, unsigned int a4)
{
ID_CHECK(a1);
NUL_CHECK(a3);
LEN_CHECK(a4);
return 4294967279LL;
}

canonical_decompiled_code:
__int64 __fastcall func20(__int64 a1, __int64 a2, __int64 a3, unsigned int a4)
{
ID_CHECK(a1);
NUL_CHECK(a3);
LEN_CHECK(a4);
return 4294967279LL;
}

original_code:
ER tcp_get_opt(ID cepid, INT optname, VP optval, INT optlen)
{
 ID_CHECK(cepid);
 NUL_CHECK(optval);
 LEN_CHECK(optlen);
 return (-17);
}

canonical_original_code:
int tcp_get_opt(int cepid, int optname, void *optval, int optlen)
{
 ID_CHECK(cepid);
 NUL_CHECK(optval);
 LEN_CHECK(optlen);
 return (-17);
}


write

decompiled_code:
void write()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code:
int
write (int fd, void *buf, int length)
{
  return (call_lowlib (39, fd, buf, length));
}

canonical_original_code:
int write(int fd, void *buf, int length)
{
  return (call_lowlib (39, fd, buf, length));
}

variable_types: fd int

variable_types:
buf
void *

variable_types: length int


decompiled_code:
void dos_null()
{
;
}

original_code:
static W
dos_null()
{
}

canonical_original_code:
static long dos_null()
{
}

return_type: long


decompiled_code:
void dos_putattr()
{
;
}

canonical_decompiled_code:
void func3()
{
;
}

original_code:
static W
dos_putattr()
{
}

canonical_original_code:
static long dos_putattr()
{
}


decompiled_code:
void dos_write()
{
;
}

canonical_decompiled_code:
void func5()
{
;
}

original_code:
static W
dos_write()
{
}

canonical_original_code:
static long dos_write()
{
}


decompiled_code:
void dos_trunc()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

original_code:
static W
dos_trunc()
{
}

canonical_original_code:
static long dos_trunc()
{
}


decompiled_code:
void dos_mkdir()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code:
static W
dos_mkdir()
{
}

canonical_original_code:
static long dos_mkdir()
{
}


decompiled_code:
void dos_rmdir()
{
;
}

canonical_decompiled_code:
void func8()
{
;
}

original_code:
static W
dos_rmdir()
{
}

canonical_original_code:
static long dos_rmdir()
{
}


decompiled_code:
void dos_mknod()
{
;
}

canonical_decompiled_code:
void func9()
{
;
}

original_code:
static W
dos_mknod()
{
}

canonical_original_code:
static long dos_mknod()
{
}


decompiled_code:
void dos_rmnod()
{
;
}

canonical_decompiled_code:
void func10()
{
;
}

original_code:
static W
dos_rmnod()
{
}

canonical_original_code:
static long dos_rmnod()
{
}


decompiled_code:
void dos_link()
{
;
}

canonical_decompiled_code:
void func11()
{
;
}

original_code:
static W
dos_link()
{
}

canonical_original_code:
static long dos_link()
{
}


decompiled_code:
void dos_remove()
{
;
}

canonical_decompiled_code:
void func12()
{
;
}

original_code:
static W
dos_remove()
{
}

canonical_original_code:
static long dos_remove()
{
}


decompiled_code:
void dos_mount()
{
;
}

canonical_decompiled_code:
void func13()
{
;
}

original_code:
static W
dos_mount()
{
}

canonical_original_code:
static long dos_mount()
{
}


decompiled_code:
void dos_unmount()
{
;
}

canonical_decompiled_code:
void func14()
{
;
}

original_code:
static W
dos_unmount()
{
}

canonical_original_code:
static long dos_unmount()
{
}


decompiled_code:
void dos_lookup()
{
;
}

canonical_decompiled_code:
void func1()
{
;
}

original_code:
static W
dos_lookup()
{
}

canonical_original_code:
static long dos_lookup()
{
}


decompiled_code:
void dos_getattr()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

original_code:
static W
dos_getattr()
{
}

canonical_original_code:
static long dos_getattr()
{
}


decompiled_code:
void dos_read()
{
;
}

canonical_decompiled_code:
void func4()
{
;
}

original_code:
static W
dos_read()
{
}

canonical_original_code:
static long dos_read()
{
}


decompiled_code:
void dos_init()
{
;
}

canonical_decompiled_code:
void func15()
{
;
}

original_code:
struct subfs_t *
dos_init(ID device)
{
}

canonical_original_code:
struct subfs_t *dos_init(int device)
{
}

variable_types: device int

return_type: struct subfs_t { char *fsname; struct subfs_proc { long (*fs_null)(); long (*fs_access)(); long (*fs_lookup)(); long (*fs_getattr)(); long (*fs_setattr)(); long (*fs_read)(); long (*fs_write)(); long (*fs_trunc)(); long (*fs_mkdir)(); long (*fs_rmdir)(); long (*fs_mknod)(); long (*fs_rmnod)(); long (*fs_link)(); long (*fs_remove)(); long (*fs_select)(); long (*fs_control)(); long (*fs_move)(); long (*fs_mountroot)(); long (*fs_mount)(); long (*fs_unmount)(); } *procp; struct fileid { unsigned short hostid; unsigned short fsid; unsigned long fileno; } *filelist; } *

user_defined_types: struct subfs_t { char *fsname; struct subfs_proc *procp; struct fileid *filelist; }


sigemptyset

decompiled_code:
void sigemptyset()
{
;
}

original_code:
int
sigemptyset (sigset_t *set)
{
  return (call_lowlib (60, set));
}

canonical_original_code:
int sigemptyset(int *set)
{
  return (call_lowlib (60, set));
}

variable_types:
set
int *


decompiled_code:
__int64 __fastcall posix_newprocess(char *file)
{
int v1; // edi
__int64 v2; // rax
__int64 v3; // rbx
_DWORD v5[3]; // [rsp+0h] [rbp-78h] BYREF
unsigned int v6; // [rsp+Ch] [rbp-6Ch]
__int64 v7; // [rsp+10h] [rbp-68h]
__int64 v8; // [rsp+18h] [rbp-60h]
__int64 v9; // [rsp+20h] [rbp-58h]
__int64 v10; // [rsp+28h] [rbp-50h]
__int64 v11; // [rsp+30h] [rbp-48h]
__int64 v12; // [rsp+38h] [rbp-40h]
__int64 v13; // [rsp+40h] [rbp-38h]
char buf[4]; // [rsp+50h] [rbp-28h] BYREF
unsigned int v15; // [rsp+54h] [rbp-24h]
int v16; // [rsp+58h] [rbp-20h]
int v17; // [rsp+5Ch] [rbp-1Ch]
unsigned int v18; // [rsp+64h] [rbp-14h]

if ( access(file, 1) == -1 )
{
printf("cannot access.\n");
v3 = -1LL;
}
else if ( posix_create_task((__int64)v5, (__int64 *)0x88030000LL) < 0 )
{
printf("cannot create new tasks.\n");
v3 = -1LL;
}
else
{
v1 = open(file, 0, 0LL);
if ( v1 < 0 )
{
printf("cannot open.\n");
v3 = -1LL;
}
else if ( read(v1, buf, 0x20uLL) <= 0 )
{
printf("cannot read exec infomation.");
v3 = -1LL;
}
else
{
v7 = 0LL;
v8 = v15;
v9 = (int)((v15 + 4095) & 0xFFFFF000);
v10 = (v16 + v17 + 4095) & 0xFFFFF000;
v11 = 805339136LL;
v12 = 10240LL;
v13 = v18;
posix_make_vm();
v3 = v2;
if ( v2 )
{
v3 = -1LL;
}
else if ( (unsigned int)sta_tsk(v5[2], 0LL) )
{
printf("cannot start main task.\n");
ter_tsk(v6);
v3 = -1LL;
}
else
{
sta_tsk(v6, 0LL);
}
}
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *file)
{
int v1; // edi
__int64 v2; // rax
__int64 v3; // rbx
_DWORD v5[3]; // [rsp+0h] [rbp-78h] BYREF
unsigned int v6; // [rsp+Ch] [rbp-6Ch]
__int64 v7; // [rsp+10h] [rbp-68h]
__int64 v8; // [rsp+18h] [rbp-60h]
__int64 v9; // [rsp+20h] [rbp-58h]
__int64 v10; // [rsp+28h] [rbp-50h]
__int64 v11; // [rsp+30h] [rbp-48h]
__int64 v12; // [rsp+38h] [rbp-40h]
__int64 v13; // [rsp+40h] [rbp-38h]
char buf[4]; // [rsp+50h] [rbp-28h] BYREF
unsigned int v15; // [rsp+54h] [rbp-24h]
int v16; // [rsp+58h] [rbp-20h]
int v17; // [rsp+5Ch] [rbp-1Ch]
unsigned int v18; // [rsp+64h] [rbp-14h]

if ( access(file, 1) == -1 )
{
printf("cannot access.\n");
v3 = -1LL;
}
else if ( func2((__int64)v5, (__int64 *)0x88030000LL) < 0 )
{
printf("cannot create new tasks.\n");
v3 = -1LL;
}
else
{
v1 = open(file, 0, 0LL);
if ( v1 < 0 )
{
printf("cannot open.\n");
v3 = -1LL;
}
else if ( read(v1, buf, 0x20uLL) <= 0 )
{
printf("cannot read exec infomation.");
v3 = -1LL;
}
else
{
v7 = 0LL;
v8 = v15;
v9 = (int)((v15 + 4095) & 0xFFFFF000);
v10 = (v16 + v17 + 4095) & 0xFFFFF000;
v11 = 805339136LL;
v12 = 10240LL;
v13 = v18;
func0();
v3 = v2;
if ( v2 )
{
v3 = -1LL;
}
else if ( (unsigned int)sta_tsk(v5[2], 0LL) )
{
printf("cannot start main task.\n");
ter_tsk(v6);
v3 = -1LL;
}
else
{
sta_tsk(v6, 0LL);
}
}
}
return v3;
}

original_code:
W
posix_newprocess (B *program)
{
  W fileid;
  struct exec exec_info;
  struct posix_lowlib_info *lowlib_info;
  struct posix_process procinfo;
  ER err;
  if (access (program, 1) == -1)
    {
      printf ("cannot access.\n");
      return (-1);
    }
  lowlib_info = (struct posix_lowlib_info *)0x88030000;
  if (posix_create_task (&procinfo, lowlib_info) < 0)
    {
      printf ("cannot create new tasks.\n");
      return (-1);
    }
  fileid = open (program, 0x00, 0);
  if (fileid < 0)
    {
      printf ("cannot open.\n");
      return (-1);
    }
  if (read (fileid, (VP)&exec_info, sizeof (exec_info)) <= 0)
    {
      printf ("cannot read exec infomation.");
      return (-1);
    }
  procinfo.text_start = 0;
  procinfo.text_size = exec_info.a_text;;
  procinfo.data_start = ((((int)exec_info.a_text) + (4096) - 1) & ~((4096) - 1));
  procinfo.data_size = ((((int)exec_info.a_data + exec_info.a_bss) + (4096) - 1) & ~((4096) - 1));
  procinfo.stack_start = 0x30008000;
  procinfo.stack_size = 10 * 1024;;
  procinfo.entry = exec_info.a_entry;
  if (posix_make_vm (&procinfo))
    {
      return (-1);
    }
  posix_load_program (fileid, &procinfo);
  err = sta_tsk (procinfo.maintask, 0);
  if (err)
    {
      printf ("cannot start main task.\n");
      ter_tsk (procinfo.signaltask);
      return (-1);
    }
  sta_tsk (procinfo.signaltask, 0);
  if (err)
    {
      printf ("cannot start main task.\n");
      ter_tsk (procinfo.maintask);
      return (-1);
    }
  return ((0));
}

canonical_original_code:
long posix_newprocess(char *program)
{
  long fileid;
  struct exec exec_info;
  struct posix_lowlib_info *lowlib_info;
  struct posix_process procinfo;
  int err;
  if (access (program, 1) == -1)
    {
      printf ("cannot access.\n");
      return (-1);
    }
  lowlib_info = (struct posix_lowlib_info *)0x88030000;
  if (posix_create_task (&procinfo, lowlib_info) < 0)
    {
      printf ("cannot create new tasks.\n");
      return (-1);
    }
  fileid = open (program, 0x00, 0);
  if (fileid < 0)
    {
      printf ("cannot open.\n");
      return (-1);
    }
  if (read (fileid, (VP)&exec_info, sizeof (exec_info)) <= 0)
    {
      printf ("cannot read exec infomation.");
      return (-1);
    }
  procinfo.text_start = 0;
  procinfo.text_size = exec_info.a_text;;
  procinfo.data_start = ((((int)exec_info.a_text) + (4096) - 1) & ~((4096) - 1));
  procinfo.data_size = ((((int)exec_info.a_data + exec_info.a_bss) + (4096) - 1) & ~((4096) - 1));
  procinfo.stack_start = 0x30008000;
  procinfo.stack_size = 10 * 1024;;
  procinfo.entry = exec_info.a_entry;
  if (posix_make_vm (&procinfo))
    {
      return (-1);
    }
  posix_load_program (fileid, &procinfo);
  err = sta_tsk (procinfo.maintask, 0);
  if (err)
    {
      printf ("cannot start main task.\n");
      ter_tsk (procinfo.signaltask);
      return (-1);
    }
  sta_tsk (procinfo.signaltask, 0);
  if (err)
    {
      printf ("cannot start main task.\n");
      ter_tsk (procinfo.maintask);
      return (-1);
    }
  return ((0));
}

variable_types:
program
char *

variable_types: fileid long

variable_types: struct exec { unsigned int a_info; unsigned int a_text; unsigned int a_data; unsigned int a_bss; unsigned int a_syms; unsigned int a_entry; unsigned int a_trsize; unsigned int a_drsize; }

variable_types: struct posix_lowlib_info { unsigned long main_entry_addr; unsigned long signal_entry_addr; } *

variable_types: struct posix_process { long procid; int maintask; int signaltask; unsigned long text_start; unsigned long text_size; unsigned long data_start; unsigned long data_size; unsigned long stack_start; unsigned long stack_size; unsigned long entry; }

variable_types: err int


decompiled_code:
__int64 psys_close()
{
errno = 26;
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
errno = 26;
return 0LL;
}

original_code:
int
psys_close (void *argp)
{
  struct a
    {
      int fileid;
    } *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

canonical_original_code:
int psys_close(void *argp)
{
  struct a *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

variable_types:
argp
void *

variable_types:
args
struct a { int fileid; } *


rmdir

decompiled_code:
void rmdir()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code:
int
rmdir (char *path)
{
  return (call_lowlib (27, strlen (path), path));
}

canonical_original_code:
int rmdir(char *path)
{
  return (call_lowlib (27, strlen (path), path));
}

variable_types:
path
char *


decompiled_code:
__int64 __fastcall vcre_reg(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(101LL, a1, a2, a3, a4, a5, a6);
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(101LL, a1, a2, a3, a4, a5, a6);
}

original_code:
ER
vcre_reg (ID id,
   VP start,
   W min,
   W max,
   UW perm,
   FP handle)
{
  return (call_syscall ((101), id, start, min, max, perm, handle));
}

canonical_original_code:
int vcre_reg(int id, void *start, long min, long max, unsigned long perm, void (*handle)())
{
  return (call_syscall ((101), id, start, min, max, perm, handle));
}

variable_types: id int

variable_types:
start
void *

variable_types: min long

variable_types: max long

variable_types:
perm
unsigned long

variable_types:
handle
void (*)()


decompiled_code:
__int64 __fastcall vdel_reg(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(102LL, a1, a2, a4, a5, a6);
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(102LL, a1, a2, a4, a5, a6);
}

original_code:
ER
vdel_reg (ID taskid, VP start)
{
  return (call_syscall ((102), taskid, start));
}

canonical_original_code:
int vdel_reg(int taskid, void *start)
{
  return (call_syscall ((102), taskid, start));
}

variable_types: taskid int


decompiled_code:
__int64 __fastcall vunm_reg(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(104LL, a1, a2, a3, a5, a6);
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(104LL, a1, a2, a3, a5, a6);
}

original_code:
ER
vunm_reg (ID id, VP start, UW size)
{
  return (call_syscall ((104), id, start, size));
}

canonical_original_code:
int vunm_reg(int id, void *start, unsigned long size)
{
  return (call_syscall ((104), id, start, size));
}

variable_types:
size
unsigned long


decompiled_code:
__int64 __fastcall vmap_reg(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(103LL, a1, a2, a3, a4, a6);
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(103LL, a1, a2, a3, a4, a6);
}

original_code:
ER
vmap_reg (ID id, VP start, UW size, W accmode)
{
  return (call_syscall ((103), id, start, size, accmode));
}

canonical_original_code:
int vmap_reg(int id, void *start, unsigned long size, long accmode)
{
  return (call_syscall ((103), id, start, size, accmode));
}

variable_types: accmode long


decompiled_code:
__int64 __fastcall vget_reg(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(109LL, a1, a2, a3, a4, a6);
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(109LL, a1, a2, a3, a4, a6);
}

original_code:
ER
vget_reg (ID id, VP start, UW size, VP buf)
{
  return (call_syscall ((109), id, start, size, buf));
}

canonical_original_code:
int vget_reg(int id, void *start, unsigned long size, void *buf)
{
  return (call_syscall ((109), id, start, size, buf));
}

variable_types:
buf
void *


decompiled_code:
__int64 __fastcall vput_reg(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(108LL, a1, a2, a3, a4, a6);
}

canonical_decompiled_code:
__int64 __fastcall func5(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
return call_syscall(108LL, a1, a2, a3, a4, a6);
}

original_code:
ER
vput_reg (ID id, VP start, UW size, VP buf)
{
  return (call_syscall ((108), id, start, size, buf));
}

canonical_original_code:
int vput_reg(int id, void *start, unsigned long size, void *buf)
{
  return (call_syscall ((108), id, start, size, buf));
}


chmod

decompiled_code:
__int64 __fastcall chmod(const char *a1, unsigned int a2)
{
unsigned int v2; // eax

v2 = strlen(a1);
return call_lowlib(3LL, v2, a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, unsigned int a2)
{
unsigned int v2; // eax

v2 = strlen(a1);
return call_lowlib(3LL, v2, a1, a2);
}

original_code:
int
chmod (char *path, int mode)
{
  return (call_lowlib (3, strlen (path), path, mode));
}

canonical_original_code:
int chmod(char *path, int mode)
{
  return (call_lowlib (3, strlen (path), path, mode));
}

variable_types: mode int


decompiled_code:
__int64 open_hcm_pci()
{
return 4294967279LL;
}

original_code:
ER
open_hcm_pci (ID caller, DDEV_OPN_REQ *packet)
{
  return ((-17));
}

canonical_original_code:
int open_hcm_pci(int caller, struct DDEV_OPN_REQ *packet)
{
  return ((-17));
}

variable_types: caller int

variable_types:
packet
struct DDEV_OPN_REQ { long dd; } *


decompiled_code:
__int64 close_hcm_pci()
{
return 4294967279LL;
}

original_code:
ER
close_hcm_pci (ID caller, DDEV_CLS_REQ *packet)
{
  return ((-17));
}

canonical_original_code:
int close_hcm_pci(int caller, struct DDEV_CLS_REQ *packet)
{
  return ((-17));
}

variable_types: struct DDEV_CLS_REQ { long dd; long eject; } *


decompiled_code:
__int64 read_hcm_pci()
{
return 4294967279LL;
}

original_code:
ER
read_hcm_pci (ID caller, DDEV_REA_REQ *packet)
{
  return ((-17));
}

canonical_original_code:
int read_hcm_pci(int caller, struct DDEV_REA_REQ *packet)
{
  return ((-17));
}

variable_types: struct DDEV_REA_REQ { long dd; long start; long size; } *


decompiled_code:
__int64 write_hcm_pci()
{
return 4294967279LL;
}

original_code:
ER
write_hcm_pci (ID caller, DDEV_WRI_REQ *packet)
{
  return ((-17));
}

canonical_original_code:
int write_hcm_pci(int caller, struct DDEV_WRI_REQ *packet)
{
  return ((-17));
}

variable_types: struct DDEV_WRI_REQ { long dd; long start; long size; unsigned char dt[1024]; } *


decompiled_code:
__int64 control_hcm_pci()
{
return 4294967279LL;
}

original_code:
ER
control_hcm_pci (ID caller, DDEV_CTL_REQ *packet)
{
  return ((-17));
}

canonical_original_code:
int control_hcm_pci(int caller, struct DDEV_CTL_REQ *packet)
{
  return ((-17));
}

variable_types: struct DDEV_CTL_REQ { long dd; unsigned long cmd; long len; unsigned char param[]; } *


decompiled_code:
__int64 init_driver()
{
init_log();
recvport = get_port(1096LL, 1096LL);
if ( recvport <= 0 )
{
dbg_printf("hcm_pci: cannot make receive porrt.\n");
slp_tsk();
}
return regist_port("driver.hcm_pci", (unsigned int)recvport);
}

canonical_decompiled_code:
__int64 func0()
{
init_log();
recvport = get_port(1096LL, 1096LL);
if ( recvport <= 0 )
{
dbg_printf("hcm_pci: cannot make receive porrt.\n");
slp_tsk();
}
return regist_port("driver.hcm_pci", (unsigned int)recvport);
}

original_code:
static void
init_driver (void)
{
  int i;
  ER error;
  init_log ();
  recvport = get_port (sizeof (DDEV_RES), sizeof (DDEV_RES));
  if (recvport <= 0)
    {
      dbg_printf ("hcm_pci: cannot make receive porrt.\n");
      slp_tsk ();
    }
  error = regist_port ("driver.hcm_pci", recvport);
  if (error != (0))
    {
    }
}

canonical_original_code:
static void init_driver()
{
  int i;
  int error;
  init_log ();
  recvport = get_port (sizeof (DDEV_RES), sizeof (DDEV_RES));
  if (recvport <= 0)
    {
      dbg_printf ("hcm_pci: cannot make receive porrt.\n");
      slp_tsk ();
    }
  error = regist_port ("driver.hcm_pci", recvport);
  if (error != (0))
    {
    }
}

variable_types: i int

variable_types: error int

return_type: void


decompiled_code:
void __noreturn main_loop()
{
char v0[8]; // [rsp+8h] [rbp-450h] BYREF
char v1[1096]; // [rsp+10h] [rbp-448h] BYREF

while ( 1 )
{
do
get_req((unsigned int)recvport, v1, v0);
while ( !sys_errno );
slp_tsk();
}
}

canonical_decompiled_code:
void __noreturn func1()
{
char v0[8]; // [rsp+8h] [rbp-450h] BYREF
char v1[1096]; // [rsp+10h] [rbp-448h] BYREF

while ( 1 )
{
do
get_req((unsigned int)recvport, v1, v0);
while ( !sys_errno );
slp_tsk();
}
}

original_code:
static void
main_loop (void)
{
  DDEV_REQ req;
  extern ER sys_errno;
  UW rsize;
  for (;;)
    {
      get_req (recvport, &req, &rsize);
      switch (sys_errno)
 {
 case (0):
   process_request (&req);
   break;
 default:
   slp_tsk ();
   break;
 }
    }
}

canonical_original_code:
static void main_loop()
{
  struct DDEV_REQ req;
  extern int sys_errno;
  unsigned long rsize;
  for (;;)
    {
      get_req (recvport, &req, &rsize);
      switch (sys_errno)
 {
 case (0):
   process_request (&req);
   break;
 default:
   slp_tsk ();
   break;
 }
    }
}

variable_types: struct DDEV_REQ { struct SVC_REQ { int mbfid; long msgtyp; int tskid; long len; unsigned long arg[]; } header; union { struct DDEV_OPN_REQ { long dd; } opn_req; struct DDEV_CLS_REQ { long dd; long eject; } cls_req; struct DDEV_REA_REQ { long dd; long start; long size; } rea_req; struct DDEV_WRI_REQ { long dd; long start; long size; unsigned char dt[1024]; } wri_req; struct DDEV_CTL_REQ { long dd; unsigned long cmd; long len; unsigned char param[]; } ctl_req; struct DDEV_PRD_REQ { long dd; char *buf; long start; long length; } prd_req; struct DDEV_RLY_REQ { long dd; long start; long size; unsigned char dt[1024]; } rly_req; } body; }

variable_types:
rsize
unsigned long

user_defined_types: struct DDEV_REQ { struct SVC_REQ header; union { struct DDEV_OPN_REQ opn_req; struct DDEV_CLS_REQ cls_req; struct DDEV_REA_REQ rea_req; struct DDEV_WRI_REQ wri_req; struct DDEV_CTL_REQ ctl_req; struct DDEV_PRD_REQ prd_req; struct DDEV_RLY_REQ rly_req; } body; }


start

decompiled_code:
void __noreturn start()
{
probe(&dev_table);
init_driver();
printf("registed hcm_pci driver.\n");
main_loop();
}

canonical_decompiled_code:
void __noreturn func2()
{
probe(&dev_table);
func0();
printf("registed hcm_pci driver.\n");
func1();
}

original_code:
void
start ()
{
  probe (&dev_table[0]);
  init_driver ();
  printf ("registed hcm_pci driver.\n");
  main_loop ();
}

canonical_original_code:
void start()
{
  probe (&dev_table[0]);
  init_driver ();
  printf ("registed hcm_pci driver.\n");
  main_loop ();
}


decompiled_code:
void process_request()
{
;
}

canonical_decompiled_code:
void func3()
{
;
}

original_code:
ER
process_request (DDEV_REQ *req)
{
  switch (req->header.msgtyp)
    {
    case DEV_OPN:
      open_hcm_pci (req->header.mbfid, &(req->body.opn_req));
      break;
    case DEV_CLS:
      close_hcm_pci (req->header.mbfid, &(req->body.cls_req));
      break;
    case DEV_REA:
      read_hcm_pci (req->header.mbfid, &(req->body.rea_req));
      break;
    case DEV_WRI:
      write_hcm_pci (req->header.mbfid, &(req->body.wri_req));
      break;
    case DEV_CTL:
      control_hcm_pci (req->header.mbfid, &(req->body.ctl_req));
      break;
    }
}

canonical_original_code:
int process_request(struct DDEV_REQ *req)
{
  switch (req->header.msgtyp)
    {
    case DEV_OPN:
      open_hcm_pci (req->header.mbfid, &(req->body.opn_req));
      break;
    case DEV_CLS:
      close_hcm_pci (req->header.mbfid, &(req->body.cls_req));
      break;
    case DEV_REA:
      read_hcm_pci (req->header.mbfid, &(req->body.rea_req));
      break;
    case DEV_WRI:
      write_hcm_pci (req->header.mbfid, &(req->body.wri_req));
      break;
    case DEV_CTL:
      control_hcm_pci (req->header.mbfid, &(req->body.ctl_req));
      break;
    }
}

variable_types: struct DDEV_REQ { struct SVC_REQ { int mbfid; long msgtyp; int tskid; long len; unsigned long arg[]; } header; union { struct DDEV_OPN_REQ { long dd; } opn_req; struct DDEV_CLS_REQ { long dd; long eject; } cls_req; struct DDEV_REA_REQ { long dd; long start; long size; } rea_req; struct DDEV_WRI_REQ { long dd; long start; long size; unsigned char dt[1024]; } wri_req; struct DDEV_CTL_REQ { long dd; unsigned long cmd; long len; unsigned char param[]; } ctl_req; struct DDEV_PRD_REQ { long dd; char *buf; long start; long length; } prd_req; struct DDEV_RLY_REQ { long dd; long start; long size; unsigned char dt[1024]; } rly_req; } body; } *


decompiled_code:
__int64 psys_pipe()
{
errno = 26;
return 0LL;
}

original_code:
int
psys_pipe (void *argp)
{
  struct a
    {
    } *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

canonical_original_code:
int psys_pipe(void *argp)
{
  struct a *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

variable_types:
argp
void *

variable_types:
args
struct a {  } *


decompiled_code:
__int64 psys_opendir()
{
errno = 26;
return 0LL;
}

original_code:
DIR *
psys_opendir (void *argp)
{
  struct a
    {
    } *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

canonical_original_code:
struct dirent *psys_opendir(void *argp)
{
  struct a *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

return_type: struct dirent { unsigned int d_ino; unsigned long d_mode; unsigned char d_name[14]; } *


original_code:
ER MitnStack_Clear (W wStkNum)
{
  if (wStkNum < 0 || wStkNum >= (3 + 1))
    {
      return (-33);
    }
  MitnStack_Top[wStkNum].type = (0x40000000);
  MitnStack_Top[wStkNum].value.link = (0);
  MitnStack_Top[wStkNum].prev = (0);
  MitnStack_Top[wStkNum].next = &MitnStack_Bottom[wStkNum];
  MitnStack_Bottom[wStkNum].type = (0x40000000);
  MitnStack_Bottom[wStkNum].prev = &MitnStack_Top[wStkNum];
  MitnStack_Bottom[wStkNum].next = (0);
  MitnStack_Bottom[wStkNum].value.link = (0);
  return (0);
}

canonical_original_code:
int MitnStack_Clear(long wStkNum)
{
  if (wStkNum < 0 || wStkNum >= (3 + 1))
    {
      return (-33);
    }
  MitnStack_Top[wStkNum].type = (0x40000000);
  MitnStack_Top[wStkNum].value.link = (0);
  MitnStack_Top[wStkNum].prev = (0);
  MitnStack_Top[wStkNum].next = &MitnStack_Bottom[wStkNum];
  MitnStack_Bottom[wStkNum].type = (0x40000000);
  MitnStack_Bottom[wStkNum].prev = &MitnStack_Top[wStkNum];
  MitnStack_Bottom[wStkNum].next = (0);
  MitnStack_Bottom[wStkNum].value.link = (0);
  return (0);
}

variable_types: wStkNum long


original_code:
ER MitnStack_CountToMark(W wStkNum, W *count)
{
  Cell *c;
  int i;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  for(i = 0; i < 1000; i++)
    {
      MitnCellMemory[i].mark = 0;
    }
  *count = 0;
  for(c = MitnStack_Top[wStkNum].next;
      c->type != (0x00010000 | (0x10000000));
      c = c->next )
    {
      if (c == &MitnStack_Bottom[wStkNum])
 {
   return (-33);
 }
      if (c->mark == 1)
 {
   return (-5);
 }
      c->mark = 1;
      (*count)++;
    }
  return (0);
}

canonical_original_code:
int MitnStack_CountToMark(long wStkNum, long *count)
{
  struct _cell *c;
  int i;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  for(i = 0; i < 1000; i++)
    {
      MitnCellMemory[i].mark = 0;
    }
  *count = 0;
  for(c = MitnStack_Top[wStkNum].next;
      c->type != (0x00010000 | (0x10000000));
      c = c->next )
    {
      if (c == &MitnStack_Bottom[wStkNum])
 {
   return (-33);
 }
      if (c->mark == 1)
 {
   return (-5);
 }
      c->mark = 1;
      (*count)++;
    }
  return (0);
}

variable_types:
count
long *

variable_types: struct _cell { char mark; unsigned long type; struct _cell *prev; struct _cell *next; union { long inum; double dnum; struct { char str[48]; long length; } string; struct { struct _cell *link; char str[48]; } name; int (*mitn_func)(); struct { long arg_num; int (*func)(int argc, char *argv[]); } trad; struct _cell *link; } value; } *


decompiled_code:
__int64 __fastcall MitnStack_Count(unsigned __int64 a1, _QWORD *a2)
{
_BYTE *v2; // rax
__int64 v3; // rax
__int64 *v4; // rdx

if ( a1 > 3 )
return 4294967263LL;
v2 = &MitnCellMemory;
do
{
*v2 = 0;
v2 += 88;
}
while ( v2 != (_BYTE *)(unsigned int)((_DWORD)&MitnCellMemory + 88000) );
*a2 = 0LL;
v3 = MitnStack_Top[11 * a1 + 3];
v4 = &MitnStack_Bottom[11 * a1];
if ( (__int64 *)v3 == v4 )
return 0LL;
while ( *(_BYTE *)v3 != 1 )
{
*(_BYTE *)v3 = 1;
++*a2;
v3 = *(_QWORD *)(v3 + 24);
if ( (__int64 *)v3 == v4 )
return 0LL;
}
return 4294967291LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int64 a1, _QWORD *a2)
{
_BYTE *v2; // rax
__int64 v3; // rax
__int64 *v4; // rdx

if ( a1 > 3 )
return 4294967263LL;
v2 = &MitnCellMemory;
do
{
*v2 = 0;
v2 += 88;
}
while ( v2 != (_BYTE *)(unsigned int)((_DWORD)&MitnCellMemory + 88000) );
*a2 = 0LL;
v3 = MitnStack_Top[11 * a1 + 3];
v4 = &MitnStack_Bottom[11 * a1];
if ( (__int64 *)v3 == v4 )
return 0LL;
while ( *(_BYTE *)v3 != 1 )
{
*(_BYTE *)v3 = 1;
++*a2;
v3 = *(_QWORD *)(v3 + 24);
if ( (__int64 *)v3 == v4 )
return 0LL;
}
return 4294967291LL;
}

original_code:
ER MitnStack_Count(W wStkNum, W *count)
{
  Cell *c;
  int i;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  for(i = 0; i < 1000; i++)
    {
      MitnCellMemory[i].mark = 0;
    }
  *count = 0;
  for(c = MitnStack_Top[wStkNum].next;
      c != &MitnStack_Bottom[wStkNum];
      c = c->next )
    {
      if (c->mark == 1)
 {
   return (-5);
 }
      c->mark = 1;
      (*count)++;
    }
  return (0);
}

canonical_original_code:
int MitnStack_Count(long wStkNum, long *count)
{
  struct _cell *c;
  int i;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  for(i = 0; i < 1000; i++)
    {
      MitnCellMemory[i].mark = 0;
    }
  *count = 0;
  for(c = MitnStack_Top[wStkNum].next;
      c != &MitnStack_Bottom[wStkNum];
      c = c->next )
    {
      if (c->mark == 1)
 {
   return (-5);
 }
      c->mark = 1;
      (*count)++;
    }
  return (0);
}

user_defined_types: struct _cell { char mark; unsigned long type; struct _cell *prev; struct _cell *next; union { long inum; double dnum; struct { char str[48]; long length; } string; struct { struct _cell *link; char str[48]; } name; int (*mitn_func)(); struct { long arg_num; int (*func)(int argc, char *argv[]); } trad; struct _cell *link; } value; }


decompiled_code:
__int64 MitnStack_Status()
{
_BYTE *v0; // rax
unsigned __int64 i; // rbx
unsigned int v2; // ebp
__int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

v0 = &MitnCellMemory;
do
{
*v0 = 0;
v0 += 88;
}
while ( v0 != (_BYTE *)(unsigned int)((_DWORD)&MitnCellMemory + 88000) );
for ( i = 0LL; i != 4; ++i )
{
v2 = MitnStack_Count(i, v4);
if ( v2 )
break;
printf("Stack No.==%d Count==%d\n", (unsigned int)i, v4[0]);
}
return v2;
}

canonical_decompiled_code:
__int64 func3()
{
_BYTE *v0; // rax
unsigned __int64 i; // rbx
unsigned int v2; // ebp
__int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

v0 = &MitnCellMemory;
do
{
*v0 = 0;
v0 += 88;
}
while ( v0 != (_BYTE *)(unsigned int)((_DWORD)&MitnCellMemory + 88000) );
for ( i = 0LL; i != 4; ++i )
{
v2 = func2(i, v4);
if ( v2 )
break;
printf("Stack No.==%d Count==%d\n", (unsigned int)i, v4[0]);
}
return v2;
}

original_code:
ER MitnStack_Status(void)
{
  int i;
  W count;
  for(i = 0; i < 1000; i++)
    {
      MitnCellMemory[i].mark = 0;
    }
  for(i = 0; i < (3 + 1); i++) {
    ER status;
    status = MitnStack_Count(i, &count);
    if ((status) != (0)) { return (status); };
    printf("Stack No.==%d Count==%d\n", i, count);
  }
  return (0);
}

canonical_original_code:
int MitnStack_Status()
{
  int i;
  long count;
  for(i = 0; i < 1000; i++)
    {
      MitnCellMemory[i].mark = 0;
    }
  for(i = 0; i < (3 + 1); i++) {
    int status;
    status = MitnStack_Count(i, &count);
    if ((status) != (0)) { return (status); };
    printf("Stack No.==%d Count==%d\n", i, count);
  }
  return (0);
}

variable_types: count long

variable_types: status int


decompiled_code:
__int64 __fastcall MitnStack_PushMark(unsigned __int64 a1)
{
__int64 result; // rax
__int64 v2; // rdx
__int64 *v3; // rcx
__int64 v4; // [rsp+0h] [rbp-10h] BYREF

if ( a1 > 3 )
return 4294967263LL;
result = MitnCell_GetCellAsMark(&v4);
if ( !(_DWORD)result )
{
v2 = v4;
v3 = &MitnStack_Top[11 * a1];
*(_QWORD *)(v4 + 24) = v3[3];
*(_QWORD *)(v2 + 16) = v3;
*(_QWORD *)(v3[3] + 16) = v2;
MitnStack_Top[11 * a1 + 3] = v2;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned __int64 a1)
{
__int64 result; // rax
__int64 v2; // rdx
__int64 *v3; // rcx
__int64 v4; // [rsp+0h] [rbp-10h] BYREF

if ( a1 > 3 )
return 4294967263LL;
result = MitnCell_GetCellAsMark(&v4);
if ( !(_DWORD)result )
{
v2 = v4;
v3 = &MitnStack_Top[11 * a1];
*(_QWORD *)(v4 + 24) = v3[3];
*(_QWORD *)(v2 + 16) = v3;
*(_QWORD *)(v3[3] + 16) = v2;
MitnStack_Top[11 * a1 + 3] = v2;
}
return result;
}

original_code:
ER MitnStack_PushMark(W wStkNum)
{
  Cell *dest;
  ER result;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  result = MitnCell_GetCellAsMark(&dest);
  if ((result) != (0)) { return (result); };
  dest->next = MitnStack_Top[wStkNum].next;
  dest->prev = &MitnStack_Top[wStkNum];
  MitnStack_Top[wStkNum].next->prev = dest;
  MitnStack_Top[wStkNum].next = dest;
  return (0);
}

canonical_original_code:
int MitnStack_PushMark(long wStkNum)
{
  struct _cell *dest;
  int result;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  result = MitnCell_GetCellAsMark(&dest);
  if ((result) != (0)) { return (result); };
  dest->next = MitnStack_Top[wStkNum].next;
  dest->prev = &MitnStack_Top[wStkNum];
  MitnStack_Top[wStkNum].next->prev = dest;
  MitnStack_Top[wStkNum].next = dest;
  return (0);
}

variable_types: result int


decompiled_code:
__int64 __fastcall MitnStack_Push(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 *v3; // rdx
__int64 result; // rax
__int64 v5; // [rsp+0h] [rbp-10h] BYREF

if ( !a2 )
return 4294967263LL;
if ( a1 > 3 )
return 4294967263LL;
if ( (*(_BYTE *)(a2 + 11) & 0x20) == 0 )
{
v5 = a2;
LABEL_5:
v2 = v5;
v3 = &MitnStack_Top[11 * a1];
*(_QWORD *)(v5 + 24) = v3[3];
*(_QWORD *)(v2 + 16) = v3;
*(_QWORD *)(v3[3] + 16) = v2;
MitnStack_Top[11 * a1 + 3] = v2;
return 0LL;
}
result = MitnCell_GetCellAsLink(&v5);
if ( !(_DWORD)result )
goto LABEL_5;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 *v3; // rdx
__int64 result; // rax
__int64 v5; // [rsp+0h] [rbp-10h] BYREF

if ( !a2 )
return 4294967263LL;
if ( a1 > 3 )
return 4294967263LL;
if ( (*(_BYTE *)(a2 + 11) & 0x20) == 0 )
{
v5 = a2;
LABEL_5:
v2 = v5;
v3 = &MitnStack_Top[11 * a1];
*(_QWORD *)(v5 + 24) = v3[3];
*(_QWORD *)(v2 + 16) = v3;
*(_QWORD *)(v3[3] + 16) = v2;
MitnStack_Top[11 * a1 + 3] = v2;
return 0LL;
}
result = MitnCell_GetCellAsLink(&v5);
if ( !(_DWORD)result )
goto LABEL_5;
return result;
}

original_code:
ER MitnStack_Push(W wStkNum, Cell *src)
{
  Cell *dest;
  ER result;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  if (src == (0))
    {
      return (-33);
    }
  if ((src->type & (0x20000000)) == (0x20000000)) {
    result = MitnCell_GetCellAsLink(&dest, src);
    if ((result) != (0)) { return (result); };
  } else {
    dest = src;
  }
  dest->next = MitnStack_Top[wStkNum].next;
  dest->prev = &MitnStack_Top[wStkNum];
  MitnStack_Top[wStkNum].next->prev = dest;
  MitnStack_Top[wStkNum].next = dest;
  return (0);
}

canonical_original_code:
int MitnStack_Push(long wStkNum, struct _cell *src)
{
  struct _cell *dest;
  int result;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  if (src == (0))
    {
      return (-33);
    }
  if ((src->type & (0x20000000)) == (0x20000000)) {
    result = MitnCell_GetCellAsLink(&dest, src);
    if ((result) != (0)) { return (result); };
  } else {
    dest = src;
  }
  dest->next = MitnStack_Top[wStkNum].next;
  dest->prev = &MitnStack_Top[wStkNum];
  MitnStack_Top[wStkNum].next->prev = dest;
  MitnStack_Top[wStkNum].next = dest;
  return (0);
}


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

v1 = (__int64 *)MitnStack_Top[3];
if ( v1 == MitnStack_Bottom )
return 4294967291LL;
*a1 = v1;
*(_QWORD *)(v1[3] + 16) = MitnStack_Top;
MitnStack_Top[3] = v1[3];
v1[3] = 0LL;
v1[2] = 0LL;
v1[4] = 0LL;
return 0LL;
}

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

v1 = (__int64 *)MitnStack_Top[3];
if ( v1 == MitnStack_Bottom )
return 4294967291LL;
*a1 = v1;
*(_QWORD *)(v1[3] + 16) = MitnStack_Top;
MitnStack_Top[3] = v1[3];
v1[3] = 0LL;
v1[2] = 0LL;
v1[4] = 0LL;
return 0LL;
}

original_code:
ER MitnStack_GetLinkCellFromPool(Cell **dest)
{
  Cell *c;
  c = MitnStack_Top[0].next;
  if (c == &MitnStack_Bottom[0])
    {
      return (-5);
    }
  *dest = c;
  c->next->prev = &MitnStack_Top[0];
  MitnStack_Top[0].next = c->next;
  c->next = (0);
  c->prev = (0);
  c->value.link = (0);
  return (0);
}

canonical_original_code:
int MitnStack_GetLinkCellFromPool(struct _cell **dest)
{
  struct _cell *c;
  c = MitnStack_Top[0].next;
  if (c == &MitnStack_Bottom[0])
    {
      return (-5);
    }
  *dest = c;
  c->next->prev = &MitnStack_Top[0];
  MitnStack_Top[0].next = c->next;
  c->next = (0);
  c->prev = (0);
  c->value.link = (0);
  return (0);
}

variable_types: struct _cell { char mark; unsigned long type; struct _cell *prev; struct _cell *next; union { long inum; double dnum; struct { char str[48]; long length; } string; struct { struct _cell *link; char str[48]; } name; int (*mitn_func)(); struct { long arg_num; int (*func)(int argc, char *argv[]); } trad; struct _cell *link; } value; } **


decompiled_code:
__int64 __fastcall MitnStack_PutLinkCellToPool(_QWORD *a1)
{
a1[1] = 0x40000000LL;
a1[3] = MitnStack_Top[3];
a1[2] = MitnStack_Top;
a1[4] = 0LL;
*(_QWORD *)(MitnStack_Top[3] + 16) = a1;
MitnStack_Top[3] = (__int64)a1;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func7(_QWORD *a1)
{
a1[1] = 0x40000000LL;
a1[3] = MitnStack_Top[3];
a1[2] = MitnStack_Top;
a1[4] = 0LL;
*(_QWORD *)(MitnStack_Top[3] + 16) = a1;
MitnStack_Top[3] = (__int64)a1;
return 0LL;
}

original_code:
ER MitnStack_PutLinkCellToPool(Cell *src)
{
  src->type = (0x40000000);
  src->next = MitnStack_Top[0].next;
  src->prev = &MitnStack_Top[0];
  src->value.link = (0);
  MitnStack_Top[0].next->prev = src;
  MitnStack_Top[0].next = src;
  return (0);
}

canonical_original_code:
int MitnStack_PutLinkCellToPool(struct _cell *src)
{
  src->type = (0x40000000);
  src->next = MitnStack_Top[0].next;
  src->prev = &MitnStack_Top[0];
  src->value.link = (0);
  MitnStack_Top[0].next->prev = src;
  MitnStack_Top[0].next = src;
  return (0);
}


decompiled_code:
__int64 MitnStack_Init()
{
_QWORD *v0; // rbx
__int64 result; // rax

MitnStack_Clear(0LL);
MitnStack_Clear(1uLL);
MitnStack_Clear(2uLL);
MitnStack_Clear(3uLL);
v0 = &MitnCellMemory;
do
{
result = MitnStack_PutLinkCellToPool(v0);
v0 += 11;
}
while ( v0 != (_QWORD *)(unsigned int)((_DWORD)&MitnCellMemory + 88000) );
return result;
}

canonical_decompiled_code:
__int64 func8()
{
_QWORD *v0; // rbx
__int64 result; // rax

func0(0LL);
func0(1uLL);
func0(2uLL);
func0(3uLL);
v0 = &MitnCellMemory;
do
{
result = func7(v0);
v0 += 11;
}
while ( v0 != (_QWORD *)(unsigned int)((_DWORD)&MitnCellMemory + 88000) );
return result;
}

original_code:
void MitnStack_Init (void)
{
  int i;
  for(i = 0; i < (3 + 1); i++) {
    MitnStack_Clear(i);
  }
  for(i = 0; i < 1000; i++)
    {
      MitnStack_PutLinkCellToPool (&MitnCellMemory[i]);
    }
}

canonical_original_code:
void MitnStack_Init()
{
  int i;
  for(i = 0; i < (3 + 1); i++) {
    MitnStack_Clear(i);
  }
  for(i = 0; i < 1000; i++)
    {
      MitnStack_PutLinkCellToPool (&MitnCellMemory[i]);
    }
}


original_code:
ER MitnStack_Pop(W wStkNum, Cell **dest)
{
  Cell *c;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  c = MitnStack_Top[wStkNum].next;
  if (c == (0)) {
    return (-5);
  }
  if (c == &MitnStack_Bottom[wStkNum]) {
    return (-33);
  }
  if ((c->type & (0x10000000)) == (0x10000000)) {
    *dest = c;
  } else {
    *dest = c->value.link;
  }
  c->next->prev = (0);
  c->next->prev = &MitnStack_Top[wStkNum];
  MitnStack_Top[wStkNum].next = c->next;
  c->next = (0);
  c->prev = (0);
  return (0);
}

canonical_original_code:
int MitnStack_Pop(long wStkNum, struct _cell **dest)
{
  struct _cell *c;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  c = MitnStack_Top[wStkNum].next;
  if (c == (0)) {
    return (-5);
  }
  if (c == &MitnStack_Bottom[wStkNum]) {
    return (-33);
  }
  if ((c->type & (0x10000000)) == (0x10000000)) {
    *dest = c;
  } else {
    *dest = c->value.link;
  }
  c->next->prev = (0);
  c->next->prev = &MitnStack_Top[wStkNum];
  MitnStack_Top[wStkNum].next = c->next;
  c->next = (0);
  c->prev = (0);
  return (0);
}


decompiled_code:
__int64 __fastcall MitnStack_ClearToMark(unsigned __int64 a1)
{
__int64 result; // rax
__int64 v2; // [rsp+0h] [rbp-8h] BYREF

if ( a1 > 3 )
return 4294967263LL;
do
result = MitnStack_Pop(1uLL, &v2);
while ( !(_DWORD)result && *(_QWORD *)(v2 + 8) != 268500992LL );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(unsigned __int64 a1)
{
__int64 result; // rax
__int64 v2; // [rsp+0h] [rbp-8h] BYREF

if ( a1 > 3 )
return 4294967263LL;
do
result = func9(1uLL, &v2);
while ( !(_DWORD)result && *(_QWORD *)(v2 + 8) != 268500992LL );
return result;
}

original_code:
ER MitnStack_ClearToMark(W wStkNum)
{
  ER result;
  Cell *c;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  while (1) {
    result = MitnStack_Pop(1, &c);
    if ((result) != (0)) { return (result); };
    if (c->type == (0x00010000 | (0x10000000))) {
     break;
    }
  }
  return (0);
}

canonical_original_code:
int MitnStack_ClearToMark(long wStkNum)
{
  int result;
  struct _cell *c;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  while (1) {
    result = MitnStack_Pop(1, &c);
    if ((result) != (0)) { return (result); };
    if (c->type == (0x00010000 | (0x10000000))) {
     break;
    }
  }
  return (0);
}


decompiled_code:
__int64 __fastcall MitnStack_BottomPush(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rdx
__int64 result; // rax
__int64 v5; // [rsp+0h] [rbp-10h] BYREF

if ( !a2 )
return 4294967263LL;
if ( a1 > 3 )
return 4294967263LL;
if ( (*(_BYTE *)(a2 + 11) & 0x20) == 0 )
{
v5 = a2;
LABEL_5:
v2 = v5;
*(_QWORD *)(v5 + 24) = &MitnStack_Bottom[11 * a1];
v3 = MitnStack_Bottom[11 * a1 + 2];
*(_QWORD *)(v2 + 16) = v3;
*(_QWORD *)(v3 + 24) = v2;
MitnStack_Bottom[11 * a1 + 2] = v2;
return 0LL;
}
result = MitnCell_GetCellAsLink(&v5);
if ( !(_DWORD)result )
goto LABEL_5;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rdx
__int64 result; // rax
__int64 v5; // [rsp+0h] [rbp-10h] BYREF

if ( !a2 )
return 4294967263LL;
if ( a1 > 3 )
return 4294967263LL;
if ( (*(_BYTE *)(a2 + 11) & 0x20) == 0 )
{
v5 = a2;
LABEL_5:
v2 = v5;
*(_QWORD *)(v5 + 24) = &MitnStack_Bottom[11 * a1];
v3 = MitnStack_Bottom[11 * a1 + 2];
*(_QWORD *)(v2 + 16) = v3;
*(_QWORD *)(v3 + 24) = v2;
MitnStack_Bottom[11 * a1 + 2] = v2;
return 0LL;
}
result = MitnCell_GetCellAsLink(&v5);
if ( !(_DWORD)result )
goto LABEL_5;
return result;
}

original_code:
ER MitnStack_BottomPush(W wStkNum, Cell *src)
{
  Cell *dest;
  ER result;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  if (src == (0))
    {
      return (-33);
    }
  if ((src->type & (0x20000000)) == (0x20000000)) {
    result = MitnCell_GetCellAsLink(&dest, src);
    if ((result) != (0)) { return (result); };
  } else {
    dest = src;
  }
  dest->next = &MitnStack_Bottom[wStkNum];
  dest->prev = MitnStack_Bottom[wStkNum].prev;
  MitnStack_Bottom[wStkNum].prev->next = dest;
  MitnStack_Bottom[wStkNum].prev = dest;
  return (0);
}

canonical_original_code:
int MitnStack_BottomPush(long wStkNum, struct _cell *src)
{
  struct _cell *dest;
  int result;
  if (wStkNum < 0 || wStkNum > 3)
    {
      return (-33);
    }
  if (src == (0))
    {
      return (-33);
    }
  if ((src->type & (0x20000000)) == (0x20000000)) {
    result = MitnCell_GetCellAsLink(&dest, src);
    if ((result) != (0)) { return (result); };
  } else {
    dest = src;
  }
  dest->next = &MitnStack_Bottom[wStkNum];
  dest->prev = MitnStack_Bottom[wStkNum].prev;
  MitnStack_Bottom[wStkNum].prev->next = dest;
  MitnStack_Bottom[wStkNum].prev = dest;
  return (0);
}


decompiled_code:
__int64 __fastcall MitnStack_Duplicate(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rbx
__int64 *v3; // rdx
__int64 v4; // rax
__int64 result; // rax
__int64 i; // r13
__int64 v7[6]; // [rsp+8h] [rbp-30h] BYREF

v2 = MitnStack_Top[11 * a1 + 3];
if ( a2 <= 1 )
{
result = 0LL;
if ( a2 != 1 )
return result;
}
else
{
v3 = &MitnStack_Bottom[11 * a1];
if ( (__int64 *)v2 == v3 )
return 4294967263LL;
v4 = 1LL;
while ( 1 )
{
v2 = *(_QWORD *)(v2 + 24);
if ( a2 == ++v4 )
break;
if ( (__int64 *)v2 == v3 )
return 4294967263LL;
}
}
for ( i = 0LL; i < a2; ++i )
{
MitnCell_CopyCell(v7, v2);
result = MitnStack_Push(a1, v7[0]);
if ( (_DWORD)result )
break;
v2 = *(_QWORD *)(v2 + 16);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(unsigned __int64 a1, __int64 a2)
{
__int64 v2; // rbx
__int64 *v3; // rdx
__int64 v4; // rax
__int64 result; // rax
__int64 i; // r13
__int64 v7[6]; // [rsp+8h] [rbp-30h] BYREF

v2 = MitnStack_Top[11 * a1 + 3];
if ( a2 <= 1 )
{
result = 0LL;
if ( a2 != 1 )
return result;
}
else
{
v3 = &MitnStack_Bottom[11 * a1];
if ( (__int64 *)v2 == v3 )
return 4294967263LL;
v4 = 1LL;
while ( 1 )
{
v2 = *(_QWORD *)(v2 + 24);
if ( a2 == ++v4 )
break;
if ( (__int64 *)v2 == v3 )
return 4294967263LL;
}
}
for ( i = 0LL; i < a2; ++i )
{
MitnCell_CopyCell(v7, v2);
result = func5(a1, v7[0]);
if ( (_DWORD)result )
break;
v2 = *(_QWORD *)(v2 + 16);
}
return result;
}

original_code:
ER MitnStack_Duplicate (W wStkNum, long num)
{
  long i;
  Cell *p;
  for(p = MitnStack_Top[wStkNum].next, i = 1;
      i < num;
      p = p->next, i++)
    {
      if (p == &MitnStack_Bottom[wStkNum])
 {
   return (-33);
 }
    }
  for(i = 0;
      i < num;
      i++, p = p->prev)
    {
      ER result;
      Cell *dest;
      result = MitnCell_CopyCell(&dest, p);
      result = MitnStack_Push(wStkNum, dest);
      if ((result) != (0)) { return (result); };
    }
  return (0);
}

canonical_original_code:
int MitnStack_Duplicate(long wStkNum, long num)
{
  long i;
  struct _cell *p;
  for(p = MitnStack_Top[wStkNum].next, i = 1;
      i < num;
      p = p->next, i++)
    {
      if (p == &MitnStack_Bottom[wStkNum])
 {
   return (-33);
 }
    }
  for(i = 0;
      i < num;
      i++, p = p->prev)
    {
      int result;
      struct _cell *dest;
      result = MitnCell_CopyCell(&dest, p);
      result = MitnStack_Push(wStkNum, dest);
      if ((result) != (0)) { return (result); };
    }
  return (0);
}

variable_types: num long

variable_types: i long


original_code:
ER MitnStack_Roll (W wStkNum, long num)
{
  ER result;
  long i;
  Cell *p;
  for(p = MitnStack_Top[wStkNum].next, i = 1;
      i < num;
      p = p->next, i++)
    {
      if (p == &MitnStack_Bottom[wStkNum])
 {
   return (-33);
 }
    }
  p->prev->next = p->next;
  p->next->prev = p->prev;
  result = MitnStack_Push(wStkNum, p);
  if ((result) != (0)) { return (result); };
  return (0);
}

canonical_original_code:
int MitnStack_Roll(long wStkNum, long num)
{
  int result;
  long i;
  struct _cell *p;
  for(p = MitnStack_Top[wStkNum].next, i = 1;
      i < num;
      p = p->next, i++)
    {
      if (p == &MitnStack_Bottom[wStkNum])
 {
   return (-33);
 }
    }
  p->prev->next = p->next;
  p->next->prev = p->prev;
  result = MitnStack_Push(wStkNum, p);
  if ((result) != (0)) { return (result); };
  return (0);
}


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

MitnStack_Top[0] = 0;
MitnStack_Bottom[0] = 0;
MitnStack_Top[88] = 0;
MitnStack_Bottom[88] = 0;
MitnStack_Top[176] = 0;
MitnStack_Bottom[176] = 0;
MitnStack_Top[264] = 0;
MitnStack_Bottom[264] = 0;
result = &MitnCellMemory;
do
{
*result = 0;
result += 88;
}
while ( result != (_BYTE *)(unsigned int)((_DWORD)&MitnCellMemory + 88000) );
return result;
}

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

MitnStack_Top[0] = 0;
MitnStack_Bottom[0] = 0;
MitnStack_Top[88] = 0;
MitnStack_Bottom[88] = 0;
MitnStack_Top[176] = 0;
MitnStack_Bottom[176] = 0;
MitnStack_Top[264] = 0;
MitnStack_Bottom[264] = 0;
result = &MitnCellMemory;
do
{
*result = 0;
result += 88;
}
while ( result != (_BYTE *)(unsigned int)((_DWORD)&MitnCellMemory + 88000) );
return result;
}

original_code:
static void
MitnGC_ClearMark()
{
  extern Cell MitnStack_Top[];
  extern Cell MitnStack_Bottom[];
  int i;
  for(i = 0; i < (3 + 1); i++)
    {
      MitnStack_Top[i].mark = 0;
      MitnStack_Bottom[i].mark = 0;
    }
  for(i = 0; i < 1000; i++)
    {
      MitnCellMemory[i].mark = 0;
    }
}

canonical_original_code:
static void MitnGC_ClearMark()
{
  extern struct _cell MitnStack_Top[];
  extern struct _cell MitnStack_Bottom[];
  int i;
  for(i = 0; i < (3 + 1); i++)
    {
      MitnStack_Top[i].mark = 0;
      MitnStack_Bottom[i].mark = 0;
    }
  for(i = 0; i < 1000; i++)
    {
      MitnCellMemory[i].mark = 0;
    }
}

variable_types: struct _cell { char mark; unsigned long type; struct _cell *prev; struct _cell *next; union { long inum; double dnum; struct { char str[48]; long length; } string; struct { struct _cell *link; char str[48]; } name; int (*mitn_func)(); struct { long arg_num; int (*func)(int argc, char *argv[]); } trad; struct _cell *link; } value; } []


decompiled_code:
__int64 MitnGC_Sweep()
{
_BYTE *v0; // rbx
__int64 result; // rax

v0 = &MitnCellMemory;
do
{
if ( !*v0 )
result = MitnStack_PutLinkCellToPool(v0);
v0 += 88;
}
while ( v0 != (_BYTE *)(unsigned int)((_DWORD)&MitnCellMemory + 88000) );
return result;
}

canonical_decompiled_code:
__int64 func1()
{
_BYTE *v0; // rbx
__int64 result; // rax

v0 = &MitnCellMemory;
do
{
if ( !*v0 )
result = MitnStack_PutLinkCellToPool(v0);
v0 += 88;
}
while ( v0 != (_BYTE *)(unsigned int)((_DWORD)&MitnCellMemory + 88000) );
return result;
}

canonical_original_code:
static void MitnGC_Sweep()
{
  int i;
  for(i = 0;i < 1000; i++)
    {
      struct _cell *c;
      c = &MitnCellMemory[i];
      if (c->mark == 0)
 {
   if ((c->type & (0x00010000 | (0x20000000))) == (0x00010000 | (0x20000000)))
     {
     }
   MitnStack_PutLinkCellToPool(c);
 }
    }
}

variable_types: i int


original_code:
void
MitnGC_MarkRecursive(Cell *c)
{
  Cell *traceCell;
  if (c == (0)) {
    return;
  }
  if ((c->type & (0x02000000)) == (0x02000000)) {
    c->mark = 1;
    return;
  }
  for(traceCell = c;
      traceCell != (0);
      traceCell = traceCell->next) {
    if (traceCell->mark == 1) {
      break;
    }
    traceCell->mark = 1;
    if (traceCell->type == (0x000C0000 | (0x10000000))) {
      MitnGC_MarkRecursive(traceCell->value.name.link);
    } else if ((traceCell->type & (0x20000000)) == (0x20000000)) {
      MitnGC_MarkRecursive(traceCell->value.link);
    }
  }
}

canonical_original_code:
void MitnGC_MarkRecursive(struct _cell *c)
{
  struct _cell *traceCell;
  if (c == (0)) {
    return;
  }
  if ((c->type & (0x02000000)) == (0x02000000)) {
    c->mark = 1;
    return;
  }
  for(traceCell = c;
      traceCell != (0);
      traceCell = traceCell->next) {
    if (traceCell->mark == 1) {
      break;
    }
    traceCell->mark = 1;
    if (traceCell->type == (0x000C0000 | (0x10000000))) {
      MitnGC_MarkRecursive(traceCell->value.name.link);
    } else if ((traceCell->type & (0x20000000)) == (0x20000000)) {
      MitnGC_MarkRecursive(traceCell->value.link);
    }
  }
}


decompiled_code:
void MitnGC_Mark()
{
_BYTE *v0; // rbx

v0 = MitnStack_Top;
do
{
MitnGC_MarkRecursive(*((_BYTE **)v0 + 3));
v0 += 88;
}
while ( v0 != (_BYTE *)(unsigned int)((_DWORD)MitnStack_Top + 352) );
}

canonical_decompiled_code:
void func3()
{
_BYTE *v0; // rbx

v0 = MitnStack_Top;
do
{
func2(*((_BYTE **)v0 + 3));
v0 += 88;
}
while ( v0 != (_BYTE *)(unsigned int)((_DWORD)MitnStack_Top + 352) );
}

original_code:
void
MitnGC_Mark()
{
  extern Cell MitnStack_Top[];
  int i;
  for(i = 0; i < (3 + 1); i++)
    {
      MitnGC_MarkRecursive(MitnStack_Top[i].next);
    }
}

canonical_original_code:
void MitnGC_Mark()
{
  extern struct _cell MitnStack_Top[];
  int i;
  for(i = 0; i < (3 + 1); i++)
    {
      MitnGC_MarkRecursive(MitnStack_Top[i].next);
    }
}


decompiled_code:
__int64 MitnStack_GarbageCollect()
{
MitnGC_ClearMark();
MitnGC_Mark();
MitnGC_Sweep();
return 0LL;
}

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

original_code:
ER MitnStack_GarbageCollect(void)
{
  MitnGC_ClearMark();
  MitnGC_Mark();
  MitnGC_Sweep();
  return (0);
}

canonical_original_code:
int MitnStack_GarbageCollect()
{
  MitnGC_ClearMark();
  MitnGC_Mark();
  MitnGC_Sweep();
  return (0);
}


decompiled_code:
__int64 __fastcall psys_read(__int64 *a1)
{
__int64 v2; // [rsp+0h] [rbp-C8h] BYREF
__int64 v3; // [rsp+18h] [rbp-B0h]
unsigned int v4; // [rsp+20h] [rbp-A8h]
char v5[32]; // [rsp+40h] [rbp-88h] BYREF
__int64 v6; // [rsp+60h] [rbp-68h]
__int64 v7; // [rsp+68h] [rbp-60h]
__int64 v8; // [rsp+70h] [rbp-58h]

v6 = *a1;
v7 = a1[1];
v8 = a1[2];
if ( (unsigned int)make_connection(25LL, v5, &v2) || !v3 )
return v4;
MEMORY[0x7FFF0028] = v3;
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 *a1)
{
__int64 v2; // [rsp+0h] [rbp-C8h] BYREF
__int64 v3; // [rsp+18h] [rbp-B0h]
unsigned int v4; // [rsp+20h] [rbp-A8h]
char v5[32]; // [rsp+40h] [rbp-88h] BYREF
__int64 v6; // [rsp+60h] [rbp-68h]
__int64 v7; // [rsp+68h] [rbp-60h]
__int64 v8; // [rsp+70h] [rbp-58h]

v6 = *a1;
v7 = a1[1];
v8 = a1[2];
if ( (unsigned int)make_connection(25LL, v5, &v2) || !v3 )
return v4;
MEMORY[0x7FFF0028] = v3;
return 0xFFFFFFFFLL;
}

original_code:
ssize_t
psys_read (void *argp)
{
  struct a
    {
    } *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

canonical_original_code:
unsigned int psys_read(void *argp)
{
  struct a *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

return_type: unsigned int


decompiled_code:
__int64 psys_getpid()
{
__int64 v1; // [rsp+0h] [rbp-C8h] BYREF
__int64 v2; // [rsp+18h] [rbp-B0h]
unsigned int v3; // [rsp+20h] [rbp-A8h]
char v4[136]; // [rsp+40h] [rbp-88h] BYREF

if ( (unsigned int)make_connection(17LL, v4, &v1) || !v2 )
return v3;
MEMORY[0x7FFF0028] = v2;
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 v1; // [rsp+0h] [rbp-C8h] BYREF
__int64 v2; // [rsp+18h] [rbp-B0h]
unsigned int v3; // [rsp+20h] [rbp-A8h]
char v4[136]; // [rsp+40h] [rbp-88h] BYREF

if ( (unsigned int)make_connection(17LL, v4, &v1) || !v2 )
return v3;
MEMORY[0x7FFF0028] = v2;
return 0xFFFFFFFFLL;
}

original_code:
pid_t
psys_getpid (void *argp)
{
  struct a
    {
    } *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

canonical_original_code:
unsigned short psys_getpid(void *argp)
{
  struct a *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

return_type: unsigned short


getgid

decompiled_code:
__int64 getgid()
{
return call_lowlib(15LL);
}

canonical_decompiled_code:
__int64 func0()
{
return call_lowlib(15LL);
}

original_code:
int
getgid (void)
{
  return (call_lowlib (15));
}

canonical_original_code:
int getgid()
{
  return (call_lowlib (15));
}


original_code:
W
open_ide (ID caller, DDEV_OPN_REQ *packet)
{
  DDEV_RES res;
  res.body.opn_res.dd = packet->dd;
  res.body.opn_res.errcd = (0);
  res.body.opn_res.errinfo = (0);
  snd_mbf (caller, sizeof (res), &res);
  return ((0));
}

canonical_original_code:
long open_ide(int caller, struct DDEV_OPN_REQ *packet)
{
  struct DDEV_RES res;
  res.body.opn_res.dd = packet->dd;
  res.body.opn_res.errcd = (0);
  res.body.opn_res.errinfo = (0);
  snd_mbf (caller, sizeof (res), &res);
  return ((0));
}

variable_types: caller int

variable_types:
packet
struct DDEV_OPN_REQ { long dd; } *

variable_types: struct DDEV_RES { struct SVC_REQ { int mbfid; long msgtyp; int tskid; long len; unsigned long arg[]; } header; union { struct DDEV_OPN_RES { long dd; long errcd; long errinfo; } opn_res; struct DDEV_CLS_RES { long dd; long errcd; long errinfo; } cls_res; struct DDEV_REA_RES { long dd; long errcd; long errinfo; long split; long a_size; unsigned char dt[1024]; } rea_res; struct DDEV_WRI_RES { long dd; long errcd; long errinfo; long a_size; } wri_res; struct DDEV_CTL_RES { long dd; long errcd; long errinfo; long res[]; } ctl_res; } body; }

user_defined_types: struct DDEV_RES { struct SVC_REQ header; union { struct DDEV_OPN_RES opn_res; struct DDEV_CLS_RES cls_res; struct DDEV_REA_RES rea_res; struct DDEV_WRI_RES wri_res; struct DDEV_CTL_RES ctl_res; } body; }


original_code:
W
close_ide (ID caller, DDEV_CLS_REQ *packet)
{
  DDEV_RES res;
  res.body.cls_res.dd = packet->dd;
  res.body.cls_res.errcd = (0);
  res.body.cls_res.errinfo = (0);
  snd_mbf (caller, sizeof (res), &res);
  return ((0));
}

canonical_original_code:
long close_ide(int caller, struct DDEV_CLS_REQ *packet)
{
  struct DDEV_RES res;
  res.body.cls_res.dd = packet->dd;
  res.body.cls_res.errcd = (0);
  res.body.cls_res.errinfo = (0);
  snd_mbf (caller, sizeof (res), &res);
  return ((0));
}

variable_types: struct DDEV_CLS_REQ { long dd; long eject; } *

user_defined_types: struct SVC_REQ { int mbfid; long msgtyp; int tskid; long len; unsigned long arg[]; }

user_defined_types: struct DDEV_OPN_RES { long dd; long errcd; long errinfo; }

user_defined_types: struct DDEV_CLS_RES { long dd; long errcd; long errinfo; }

user_defined_types: struct DDEV_REA_RES { long dd; long errcd; long errinfo; long split; long a_size; unsigned char dt[1024]; }

user_defined_types: struct DDEV_WRI_RES { long dd; long errcd; long errinfo; long a_size; }

user_defined_types: struct DDEV_CTL_RES { long dd; long errcd; long errinfo; long res[]; }


original_code:
W
read_ide (ID caller, DDEV_REA_REQ *packet)
{
  DDEV_RES res;
  W blockno;
  W bcount;
  W cylinder;
  W head;
  W sector;
  W drive;
  UW partition;
  W i, try;
  W done_length;
  static B buff[512 * 2];
  UW bp;
  ER ret;
  ER error;
  UW bufstart;
  UW buflength;
  UW parstart;
  drive = ((packet->dd & 0xff00) >> 8);
  partition = (packet->dd & 0xff);
  if (partition == 0)
    {
      parstart = 0;
    }
  else
    {
      parstart = ide_partition[drive][partition - 1].start * 512;
    }
  bufstart = ((packet->start / 512) * 512);
  buflength = ((packet->start + packet->size + (512 -1)) / 512 * 512);
  done_length = 0;
  error = (0);
  ret = (0);
  for (bp = 0; bp < (buflength - bufstart); bp += 512)
    {
      blockno = ((UW)(bp + bufstart + parstart) / 512) * (512 / 512);
      if (512 >= (512))
 {
   bcount = 512 / 512;
 }
      for (i = 0; i < bcount; i++)
 {
   head = (blockno % ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector))) / (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector);
   cylinder = (blockno / ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)));
   sector = (blockno % (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)) + 1;
   for (try = 0; try < 10; try++)
     {
       ret = get_data (drive, head, cylinder, sector, (void *)&(buff[bp + (i * 512)]), 512 / 512);
       if (ret > 0)
  break;
     }
   if (ret > 0)
     {
       done_length += ret;
       blockno++;
     }
   else
     {
       error = (-5);
       goto bad;
     }
 }
    }
  if (((done_length < packet->size) ? done_length : packet->size) > 512 * 2)
    {
      printf ("buffer overflow (size = %d)\n", (done_length < packet->size) ? done_length : packet->size);
      error = (-5);
      goto bad;
    }
  bcopy (&buff[packet->start - bufstart],
  res.body.rea_res.dt,
  (done_length < packet->size) ? done_length : packet->size);
  res.body.rea_res.dd = packet->dd;
  res.body.rea_res.a_size = (done_length < packet->size) ? done_length : packet->size;
  res.body.rea_res.errcd = (0);
  res.body.rea_res.errinfo = 0;
  snd_mbf (caller, sizeof (res), &res);
  return ((0));
bad:
  res.body.rea_res.dd = packet->dd;
  res.body.rea_res.a_size = done_length;
  res.body.rea_res.errcd = error;
  res.body.rea_res.errinfo = (0);
  snd_mbf (caller, sizeof (res), &res);
  return (error);
}

canonical_original_code:
long read_ide(int caller, struct DDEV_REA_REQ *packet)
{
  struct DDEV_RES res;
  long blockno;
  long bcount;
  long cylinder;
  long head;
  long sector;
  long drive;
  unsigned long partition;
  long i; long try;
  long done_length;
  static char buff[-1];
  unsigned long bp;
  int ret;
  int error;
  unsigned long bufstart;
  unsigned long buflength;
  unsigned long parstart;
  drive = ((packet->dd & 0xff00) >> 8);
  partition = (packet->dd & 0xff);
  if (partition == 0)
    {
      parstart = 0;
    }
  else
    {
      parstart = ide_partition[drive][partition - 1].start * 512;
    }
  bufstart = ((packet->start / 512) * 512);
  buflength = ((packet->start + packet->size + (512 -1)) / 512 * 512);
  done_length = 0;
  error = (0);
  ret = (0);
  for (bp = 0; bp < (buflength - bufstart); bp += 512)
    {
      blockno = ((UW)(bp + bufstart + parstart) / 512) * (512 / 512);
      if (512 >= (512))
 {
   bcount = 512 / 512;
 }
      for (i = 0; i < bcount; i++)
 {
   head = (blockno % ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector))) / (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector);
   cylinder = (blockno / ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)));
   sector = (blockno % (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)) + 1;
   for (try = 0; try < 10; try++)
     {
       ret = get_data (drive, head, cylinder, sector, (void *)&(buff[bp + (i * 512)]), 512 / 512);
       if (ret > 0)
  break;
     }
   if (ret > 0)
     {
       done_length += ret;
       blockno++;
     }
   else
     {
       error = (-5);
       goto bad;
     }
 }
    }
  if (((done_length < packet->size) ? done_length : packet->size) > 512 * 2)
    {
      printf ("buffer overflow (size = %d)\n", (done_length < packet->size) ? done_length : packet->size);
      error = (-5);
      goto bad;
    }
  bcopy (&buff[packet->start - bufstart],
  res.body.rea_res.dt,
  (done_length < packet->size) ? done_length : packet->size);
  res.body.rea_res.dd = packet->dd;
  res.body.rea_res.a_size = (done_length < packet->size) ? done_length : packet->size;
  res.body.rea_res.errcd = (0);
  res.body.rea_res.errinfo = 0;
  snd_mbf (caller, sizeof (res), &res);
  return ((0));
bad:
  res.body.rea_res.dd = packet->dd;
  res.body.rea_res.a_size = done_length;
  res.body.rea_res.errcd = error;
  res.body.rea_res.errinfo = (0);
  snd_mbf (caller, sizeof (res), &res);
  return (error);
}

variable_types: struct DDEV_REA_REQ { long dd; long start; long size; } *

variable_types: blockno long

variable_types: bcount long

variable_types: cylinder long

variable_types: head long

variable_types: sector long

variable_types: drive long

variable_types:
partition
unsigned long

variable_types: try long

variable_types:
buff
char [-1]

variable_types:
bp
unsigned long

variable_types: ret int

variable_types: error int

variable_types:
bufstart
unsigned long

variable_types:
buflength
unsigned long

variable_types:
parstart
unsigned long


original_code:
W
write_ide(ID caller, DDEV_WRI_REQ *packet)
{
  DDEV_RES res;
  W blockno;
  W bcount;
  W cylinder;
  W head;
  W sector;
  W drive;
  UW partition;
  W i, try;
  W done_length;
  static B buff[512 * 2];
  UW bp;
  ER ret;
  ER error;
  UW bufstart;
  UW buflength;
  UW parstart;
  drive = ((packet->dd & 0xff00) >> 8);
  partition = (packet->dd & 0xff);
  if (partition == 0)
    {
      parstart = 0;
    }
  else
    {
      parstart = ide_partition[drive][partition - 1].start * 512;
    }
  bufstart = ((packet->start / 512) * 512);
  buflength = ((packet->start + packet->size + (512 -1)) / 512 * 512);
  done_length = 0;
  error = (0);
  ret = (0);
  for (bp = 0; bp < (buflength - bufstart); bp += 512)
    {
      blockno = ((UW)(bp + bufstart + parstart) / 512) * (512 / 512);
      if (512 >= (512))
 {
   bcount = 512 / 512;
 }
      for (i = 0; i < bcount; i++)
 {
   head = (blockno % ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector))) / (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector);
   cylinder = (blockno / ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)));
   sector = (blockno % (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)) + 1;
   for (try = 0; try < 10; try++)
     {
       ret = get_data (drive, head, cylinder, sector, (void *)&(buff[bp + (i * 512)]), 512 / 512);
       if (ret > 0)
  break;
     }
   if (ret > 0)
     {
       done_length += ret;
       blockno++;
     }
   else
     {
       error = (-5);
       goto bad;
     }
 }
    }
  bcopy (packet->dt, &buff[packet->start - bufstart], packet->size);
  done_length = 0;
  error = (0);
  ret = (0);
  for (bp = 0; bp < (buflength - bufstart); bp += 512)
    {
      blockno = ((UW)(bp + bufstart + parstart) / 512) * (512 / 512);
      if (512 >= (512))
 {
   bcount = 512 / 512;
 }
      for (i = 0; i < bcount; i++)
 {
   head = (blockno % ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector))) / (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector);
   cylinder = (blockno / ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)));
   sector = (blockno % (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)) + 1;
   for (try = 0; try < 10; try++)
     {
       ret = put_data (drive, head, cylinder, sector, (void *)&(buff[bp + (i * 512)]), 512 / 512);
       if (ret > 0)
  break;
     }
   if (ret > 0)
     {
       done_length += ret;
       blockno++;
     }
   else
     {
       error = (-5);
       goto bad;
     }
 }
    }
  if (((done_length < packet->size) ? done_length : packet->size) > 512 * 2)
    {
      printf ("buffer overflow (size = %d)\n", (done_length < packet->size) ? done_length : packet->size);
      error = (-5);
      goto bad;
    }
  res.body.wri_res.dd = packet->dd;
  res.body.wri_res.a_size = (done_length < packet->size) ? done_length : packet->size;
  res.body.wri_res.errcd = (0);
  res.body.wri_res.errinfo = 0;
  snd_mbf (caller, sizeof (res), &res);
  return ((0));
bad:
  res.body.wri_res.dd = packet->dd;
  res.body.wri_res.a_size = done_length;
  res.body.wri_res.errcd = error;
  res.body.wri_res.errinfo = (0);
  snd_mbf (caller, sizeof (res), &res);
  return (error);
}

canonical_original_code:
long write_ide(int caller, struct DDEV_WRI_REQ *packet)
{
  struct DDEV_RES res;
  long blockno;
  long bcount;
  long cylinder;
  long head;
  long sector;
  long drive;
  unsigned long partition;
  long i; long try;
  long done_length;
  static char buff[-1];
  unsigned long bp;
  int ret;
  int error;
  unsigned long bufstart;
  unsigned long buflength;
  unsigned long parstart;
  drive = ((packet->dd & 0xff00) >> 8);
  partition = (packet->dd & 0xff);
  if (partition == 0)
    {
      parstart = 0;
    }
  else
    {
      parstart = ide_partition[drive][partition - 1].start * 512;
    }
  bufstart = ((packet->start / 512) * 512);
  buflength = ((packet->start + packet->size + (512 -1)) / 512 * 512);
  done_length = 0;
  error = (0);
  ret = (0);
  for (bp = 0; bp < (buflength - bufstart); bp += 512)
    {
      blockno = ((UW)(bp + bufstart + parstart) / 512) * (512 / 512);
      if (512 >= (512))
 {
   bcount = 512 / 512;
 }
      for (i = 0; i < bcount; i++)
 {
   head = (blockno % ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector))) / (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector);
   cylinder = (blockno / ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)));
   sector = (blockno % (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)) + 1;
   for (try = 0; try < 10; try++)
     {
       ret = get_data (drive, head, cylinder, sector, (void *)&(buff[bp + (i * 512)]), 512 / 512);
       if (ret > 0)
  break;
     }
   if (ret > 0)
     {
       done_length += ret;
       blockno++;
     }
   else
     {
       error = (-5);
       goto bad;
     }
 }
    }
  bcopy (packet->dt, &buff[packet->start - bufstart], packet->size);
  done_length = 0;
  error = (0);
  ret = (0);
  for (bp = 0; bp < (buflength - bufstart); bp += 512)
    {
      blockno = ((UW)(bp + bufstart + parstart) / 512) * (512 / 512);
      if (512 >= (512))
 {
   bcount = 512 / 512;
 }
      for (i = 0; i < bcount; i++)
 {
   head = (blockno % ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector))) / (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector);
   cylinder = (blockno / ((ide_spec[((packet->dd & 0xff00) >> 8)].n_head) * (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)));
   sector = (blockno % (ide_spec[((packet->dd & 0xff00) >> 8)].n_sector)) + 1;
   for (try = 0; try < 10; try++)
     {
       ret = put_data (drive, head, cylinder, sector, (void *)&(buff[bp + (i * 512)]), 512 / 512);
       if (ret > 0)
  break;
     }
   if (ret > 0)
     {
       done_length += ret;
       blockno++;
     }
   else
     {
       error = (-5);
       goto bad;
     }
 }
    }
  if (((done_length < packet->size) ? done_length : packet->size) > 512 * 2)
    {
      printf ("buffer overflow (size = %d)\n", (done_length < packet->size) ? done_length : packet->size);
      error = (-5);
      goto bad;
    }
  res.body.wri_res.dd = packet->dd;
  res.body.wri_res.a_size = (done_length < packet->size) ? done_length : packet->size;
  res.body.wri_res.errcd = (0);
  res.body.wri_res.errinfo = 0;
  snd_mbf (caller, sizeof (res), &res);
  return ((0));
bad:
  res.body.wri_res.dd = packet->dd;
  res.body.wri_res.a_size = done_length;
  res.body.wri_res.errcd = error;
  res.body.wri_res.errinfo = (0);
  snd_mbf (caller, sizeof (res), &res);
  return (error);
}

variable_types: caller int

variable_types: struct DDEV_WRI_REQ { long dd; long start; long size; unsigned char dt[1024]; } *

variable_types: struct DDEV_RES { struct SVC_REQ { int mbfid; long msgtyp; int tskid; long len; unsigned long arg[]; } header; union { struct DDEV_OPN_RES { long dd; long errcd; long errinfo; } opn_res; struct DDEV_CLS_RES { long dd; long errcd; long errinfo; } cls_res; struct DDEV_REA_RES { long dd; long errcd; long errinfo; long split; long a_size; unsigned char dt[1024]; } rea_res; struct DDEV_WRI_RES { long dd; long errcd; long errinfo; long a_size; } wri_res; struct DDEV_CTL_RES { long dd; long errcd; long errinfo; long res[]; } ctl_res; } body; }

variable_types: i long


decompiled_code:
__int64 __fastcall read_partition(__int64 a1)
{
unsigned int v1; // ebp
int v3; // eax

v1 = read_stat(a1, ide_spec);
if ( !v1 )
{
v3 = get_data(a1, 0LL, 0LL, 1LL, &buf_0, 1LL);
printf("IDE: get_data length = %d\n", v3);
bcopy(&unk_D1E, &ide_partition[12 * a1], 0x60uLL);
}
return v1;
}

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

v1 = read_stat(a1, ide_spec);
if ( !v1 )
{
v3 = get_data(a1, 0LL, 0LL, 1LL, &buf_0, 1LL);
printf("IDE: get_data length = %d\n", v3);
bcopy(&unk_D1E, &ide_partition[12 * a1], 0x60uLL);
}
return v1;
}

original_code:
ER
read_partition (W drive)
{
  static UB buf[512];
  W rlength;
  UW *ip;
  W i;
  ER error = (0);
  struct ide_partition *table;
  error = read_stat (drive, &ide_spec[0]);
  if (error)
    {
      return (error);
    }
  rlength = get_data (drive, 0, 0, 1, buf, 1);
  printf ("IDE: get_data length = %d\n", rlength);
  bcopy (&buf[(0x1be)], ide_partition[drive], sizeof (struct ide_partition) * 4);
  return ((0));
}

canonical_original_code:
int read_partition(long drive)
{
  static unsigned char buf[512];
  long rlength;
  unsigned long *ip;
  long i;
  int error = (0);
  struct ide_partition *table;
  error = read_stat (drive, &ide_spec[0]);
  if (error)
    {
      return (error);
    }
  rlength = get_data (drive, 0, 0, 1, buf, 1);
  printf ("IDE: get_data length = %d\n", rlength);
  bcopy (&buf[(0x1be)], ide_partition[drive], sizeof (struct ide_partition) * 4);
  return ((0));
}

variable_types:
buf
unsigned char [512]

variable_types: rlength long

variable_types:
ip
unsigned long *

variable_types: struct ide_partition { unsigned char boot_flag; unsigned char begin[3]; unsigned char type; unsigned char end[3]; unsigned long start; unsigned long length; } *


original_code:
W
control_ide (ID caller, DDEV_CTL_REQ *packet)
{
  DDEV_RES res;
  ER error = (0);
  W drive;
  struct ide_partition *p;
  W i;
  drive = packet->dd >> 3;
  switch (packet->cmd)
    {
    case 0x01:
      error = read_stat (drive, &ide_spec[drive]);
      break;
    case 0x02:
      printf ("IDE_GET_GEOMETRIC: start. (drive = %d)\n", drive);
      error = read_partition (drive);
      p = (struct ide_partition *)res.body.ctl_res.res;
      for (i = 0; i < 4; i++)
 {
   p[i].boot_flag = ide_partition[drive][i].boot_flag;
   p[i].length = ide_partition[drive][i].length;
   p[i].type = ide_partition[drive][i].type;
   p[i].start = ide_partition[drive][i].start;
 }
      break;
    default:
      error = (-17);
      break;
    }
  res.body.ctl_res.dd = packet->dd;
  res.body.ctl_res.errcd = error;
  res.body.ctl_res.errinfo = error;
  snd_mbf (caller, sizeof (res), &res);
  return (error);
}

canonical_original_code:
long control_ide(int caller, struct DDEV_CTL_REQ *packet)
{
  struct DDEV_RES res;
  int error = (0);
  long drive;
  struct ide_partition *p;
  long i;
  drive = packet->dd >> 3;
  switch (packet->cmd)
    {
    case 0x01:
      error = read_stat (drive, &ide_spec[drive]);
      break;
    case 0x02:
      printf ("IDE_GET_GEOMETRIC: start. (drive = %d)\n", drive);
      error = read_partition (drive);
      p = (struct ide_partition *)res.body.ctl_res.res;
      for (i = 0; i < 4; i++)
 {
   p[i].boot_flag = ide_partition[drive][i].boot_flag;
   p[i].length = ide_partition[drive][i].length;
   p[i].type = ide_partition[drive][i].type;
   p[i].start = ide_partition[drive][i].start;
 }
      break;
    default:
      error = (-17);
      break;
    }
  res.body.ctl_res.dd = packet->dd;
  res.body.ctl_res.errcd = error;
  res.body.ctl_res.errinfo = error;
  snd_mbf (caller, sizeof (res), &res);
  return (error);
}

variable_types: struct DDEV_CTL_REQ { long dd; unsigned long cmd; long len; unsigned char param[]; } *

variable_types: drive long

user_defined_types: struct ide_partition { unsigned char boot_flag; unsigned char begin[3]; unsigned char type; unsigned char end[3]; unsigned long start; unsigned long length; }


decompiled_code:
__int64 init_ide()
{
int v0; // eax

outb(0xF6u, 0xEu);
outb(0xF6u, 0xAu);
LOBYTE(v0) = inb(0x1F7u);
dbg_printf("IDE init status = 0x%x\n", v0);
read_stat(0LL, ide_spec);
return read_partition(0LL);
}

canonical_decompiled_code:
__int64 func8()
{
int v0; // eax

outb(0xF6u, 0xEu);
outb(0xF6u, 0xAu);
LOBYTE(v0) = inb(0x1F7u);
dbg_printf("IDE init status = 0x%x\n", v0);
read_stat(0LL, ide_spec);
return func4(0LL);
}

original_code:
W
init_ide (void)
{
  W status;
  T_DINT pkt;
  ER err;
  pkt.intatr = (3);
  pkt.inthdr = (FP)intr_ide;
  outb (0x3f6, 0x0e);
  busywait (10000);
  outb (0x3f6, 0x0a);
  busywait (10000);
  status = inb (0x1f7);
  dbg_printf ("IDE init status = 0x%x\n", status);
  reset_ide (0);
  read_stat (0, &ide_spec[0]);
  read_partition (0);
}

canonical_original_code:
long init_ide()
{
  long status;
  struct t_dint pkt;
  int err;
  pkt.intatr = (3);
  pkt.inthdr = (void (*)())intr_ide;
  outb (0x3f6, 0x0e);
  busywait (10000);
  outb (0x3f6, 0x0a);
  busywait (10000);
  status = inb (0x1f7);
  dbg_printf ("IDE init status = 0x%x\n", status);
  reset_ide (0);
  read_stat (0, &ide_spec[0]);
  read_partition (0);
}

variable_types: status long

variable_types: struct t_dint { unsigned int intatr; void (*inthdr)(); }

variable_types: err int


decompiled_code:
__int64 init_ide_driver()
{
recvport = get_port(1096LL, 1096LL);
if ( recvport <= 0 )
{
printf("IDE: cannot make receive porrt.\n");
slp_tsk();
}
regist_port("driver.ide", (unsigned int)recvport);
init_log();
return init_ide();
}

canonical_decompiled_code:
__int64 func9()
{
recvport = get_port(1096LL, 1096LL);
if ( recvport <= 0 )
{
printf("IDE: cannot make receive porrt.\n");
slp_tsk();
}
regist_port("driver.ide", (unsigned int)recvport);
init_log();
return func8();
}

original_code:
static void
init_ide_driver (void)
{
  int i;
  ID root_dev;
  ER error;
  recvport = get_port (sizeof (DDEV_RES), sizeof (DDEV_RES));
  if (recvport <= 0)
    {
      printf ("IDE: cannot make receive porrt.\n");
      slp_tsk ();
    }
  error = regist_port ("driver.ide", recvport);
  if (error != (0))
    {
    }
  init_log ();
  init_ide ();
}

canonical_original_code:
static void init_ide_driver()
{
  int i;
  int root_dev;
  int error;
  recvport = get_port (sizeof (DDEV_RES), sizeof (DDEV_RES));
  if (recvport <= 0)
    {
      printf ("IDE: cannot make receive porrt.\n");
      slp_tsk ();
    }
  error = regist_port ("driver.ide", recvport);
  if (error != (0))
    {
    }
  init_log ();
  init_ide ();
}

variable_types: i int

variable_types: error int


doit

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

result = *((_QWORD *)a1 + 1);
switch ( result )
{
case 0LL:
result = open_ide(*a1, (_QWORD *)a1 + 4);
break;
case 1LL:
result = close_ide(*a1, (_QWORD *)a1 + 4);
break;
case 2LL:
result = read_ide(*a1, (__int64 *)a1 + 4);
break;
case 3LL:
result = write_ide(*a1, (__int64 *)a1 + 4);
break;
case 4LL:
result = control_ide(*a1, (__int64 *)a1 + 4);
break;
default:
return result;
}
return result;
}

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

result = *((_QWORD *)a1 + 1);
switch ( result )
{
case 0LL:
result = func0(*a1, (_QWORD *)a1 + 4);
break;
case 1LL:
result = func1(*a1, (_QWORD *)a1 + 4);
break;
case 2LL:
result = func2(*a1, (__int64 *)a1 + 4);
break;
case 3LL:
result = func3(*a1, (__int64 *)a1 + 4);
break;
case 4LL:
result = func5(*a1, (__int64 *)a1 + 4);
break;
default:
return result;
}
return result;
}

original_code:
static void
doit (DDEV_REQ *packet)
{
  switch (packet->header.msgtyp)
    {
    case DEV_OPN:
      open_ide (packet->header.mbfid, &(packet->body.opn_req));
      break;
    case DEV_CLS:
      close_ide (packet->header.mbfid, &(packet->body.cls_req));
      break;
    case DEV_REA:
      read_ide (packet->header.mbfid, &(packet->body.rea_req));
      break;
    case DEV_WRI:
      write_ide (packet->header.mbfid, &(packet->body.wri_req));
      break;
    case DEV_CTL:
      control_ide (packet->header.mbfid, &(packet->body.ctl_req));
      break;
    }
}

canonical_original_code:
static void doit(struct DDEV_REQ *packet)
{
  switch (packet->header.msgtyp)
    {
    case DEV_OPN:
      open_ide (packet->header.mbfid, &(packet->body.opn_req));
      break;
    case DEV_CLS:
      close_ide (packet->header.mbfid, &(packet->body.cls_req));
      break;
    case DEV_REA:
      read_ide (packet->header.mbfid, &(packet->body.rea_req));
      break;
    case DEV_WRI:
      write_ide (packet->header.mbfid, &(packet->body.wri_req));
      break;
    case DEV_CTL:
      control_ide (packet->header.mbfid, &(packet->body.ctl_req));
      break;
    }
}

variable_types: struct DDEV_REQ { struct SVC_REQ { int mbfid; long msgtyp; int tskid; long len; unsigned long arg[]; } header; union { struct DDEV_OPN_REQ { long dd; } opn_req; struct DDEV_CLS_REQ { long dd; long eject; } cls_req; struct DDEV_REA_REQ { long dd; long start; long size; } rea_req; struct DDEV_WRI_REQ { long dd; long start; long size; unsigned char dt[1024]; } wri_req; struct DDEV_CTL_REQ { long dd; unsigned long cmd; long len; unsigned char param[]; } ctl_req; struct DDEV_PRD_REQ { long dd; char *buf; long start; long length; } prd_req; struct DDEV_RLY_REQ { long dd; long start; long size; unsigned char dt[1024]; } rly_req; } body; } *


decompiled_code:
void __noreturn main_loop()
{
char v0[8]; // [rsp+8h] [rbp-450h] BYREF
unsigned int v1[274]; // [rsp+10h] [rbp-448h] BYREF

while ( 1 )
{
get_req((unsigned int)recvport, v1, v0);
if ( sys_errno )
{
printf("ide: get_req() Unknown error(error = %d)\n", sys_errno);
printf("IDE driver is halt.\n");
slp_tsk();
}
else
{
doit(v1);
}
}
}

canonical_decompiled_code:
void __noreturn func7()
{
char v0[8]; // [rsp+8h] [rbp-450h] BYREF
unsigned int v1[274]; // [rsp+10h] [rbp-448h] BYREF

while ( 1 )
{
get_req((unsigned int)recvport, v1, v0);
if ( sys_errno )
{
printf("ide: get_req() Unknown error(error = %d)\n", sys_errno);
printf("IDE driver is halt.\n");
slp_tsk();
}
else
{
func6(v1);
}
}
}

original_code:
static void
main_loop ()
{
  DDEV_REQ req;
  extern ER sys_errno;
  UW rsize;
  for (;;)
    {
      get_req (recvport, &req, &rsize);
      switch (sys_errno)
 {
 case (0):
   doit (&req);
   break;
 default:
   printf ("ide: get_req() Unknown error(error = %d)\n", sys_errno);
   printf ("IDE driver is halt.\n");
   slp_tsk ();
   break;
 }
    }
}

canonical_original_code:
static void main_loop()
{
  struct DDEV_REQ req;
  extern int sys_errno;
  unsigned long rsize;
  for (;;)
    {
      get_req (recvport, &req, &rsize);
      switch (sys_errno)
 {
 case (0):
   doit (&req);
   break;
 default:
   printf ("ide: get_req() Unknown error(error = %d)\n", sys_errno);
   printf ("IDE driver is halt.\n");
   slp_tsk ();
   break;
 }
    }
}

variable_types: struct DDEV_REQ { struct SVC_REQ { int mbfid; long msgtyp; int tskid; long len; unsigned long arg[]; } header; union { struct DDEV_OPN_REQ { long dd; } opn_req; struct DDEV_CLS_REQ { long dd; long eject; } cls_req; struct DDEV_REA_REQ { long dd; long start; long size; } rea_req; struct DDEV_WRI_REQ { long dd; long start; long size; unsigned char dt[1024]; } wri_req; struct DDEV_CTL_REQ { long dd; unsigned long cmd; long len; unsigned char param[]; } ctl_req; struct DDEV_PRD_REQ { long dd; char *buf; long start; long length; } prd_req; struct DDEV_RLY_REQ { long dd; long start; long size; unsigned char dt[1024]; } rly_req; } body; }

variable_types:
rsize
unsigned long


decompiled_code:
__int64 intr_ide()
{
dis_int();
ide_intr_flag = 1LL;
reset_intr_mask(14LL);
return ena_int();
}

canonical_decompiled_code:
__int64 func11()
{
dis_int();
ide_intr_flag = 1LL;
reset_intr_mask(14LL);
return ena_int();
}

original_code:
void
intr_ide (void)
{
  dis_int ();
  ide_intr_flag = (1);
  reset_intr_mask (14);
  ena_int ();
}

canonical_original_code:
void intr_ide()
{
  dis_int ();
  ide_intr_flag = (1);
  reset_intr_mask (14);
  ena_int ();
}


busywait

decompiled_code:
void __fastcall busywait(__int64 a1)
{
int v1; // edx
int v2; // eax

if ( a1 > 0 )
{
v1 = 0;
do
{
v2 = 100;
do
--v2;
while ( v2 );
++v1;
}
while ( v1 != (_DWORD)a1 );
}
}

canonical_decompiled_code:
void __fastcall func13(__int64 a1)
{
int v1; // edx
int v2; // eax

if ( a1 > 0 )
{
v1 = 0;
do
{
v2 = 100;
do
--v2;
while ( v2 );
++v1;
}
while ( v1 != (_DWORD)a1 );
}
}

original_code:
void
busywait(W x)
{
  int i,j;
  int tmp;
  for (i = 0; i < x; i++)
     for (j = 0; j < 100; j++)
       tmp = j;
}

canonical_original_code:
void busywait(long x)
{
  int i; int j;
  int tmp;
  for (i = 0; i < x; i++)
     for (j = 0; j < 100; j++)
       tmp = j;
}

variable_types: x long

variable_types: j int

variable_types: tmp int


umask

decompiled_code:
__int64 __fastcall umask(unsigned int a1)
{
return call_lowlib(35LL, a1);
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1)
{
return call_lowlib(35LL, a1);
}

original_code:
int
umask (int mask)
{
  return (call_lowlib (35, mask));
}

canonical_original_code:
int umask(int mask)
{
  return (call_lowlib (35, mask));
}

variable_types: mask int


decompiled_code:
__int64 __fastcall psys_rewind(__int64 *a1)
{
__int64 v2; // [rsp+0h] [rbp-C8h] BYREF
__int64 v3; // [rsp+18h] [rbp-B0h]
unsigned int v4; // [rsp+20h] [rbp-A8h]
char v5[32]; // [rsp+40h] [rbp-88h] BYREF
__int64 v6; // [rsp+60h] [rbp-68h]

v6 = *a1;
if ( (unsigned int)make_connection(76LL, v5, &v2) || !v3 )
return v4;
MEMORY[0x7FFF0028] = v3;
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 *a1)
{
__int64 v2; // [rsp+0h] [rbp-C8h] BYREF
__int64 v3; // [rsp+18h] [rbp-B0h]
unsigned int v4; // [rsp+20h] [rbp-A8h]
char v5[32]; // [rsp+40h] [rbp-88h] BYREF
__int64 v6; // [rsp+60h] [rbp-68h]

v6 = *a1;
if ( (unsigned int)make_connection(76LL, v5, &v2) || !v3 )
return v4;
MEMORY[0x7FFF0028] = v3;
return 0xFFFFFFFFLL;
}

original_code:
int
psys_rewind (void *argp)
{
  struct a
    {
    } *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

canonical_original_code:
int psys_rewind(void *argp)
{
  struct a *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

variable_types:
argp
void *

variable_types:
args
struct a {  } *


decompiled_code:
__int64 __fastcall psys_dup2(__int64 *a1)
{
__int64 v2; // [rsp+0h] [rbp-C8h] BYREF
__int64 v3; // [rsp+18h] [rbp-B0h]
unsigned int v4; // [rsp+20h] [rbp-A8h]
char v5[32]; // [rsp+40h] [rbp-88h] BYREF
__int64 v6; // [rsp+60h] [rbp-68h]
__int64 v7; // [rsp+68h] [rbp-60h]

v6 = *a1;
v7 = a1[1];
if ( (unsigned int)make_connection(67LL, v5, &v2) || !v3 )
return v4;
MEMORY[0x7FFF0028] = v3;
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 *a1)
{
__int64 v2; // [rsp+0h] [rbp-C8h] BYREF
__int64 v3; // [rsp+18h] [rbp-B0h]
unsigned int v4; // [rsp+20h] [rbp-A8h]
char v5[32]; // [rsp+40h] [rbp-88h] BYREF
__int64 v6; // [rsp+60h] [rbp-68h]
__int64 v7; // [rsp+68h] [rbp-60h]

v6 = *a1;
v7 = a1[1];
if ( (unsigned int)make_connection(67LL, v5, &v2) || !v3 )
return v4;
MEMORY[0x7FFF0028] = v3;
return 0xFFFFFFFFLL;
}

original_code:
int
psys_dup2 (void *argp)
{
  struct a
    {
    } *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

canonical_original_code:
int psys_dup2(void *argp)
{
  struct a *args = (struct a *)argp;
  errno = 26;
  return ((0));
}


decompiled_code:
void psys__exit()
{
errno = 26;
}

canonical_decompiled_code:
void func0()
{
errno = 26;
}

original_code:
void
psys__exit (void *argp)
{
  struct a
    {
      int exit_code;
    } *args = (struct a *)argp;
  errno = 26;
}

canonical_original_code:
void psys__exit(void *argp)
{
  struct a *args = (struct a *)argp;
  errno = 26;
}

variable_types:
args
struct a { int exit_code; } *


decompiled_code:
__int64 psys_sigaddset()
{
errno = 26;
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
errno = 26;
return 0LL;
}

original_code:
int
psys_sigaddset (void *argp)
{
  struct a
    {
    } *args = (struct a *)argp;
  errno = 26;
  return ((0));
}

canonical_original_code:
int psys_sigaddset(void *argp)
{
  struct a *args = (struct a *)argp;
  errno = 26;
  return ((0));
}


decompiled_code:
void init_vm()
{
page_dir = 12288LL;
page_entry = (void *)0x4000;
bzero((void *)0x3000, 0x1000uLL);
bzero(page_entry, 0x5000uLL);
init_dir_ent(page_dir, 0x4000uLL, 1LL);
init_dir_ent(page_dir + 2048, 0x6000uLL, 3LL);
init_page_ent((__int64)page_entry, 0LL, 2048LL, 0LL, 0);
init_page_ent((__int64)page_entry + 0x2000, 0LL, 2048LL, 0x80000000LL, 0);
}

canonical_decompiled_code:
void func2()
{
page_dir = 12288LL;
page_entry = (void *)0x4000;
bzero((void *)0x3000, 0x1000uLL);
bzero(page_entry, 0x5000uLL);
func0(page_dir, 0x4000uLL, 1LL);
func0(page_dir + 2048, 0x6000uLL, 3LL);
func1((__int64)page_entry, 0LL, 2048LL, 0LL, 0);
func1((__int64)page_entry + 0x2000, 0LL, 2048LL, 0x80000000LL, 0);
}

original_code:
void
init_vm (void)
{
  page_dir = (struct page_directory_entry *)0x3000;
  page_entry = (struct page_table_entry *)0x4000;
  bzero ((char *)page_dir, 1024 * sizeof (struct page_directory_entry));
  bzero ((char *)page_entry, (1024 * 5) * sizeof (struct page_table_entry));
  init_dir_ent (page_dir, 0x4000, 1);
  init_dir_ent (&page_dir[512], 0x4000 + 4096 * 2, 3);
  init_page_ent (page_entry, 0x0, 1024 * 2, 0, 0);
  init_page_ent (&page_entry[2048], 0x0, 1024 * 2, 0x80000000, 0);
}

canonical_original_code:
void init_vm()
{
  page_dir = (struct page_directory_entry *)0x3000;
  page_entry = (struct page_table_entry *)0x4000;
  bzero ((char *)page_dir, 1024 * sizeof (struct page_directory_entry));
  bzero ((char *)page_entry, (1024 * 5) * sizeof (struct page_table_entry));
  init_dir_ent (page_dir, 0x4000, 1);
  init_dir_ent (&page_dir[512], 0x4000 + 4096 * 2, 3);
  init_page_ent (page_entry, 0x0, 1024 * 2, 0, 0);
  init_page_ent (&page_entry[2048], 0x0, 1024 * 2, 0x80000000, 0);
}

user_defined_types: struct page_directory_entry { unsigned int present; unsigned int read_write; unsigned int u_and_s; unsigned int zero2; unsigned int access; unsigned int dirty; unsigned int zero1; unsigned int user; unsigned int frame_addr; }

user_defined_types: struct page_table_entry { unsigned int present; unsigned int read_write; unsigned int u_and_s; unsigned int zero2; unsigned int access; unsigned int dirty; unsigned int zero1; unsigned int user; unsigned int frame_addr; }


decompiled_code:
__int64 __fastcall get_page_entry(unsigned __int64 a1)
{
return ((a1 >> 10) & 0xFFC) + (int)(*(_DWORD *)(page_dir + 4LL * ((unsigned int)a1 >> 22)) & 0xFFFFF000);
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned __int64 a1)
{
return ((a1 >> 10) & 0xFFC) + (int)(*(_DWORD *)(page_dir + 4LL * ((unsigned int)a1 >> 22)) & 0xFFFFF000);
}

original_code:
struct page_table_entry *
get_page_entry (ULONG addr)
{
  int dir_entry;
  int page_entry;
  struct page_table_entry *pent;
  dir_entry = (addr >> 22) & 0x3ff;
  page_entry = (addr >> 12) & 0x3ff;
  pent = (struct page_table_entry *)(page_dir[dir_entry].frame_addr << 12);
  return ((struct page_table_entry *)&pent[page_entry]);
}

canonical_original_code:
struct page_table_entry *get_page_entry(unsigned long addr)
{
  int dir_entry;
  int page_entry;
  struct page_table_entry *pent;
  dir_entry = (addr >> 22) & 0x3ff;
  page_entry = (addr >> 12) & 0x3ff;
  pent = (struct page_table_entry *)(page_dir[dir_entry].frame_addr << 12);
  return ((struct page_table_entry *)&pent[page_entry]);
}

variable_types:
addr
unsigned long

variable_types: struct page_table_entry { unsigned int present; unsigned int read_write; unsigned int u_and_s; unsigned int zero2; unsigned int access; unsigned int dirty; unsigned int zero1; unsigned int user; unsigned int frame_addr; } *