decompiled_code:
__int64 __fastcall plindown_stampalive(_BYTE *a1)
{
__int64 result; // rax
__int64 v2; // rbx
int v3; // ebp
time_t timer; // [rsp+0h] [rbp-20h] BYREF

if ( !a1 )
return 0LL;
result = 0LL;
if ( *a1 )
{
time(&timer);
v2 = route_open(a1, "alive time stamp", 0LL, 1LL);
result = 0LL;
if ( v2 )
{
v3 = route_printf(v2, "%d ", timer);
route_close(v2);
result = 0LL;
if ( v3 > 0 )
result = (unsigned int)timer;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(_BYTE *a1)
{
__int64 result; // rax
__int64 v2; // rbx
int v3; // ebp
time_t timer; // [rsp+0h] [rbp-20h] BYREF

if ( !a1 )
return 0LL;
result = 0LL;
if ( *a1 )
{
time(&timer);
v2 = route_open(a1, "alive time stamp", 0LL, 1LL);
result = 0LL;
if ( v2 )
{
v3 = route_printf(v2, "%d ", timer);
route_close(v2);
result = 0LL;
if ( v3 > 0 )
result = (unsigned int)timer;
}
}
return result;
}

original_code:
int plindown_stampalive(char *alive_purl)
{
     time_t alive;
     int r;
     ROUTE output;
     if (alive_purl == ((void *)0) || *alive_purl == '\0')
   return 0;
     time(&alive);
     output = route_open(alive_purl, "alive time stamp", ((void *)0), 1);
     if (output == ((void *)0))
   return 0;
     r = route_printf(output, "%d ", alive);
     route_close(output);
     if (r <= 0)
   return 0;
     return alive;
}

canonical_original_code:
int plindown_stampalive(char *alive_purl)
{
     long alive;
     int r;
     struct route_handle *output;
     if (alive_purl == ((void *)0) || *alive_purl == '\0')
   return 0;
     time(&alive);
     output = route_open(alive_purl, "alive time stamp", ((void *)0), 1);
     if (output == ((void *)0))
   return 0;
     r = route_printf(output, "%d ", alive);
     route_close(output);
     if (r <= 0)
   return 0;
     return alive;
}

variable_types: alive long

variable_types: r int

variable_types: struct route_handle { char *p_url; struct route_lowlevel { int (*ll_magic)(); char *(*ll_prefix)(); char *(*ll_description)(); void (*ll_init)(struct tree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *cf, int debug); void (*ll_fini)(); int (*ll_access)(char *p_url, char *password, char *basename, int flag); void *(*ll_open)(char *p_url, char *comment, char *password, int keep, char *basename); void (*ll_close)(void *lld); int (*ll_write)(void *lld, void *buf, int buflen); int (*ll_twrite)(void *lld, struct table_info { int ncols; int nrows; int minrowkey; int maxrowkey; struct tree_head *data; struct itree_head { struct rb_node *root; struct rb_node *node; } *colorder; struct tree_head *info; struct tree_head *infolookup; struct itree_head *tobegarbage; int refcount; struct itree_head *roworder; char separator; } *tab); int (*ll_tell)(void *lld, int *seq, int *size, long *modt); struct itree_head *(*ll_read)(void *lld, int seq, int offset); struct table_info *(*ll_tread)(void *lld, int seq, int offset); void (*ll_status)(void *lld, char **status, char **info); int (*ll_checkpoint)(void *lld); } *method; void *handle; struct route_buffer { int buflen; char *buffer; } unsent; } *

user_defined_types: struct route_handle { char *p_url; struct route_lowlevel *method; void *handle; struct route_buffer unsent; }

user_defined_types: struct route_lowlevel { int (*ll_magic)(); char *(*ll_prefix)(); char *(*ll_description)(); void (*ll_init)(struct tree_head *cf, int debug); void (*ll_fini)(); int (*ll_access)(char *p_url, char *password, char *basename, int flag); void *(*ll_open)(char *p_url, char *comment, char *password, int keep, char *basename); void (*ll_close)(void *lld); int (*ll_write)(void *lld, void *buf, int buflen); int (*ll_twrite)(void *lld, struct table_info *tab); int (*ll_tell)(void *lld, int *seq, int *size, long *modt); struct itree_head *(*ll_read)(void *lld, int seq, int offset); struct table_info *(*ll_tread)(void *lld, int seq, int offset); void (*ll_status)(void *lld, char **status, char **info); int (*ll_checkpoint)(void *lld); }


repo: SystemGarden/habitat

decompiled_code:
__int64 __fastcall plindown_getutmpuptime(_QWORD *a1, _QWORD *a2, const char *a3)
{
int v5; // eax
unsigned int v6; // ebx
char *v7; // rax
char *v8; // rdi
__off_t v9; // rsi
char *v10; // rax
char *v11; // rdx
struct stat v13; // [rsp+0h] [rbp-A8h] BYREF

*a2 = 0LL;
*a1 = 0LL;
v5 = open(a3, 0);
v6 = v5;
if ( v5 )
{
fstat(v5, &v13);
v7 = (char *)mmap(0LL, v13.st_size, 1, 1, v6, 0LL);
v8 = v7;
if ( v7 == (char *)-1LL )
{
elog_fprintf(4LL, "probe/plindown.c", 241LL, "plindown_getutmpuptime", "unable to map file %s, no downtime", a3);
close(v6);
v6 = 0;
}
else
{
v9 = v13.st_size;
v10 = &v7[v13.st_size];
v11 = v8;
if ( v8 < v10 )
{
while ( *(_WORD *)v11 != 2 )
{
v11 += 384;
if ( v11 >= v10 )
goto LABEL_10;
}
*a2 = *((int *)v11 + 85);
}
LABEL_10:
munmap(v8, v9);
close(v6);
v6 = 1;
}
}
else
{
elog_fprintf(4LL, "probe/plindown.c", 234LL, "plindown_getutmpuptime", "unable to open file %s, no downtime", a3);
}
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func6(_QWORD *a1, _QWORD *a2, const char *a3)
{
int v5; // eax
unsigned int v6; // ebx
char *v7; // rax
char *v8; // rdi
__off_t v9; // rsi
char *v10; // rax
char *v11; // rdx
struct stat v13; // [rsp+0h] [rbp-A8h] BYREF

*a2 = 0LL;
*a1 = 0LL;
v5 = open(a3, 0);
v6 = v5;
if ( v5 )
{
fstat(v5, &v13);
v7 = (char *)mmap(0LL, v13.st_size, 1, 1, v6, 0LL);
v8 = v7;
if ( v7 == (char *)-1LL )
{
elog_fprintf(4LL, "probe/plindown.c", 241LL, "plindown_getutmpuptime", "unable to map file %s, no downtime", a3);
close(v6);
v6 = 0;
}
else
{
v9 = v13.st_size;
v10 = &v7[v13.st_size];
v11 = v8;
if ( v8 < v10 )
{
while ( *(_WORD *)v11 != 2 )
{
v11 += 384;
if ( v11 >= v10 )
goto LABEL_10;
}
*a2 = *((int *)v11 + 85);
}
LABEL_10:
munmap(v8, v9);
close(v6);
v6 = 1;
}
}
else
{
elog_fprintf(4LL, "probe/plindown.c", 234LL, "plindown_getutmpuptime", "unable to open file %s, no downtime", a3);
}
return v6;
}

original_code:
int plindown_getutmpuptime(time_t *down, time_t *boot, char *filename)
{
     struct stat utmp_stat;
     struct utmp *ut;
     int fd;
     void *map;
     *down = *boot = 0;
     fd = open(filename, 00);
     if (fd == 0) {
   elog_fprintf(WARNING,"probe/plindown.c",234,__PRETTY_FUNCTION__,"unable to open file %s, no downtime", filename);
   return 0;
     }
     fstat(fd, &utmp_stat);
     map = mmap(0, utmp_stat.st_size, 0x1, 0x01, fd, 0);
     if (map == ((void *) -1)) {
   elog_fprintf(WARNING,"probe/plindown.c",241,__PRETTY_FUNCTION__,"unable to map file %s, no downtime", filename);
   close(fd);
   return 0;
     }
     for (ut = map; (char *)ut < ((char *)map) + utmp_stat.st_size; ut++) {
   if (ut->ut_type == 2) {
        *boot = ut->ut_tv.tv_sec;
        break;
   }
     }
     munmap(map, utmp_stat.st_size);
     close(fd);
     return 1;
}

canonical_original_code:
int plindown_getutmpuptime(long *down, long *boot, char *filename)
{
     struct stat utmp_stat;
     struct utmp *ut;
     int fd;
     void *map;
     *down = *boot = 0;
     fd = open(filename, 00);
     if (fd == 0) {
   elog_fprintf(WARNING,"probe/plindown.c",234,__PRETTY_FUNCTION__,"unable to open file %s, no downtime", filename);
   return 0;
     }
     fstat(fd, &utmp_stat);
     map = mmap(0, utmp_stat.st_size, 0x1, 0x01, fd, 0);
     if (map == ((void *) -1)) {
   elog_fprintf(WARNING,"probe/plindown.c",241,__PRETTY_FUNCTION__,"unable to map file %s, no downtime", filename);
   close(fd);
   return 0;
     }
     for (ut = map; (char *)ut < ((char *)map) + utmp_stat.st_size; ut++) {
   if (ut->ut_type == 2) {
        *boot = ut->ut_tv.tv_sec;
        break;
   }
     }
     munmap(map, utmp_stat.st_size);
     close(fd);
     return 1;
}

variable_types:
down
long *

variable_types:
boot
long *

variable_types:
filename
char *

variable_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }

variable_types: struct utmp { short ut_type; int ut_pid; char ut_line[32]; char ut_id[4]; char ut_user[32]; char ut_host[256]; struct exit_status { short e_termination; short e_exit; } ut_exit; int ut_session; struct { int tv_sec; int tv_usec; } ut_tv; int ut_addr_v6[4]; char __glibc_reserved[20]; } *

variable_types: fd int

variable_types:
map
void *

return_type: int

user_defined_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }

user_defined_types: struct utmp { short ut_type; int ut_pid; char ut_line[32]; char ut_id[4]; char ut_user[32]; char ut_host[256]; struct exit_status ut_exit; int ut_session; struct { int tv_sec; int tv_usec; } ut_tv; int ut_addr_v6[4]; char __glibc_reserved[20]; }


decompiled_code:
__int64 __fastcall plindown_stampboot(_BYTE *a1)
{
__int64 result; // rax
__int64 v2; // rbx
int v3; // ebp
__int64 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5[4]; // [rsp+8h] [rbp-20h] BYREF

if ( !a1 )
return 0LL;
result = 0LL;
if ( *a1 )
{
result = plindown_getutmpuptime(v5, &v4, "/var/run/utmp");
if ( (_DWORD)result )
{
v2 = route_open(a1, "boot time stamp", 0LL, 1LL);
result = 0LL;
if ( v2 )
{
v3 = route_printf(v2, "%d ", v4);
route_close(v2);
result = 0LL;
if ( v3 > 0 )
result = (unsigned int)v4;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(_BYTE *a1)
{
__int64 result; // rax
__int64 v2; // rbx
int v3; // ebp
__int64 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5[4]; // [rsp+8h] [rbp-20h] BYREF

if ( !a1 )
return 0LL;
result = 0LL;
if ( *a1 )
{
result = func6(v5, &v4, "/var/run/utmp");
if ( (_DWORD)result )
{
v2 = route_open(a1, "boot time stamp", 0LL, 1LL);
result = 0LL;
if ( v2 )
{
v3 = route_printf(v2, "%d ", v4);
route_close(v2);
result = 0LL;
if ( v3 > 0 )
result = (unsigned int)v4;
}
}
}
return result;
}

original_code:
int plindown_stampboot(char *boot_purl)
{
     time_t down, boot;
     int r;
     ROUTE output;
     if (boot_purl == ((void *)0) || *boot_purl == '\0')
   return 0;
     if (plindown_getutmpuptime(&down, &boot, "/var/run/utmp")) {
   output = route_open(boot_purl, "boot time stamp", ((void *)0), 1);
   if (output == ((void *)0))
        return 0;
   r = route_printf(output, "%d ", boot);
   route_close(output);
   if (r <= 0)
        return 0;
     } else {
   return 0;
     }
     return boot;
}

canonical_original_code:
int plindown_stampboot(char *boot_purl)
{
     long down; long boot;
     int r;
     struct route_handle *output;
     if (boot_purl == ((void *)0) || *boot_purl == '\0')
   return 0;
     if (plindown_getutmpuptime(&down, &boot, "/var/run/utmp")) {
   output = route_open(boot_purl, "boot time stamp", ((void *)0), 1);
   if (output == ((void *)0))
        return 0;
   r = route_printf(output, "%d ", boot);
   route_close(output);
   if (r <= 0)
        return 0;
     } else {
   return 0;
     }
     return boot;
}

variable_types: down long

variable_types: boot long

user_defined_types: struct route_buffer { int buflen; char *buffer; }

user_defined_types: struct tree_head { struct rb_node *root; struct rb_node *node; }

user_defined_types: struct table_info { int ncols; int nrows; int minrowkey; int maxrowkey; struct tree_head *data; struct itree_head *colorder; struct tree_head *info; struct tree_head *infolookup; struct itree_head *tobegarbage; int refcount; struct itree_head *roworder; char separator; }

user_defined_types: struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; }

user_defined_types: struct itree_head { struct rb_node *root; struct rb_node *node; }

user_defined_types: struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; }


decompiled_code:
__int64 __fastcall plindown_collect(__int64 a1)
{
const char *v1; // rax
const char *v2; // rbx
int v3; // er12
const char *v4; // rax
const char *v5; // r13
int v6; // er14
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
unsigned int v12; // er12
__int64 v13; // rax
char v14[60]; // [rsp+Ch] [rbp-3Ch] BYREF

if ( !plindown_purl_boot || !plindown_purl_alive )
return elog_fprintf(
5LL,
"probe/plindown.c",
98LL,
"plindown_collect",
"probe was not initialised properly with p-urls for boot and alive\nusage: %s",
plindown_usage);
v1 = (const char *)route_read(plindown_purl_boot, 0LL, v14);
v2 = v1;
if ( v1 )
{
v3 = strtol(v1, 0LL, 10);
}
else
{
v8 = plindown_stampboot(plindown_purl_boot);
v3 = v8;
elog_fprintf(
2LL,
"probe/plindown.c",
109LL,
"plindown_collect",
"No 'boot' timestamp at %s: stamping now boot=%d",
plindown_purl_boot,
v8);
}
v4 = (const char *)route_read(plindown_purl_alive, 0LL, v14);
v5 = v4;
if ( v4 )
{
v6 = strtol(v4, 0LL, 10);
}
else
{
v9 = plindown_stampalive((_BYTE *)plindown_purl_alive);
v6 = v9;
elog_fprintf(
2LL,
"probe/plindown.c",
121LL,
"plindown_collect",
"No 'last alive' timestamp at %s: stamping now alive=%d",
(const char *)plindown_purl_alive,
v9);
}
if ( v3 > v6 )
{
table_addemptyrow(a1);
v10 = util_i32toa(v6);
table_replacecurrentcell_alloc(a1, "lastup", v10);
v11 = util_i32toa(v3);
table_replacecurrentcell_alloc(a1, "boot", v11);
v12 = v3 - v6;
v13 = util_i32toa((int)v12);
table_replacecurrentcell_alloc(a1, "downtime", v13);
elog_fprintf(
2LL,
"probe/plindown.c",
138LL,
"plindown_collect",
"New boot detected: stamping boot and alive now, down %d secs",
v12);
plindown_stampboot(plindown_purl_boot);
plindown_stampalive((_BYTE *)plindown_purl_alive);
}
if ( v2 )
nm_nfree(v2, "probe/plindown.c", 146LL, "plindown_collect");
return nm_nfree(v5, "probe/plindown.c", 147LL, "plindown_collect");
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
const char *v1; // rax
const char *v2; // rbx
int v3; // er12
const char *v4; // rax
const char *v5; // r13
int v6; // er14
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
unsigned int v12; // er12
__int64 v13; // rax
char v14[60]; // [rsp+Ch] [rbp-3Ch] BYREF

if ( !plindown_purl_boot || !plindown_purl_alive )
return elog_fprintf(
5LL,
"probe/plindown.c",
98LL,
"plindown_collect",
"probe was not initialised properly with p-urls for boot and alive\nusage: %s",
plindown_usage);
v1 = (const char *)route_read(plindown_purl_boot, 0LL, v14);
v2 = v1;
if ( v1 )
{
v3 = strtol(v1, 0LL, 10);
}
else
{
v8 = func7(plindown_purl_boot);
v3 = v8;
elog_fprintf(
2LL,
"probe/plindown.c",
109LL,
"plindown_collect",
"No 'boot' timestamp at %s: stamping now boot=%d",
plindown_purl_boot,
v8);
}
v4 = (const char *)route_read(plindown_purl_alive, 0LL, v14);
v5 = v4;
if ( v4 )
{
v6 = strtol(v4, 0LL, 10);
}
else
{
v9 = func5((_BYTE *)plindown_purl_alive);
v6 = v9;
elog_fprintf(
2LL,
"probe/plindown.c",
121LL,
"plindown_collect",
"No 'last alive' timestamp at %s: stamping now alive=%d",
(const char *)plindown_purl_alive,
v9);
}
if ( v3 > v6 )
{
table_addemptyrow(a1);
v10 = util_i32toa(v6);
table_replacecurrentcell_alloc(a1, "lastup", v10);
v11 = util_i32toa(v3);
table_replacecurrentcell_alloc(a1, "boot", v11);
v12 = v3 - v6;
v13 = util_i32toa((int)v12);
table_replacecurrentcell_alloc(a1, "downtime", v13);
elog_fprintf(
2LL,
"probe/plindown.c",
138LL,
"plindown_collect",
"New boot detected: stamping boot and alive now, down %d secs",
v12);
func7(plindown_purl_boot);
func5((_BYTE *)plindown_purl_alive);
}
if ( v2 )
nm_nfree(v2, "probe/plindown.c", 146LL, "plindown_collect");
return nm_nfree(v5, "probe/plindown.c", 147LL, "plindown_collect");
}

original_code:
void plindown_collect(TABLE tab) {
     char *bootstr, *alivestr;
     int len, boot, alive;
     if (plindown_purl_boot == ((void *)0) || plindown_purl_alive == ((void *)0)) {
   elog_fprintf(ERROR,"probe/plindown.c",98,__PRETTY_FUNCTION__,"probe was not initialised properly with " "p-urls for boot and alive\nusage: %s", plindown_usage);
   return;
     }
     bootstr = route_read(plindown_purl_boot, ((void *)0), &len);
     if (bootstr == ((void *)0)) {
   boot = plindown_stampboot(plindown_purl_boot);
   elog_fprintf(DIAG,"probe/plindown.c",109,__PRETTY_FUNCTION__,"No 'boot' timestamp at %s: " "stamping now boot=%d", plindown_purl_boot, boot);
     } else {
          boot = strtol(bootstr, ((void *)0), 10);
     }
     alivestr = route_read(plindown_purl_alive, ((void *)0), &len);
     if (alivestr == ((void *)0)) {
   alive = plindown_stampalive(plindown_purl_alive);
   elog_fprintf(DIAG,"probe/plindown.c",121,__PRETTY_FUNCTION__,"No 'last alive' timestamp at %s: " "stamping now alive=%d", plindown_purl_alive, alive);
     } else {
          alive = strtol(alivestr, ((void *)0), 10);
     }
     if (boot > alive) {
   table_addemptyrow(tab);
   table_replacecurrentcell_alloc(tab, "lastup", util_i32toa(alive));
   table_replacecurrentcell_alloc(tab, "boot", util_i32toa(boot));
   table_replacecurrentcell_alloc(tab, "downtime",
      util_i32toa(boot-alive));
   elog_fprintf(DIAG,"probe/plindown.c",138,__PRETTY_FUNCTION__,"New boot detected: stamping boot and " "alive now, down %d secs", boot-alive);
   plindown_stampboot (plindown_purl_boot);
   plindown_stampalive(plindown_purl_alive);
     }
     if (bootstr)
   nm_nfree(bootstr,"probe/plindown.c",146,__PRETTY_FUNCTION__);
     nm_nfree(alivestr,"probe/plindown.c",147,__PRETTY_FUNCTION__);
}

canonical_original_code:
void plindown_collect(struct table_info *tab) {
     char *bootstr; char *alivestr;
     int len; int boot; int alive;
     if (plindown_purl_boot == ((void *)0) || plindown_purl_alive == ((void *)0)) {
   elog_fprintf(ERROR,"probe/plindown.c",98,__PRETTY_FUNCTION__,"probe was not initialised properly with " "p-urls for boot and alive\nusage: %s", plindown_usage);
   return;
     }
     bootstr = route_read(plindown_purl_boot, ((void *)0), &len);
     if (bootstr == ((void *)0)) {
   boot = plindown_stampboot(plindown_purl_boot);
   elog_fprintf(DIAG,"probe/plindown.c",109,__PRETTY_FUNCTION__,"No 'boot' timestamp at %s: " "stamping now boot=%d", plindown_purl_boot, boot);
     } else {
          boot = strtol(bootstr, ((void *)0), 10);
     }
     alivestr = route_read(plindown_purl_alive, ((void *)0), &len);
     if (alivestr == ((void *)0)) {
   alive = plindown_stampalive(plindown_purl_alive);
   elog_fprintf(DIAG,"probe/plindown.c",121,__PRETTY_FUNCTION__,"No 'last alive' timestamp at %s: " "stamping now alive=%d", plindown_purl_alive, alive);
     } else {
          alive = strtol(alivestr, ((void *)0), 10);
     }
     if (boot > alive) {
   table_addemptyrow(tab);
   table_replacecurrentcell_alloc(tab, "lastup", util_i32toa(alive));
   table_replacecurrentcell_alloc(tab, "boot", util_i32toa(boot));
   table_replacecurrentcell_alloc(tab, "downtime",
      util_i32toa(boot-alive));
   elog_fprintf(DIAG,"probe/plindown.c",138,__PRETTY_FUNCTION__,"New boot detected: stamping boot and " "alive now, down %d secs", boot-alive);
   plindown_stampboot (plindown_purl_boot);
   plindown_stampalive(plindown_purl_alive);
     }
     if (bootstr)
   nm_nfree(bootstr,"probe/plindown.c",146,__PRETTY_FUNCTION__);
     nm_nfree(alivestr,"probe/plindown.c",147,__PRETTY_FUNCTION__);
}

variable_types: struct table_info { int ncols; int nrows; int minrowkey; int maxrowkey; struct tree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *data; struct itree_head { struct rb_node *root; struct rb_node *node; } *colorder; struct tree_head *info; struct tree_head *infolookup; struct itree_head *tobegarbage; int refcount; struct itree_head *roworder; char separator; } *

variable_types:
bootstr
char *

variable_types:
alivestr
char *

variable_types: len int

variable_types: boot int

variable_types: alive int

return_type: void


decompiled_code:
void plindown_derive()
{
;
}

canonical_decompiled_code:
void func9()
{
;
}

original_code: void plindown_derive(TABLE prev, TABLE cur) {}

canonical_original_code: void plindown_derive(struct table_info *prev, struct table_info *cur) {}

variable_types:
cur
struct table_info *


decompiled_code:
__int64 rt_local_magic()
{
return 672049LL;
}

original_code: int rt_local_magic() { return 672049; }

canonical_original_code: int rt_local_magic() { return 672049; }


decompiled_code:
const char *rt_local_prefix()
{
return "local";
}

canonical_decompiled_code:
const char *func1()
{
return "local";
}

original_code: char * rt_local_prefix() { return "local"; }

return_type: char *


decompiled_code:
const char *rt_local_description()
{
return "Local host data from clockwork";
}

canonical_decompiled_code:
const char *func2()
{
return "Local host data from clockwork";
}

original_code: char * rt_local_description() { return "Local host data from clockwork"; }


decompiled_code:
__int64 rt_localmeta_magic()
{
return 676051LL;
}

original_code: int rt_localmeta_magic() { return 676051; }


decompiled_code:
const char *rt_localmeta_prefix()
{
return "localmeta";
}

canonical_decompiled_code:
const char *func4()
{
return "localmeta";
}

original_code: char * rt_localmeta_prefix() { return "localmeta"; }


decompiled_code:
const char *rt_localmeta_description()
{
return "Meta information from local clockwork instance";
}

canonical_decompiled_code:
const char *func5()
{
return "Meta information from local clockwork instance";
}

original_code: char * rt_localmeta_description() { return "Meta information from local clockwork instance"; }


decompiled_code:
void rt_local_init()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

original_code: void rt_local_init (CF_VALS cf, int debug) {}

canonical_original_code: void rt_local_init(struct tree_head *cf, int debug) {}

variable_types: struct tree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *

variable_types: debug int


decompiled_code:
void rt_local_fini()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code: void rt_local_fini () {}

canonical_original_code: void rt_local_fini() {}


decompiled_code:
__int64 __fastcall rt_local_tell(__int64 a1, _DWORD *a2, _DWORD *a3, _QWORD *a4)
{
*a2 = 0;
*a3 = 0;
*a4 = 0LL;
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, _DWORD *a2, _DWORD *a3, _QWORD *a4)
{
*a2 = 0;
*a3 = 0;
*a4 = 0LL;
return 1LL;
}

original_code:
int rt_local_tell (RT_LLD lld, int *seq, int *size, time_t *modt)
{
     *seq = 0;
     *size = 0;
     *modt = 0;
     return 1;
}

canonical_original_code:
int rt_local_tell(void *lld, int *seq, int *size, long *modt)
{
     *seq = 0;
     *size = 0;
     *modt = 0;
     return 1;
}

variable_types:
lld
void *

variable_types:
seq
int *

variable_types:
size
int *

variable_types:
modt
long *


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

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

original_code:
int rt_local_checkpoint (RT_LLD lld)
{
     return 1;
}

canonical_original_code:
int rt_local_checkpoint(void *lld)
{
     return 1;
}


decompiled_code:
__int64 __fastcall rt_local_access(__int64 a1, __int64 a2, __int64 a3, unsigned int a4)
{
__int64 v6; // rbx
unsigned int v7; // ebp

v6 = util_strjoin("http://localhost:", "8096", "/localtsv/", a1, 0LL);
v7 = rt_http_access(v6, a2, a3, a4);
nm_nfree(v6, "iiab/rt_local.c", 71LL, "rt_local_access");
return v7;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1, __int64 a2, __int64 a3, unsigned int a4)
{
__int64 v6; // rbx
unsigned int v7; // ebp

v6 = util_strjoin("http://localhost:", "8096", "/localtsv/", a1, 0LL);
v7 = rt_http_access(v6, a2, a3, a4);
nm_nfree(v6, "iiab/rt_local.c", 71LL, "rt_local_access");
return v7;
}

original_code:
int rt_local_access(char *p_url, char *password, char *basename, int flag)
{
     char *local;
     int r;
     local = util_strjoin("http://localhost:", "8096",
     "/localtsv/", p_url, ((void *)0));
     r = rt_http_access(local, password, basename, flag);
     nm_nfree(local,"iiab/rt_local.c",71,__PRETTY_FUNCTION__);
     return r;
}

variable_types:
password
char *

variable_types:
basename
char *

variable_types: flag int

variable_types:
local
char *

variable_types: r int


decompiled_code:
__int64 __fastcall rt_local_from_lld(__int64 a1)
{
const char *v2; // rbp
const char *v3; // rax

if ( !a1 )
elog_fdie(6LL, "iiab/rt_local.c", 249LL, "rt_local_from_lld", "passed NULL low level descriptor");
if ( *(_DWORD *)a1 != 672049 && *(_DWORD *)a1 != 676051 )
{
v2 = rt_local_description();
v3 = rt_local_prefix();
elog_fdie(
6LL,
"iiab/rt_local.c",
253LL,
"rt_local_from_lld",
"magic type mismatch: we were given %s (%s) but can handle only %s (%s)",
*(const char **)(a1 + 8),
*(const char **)(a1 + 16),
v3,
v2);
}
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1)
{
const char *v2; // rbp
const char *v3; // rax

if ( !a1 )
elog_fdie(6LL, "iiab/rt_local.c", 249LL, "rt_local_from_lld", "passed NULL low level descriptor");
if ( *(_DWORD *)a1 != 672049 && *(_DWORD *)a1 != 676051 )
{
v2 = func2();
v3 = func1();
elog_fdie(
6LL,
"iiab/rt_local.c",
253LL,
"rt_local_from_lld",
"magic type mismatch: we were given %s (%s) but can handle only %s (%s)",
*(const char **)(a1 + 8),
*(const char **)(a1 + 16),
v3,
v2);
}
return a1;
}

original_code:
RT_LOCALD rt_local_from_lld(RT_LLD lld )
{
     if (!lld)
   elog_fdie(FATAL,"iiab/rt_local.c",249,__PRETTY_FUNCTION__,"passed NULL low level descriptor");
     if ( (((RT_LOCALD)lld)->magic != 672049) &&
   (((RT_LOCALD)lld)->magic != 676051) )
   elog_fdie(FATAL,"iiab/rt_local.c",253,__PRETTY_FUNCTION__,"magic type mismatch: we were given " "%s (%s) but can handle only %s (%s)", ((RT_LOCALD)lld)->prefix, ((RT_LOCALD)lld)->description, rt_local_prefix(), rt_local_description());
     return (RT_LOCALD) lld;
}

canonical_original_code:
struct rt_local_desc *rt_local_from_lld(void *lld)
{
     if (!lld)
   elog_fdie(FATAL,"iiab/rt_local.c",249,__PRETTY_FUNCTION__,"passed NULL low level descriptor");
     if ( (((struct rt_local_desc *)lld)->magic != 672049) &&
   (((struct rt_local_desc *)lld)->magic != 676051) )
   elog_fdie(FATAL,"iiab/rt_local.c",253,__PRETTY_FUNCTION__,"magic type mismatch: we were given " "%s (%s) but can handle only %s (%s)", ((struct rt_local_desc *)lld)->prefix, ((struct rt_local_desc *)lld)->description, rt_local_prefix(), rt_local_description());
     return (struct rt_local_desc *) lld;
}

return_type: struct rt_local_desc { int magic; char *prefix; char *description; char *url; char *basepurl; struct rt_http_desc { int magic; char *prefix; char *description; char *url; } *hrt; } *

user_defined_types: struct rt_local_desc { int magic; char *prefix; char *description; char *url; char *basepurl; struct rt_http_desc *hrt; }


decompiled_code:
__int64 __fastcall rt_local_close(__int64 a1)
{
__int64 v1; // rbx

v1 = rt_local_from_lld(a1);
rt_http_close(*(_QWORD *)(v1 + 40));
*(_DWORD *)v1 = 0;
nm_nfree(*(_QWORD *)(v1 + 32), "iiab/rt_local.c", 144LL, "rt_local_close");
return nm_nfree(v1, "iiab/rt_local.c", 145LL, "rt_local_close");
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1)
{
__int64 v1; // rbx

v1 = func14(a1);
rt_http_close(*(_QWORD *)(v1 + 40));
*(_DWORD *)v1 = 0;
nm_nfree(*(_QWORD *)(v1 + 32), "iiab/rt_local.c", 144LL, "rt_local_close");
return nm_nfree(v1, "iiab/rt_local.c", 145LL, "rt_local_close");
}

original_code:
void rt_local_close (RT_LLD lld)
{
     RT_LOCALD rt;
     rt = rt_local_from_lld(lld);
     rt_http_close(rt->hrt);
     rt->magic = 0;
     nm_nfree(rt->basepurl,"iiab/rt_local.c",144,__PRETTY_FUNCTION__);
     nm_nfree(rt,"iiab/rt_local.c",145,__PRETTY_FUNCTION__);
}

canonical_original_code:
void rt_local_close(void *lld)
{
     struct rt_local_desc *rt;
     rt = rt_local_from_lld(lld);
     rt_http_close(rt->hrt);
     rt->magic = 0;
     nm_nfree(rt->basepurl,"iiab/rt_local.c",144,__PRETTY_FUNCTION__);
     nm_nfree(rt,"iiab/rt_local.c",145,__PRETTY_FUNCTION__);
}

variable_types: struct rt_local_desc { int magic; char *prefix; char *description; char *url; char *basepurl; struct rt_http_desc { int magic; char *prefix; char *description; char *url; } *hrt; } *


decompiled_code:
__int64 __fastcall rt_local_write(__int64 a1, __int64 a2, unsigned int a3)
{
__int64 v4; // rax

v4 = rt_local_from_lld(a1);
return rt_http_write(*(_QWORD *)(v4 + 40), a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1, __int64 a2, unsigned int a3)
{
__int64 v4; // rax

v4 = func14(a1);
return rt_http_write(*(_QWORD *)(v4 + 40), a2, a3);
}

original_code:
int rt_local_write (RT_LLD lld, const void *buf, int buflen)
{
     RT_LOCALD rt;
     int r;
     rt = rt_local_from_lld(lld);
     r = rt_http_write(rt->hrt, buf, buflen);
     return r;
}

canonical_original_code:
int rt_local_write(void *lld, void *buf, int buflen)
{
     struct rt_local_desc *rt;
     int r;
     rt = rt_local_from_lld(lld);
     r = rt_http_write(rt->hrt, buf, buflen);
     return r;
}

variable_types:
buf
void *

variable_types: buflen int

user_defined_types: struct rt_http_desc { int magic; char *prefix; char *description; char *url; }


decompiled_code:
__int64 __fastcall rt_local_twrite(__int64 a1, __int64 a2)
{
__int64 v2; // rax

v2 = rt_local_from_lld(a1);
return rt_http_twrite(*(_QWORD *)(v2 + 40), a2);
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1, __int64 a2)
{
__int64 v2; // rax

v2 = func14(a1);
return rt_http_twrite(*(_QWORD *)(v2 + 40), a2);
}

original_code:
int rt_local_twrite (RT_LLD lld, TABLE tab)
{
     RT_LOCALD rt;
     int r;
     rt = rt_local_from_lld(lld);
     r = rt_http_twrite(rt->hrt, tab);
     return r;
}

canonical_original_code:
int rt_local_twrite(void *lld, struct table_info *tab)
{
     struct rt_local_desc *rt;
     int r;
     rt = rt_local_from_lld(lld);
     r = rt_http_twrite(rt->hrt, tab);
     return r;
}

variable_types: struct table_info { int ncols; int nrows; int minrowkey; int maxrowkey; struct tree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *data; struct itree_head { struct rb_node *root; struct rb_node *node; } *colorder; struct tree_head *info; struct tree_head *infolookup; struct itree_head *tobegarbage; int refcount; struct itree_head *roworder; char separator; } *


decompiled_code:
__int64 __fastcall rt_local_read(__int64 a1, unsigned int a2, unsigned int a3)
{
__int64 v4; // rax

v4 = rt_local_from_lld(a1);
return rt_http_read(*(_QWORD *)(v4 + 40), a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func18(__int64 a1, unsigned int a2, unsigned int a3)
{
__int64 v4; // rax

v4 = func14(a1);
return rt_http_read(*(_QWORD *)(v4 + 40), a2, a3);
}

original_code:
ITREE *rt_local_read (RT_LLD lld, int seq, int offset)
{
     RT_LOCALD rt;
     ITREE *it;
     rt = rt_local_from_lld(lld);
     it = rt_http_read(rt->hrt, seq, offset);
     return it;
}

canonical_original_code:
struct itree_head *rt_local_read(void *lld, int seq, int offset)
{
     struct rt_local_desc *rt;
     struct itree_head *it;
     rt = rt_local_from_lld(lld);
     it = rt_http_read(rt->hrt, seq, offset);
     return it;
}

variable_types: seq int

variable_types: offset int

variable_types: struct itree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *


decompiled_code:
__int64 __fastcall rt_local_tread(__int64 a1, unsigned int a2, unsigned int a3)
{
__int64 v4; // rax

v4 = rt_local_from_lld(a1);
return rt_http_tread(*(_QWORD *)(v4 + 40), a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func19(__int64 a1, unsigned int a2, unsigned int a3)
{
__int64 v4; // rax

v4 = func14(a1);
return rt_http_tread(*(_QWORD *)(v4 + 40), a2, a3);
}

original_code:
TABLE rt_local_tread (RT_LLD lld, int seq, int offset)
{
     RT_LOCALD rt;
     rt = rt_local_from_lld(lld);
     return rt_http_tread(rt->hrt, seq, offset);
}

canonical_original_code:
struct table_info *rt_local_tread(void *lld, int seq, int offset)
{
     struct rt_local_desc *rt;
     rt = rt_local_from_lld(lld);
     return rt_http_tread(rt->hrt, seq, offset);
}

return_type: struct table_info { int ncols; int nrows; int minrowkey; int maxrowkey; struct tree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *data; struct itree_head { struct rb_node *root; struct rb_node *node; } *colorder; struct tree_head *info; struct tree_head *infolookup; struct itree_head *tobegarbage; int refcount; struct itree_head *roworder; char separator; } *


decompiled_code:
void __fastcall tree_really_destroy(void *ptr, __int64 a2, unsigned int a3, __int64 a4)
{
if ( !ptr )
{
fwrite("(tree_destroy) t == NULL\n", 1uLL, 0x19uLL, stderr);
abort();
}
rb_free_tree(*(_QWORD *)ptr);
if ( nm_active )
nm_rm(13LL, ptr, a2, a3, a4);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func0(void *ptr, __int64 a2, unsigned int a3, __int64 a4)
{
if ( !ptr )
{
fwrite("(tree_destroy) t == NULL\n", 1uLL, 0x19uLL, stderr);
abort();
}
rb_free_tree(*(_QWORD *)ptr);
if ( nm_active )
nm_rm(13LL, ptr, a2, a3, a4);
free(ptr);
}

original_code:
void tree_really_destroy(TREE *t, char *rfile, int rline, const char *rfunc) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_destroy) t == NULL\n");
  abort();
 }
 rb_free_tree(t->root);
 if (nm_active)
      nm_rm(NM_TREE, t, rfile, rline, rfunc);
 free(t);
}

canonical_original_code:
void tree_really_destroy(struct tree_head *t, char *rfile, int rline, char *rfunc) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_destroy) t == NULL\n");
  abort();
 }
 rb_free_tree(t->root);
 if (nm_active)
      nm_rm(NM_TREE, t, rfile, rline, rfunc);
 free(t);
}

variable_types: struct tree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *

variable_types:
rfile
char *

variable_types: rline int

variable_types:
rfunc
char *


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

if ( !a1 )
{
fwrite("(tree_add) t == NULL\n", 1uLL, 0x15uLL, stderr);
abort();
}
result = rb_insert(*a1);
a1[1] = result;
return result;
}

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

if ( !a1 )
{
fwrite("(tree_add) t == NULL\n", 1uLL, 0x15uLL, stderr);
abort();
}
result = rb_insert(*a1);
a1[1] = result;
return result;
}

original_code:
void tree_add(TREE *t,
       char *key,
       void *datum ) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_add) t == NULL\n");
  abort();
 }
 t->node = rb_insert(t->root, key, datum);
}

canonical_original_code:
void tree_add(struct tree_head *t, char *key, void *datum) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_add) t == NULL\n");
  abort();
 }
 t->node = rb_insert(t->root, key, datum);
}

variable_types:
key
char *

variable_types:
datum
void *


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

if ( !a1 )
{
fwrite("(tree_rm) t == NULL\n", 1uLL, 0x14uLL, stderr);
abort();
}
v1 = *(_QWORD **)(a1 + 8);
*(_QWORD *)(a1 + 8) = *v1;
return rb_delete_node(v1);
}

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

if ( !a1 )
{
fwrite("(tree_rm) t == NULL\n", 1uLL, 0x14uLL, stderr);
abort();
}
v1 = *(_QWORD **)(a1 + 8);
*(_QWORD *)(a1 + 8) = *v1;
return rb_delete_node(v1);
}

original_code:
void tree_rm(TREE *t) {
 Rb_node wasteme;
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_rm) t == NULL\n");
  abort();
 }
 wasteme = t->node;
 t->node = (t->node->c.list.flink);
 rb_delete_node(wasteme);
}

canonical_original_code:
void tree_rm(struct tree_head *t) {
 struct rb_node *wasteme;
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_rm) t == NULL\n");
  abort();
 }
 wasteme = t->node;
 t->node = (t->node->c.list.flink);
 rb_delete_node(wasteme);
}

variable_types: struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *


decompiled_code:
__int64 __fastcall tree_get(__int64 a1)
{
if ( !a1 )
{
fwrite("(tree_get) t == NULL\n", 1uLL, 0x15uLL, stderr);
abort();
}
return rb_val(*(_QWORD *)(a1 + 8));
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
if ( !a1 )
{
fwrite("(tree_get) t == NULL\n", 1uLL, 0x15uLL, stderr);
abort();
}
return rb_val(*(_QWORD *)(a1 + 8));
}

original_code:
void *tree_get(TREE *t) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_get) t == NULL\n");
  abort();
 }
 return rb_val(t->node);
}

canonical_original_code:
void *tree_get(struct tree_head *t) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_get) t == NULL\n");
  abort();
 }
 return rb_val(t->node);
}

return_type: void *


decompiled_code:
__int64 __fastcall tree_getkey(__int64 a1)
{
if ( !a1 )
{
fwrite("(tree_getkey) t == NULL\n", 1uLL, 0x18uLL, stderr);
abort();
}
return *(_QWORD *)(*(_QWORD *)(a1 + 8) + 32LL);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
if ( !a1 )
{
fwrite("(tree_getkey) t == NULL\n", 1uLL, 0x18uLL, stderr);
abort();
}
return *(_QWORD *)(*(_QWORD *)(a1 + 8) + 32LL);
}

original_code:
char *tree_getkey(TREE *t) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_getkey) t == NULL\n");
  abort();
 }
 return t->node->k.key;
}

canonical_original_code:
char *tree_getkey(struct tree_head *t) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_getkey) t == NULL\n");
  abort();
 }
 return t->node->k.key;
}


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

if ( !a1 )
{
fwrite("(tree_put) t == NULL\n", 1uLL, 0x15uLL, stderr);
abort();
}
result = rb_val(*(_QWORD *)(a1 + 8));
*(_QWORD *)(*(_QWORD *)(a1 + 8) + 40LL) = a2;
return result;
}

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

if ( !a1 )
{
fwrite("(tree_put) t == NULL\n", 1uLL, 0x15uLL, stderr);
abort();
}
result = rb_val(*(_QWORD *)(a1 + 8));
*(_QWORD *)(*(_QWORD *)(a1 + 8) + 40LL) = a2;
return result;
}

original_code:
void *tree_put(TREE *t, void *dat) {
 void *old;
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_put) t == NULL\n");
  abort();
 }
 old = rb_val(t->node);
 t->node->v.val = dat;
 return old;
}

canonical_original_code:
void *tree_put(struct tree_head *t, void *dat) {
 void *old;
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_put) t == NULL\n");
  abort();
 }
 old = rb_val(t->node);
 t->node->v.val = dat;
 return old;
}

variable_types:
dat
void *

variable_types:
old
void *


decompiled_code:
__int64 __fastcall tree_find(_QWORD *a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rdx
int v5[3]; // [rsp+Ch] [rbp-Ch] BYREF

if ( !a1 )
{
fwrite("(tree_find) t == NULL\n", 1uLL, 0x16uLL, stderr);
abort();
}
v2 = rb_find_key_n(*a1, a2, v5);
v3 = -1LL;
if ( v5[0] )
{
a1[1] = v2;
v3 = rb_val(v2);
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func6(_QWORD *a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rdx
int v5[3]; // [rsp+Ch] [rbp-Ch] BYREF

if ( !a1 )
{
fwrite("(tree_find) t == NULL\n", 1uLL, 0x16uLL, stderr);
abort();
}
v2 = rb_find_key_n(*a1, a2, v5);
v3 = -1LL;
if ( v5[0] )
{
a1[1] = v2;
v3 = rb_val(v2);
}
return v3;
}

original_code:
void *tree_find(TREE *t, char *key) {
 int found;
 Rb_node n;
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_find) t == NULL\n");
  abort();
 }
 n = rb_find_key_n(t->root, key, &found);
 if (found) {
  t->node = n;
  return rb_val(n);
 }
 else
  return (void *) -1;
}

canonical_original_code:
void *tree_find(struct tree_head *t, char *key) {
 int found;
 struct rb_node *n;
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_find) t == NULL\n");
  abort();
 }
 n = rb_find_key_n(t->root, key, &found);
 if (found) {
  t->node = n;
  return rb_val(n);
 }
 else
  return (void *) -1;
}

variable_types: found int


decompiled_code:
__int64 __fastcall tree_search(__int64 a1, const void *a2, int a3)
{
_QWORD *v3; // rcx
_QWORD *v4; // rax
size_t v5; // rbp
const void *v6; // rax
__int64 v7; // rax

v3 = *(_QWORD **)a1;
v4 = **(_QWORD ***)a1;
*(_QWORD *)(a1 + 8) = v4;
if ( v3 == v4 )
return 0LL;
v5 = a3;
while ( 1 )
{
v6 = (const void *)tree_get(a1);
if ( !memcmp(a2, v6, v5) )
break;
v7 = **(_QWORD **)(a1 + 8);
*(_QWORD *)(a1 + 8) = v7;
if ( v7 == *(_QWORD *)a1 )
return 0LL;
}
return tree_getkey(a1);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, const void *a2, int a3)
{
_QWORD *v3; // rcx
_QWORD *v4; // rax
size_t v5; // rbp
const void *v6; // rax
__int64 v7; // rax

v3 = *(_QWORD **)a1;
v4 = **(_QWORD ***)a1;
*(_QWORD *)(a1 + 8) = v4;
if ( v3 == v4 )
return 0LL;
v5 = a3;
while ( 1 )
{
v6 = (const void *)func3(a1);
if ( !memcmp(a2, v6, v5) )
break;
v7 = **(_QWORD **)(a1 + 8);
*(_QWORD *)(a1 + 8) = v7;
if ( v7 == *(_QWORD *)a1 )
return 0LL;
}
return func4(a1);
}

original_code:
char *tree_search(TREE *haystack, void *needle, int needlelen) {
     for((haystack)->node = ((haystack)->root->c.list.flink); (haystack)->node != ((haystack)->root); (haystack)->node = ((haystack)->node->c.list.flink)) {
   if (memcmp(needle, tree_get(haystack), needlelen) == 0)
        return tree_getkey(haystack);
     }
     return ((void *)0);
}

canonical_original_code:
char *tree_search(struct tree_head *haystack, void *needle, int needlelen) {
     for((haystack)->node = ((haystack)->root->c.list.flink); (haystack)->node != ((haystack)->root); (haystack)->node = ((haystack)->node->c.list.flink)) {
   if (memcmp(needle, tree_get(haystack), needlelen) == 0)
        return tree_getkey(haystack);
     }
     return ((void *)0);
}

variable_types:
needle
void *

variable_types: needlelen int


decompiled_code:
__int64 __fastcall tree_n(__int64 a1)
{
_QWORD **v1; // rcx
_QWORD *v2; // rax
unsigned int v3; // edx

if ( !a1 )
{
fwrite("(tree_n) t == NULL\n", 1uLL, 0x13uLL, stderr);
abort();
}
v1 = *(_QWORD ***)a1;
v2 = **(_QWORD ***)a1;
*(_QWORD *)(a1 + 8) = v2;
if ( v1 == v2 )
return 0;
v3 = 0;
do
{
++v3;
v2 = (_QWORD *)*v2;
*(_QWORD *)(a1 + 8) = v2;
}
while ( v1 != v2 );
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
_QWORD **v1; // rcx
_QWORD *v2; // rax
unsigned int v3; // edx

if ( !a1 )
{
fwrite("(tree_n) t == NULL\n", 1uLL, 0x13uLL, stderr);
abort();
}
v1 = *(_QWORD ***)a1;
v2 = **(_QWORD ***)a1;
*(_QWORD *)(a1 + 8) = v2;
if ( v1 == v2 )
return 0;
v3 = 0;
do
{
++v3;
v2 = (_QWORD *)*v2;
*(_QWORD *)(a1 + 8) = v2;
}
while ( v1 != v2 );
return v3;
}

original_code:
int tree_n(TREE *t) {
 int n=0;
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_n) t == NULL\n");
  abort();
 }
 for((t)->node = ((t)->root->c.list.flink); (t)->node != ((t)->root); (t)->node = ((t)->node->c.list.flink))
  n++;
 return n;
}

canonical_original_code:
int tree_n(struct tree_head *t) {
 int n = 0;
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_n) t == NULL\n");
  abort();
 }
 for((t)->node = ((t)->root->c.list.flink); (t)->node != ((t)->root); (t)->node = ((t)->node->c.list.flink))
  n++;
 return n;
}

variable_types: n int


decompiled_code:
__int64 __fastcall tree_present(_QWORD *a1, __int64 a2)
{
unsigned int v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

if ( !a1 )
{
fwrite("(tree_present) t == NULL\n", 1uLL, 0x19uLL, stderr);
exit(-1);
}
rb_find_key_n(*a1, a2, v3);
return v3[0];
}

canonical_decompiled_code:
__int64 __fastcall func9(_QWORD *a1, __int64 a2)
{
unsigned int v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

if ( !a1 )
{
fwrite("(tree_present) t == NULL\n", 1uLL, 0x19uLL, stderr);
exit(-1);
}
rb_find_key_n(*a1, a2, v3);
return v3[0];
}

original_code:
int tree_present(TREE *t, char *key) {
 int found;
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_present) t == NULL\n");
  exit(-1);
 }
 rb_find_key_n(t->root, key, &found);
 return found;
}

canonical_original_code:
int tree_present(struct tree_head *t, char *key) {
 int found;
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_present) t == NULL\n");
  exit(-1);
 }
 rb_find_key_n(t->root, key, &found);
 return found;
}


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

if ( a1 )
result = nm_nfree(a1, "iiab/tree.c", 272LL, "tree_infreemem");
return result;
}

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

if ( a1 )
result = nm_nfree(a1, "iiab/tree.c", 272LL, "tree_infreemem");
return result;
}

original_code:
void tree_infreemem(void *memtofree) {
     if (memtofree)
          nm_nfree(memtofree,"iiab/tree.c",272,__PRETTY_FUNCTION__);
}

variable_types:
memtofree
void *


decompiled_code:
__int64 __fastcall tree_adduniqandfree(_QWORD *a1, __int64 a2, __int64 a3)
{
__int64 v4; // rax

if ( !a1 )
{
fwrite("(tree_adduniqueandfree) t == NULL\n", 1uLL, 0x22uLL, stderr);
exit(-1);
}
if ( tree_find(a1, a2) == -1 )
return tree_add(a1);
tree_infreemem(a2);
v4 = tree_get((__int64)a1);
tree_infreemem(v4);
return tree_put((__int64)a1, a3);
}

canonical_decompiled_code:
__int64 __fastcall func11(_QWORD *a1, __int64 a2, __int64 a3)
{
__int64 v4; // rax

if ( !a1 )
{
fwrite("(tree_adduniqueandfree) t == NULL\n", 1uLL, 0x22uLL, stderr);
exit(-1);
}
if ( func6(a1, a2) == -1 )
return func1(a1);
func10(a2);
v4 = func3((__int64)a1);
func10(v4);
return func5((__int64)a1, a3);
}

original_code:
void tree_adduniqandfree(TREE *t, char *key, void *data) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_adduniqueandfree) t == NULL\n");
  exit(-1);
 }
 if (tree_find(t, key) == (void *) -1) {
      tree_add(t, key, data);
 } else {
      tree_infreemem(key);
      tree_infreemem( tree_get(t) );
      tree_put(t, data);
 }
}

canonical_original_code:
void tree_adduniqandfree(struct tree_head *t, char *key, void *data) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(tree_adduniqueandfree) t == NULL\n");
  exit(-1);
 }
 if (tree_find(t, key) == (void *) -1) {
      tree_add(t, key, data);
 } else {
      tree_infreemem(key);
      tree_infreemem( tree_get(t) );
      tree_put(t, data);
 }
}

variable_types:
data
void *


decompiled_code:
char **plinnet_getcols()
{
return &plinnet_cols;
}

canonical_decompiled_code:
char **func0()
{
return &plinnet_cols;
}

original_code: struct probe_sampletab *plinnet_getcols() {return plinnet_cols;}

return_type: struct probe_sampletab { char *name; char *rname; char *type; char *sense; char *max; char *key; char *info; } *


decompiled_code:
void *plinnet_getrowdiff()
{
return &plinnet_diffs;
}

canonical_decompiled_code:
void *func1()
{
return &plinnet_diffs;
}

original_code: struct probe_rowdiff *plinnet_getrowdiff() {return plinnet_diffs;}

return_type: struct probe_rowdiff { char *source; char *result; } *


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

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

original_code: char **plinnet_getpub() {return ((void *)0);}

return_type: char **


decompiled_code:
__int64 plinnet_init()
{
const char *v0; // rax
const char *v1; // rbx
char *v2; // rax
const void *v3; // rax
__int64 result; // rax

v0 = (const char *)probe_readfile("/proc/version");
if ( !v0 )
return elog_fprintf(5LL, "probe/plinnet.c", 66LL, "plinnet_init", "unable to find the linux kernel version file");
v1 = v0;
v2 = strstr(v0, "version ");
if ( v2 )
{
v3 = v2 + 8;
if ( !memcmp(v3, "2.1.", 4uLL) || !memcmp(v3, "2.2.", 4uLL) )
{
plinnet_linuxversion = 22;
}
else if ( !memcmp(v3, "2.3.", 4uLL) || !memcmp(v3, "2.4.", 4uLL) )
{
plinnet_linuxversion = 24;
}
else if ( !memcmp(v3, "2.5.", 4uLL) || !memcmp(v3, "2.6.", 4uLL) )
{
plinnet_linuxversion = 26;
}
else if ( !memcmp(v3, "3.", 2uLL) )
{
plinnet_linuxversion = 30;
}
else
{
elog_fprintf(5LL, "probe/plinnet.c", 86LL, "plinnet_init", "unsupported linux kernel version");
}
result = nm_nfree(v1, "probe/plinnet.c", 89LL, "plinnet_init");
}
else
{
elog_fprintf(5LL, "probe/plinnet.c", 72LL, "plinnet_init", "unable to find the linux kernel version");
result = nm_nfree(v1, "probe/plinnet.c", 73LL, "plinnet_init");
}
return result;
}

canonical_decompiled_code:
__int64 func3()
{
const char *v0; // rax
const char *v1; // rbx
char *v2; // rax
const void *v3; // rax
__int64 result; // rax

v0 = (const char *)probe_readfile("/proc/version");
if ( !v0 )
return elog_fprintf(5LL, "probe/plinnet.c", 66LL, "plinnet_init", "unable to find the linux kernel version file");
v1 = v0;
v2 = strstr(v0, "version ");
if ( v2 )
{
v3 = v2 + 8;
if ( !memcmp(v3, "2.1.", 4uLL) || !memcmp(v3, "2.2.", 4uLL) )
{
plinnet_linuxversion = 22;
}
else if ( !memcmp(v3, "2.3.", 4uLL) || !memcmp(v3, "2.4.", 4uLL) )
{
plinnet_linuxversion = 24;
}
else if ( !memcmp(v3, "2.5.", 4uLL) || !memcmp(v3, "2.6.", 4uLL) )
{
plinnet_linuxversion = 26;
}
else if ( !memcmp(v3, "3.", 2uLL) )
{
plinnet_linuxversion = 30;
}
else
{
elog_fprintf(5LL, "probe/plinnet.c", 86LL, "plinnet_init", "unsupported linux kernel version");
}
result = nm_nfree(v1, "probe/plinnet.c", 89LL, "plinnet_init");
}
else
{
elog_fprintf(5LL, "probe/plinnet.c", 72LL, "plinnet_init", "unable to find the linux kernel version");
result = nm_nfree(v1, "probe/plinnet.c", 73LL, "plinnet_init");
}
return result;
}

original_code:
void plinnet_init() {
     char *data, *vpt;
     data = probe_readfile("/proc/version");
     if (!data) {
          elog_fprintf(ERROR,"probe/plinnet.c",66,__PRETTY_FUNCTION__,"unable to find the linux kernel " "version file");
   return;
     }
     vpt = strstr(data, "version ");
     if (!vpt) {
          elog_fprintf(ERROR,"probe/plinnet.c",72,__PRETTY_FUNCTION__,"unable to find the linux kernel version");
   nm_nfree(data,"probe/plinnet.c",73,__PRETTY_FUNCTION__);
   return;
     }
     vpt += 8;
     if (strncmp(vpt, "2.1.", 4) == 0 || strncmp(vpt, "2.2.", 4) == 0) {
          plinnet_linuxversion=22;
     } else if (strncmp(vpt, "2.3.", 4) == 0 || strncmp(vpt, "2.4.", 4) == 0) {
          plinnet_linuxversion=24;
     } else if (strncmp(vpt, "2.5.", 4) == 0 || strncmp(vpt, "2.6.", 4) == 0) {
          plinnet_linuxversion=26;
     } else if (strncmp(vpt, "3.", 2) == 0) {
          plinnet_linuxversion=30;
     } else {
          elog_fprintf(ERROR,"probe/plinnet.c",86,__PRETTY_FUNCTION__,"unsupported linux kernel version");
     }
     nm_nfree(data,"probe/plinnet.c",89,__PRETTY_FUNCTION__);
     return;
}

canonical_original_code:
void plinnet_init() {
     char *data; char *vpt;
     data = probe_readfile("/proc/version");
     if (!data) {
          elog_fprintf(ERROR,"probe/plinnet.c",66,__PRETTY_FUNCTION__,"unable to find the linux kernel " "version file");
   return;
     }
     vpt = strstr(data, "version ");
     if (!vpt) {
          elog_fprintf(ERROR,"probe/plinnet.c",72,__PRETTY_FUNCTION__,"unable to find the linux kernel version");
   nm_nfree(data,"probe/plinnet.c",73,__PRETTY_FUNCTION__);
   return;
     }
     vpt += 8;
     if (strncmp(vpt, "2.1.", 4) == 0 || strncmp(vpt, "2.2.", 4) == 0) {
          plinnet_linuxversion=22;
     } else if (strncmp(vpt, "2.3.", 4) == 0 || strncmp(vpt, "2.4.", 4) == 0) {
          plinnet_linuxversion=24;
     } else if (strncmp(vpt, "2.5.", 4) == 0 || strncmp(vpt, "2.6.", 4) == 0) {
          plinnet_linuxversion=26;
     } else if (strncmp(vpt, "3.", 2) == 0) {
          plinnet_linuxversion=30;
     } else {
          elog_fprintf(ERROR,"probe/plinnet.c",86,__PRETTY_FUNCTION__,"unsupported linux kernel version");
     }
     nm_nfree(data,"probe/plinnet.c",89,__PRETTY_FUNCTION__);
     return;
}

variable_types:
data
char *

variable_types:
vpt
char *


decompiled_code:
__int64 __fastcall plinnet_col_netdev(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rax
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rax
__int64 v18; // rax
__int64 v19; // rax

if ( (plinnet_linuxversion & 0xFFFFFFF7) == 22 || (result = plinnet_linuxversion & 0xFFFFFFFD, (_DWORD)result == 24) )
{
itree_first(a2);
v3 = itree_get(a2);
table_replacecurrentcell(a1, "device", v3);
itree_next(a2);
v4 = itree_get(a2);
table_replacecurrentcell(a1, "rx_bytes", v4);
itree_next(a2);
v5 = itree_get(a2);
table_replacecurrentcell(a1, "rx_pkts", v5);
itree_next(a2);
v6 = itree_get(a2);
table_replacecurrentcell(a1, "rx_errs", v6);
itree_next(a2);
v7 = itree_get(a2);
table_replacecurrentcell(a1, "rx_drop", v7);
itree_next(a2);
v8 = itree_get(a2);
table_replacecurrentcell(a1, "rx_fifo", v8);
itree_next(a2);
v9 = itree_get(a2);
table_replacecurrentcell(a1, "rx_frame", v9);
itree_next(a2);
v10 = itree_get(a2);
table_replacecurrentcell(a1, "rx_comp", v10);
itree_next(a2);
v11 = itree_get(a2);
table_replacecurrentcell(a1, "rx_mcast", v11);
itree_next(a2);
v12 = itree_get(a2);
table_replacecurrentcell(a1, "tx_bytes", v12);
itree_next(a2);
v13 = itree_get(a2);
table_replacecurrentcell(a1, "tx_pkts", v13);
itree_next(a2);
v14 = itree_get(a2);
table_replacecurrentcell(a1, "tx_errs", v14);
itree_next(a2);
v15 = itree_get(a2);
table_replacecurrentcell(a1, "tx_drop", v15);
itree_next(a2);
v16 = itree_get(a2);
table_replacecurrentcell(a1, "tx_fifo", v16);
itree_next(a2);
v17 = itree_get(a2);
table_replacecurrentcell(a1, "tx_colls", v17);
itree_next(a2);
v18 = itree_get(a2);
table_replacecurrentcell(a1, "tx_carrier", v18);
itree_next(a2);
v19 = itree_get(a2);
result = table_replacecurrentcell(a1, "tx_comp", v19);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2)
{
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rax
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rax
__int64 v18; // rax
__int64 v19; // rax

if ( (plinnet_linuxversion & 0xFFFFFFF7) == 22 || (result = plinnet_linuxversion & 0xFFFFFFFD, (_DWORD)result == 24) )
{
itree_first(a2);
v3 = itree_get(a2);
table_replacecurrentcell(a1, "device", v3);
itree_next(a2);
v4 = itree_get(a2);
table_replacecurrentcell(a1, "rx_bytes", v4);
itree_next(a2);
v5 = itree_get(a2);
table_replacecurrentcell(a1, "rx_pkts", v5);
itree_next(a2);
v6 = itree_get(a2);
table_replacecurrentcell(a1, "rx_errs", v6);
itree_next(a2);
v7 = itree_get(a2);
table_replacecurrentcell(a1, "rx_drop", v7);
itree_next(a2);
v8 = itree_get(a2);
table_replacecurrentcell(a1, "rx_fifo", v8);
itree_next(a2);
v9 = itree_get(a2);
table_replacecurrentcell(a1, "rx_frame", v9);
itree_next(a2);
v10 = itree_get(a2);
table_replacecurrentcell(a1, "rx_comp", v10);
itree_next(a2);
v11 = itree_get(a2);
table_replacecurrentcell(a1, "rx_mcast", v11);
itree_next(a2);
v12 = itree_get(a2);
table_replacecurrentcell(a1, "tx_bytes", v12);
itree_next(a2);
v13 = itree_get(a2);
table_replacecurrentcell(a1, "tx_pkts", v13);
itree_next(a2);
v14 = itree_get(a2);
table_replacecurrentcell(a1, "tx_errs", v14);
itree_next(a2);
v15 = itree_get(a2);
table_replacecurrentcell(a1, "tx_drop", v15);
itree_next(a2);
v16 = itree_get(a2);
table_replacecurrentcell(a1, "tx_fifo", v16);
itree_next(a2);
v17 = itree_get(a2);
table_replacecurrentcell(a1, "tx_colls", v17);
itree_next(a2);
v18 = itree_get(a2);
table_replacecurrentcell(a1, "tx_carrier", v18);
itree_next(a2);
v19 = itree_get(a2);
result = table_replacecurrentcell(a1, "tx_comp", v19);
}
return result;
}

original_code:
void plinnet_col_netdev(TABLE tab, ITREE *idata) {
     if (plinnet_linuxversion == 24 || plinnet_linuxversion == 22 ||
  plinnet_linuxversion == 26 || plinnet_linuxversion == 30) {
   itree_first(idata);
   table_replacecurrentcell(tab, "device", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_bytes", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_pkts", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_errs", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_drop", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_fifo", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_frame", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_comp", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_mcast", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_bytes", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_pkts", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_errs", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_drop", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_fifo", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_colls", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_carrier", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_comp", itree_get(idata));
     }
}

canonical_original_code:
void plinnet_col_netdev(struct table_info *tab, struct itree_head *idata) {
     if (plinnet_linuxversion == 24 || plinnet_linuxversion == 22 ||
  plinnet_linuxversion == 26 || plinnet_linuxversion == 30) {
   itree_first(idata);
   table_replacecurrentcell(tab, "device", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_bytes", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_pkts", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_errs", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_drop", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_fifo", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_frame", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_comp", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "rx_mcast", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_bytes", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_pkts", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_errs", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_drop", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_fifo", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_colls", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_carrier", itree_get(idata));
   itree_next(idata);
   table_replacecurrentcell(tab, "tx_comp", itree_get(idata));
     }
}

variable_types: struct table_info { int ncols; int nrows; int minrowkey; int maxrowkey; struct tree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *data; struct itree_head { struct rb_node *root; struct rb_node *node; } *colorder; struct tree_head *info; struct tree_head *infolookup; struct itree_head *tobegarbage; int refcount; struct itree_head *roworder; char separator; } *

variable_types:
idata
struct itree_head *


decompiled_code:
__int64 __fastcall plinnet_collect(__int64 a1)
{
__int64 result; // rax
__int64 v2; // rbp
__int64 v3; // rsi
__int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

result = probe_readfile("/proc/net/dev");
if ( result )
{
v2 = result;
util_scantext(result, ": |", 1LL, v4);
itree_find(v4[0], 2LL);
while ( *(_QWORD *)v4[0] != *(_QWORD *)(v4[0] + 8) )
{
table_addemptyrow(a1);
v3 = itree_get(v4[0]);
plinnet_col_netdev(a1, v3);
itree_next(v4[0]);
}
util_scanfree();
result = table_freeondestroy(a1, v2);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
__int64 result; // rax
__int64 v2; // rbp
__int64 v3; // rsi
__int64 v4[4]; // [rsp+8h] [rbp-20h] BYREF

result = probe_readfile("/proc/net/dev");
if ( result )
{
v2 = result;
util_scantext(result, ": |", 1LL, v4);
itree_find(v4[0], 2LL);
while ( *(_QWORD *)v4[0] != *(_QWORD *)(v4[0] + 8) )
{
table_addemptyrow(a1);
v3 = itree_get(v4[0]);
func4(a1, v3);
itree_next(v4[0]);
}
util_scanfree();
result = table_freeondestroy(a1, v2);
}
return result;
}

original_code:
void plinnet_collect(TABLE tab) {
     char *data;
     ITREE *lines;
     data = probe_readfile("/proc/net/dev");
     if (data) {
       util_scantext(data, ": |", 1, &lines);
   itree_find(lines, 2);
   while(!((lines)->root==(lines)->node)) {
        table_addemptyrow(tab);
        plinnet_col_netdev(tab, itree_get(lines) );
        itree_next(lines);
   }
   util_scanfree(lines);
   table_freeondestroy(tab, data);
     }
}

canonical_original_code:
void plinnet_collect(struct table_info *tab) {
     char *data;
     struct itree_head *lines;
     data = probe_readfile("/proc/net/dev");
     if (data) {
       util_scantext(data, ": |", 1, &lines);
   itree_find(lines, 2);
   while(!((lines)->root==(lines)->node)) {
        table_addemptyrow(tab);
        plinnet_col_netdev(tab, itree_get(lines) );
        itree_next(lines);
   }
   util_scanfree(lines);
   table_freeondestroy(tab, data);
     }
}

variable_types: struct itree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *


decompiled_code:
void plinnet_derive()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

original_code: void plinnet_derive(TABLE prev, TABLE cur) {}

canonical_original_code: void plinnet_derive(struct table_info *prev, struct table_info *cur) {}

variable_types:
cur
struct table_info *


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

result = callback_events;
if ( !callback_events[0] )
{
result = (_QWORD *)tree_really_create("iiab/callback.c", 38LL, "callback_init");
callback_events[0] = result;
}
return result;
}

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

result = callback_events;
if ( !callback_events[0] )
{
result = (_QWORD *)tree_really_create("iiab/callback.c", 38LL, "callback_init");
callback_events[0] = result;
}
return result;
}

original_code:
void callback_init()
{
     if (callback_events)
   return;
     callback_events = tree_really_create("iiab/callback.c",38,__PRETTY_FUNCTION__);
}


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

result = callback_events;
if ( callback_events[0] )
{
tree_clearout(callback_events[0], &tree_infreemem, &ptree_destroy);
result = (_QWORD *)tree_really_destroy(callback_events[0], "iiab/callback.c", 52LL, "callback_fini");
}
return result;
}

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

result = callback_events;
if ( callback_events[0] )
{
tree_clearout(callback_events[0], &tree_infreemem, &ptree_destroy);
result = (_QWORD *)tree_really_destroy(callback_events[0], "iiab/callback.c", 52LL, "callback_fini");
}
return result;
}

original_code:
void callback_fini()
{
     if ( ! callback_events )
   return;
     tree_clearout(callback_events, tree_infreemem,
     (void (*)(void *)) ptree_destroy);
     tree_really_destroy(callback_events,"iiab/callback.c",52,__PRETTY_FUNCTION__);
}


decompiled_code:
__int64 __fastcall callback_mkevent(__int64 a1)
{
__int64 result; // rax
__int64 v2; // rbx
__int64 v3; // rax

result = tree_find(callback_events[0], a1);
if ( result == -1 )
{
v2 = nm_xnstrdup(a1, "iiab/callback.c", 68LL, "callback_mkevent");
v3 = ptree_create();
result = tree_add(callback_events[0], v2, v3);
}
return result;
}

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

result = tree_find(callback_events[0], a1);
if ( result == -1 )
{
v2 = nm_xnstrdup(a1, "iiab/callback.c", 68LL, "callback_mkevent");
v3 = ptree_create();
result = tree_add(callback_events[0], v2, v3);
}
return result;
}

original_code:
void callback_mkevent(char *e_name)
{
     char *name;
     PTREE *cbs;
     if (tree_find(callback_events, e_name) != (void *) -1)
   return;
     name = nm_xnstrdup(e_name,"iiab/callback.c",68,__PRETTY_FUNCTION__);
     cbs = ptree_create();
     tree_add(callback_events, name, cbs);
}

canonical_original_code:
void callback_mkevent(char *e_name)
{
     char *name;
     struct ptree_head *cbs;
     if (tree_find(callback_events, e_name) != (void *) -1)
   return;
     name = nm_xnstrdup(e_name,"iiab/callback.c",68,__PRETTY_FUNCTION__);
     cbs = ptree_create();
     tree_add(callback_events, name, cbs);
}

variable_types:
name
char *

variable_types: struct ptree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *

user_defined_types: struct ptree_head { struct rb_node *root; struct rb_node *node; }


decompiled_code:
__int64 __fastcall callback_rmevent(__int64 a1)
{
__int64 v1; // rdx
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rax

v1 = tree_find(callback_events[0], a1);
result = 0LL;
if ( v1 != -1 )
{
v3 = tree_getkey(callback_events[0]);
nm_nfree(v3, "iiab/callback.c", 86LL, "callback_rmevent");
v4 = tree_get(callback_events[0]);
ptree_destroy(v4);
tree_rm(callback_events[0]);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
__int64 v1; // rdx
__int64 result; // rax
__int64 v3; // rax
__int64 v4; // rax

v1 = tree_find(callback_events[0], a1);
result = 0LL;
if ( v1 != -1 )
{
v3 = tree_getkey(callback_events[0]);
nm_nfree(v3, "iiab/callback.c", 86LL, "callback_rmevent");
v4 = tree_get(callback_events[0]);
ptree_destroy(v4);
tree_rm(callback_events[0]);
result = 1LL;
}
return result;
}

original_code:
int callback_rmevent(char *e_name)
{
     if (tree_find(callback_events, e_name) == (void *) -1)
   return 0;
     nm_nfree(tree_getkey(callback_events),"iiab/callback.c",86,__PRETTY_FUNCTION__);
     ptree_destroy( (PTREE *) tree_get(callback_events) );
     tree_rm(callback_events);
     return 1;
}

canonical_original_code:
int callback_rmevent(char *e_name)
{
     if (tree_find(callback_events, e_name) == (void *) -1)
   return 0;
     nm_nfree(tree_getkey(callback_events),"iiab/callback.c",86,__PRETTY_FUNCTION__);
     ptree_destroy( (struct ptree_head *) tree_get(callback_events) );
     tree_rm(callback_events);
     return 1;
}


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

if ( tree_find(callback_events[0], a1) == -1 )
{
callback_mkevent(a1);
tree_find(callback_events[0], a1);
}
v2 = tree_get(callback_events[0]);
result = ptree_find(v2, a2);
if ( !result )
result = ptree_add(v2, a2, 0LL);
return result;
}

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

if ( tree_find(callback_events[0], a1) == -1 )
{
func2(a1);
tree_find(callback_events[0], a1);
}
v2 = tree_get(callback_events[0]);
result = ptree_find(v2, a2);
if ( !result )
result = ptree_add(v2, a2, 0LL);
return result;
}

original_code:
void callback_regcb(char *e_name, void(*cb)(void*,void*,void*,void*))
{
     PTREE *cbs;
     if (tree_find(callback_events, e_name) == (void *) -1) {
   callback_mkevent(e_name);
   tree_find(callback_events, e_name);
     }
     cbs = tree_get(callback_events);
     if (ptree_find(cbs, cb) == (void *) ((void *)0))
   ptree_add(cbs, cb, ((void *)0));
}

canonical_original_code:
void callback_regcb(char *e_name, void (*cb)(void *, void *, void *, void *))
{
     struct ptree_head *cbs;
     if (tree_find(callback_events, e_name) == (void *) -1) {
   callback_mkevent(e_name);
   tree_find(callback_events, e_name);
     }
     cbs = tree_get(callback_events);
     if (ptree_find(cbs, cb) == (void *) ((void *)0))
   ptree_add(cbs, cb, ((void *)0));
}

variable_types: void (*)(void *, void *, void *, void *)


decompiled_code:
__int64 __fastcall callback_unregcb(__int64 a1, __int64 a2)
{
__int64 v2; // rdx
__int64 result; // rax
__int64 v4; // rbp
__int64 v5; // rdx

v2 = tree_find(callback_events[0], a1);
result = 0LL;
if ( v2 != -1 )
{
v4 = tree_get(callback_events[0]);
v5 = ptree_find(v4, a2);
result = 0LL;
if ( v5 )
{
ptree_rm(v4);
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2)
{
__int64 v2; // rdx
__int64 result; // rax
__int64 v4; // rbp
__int64 v5; // rdx

v2 = tree_find(callback_events[0], a1);
result = 0LL;
if ( v2 != -1 )
{
v4 = tree_get(callback_events[0]);
v5 = ptree_find(v4, a2);
result = 0LL;
if ( v5 )
{
ptree_rm(v4);
result = 1LL;
}
}
return result;
}

original_code:
int callback_unregcb(char *e_name, void(*cb)(void*,void*,void*,void*))
{
     PTREE *cbs;
     if (tree_find(callback_events, e_name) == (void *) -1)
   return 0;
     cbs = tree_get(callback_events);
     if (ptree_find(cbs, cb) == (void *) ((void *)0))
   return 0;
     ptree_rm(cbs);
     return 1;
}

canonical_original_code:
int callback_unregcb(char *e_name, void (*cb)(void *, void *, void *, void *))
{
     struct ptree_head *cbs;
     if (tree_find(callback_events, e_name) == (void *) -1)
   return 0;
     cbs = tree_get(callback_events);
     if (ptree_find(cbs, cb) == (void *) ((void *)0))
   return 0;
     ptree_rm(cbs);
     return 1;
}


decompiled_code:
__int64 __fastcall callback_raise(const char *a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)
{
__int64 v6; // rbp
_QWORD *v7; // rdx
_QWORD *v8; // rax
unsigned int v9; // er12
void (__fastcall *v10)(__int64, __int64, __int64, __int64); // rbx
__int64 v11; // rax

if ( tree_find(callback_events[0], a1) == -1 )
{
elog_fprintf(1LL, "iiab/callback.c", 149LL, "callback_raise", "event %s not registered", a1);
v9 = 0;
}
else
{
v6 = tree_get(callback_events[0]);
v7 = *(_QWORD **)v6;
v8 = **(_QWORD ***)v6;
*(_QWORD *)(v6 + 8) = v8;
if ( v7 == v8 )
{
v9 = 0;
}
else
{
v9 = 0;
do
{
v10 = (void (__fastcall *)(__int64, __int64, __int64, __int64))ptree_getkey(v6);
elog_fprintf(1LL, "iiab/callback.c", 156LL, "callback_raise", "event %s raised -> calling %p", a1, v10);
v10(a2, a3, a4, a5);
++v9;
v11 = **(_QWORD **)(v6 + 8);
*(_QWORD *)(v6 + 8) = v11;
}
while ( v11 != *(_QWORD *)v6 );
}
}
return v9;
}

canonical_decompiled_code:
__int64 __fastcall func6(const char *a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5)
{
__int64 v6; // rbp
_QWORD *v7; // rdx
_QWORD *v8; // rax
unsigned int v9; // er12
void (__fastcall *v10)(__int64, __int64, __int64, __int64); // rbx
__int64 v11; // rax

if ( tree_find(callback_events[0], a1) == -1 )
{
elog_fprintf(1LL, "iiab/callback.c", 149LL, "callback_raise", "event %s not registered", a1);
v9 = 0;
}
else
{
v6 = tree_get(callback_events[0]);
v7 = *(_QWORD **)v6;
v8 = **(_QWORD ***)v6;
*(_QWORD *)(v6 + 8) = v8;
if ( v7 == v8 )
{
v9 = 0;
}
else
{
v9 = 0;
do
{
v10 = (void (__fastcall *)(__int64, __int64, __int64, __int64))ptree_getkey(v6);
elog_fprintf(1LL, "iiab/callback.c", 156LL, "callback_raise", "event %s raised -> calling %p", a1, v10);
v10(a2, a3, a4, a5);
++v9;
v11 = **(_QWORD **)(v6 + 8);
*(_QWORD *)(v6 + 8) = v11;
}
while ( v11 != *(_QWORD *)v6 );
}
}
return v9;
}

original_code:
int callback_raise(char *e_name, void *arg1, void *arg2, void *arg3,
      void *arg4)
{
     PTREE *cbs;
     void (*cb)(void*,void*,void*,void*) = 0;
     int n=0;
     if (tree_find(callback_events, e_name) == (void *) -1) {
   elog_fprintf(DEBUG,"iiab/callback.c",149,__PRETTY_FUNCTION__,"event %s not registered", e_name);
   return 0;
     }
     cbs = tree_get(callback_events);
     for((cbs)->node = ((cbs)->root->c.list.flink); (cbs)->node != ((cbs)->root); (cbs)->node = ((cbs)->node->c.list.flink)) {
   cb = ptree_getkey(cbs);
   elog_fprintf(DEBUG,"iiab/callback.c",156,__PRETTY_FUNCTION__,"event %s raised -> calling %p", e_name, cb);
   (*cb)(arg1, arg2, arg3, arg4);
   n++;
     }
     return n;
}

canonical_original_code:
int callback_raise(char *e_name, void *arg1, void *arg2, void *arg3, void *arg4)
{
     struct ptree_head *cbs;
     void (*cb)(void *, void *, void *, void *) = 0;
     int n = 0;
     if (tree_find(callback_events, e_name) == (void *) -1) {
   elog_fprintf(DEBUG,"iiab/callback.c",149,__PRETTY_FUNCTION__,"event %s not registered", e_name);
   return 0;
     }
     cbs = tree_get(callback_events);
     for((cbs)->node = ((cbs)->root->c.list.flink); (cbs)->node != ((cbs)->root); (cbs)->node = ((cbs)->node->c.list.flink)) {
   cb = ptree_getkey(cbs);
   elog_fprintf(DEBUG,"iiab/callback.c",156,__PRETTY_FUNCTION__,"event %s raised -> calling %p", e_name, cb);
   (*cb)(arg1, arg2, arg3, arg4);
   n++;
     }
     return n;
}


decompiled_code:
__int64 rt_none_magic()
{
return 887766LL;
}

original_code: int rt_none_magic() { return 887766; }

canonical_original_code: int rt_none_magic() { return 887766; }


decompiled_code:
const char *rt_none_prefix()
{
return "none";
}

canonical_decompiled_code:
const char *func1()
{
return "none";
}

original_code: char * rt_none_prefix() { return "none"; }


decompiled_code:
const char *rt_none_description()
{
return "null channel";
}

canonical_decompiled_code:
const char *func2()
{
return "null channel";
}

original_code: char * rt_none_description() { return "null channel"; }


decompiled_code:
void rt_none_init()
{
;
}

canonical_decompiled_code:
void func3()
{
;
}

original_code: void rt_none_init (CF_VALS cf, int debug) {}

canonical_original_code: void rt_none_init(struct tree_head *cf, int debug) {}

variable_types: struct tree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *

variable_types: debug int


decompiled_code:
void rt_none_fini()
{
;
}

canonical_decompiled_code:
void func4()
{
;
}

original_code: void rt_none_fini () {}

canonical_original_code: void rt_none_fini() {}


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

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

original_code:
int rt_none_access(char *p_url, char *password, char *basename, int flag)
                     {return 1;}

variable_types:
password
char *

variable_types:
basename
char *

variable_types: flag int


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

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

original_code:
RT_LLD rt_none_open (char *p_url, char *comment, char *password, int keep,
       char *basename) {return (RT_LLD) 1;}

canonical_original_code: void *rt_none_open(char *p_url, char *comment, char *password, int keep, char *basename) {return (void *) 1;}

variable_types:
comment
char *

variable_types: keep int


decompiled_code:
void rt_none_close()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code: void rt_none_close (RT_LLD lld) {}

canonical_original_code: void rt_none_close(void *lld) {}

variable_types:
lld
void *


decompiled_code:
__int64 __fastcall rt_none_write(__int64 a1, __int64 a2, unsigned int a3)
{
return a3;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2, unsigned int a3)
{
return a3;
}

original_code: int rt_none_write (RT_LLD lld, const void *buf, int buflen) {return buflen;}

canonical_original_code: int rt_none_write(void *lld, void *buf, int buflen) {return buflen;}

variable_types:
buf
void *

variable_types: buflen int


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

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

original_code: int rt_none_twrite(RT_LLD lld, TABLE tab) {return 1;}

canonical_original_code: int rt_none_twrite(void *lld, struct table_info *tab) {return 1;}

variable_types: struct table_info { int ncols; int nrows; int minrowkey; int maxrowkey; struct tree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *data; struct itree_head { struct rb_node *root; struct rb_node *node; } *colorder; struct tree_head *info; struct tree_head *infolookup; struct itree_head *tobegarbage; int refcount; struct itree_head *roworder; char separator; } *


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

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

original_code:
int rt_none_tell (RT_LLD lld, int *seq, int *size, time_t *modt)
                     {return 0;}

canonical_original_code:
int rt_none_tell(void *lld, int *seq, int *size, long *modt)
                     {return 0;}

variable_types:
seq
int *

variable_types:
size
int *

variable_types:
modt
long *


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

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

original_code: TABLE rt_none_tread (RT_LLD lld, int seq, int offset) {return ((void *)0);}

canonical_original_code: struct table_info *rt_none_tread(void *lld, int seq, int offset) {return ((void *)0);}

variable_types: seq int

variable_types: offset int


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

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

original_code: int rt_none_checkpoint(RT_LLD lld) {return 1;}

canonical_original_code: int rt_none_checkpoint(void *lld) {return 1;}


decompiled_code:
void __fastcall itree_really_destroy(void *ptr, __int64 a2, unsigned int a3, __int64 a4)
{
if ( !ptr )
{
fwrite("(itree_destroy) t == NULL\n", 1uLL, 0x1AuLL, stderr);
abort();
}
rb_free_tree(*(_QWORD *)ptr);
if ( nm_active )
nm_rm(12LL, ptr, a2, a3, a4);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func0(void *ptr, __int64 a2, unsigned int a3, __int64 a4)
{
if ( !ptr )
{
fwrite("(itree_destroy) t == NULL\n", 1uLL, 0x1AuLL, stderr);
abort();
}
rb_free_tree(*(_QWORD *)ptr);
if ( nm_active )
nm_rm(12LL, ptr, a2, a3, a4);
free(ptr);
}

original_code:
void itree_really_destroy(ITREE *t, char *rfile, int rline, const char *rfunc) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_destroy) t == NULL\n");
  abort();
 }
 rb_free_tree(t->root);
 if (nm_active)
      nm_rm(NM_ITREE, t, rfile, rline, rfunc);
 free(t);
}

canonical_original_code:
void itree_really_destroy(struct itree_head *t, char *rfile, int rline, char *rfunc) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_destroy) t == NULL\n");
  abort();
 }
 rb_free_tree(t->root);
 if (nm_active)
      nm_rm(NM_ITREE, t, rfile, rline, rfunc);
 free(t);
}

variable_types: struct itree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *

variable_types:
rfile
char *

variable_types: rline int

variable_types:
rfunc
char *


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

if ( !a1 )
{
fwrite("(itree_add) t == NULL\n", 1uLL, 0x16uLL, stderr);
abort();
}
result = rb_inserti(*a1);
a1[1] = result;
return result;
}

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

if ( !a1 )
{
fwrite("(itree_add) t == NULL\n", 1uLL, 0x16uLL, stderr);
abort();
}
result = rb_inserti(*a1);
a1[1] = result;
return result;
}

original_code:
void itree_add(ITREE *t, unsigned int ikey, void *datum) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_add) t == NULL\n");
  abort();
 }
 t->node = rb_inserti(t->root, ikey, datum);
}

canonical_original_code:
void itree_add(struct itree_head *t, unsigned int ikey, void *datum) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_add) t == NULL\n");
  abort();
 }
 t->node = rb_inserti(t->root, ikey, datum);
}

variable_types:
ikey
unsigned int

variable_types:
datum
void *


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

if ( !a1 )
{
fwrite("(itree_rm) t == NULL\n", 1uLL, 0x15uLL, stderr);
abort();
}
v1 = *(_QWORD **)(a1 + 8);
*(_QWORD *)(a1 + 8) = *v1;
return rb_delete_node(v1);
}

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

if ( !a1 )
{
fwrite("(itree_rm) t == NULL\n", 1uLL, 0x15uLL, stderr);
abort();
}
v1 = *(_QWORD **)(a1 + 8);
*(_QWORD *)(a1 + 8) = *v1;
return rb_delete_node(v1);
}

original_code:
void itree_rm(ITREE *t) {
 Rb_node wasteme;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_rm) t == NULL\n");
  abort();
 }
 wasteme = t->node;
 t->node = (t->node->c.list.flink);
 rb_delete_node(wasteme);
}

canonical_original_code:
void itree_rm(struct itree_head *t) {
 struct rb_node *wasteme;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_rm) t == NULL\n");
  abort();
 }
 wasteme = t->node;
 t->node = (t->node->c.list.flink);
 rb_delete_node(wasteme);
}

variable_types: struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *


decompiled_code:
__int64 __fastcall itree_get(__int64 a1)
{
if ( !a1 )
{
fwrite("(itree_get) t == NULL\n", 1uLL, 0x16uLL, stderr);
abort();
}
return rb_val(*(_QWORD *)(a1 + 8));
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
if ( !a1 )
{
fwrite("(itree_get) t == NULL\n", 1uLL, 0x16uLL, stderr);
abort();
}
return rb_val(*(_QWORD *)(a1 + 8));
}

original_code:
void *itree_get(ITREE *t) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_get) t == NULL\n");
  abort();
 }
 return rb_val(t->node);
}

canonical_original_code:
void *itree_get(struct itree_head *t) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_get) t == NULL\n");
  abort();
 }
 return rb_val(t->node);
}


decompiled_code:
__int64 __fastcall itree_getkey(__int64 a1)
{
if ( !a1 )
{
fwrite("(itree_getkey) t == NULL\n", 1uLL, 0x19uLL, stderr);
abort();
}
return *(unsigned int *)(*(_QWORD *)(a1 + 8) + 32LL);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
if ( !a1 )
{
fwrite("(itree_getkey) t == NULL\n", 1uLL, 0x19uLL, stderr);
abort();
}
return *(unsigned int *)(*(_QWORD *)(a1 + 8) + 32LL);
}

original_code:
unsigned int itree_getkey(ITREE *t) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_getkey) t == NULL\n");
  abort();
 }
 return t->node->k.ikey;
}

canonical_original_code:
unsigned int itree_getkey(struct itree_head *t) {
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_getkey) t == NULL\n");
  abort();
 }
 return t->node->k.ikey;
}

return_type: unsigned int


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

if ( !a1 )
{
fwrite("(itree_put) t == NULL\n", 1uLL, 0x16uLL, stderr);
abort();
}
result = rb_val(*(_QWORD *)(a1 + 8));
*(_QWORD *)(*(_QWORD *)(a1 + 8) + 40LL) = a2;
return result;
}

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

if ( !a1 )
{
fwrite("(itree_put) t == NULL\n", 1uLL, 0x16uLL, stderr);
abort();
}
result = rb_val(*(_QWORD *)(a1 + 8));
*(_QWORD *)(*(_QWORD *)(a1 + 8) + 40LL) = a2;
return result;
}

original_code:
void *itree_put(ITREE *t, void *dat) {
 void *old;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_put) t == NULL\n");
  abort();
 }
 old = rb_val(t->node);
 t->node->v.val = dat;
 return old;
}

canonical_original_code:
void *itree_put(struct itree_head *t, void *dat) {
 void *old;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_put) t == NULL\n");
  abort();
 }
 old = rb_val(t->node);
 t->node->v.val = dat;
 return old;
}

variable_types:
dat
void *

variable_types:
old
void *


decompiled_code:
__int64 __fastcall itree_find(_QWORD *a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rdx
int v5[3]; // [rsp+Ch] [rbp-Ch] BYREF

if ( !a1 )
{
fwrite("(itree_find) t == NULL\n", 1uLL, 0x17uLL, stderr);
abort();
}
v2 = rb_find_ikey_n(*a1, a2, v5);
v3 = -1LL;
if ( v5[0] )
{
a1[1] = v2;
v3 = rb_val(v2);
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func6(_QWORD *a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rdx
int v5[3]; // [rsp+Ch] [rbp-Ch] BYREF

if ( !a1 )
{
fwrite("(itree_find) t == NULL\n", 1uLL, 0x17uLL, stderr);
abort();
}
v2 = rb_find_ikey_n(*a1, a2, v5);
v3 = -1LL;
if ( v5[0] )
{
a1[1] = v2;
v3 = rb_val(v2);
}
return v3;
}

original_code:
void *itree_find(ITREE *t, unsigned int ikey) {
 int found;
 Rb_node n;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_find) t == NULL\n");
  abort();
 }
 n = rb_find_ikey_n(t->root, ikey, &found);
 if (found) {
  t->node = n;
  return rb_val(n);
 }
 else
  return (void *) -1;
}

canonical_original_code:
void *itree_find(struct itree_head *t, unsigned int ikey) {
 int found;
 struct rb_node *n;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_find) t == NULL\n");
  abort();
 }
 n = rb_find_ikey_n(t->root, ikey, &found);
 if (found) {
  t->node = n;
  return rb_val(n);
 }
 else
  return (void *) -1;
}

variable_types: found int


decompiled_code:
__int64 __fastcall itree_search(__int64 a1, const void *a2, int a3)
{
_QWORD *v3; // rcx
_QWORD *v4; // rax
size_t v5; // rbp
const void *v6; // rax
__int64 v7; // rax

v3 = *(_QWORD **)a1;
v4 = **(_QWORD ***)a1;
*(_QWORD *)(a1 + 8) = v4;
if ( v3 == v4 )
return 0xFFFFFFFFLL;
v5 = a3;
while ( 1 )
{
v6 = (const void *)itree_get(a1);
if ( !memcmp(a2, v6, v5) )
break;
v7 = **(_QWORD **)(a1 + 8);
*(_QWORD *)(a1 + 8) = v7;
if ( v7 == *(_QWORD *)a1 )
return 0xFFFFFFFFLL;
}
return itree_getkey(a1);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, const void *a2, int a3)
{
_QWORD *v3; // rcx
_QWORD *v4; // rax
size_t v5; // rbp
const void *v6; // rax
__int64 v7; // rax

v3 = *(_QWORD **)a1;
v4 = **(_QWORD ***)a1;
*(_QWORD *)(a1 + 8) = v4;
if ( v3 == v4 )
return 0xFFFFFFFFLL;
v5 = a3;
while ( 1 )
{
v6 = (const void *)func3(a1);
if ( !memcmp(a2, v6, v5) )
break;
v7 = **(_QWORD **)(a1 + 8);
*(_QWORD *)(a1 + 8) = v7;
if ( v7 == *(_QWORD *)a1 )
return 0xFFFFFFFFLL;
}
return func4(a1);
}

original_code:
int itree_search(ITREE *haystack, void *needle, int needlelen) {
     for((haystack)->node = ((haystack)->root->c.list.flink); (haystack)->node != ((haystack)->root); (haystack)->node = ((haystack)->node->c.list.flink)) {
   if (memcmp(needle, itree_get(haystack), needlelen) == 0)
        return itree_getkey(haystack);
     }
     return -1;
}

canonical_original_code:
int itree_search(struct itree_head *haystack, void *needle, int needlelen) {
     for((haystack)->node = ((haystack)->root->c.list.flink); (haystack)->node != ((haystack)->root); (haystack)->node = ((haystack)->node->c.list.flink)) {
   if (memcmp(needle, itree_get(haystack), needlelen) == 0)
        return itree_getkey(haystack);
     }
     return -1;
}

variable_types:
needle
void *

variable_types: needlelen int


decompiled_code:
__int64 __fastcall itree_n(__int64 a1)
{
_QWORD **v1; // rcx
_QWORD *v2; // rax
unsigned int v3; // edx

if ( !a1 )
{
fwrite("(itree_n) t == NULL\n", 1uLL, 0x14uLL, stderr);
abort();
}
v1 = *(_QWORD ***)a1;
v2 = **(_QWORD ***)a1;
*(_QWORD *)(a1 + 8) = v2;
if ( v1 == v2 )
return 0;
v3 = 0;
do
{
++v3;
v2 = (_QWORD *)*v2;
*(_QWORD *)(a1 + 8) = v2;
}
while ( v1 != v2 );
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
_QWORD **v1; // rcx
_QWORD *v2; // rax
unsigned int v3; // edx

if ( !a1 )
{
fwrite("(itree_n) t == NULL\n", 1uLL, 0x14uLL, stderr);
abort();
}
v1 = *(_QWORD ***)a1;
v2 = **(_QWORD ***)a1;
*(_QWORD *)(a1 + 8) = v2;
if ( v1 == v2 )
return 0;
v3 = 0;
do
{
++v3;
v2 = (_QWORD *)*v2;
*(_QWORD *)(a1 + 8) = v2;
}
while ( v1 != v2 );
return v3;
}

original_code:
int itree_n(ITREE *t) {
 int n=0;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_n) t == NULL\n");
  abort();
 }
 for((t)->node = ((t)->root->c.list.flink); (t)->node != ((t)->root); (t)->node = ((t)->node->c.list.flink))
  n++;
 return n;
}

canonical_original_code:
int itree_n(struct itree_head *t) {
 int n = 0;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_n) t == NULL\n");
  abort();
 }
 for((t)->node = ((t)->root->c.list.flink); (t)->node != ((t)->root); (t)->node = ((t)->node->c.list.flink))
  n++;
 return n;
}

variable_types: n int


decompiled_code:
__int64 __fastcall itree_append(_QWORD *a1)
{
_QWORD *v2; // rdi
unsigned int v3; // er12

if ( !a1 )
{
fwrite("(itree_append) t == NULL\n", 1uLL, 0x19uLL, stderr);
abort();
}
v2 = (_QWORD *)*a1;
if ( v2 == (_QWORD *)*v2 )
{
a1[1] = rb_inserti(v2);
v3 = 0;
}
else
{
itree_last((__int64)a1);
v3 = itree_getkey((__int64)a1) + 1;
a1[1] = rb_inserti(*a1);
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func9(_QWORD *a1)
{
_QWORD *v2; // rdi
unsigned int v3; // er12

if ( !a1 )
{
fwrite("(itree_append) t == NULL\n", 1uLL, 0x19uLL, stderr);
abort();
}
v2 = (_QWORD *)*a1;
if ( v2 == (_QWORD *)*v2 )
{
a1[1] = rb_inserti(v2);
v3 = 0;
}
else
{
itree_last((__int64)a1);
v3 = func4((__int64)a1) + 1;
a1[1] = rb_inserti(*a1);
}
return v3;
}

original_code:
unsigned int itree_append(ITREE *t, void *datum) {
 int i;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_append) t == NULL\n");
  abort();
 }
 if ((t->root->c.list.flink == t->root)) {
  t->node = rb_inserti(t->root, (i=0), datum);
 } else {
  itree_last(t);
  t->node = rb_inserti(t->root, (i=itree_getkey(t)+1), datum);
 }
 return i;
}

canonical_original_code:
unsigned int itree_append(struct itree_head *t, void *datum) {
 int i;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_append) t == NULL\n");
  abort();
 }
 if ((t->root->c.list.flink == t->root)) {
  t->node = rb_inserti(t->root, (i=0), datum);
 } else {
  itree_last(t);
  t->node = rb_inserti(t->root, (i=itree_getkey(t)+1), datum);
 }
 return i;
}

variable_types: i int


decompiled_code:
__int64 __fastcall itree_present(_QWORD *a1, __int64 a2)
{
unsigned int v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

if ( !a1 )
{
fwrite("(itree_present) t == NULL\n", 1uLL, 0x1AuLL, stderr);
abort();
}
rb_find_ikey_n(*a1, a2, v3);
return v3[0];
}

canonical_decompiled_code:
__int64 __fastcall func10(_QWORD *a1, __int64 a2)
{
unsigned int v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

if ( !a1 )
{
fwrite("(itree_present) t == NULL\n", 1uLL, 0x1AuLL, stderr);
abort();
}
rb_find_ikey_n(*a1, a2, v3);
return v3[0];
}

original_code:
int itree_present(ITREE *t, unsigned int ikey) {
 int found;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_present) t == NULL\n");
  abort();
 }
 rb_find_ikey_n(t->root, ikey, &found);
 return found;
}

canonical_original_code:
int itree_present(struct itree_head *t, unsigned int ikey) {
 int found;
 if (t == ((void *)0)) {
  fprintf(stderr, "(itree_present) t == NULL\n");
  abort();
 }
 rb_find_ikey_n(t->root, ikey, &found);
 return found;
}


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

if ( a1 )
result = nm_nfree(a1, "iiab/itree.c", 280LL, "itree_infreemem");
return result;
}

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

if ( a1 )
result = nm_nfree(a1, "iiab/itree.c", 280LL, "itree_infreemem");
return result;
}

original_code:
void itree_infreemem(void *memtofree) {
     if (memtofree)
          nm_nfree(memtofree,"iiab/itree.c",280,__PRETTY_FUNCTION__);
}

variable_types:
memtofree
void *


decompiled_code:
__int64 rt_filea_magic()
{
return 5592885LL;
}

original_code: int rt_filea_magic() { return 5592885; }


decompiled_code:
const char *rt_filea_prefix()
{
return "file";
}

canonical_decompiled_code:
const char *func1()
{
return "file";
}

original_code: char * rt_filea_prefix() { return "file"; }


decompiled_code:
const char *rt_filea_description()
{
return "local file system (append mode)";
}

canonical_decompiled_code:
const char *func2()
{
return "local file system (append mode)";
}

original_code: char * rt_filea_description() { return "local file system (append mode)"; }


decompiled_code:
__int64 rt_fileov_magic()
{
return 9224581LL;
}

original_code: int rt_fileov_magic() { return 9224581; }


decompiled_code:
const char *rt_fileov_prefix()
{
return "fileov";
}

canonical_decompiled_code:
const char *func4()
{
return "fileov";
}

original_code: char * rt_fileov_prefix() { return "fileov"; }


decompiled_code:
const char *rt_fileov_description()
{
return "local file system (overwrite mode)";
}

canonical_decompiled_code:
const char *func5()
{
return "local file system (overwrite mode)";
}

original_code: char * rt_fileov_description() { return "local file system (overwrite mode)"; }


decompiled_code:
void rt_file_init()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

original_code: void rt_file_init (CF_VALS cf, int debug) {}

canonical_original_code: void rt_file_init(struct tree_head *cf, int debug) {}

variable_types: struct tree_head { struct rb_node { union { struct { struct rb_node *flink; struct rb_node *blink; } list; struct { struct rb_node *left; struct rb_node *right; } child; } c; union { struct rb_node *parent; struct rb_node *root; } p; struct status { unsigned int red; unsigned int internal; unsigned int left; unsigned int root; unsigned int head; } s; union { unsigned int ikey; char *key; struct rb_node *lext; } k; union { char *val; struct rb_node *rext; } v; } *root; struct rb_node *node; } *

variable_types: debug int


decompiled_code:
void rt_file_fini()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code: void rt_file_fini () {}

canonical_original_code: void rt_file_fini() {}


decompiled_code:
__int64 __fastcall rt_file_access(__int64 a1, __int64 a2, const char *a3, char a4)
{
unsigned int v6; // er12

if ( !a3 )
return 0;
v6 = a4 & 1;
if ( (a4 & 1) == 0 || access(a3, 4) )
{
v6 = a4 & 2;
if ( (a4 & 2) != 0 )
v6 = access(a3, 6) == 0;
}
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, __int64 a2, const char *a3, char a4)
{
unsigned int v6; // er12

if ( !a3 )
return 0;
v6 = a4 & 1;
if ( (a4 & 1) == 0 || access(a3, 4) )
{
v6 = a4 & 2;
if ( (a4 & 2) != 0 )
v6 = access(a3, 6) == 0;
}
return v6;
}

original_code:
int rt_file_access(char *p_url, char *password, char *basename, int flag)
{
     if (!basename)
   return 0;
     if ((flag & 1) && (access(basename, 4) == 0))
   return 1;
     else if ((flag & 2) && (access(basename, 2 | 4) == 0))
   return 1;
     else
   return 0;
}

variable_types:
password
char *

variable_types:
basename
char *

variable_types: flag int