decompiled_code:
__int64 __fastcall itree_find(_QWORD *a1, __int64 a2)
{
__int64 v2; // rax
int v4[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, v4);
if ( !v4[0] )
return -1LL;
a1[1] = v2;
return rb_val(v2);
}

canonical_decompiled_code:
__int64 __fastcall func6(_QWORD *a1, __int64 a2)
{
__int64 v2; // rax
int v4[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, v4);
if ( !v4[0] )
return -1LL;
a1[1] = v2;
return rb_val(v2);
}

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


repo: SystemGarden/habitat

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

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

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

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

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: 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:
needle
void *

variable_types: needlelen int

return_type: int

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

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


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

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

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

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

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

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


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

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

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

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

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:
datum
void *

variable_types: i int

return_type: unsigned 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;
}

variable_types:
ikey
unsigned int


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 *

return_type: 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"; }

return_type: char *


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

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


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) )
return v6;
if ( (a4 & 2) == 0 )
return 0;
return access(a3, 6) == 0;
}

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) )
return v6;
if ( (a4 & 2) == 0 )
return 0;
return access(a3, 6) == 0;
}

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


decompiled_code:
__int64 __fastcall rt_filea_open(__int64 a1, double a2, __int64 a3, __int64 a4, int a5, const char *a6)
{
int v7; // ebp
__int64 v8; // r12
const char *v9; // rax
int v11; // eax
const char *v12; // r9
int v13; // eax
__int64 v14; // rdx
const char *v15; // r8
int v16; // eax

if ( !a6 )
return 0LL;
if ( a5 <= 0 )
{
if ( access(a6, 4) )
{
v11 = access(a6, 0);
v12 = a6;
if ( !v11 )
{
v8 = 0LL;
elog_fprintf(
6LL,
"iiab/rt_file.c",
109LL,
"rt_filea_open",
"file % exists but no read permission (reading in append method as keep lt 0)",
a2);
return v8;
}
v15 = "file %s does not exist for reading; check permission of the leading path (reading in append method as keep lt 0)";
v14 = 113LL;
}
else
{
v13 = open(a6, 0);
v12 = a6;
v14 = 103LL;
v15 = "should be able to open file %s for reading but can't (reading in append method as keep lt 0)";
v7 = v13;
if ( v13 != -1 )
goto LABEL_4;
}
}
else
{
v7 = open(a6, 1218, 420LL);
if ( v7 != -1 )
{
LABEL_4:
v8 = nm_nmalloc(48LL, "iiab/rt_file.c", 120LL, "rt_filea_open");
*(_DWORD *)v8 = rt_filea_magic();
*(_QWORD *)(v8 + 8) = rt_filea_prefix();
v9 = rt_filea_description();
*(_DWORD *)(v8 + 24) = v7;
*(_QWORD *)(v8 + 16) = v9;
*(_QWORD *)(v8 + 32) = a1;
*(_QWORD *)(v8 + 40) = a6;
return v8;
}
if ( access(a6, 6) )
{
v12 = a6;
v15 = "can't open file %s for writing";
v14 = 94LL;
}
else
{
v16 = open(a6, 1026, 420LL);
v12 = a6;
v14 = 88LL;
v15 = "should be able to open file %s for writing but can't";
v7 = v16;
if ( v16 != -1 )
goto LABEL_4;
}
}
elog_fprintf(6LL, "iiab/rt_file.c", v14, "rt_filea_open", v15, v12);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, double a2, __int64 a3, __int64 a4, int a5, const char *a6)
{
int v7; // ebp
__int64 v8; // r12
const char *v9; // rax
int v11; // eax
const char *v12; // r9
int v13; // eax
__int64 v14; // rdx
const char *v15; // r8
int v16; // eax

if ( !a6 )
return 0LL;
if ( a5 <= 0 )
{
if ( access(a6, 4) )
{
v11 = access(a6, 0);
v12 = a6;
if ( !v11 )
{
v8 = 0LL;
elog_fprintf(
6LL,
"iiab/rt_file.c",
109LL,
"rt_filea_open",
"file % exists but no read permission (reading in append method as keep lt 0)",
a2);
return v8;
}
v15 = "file %s does not exist for reading; check permission of the leading path (reading in append method as keep lt 0)";
v14 = 113LL;
}
else
{
v13 = open(a6, 0);
v12 = a6;
v14 = 103LL;
v15 = "should be able to open file %s for reading but can't (reading in append method as keep lt 0)";
v7 = v13;
if ( v13 != -1 )
goto LABEL_4;
}
}
else
{
v7 = open(a6, 1218, 420LL);
if ( v7 != -1 )
{
LABEL_4:
v8 = nm_nmalloc(48LL, "iiab/rt_file.c", 120LL, "rt_filea_open");
*(_DWORD *)v8 = func0();
*(_QWORD *)(v8 + 8) = func1();
v9 = func2();
*(_DWORD *)(v8 + 24) = v7;
*(_QWORD *)(v8 + 16) = v9;
*(_QWORD *)(v8 + 32) = a1;
*(_QWORD *)(v8 + 40) = a6;
return v8;
}
if ( access(a6, 6) )
{
v12 = a6;
v15 = "can't open file %s for writing";
v14 = 94LL;
}
else
{
v16 = open(a6, 1026, 420LL);
v12 = a6;
v14 = 88LL;
v15 = "should be able to open file %s for writing but can't";
v7 = v16;
if ( v16 != -1 )
goto LABEL_4;
}
}
elog_fprintf(6LL, "iiab/rt_file.c", v14, "rt_filea_open", v15, v12);
return 0LL;
}

original_code:
RT_LLD rt_filea_open (char *p_url, char *comment, char *password, int keep,
        char *basename)
{
     RT_FILED rt;
     int fd;
     if ( ! basename)
   return ((void *)0);
     if (keep > 0) {
          fd = open(basename, (02 | 02000 | 0100 | 0200), 0644);
   if (fd == -1) {
        if (access(basename, (4 |2)) == 0) {
      fd = open(basename, (02 | 02000), 0644);
      if (fd == -1) {
           elog_fprintf(FATAL,"iiab/rt_file.c",88,__PRETTY_FUNCTION__,"should be able to open " "file %s for writing but can't", basename);
    return ((void *)0);
      }
        } else {
      elog_fprintf(FATAL,"iiab/rt_file.c",94,__PRETTY_FUNCTION__,"can't open file %s for writing", basename);
      return ((void *)0);
        }
   }
     } else {
          if (access(basename, 4) == 0) {
        fd = open(basename, 00);
        if (fd == -1) {
      elog_fprintf(FATAL,"iiab/rt_file.c",103,__PRETTY_FUNCTION__,"should be able to open " "file %s for reading but can't (reading in " "append method as keep lt 0)", basename);
      return ((void *)0);
        }
   } else if (access(basename, 0) == 0) {
        elog_fprintf(FATAL,"iiab/rt_file.c",109,__PRETTY_FUNCTION__,"file % exists but no read permission " "(reading in append method as keep lt 0)",basename);
        return ((void *)0);
   } else {
        elog_fprintf(FATAL,"iiab/rt_file.c",113,__PRETTY_FUNCTION__,"file %s does not exist for reading; " "check permission of the leading path " "(reading in append method as keep lt 0)",basename);
        return ((void *)0);
   }
     }
     rt = nm_nmalloc(sizeof(struct rt_file_desc),"iiab/rt_file.c",120,__PRETTY_FUNCTION__);
     rt->magic = rt_filea_magic();
     rt->prefix = rt_filea_prefix();
     rt->description = rt_filea_description();
     rt->fd = fd;
     rt->p_url = p_url;
     rt->filepath = basename;
     return rt;
}

canonical_original_code:
void *rt_filea_open(char *p_url, char *comment, char *password, int keep, char *basename)
{
     struct rt_file_desc *rt;
     int fd;
     if ( ! basename)
   return ((void *)0);
     if (keep > 0) {
          fd = open(basename, (02 | 02000 | 0100 | 0200), 0644);
   if (fd == -1) {
        if (access(basename, (4 |2)) == 0) {
      fd = open(basename, (02 | 02000), 0644);
      if (fd == -1) {
           elog_fprintf(FATAL,"iiab/rt_file.c",88,__PRETTY_FUNCTION__,"should be able to open " "file %s for writing but can't", basename);
    return ((void *)0);
      }
        } else {
      elog_fprintf(FATAL,"iiab/rt_file.c",94,__PRETTY_FUNCTION__,"can't open file %s for writing", basename);
      return ((void *)0);
        }
   }
     } else {
          if (access(basename, 4) == 0) {
        fd = open(basename, 00);
        if (fd == -1) {
      elog_fprintf(FATAL,"iiab/rt_file.c",103,__PRETTY_FUNCTION__,"should be able to open " "file %s for reading but can't (reading in " "append method as keep lt 0)", basename);
      return ((void *)0);
        }
   } else if (access(basename, 0) == 0) {
        elog_fprintf(FATAL,"iiab/rt_file.c",109,__PRETTY_FUNCTION__,"file % exists but no read permission " "(reading in append method as keep lt 0)",basename);
        return ((void *)0);
   } else {
        elog_fprintf(FATAL,"iiab/rt_file.c",113,__PRETTY_FUNCTION__,"file %s does not exist for reading; " "check permission of the leading path " "(reading in append method as keep lt 0)",basename);
        return ((void *)0);
   }
     }
     rt = nm_nmalloc(sizeof(struct rt_file_desc),"iiab/rt_file.c",120,__PRETTY_FUNCTION__);
     rt->magic = rt_filea_magic();
     rt->prefix = rt_filea_prefix();
     rt->description = rt_filea_description();
     rt->fd = fd;
     rt->p_url = p_url;
     rt->filepath = basename;
     return rt;
}

variable_types:
comment
char *

variable_types: keep int

variable_types: struct rt_file_desc { int magic; char *prefix; char *description; int fd; char *p_url; char *filepath; } *

variable_types: fd int

return_type: void *


decompiled_code:
__int64 __fastcall rt_fileov_open(__int64 a1, __int64 a2, __int64 a3, int a4, const char *a5)
{
int v6; // ebp
__int64 v7; // r12
const char *v8; // rax
int v10; // eax
const char *v11; // r9
int v12; // eax
__int64 v13; // rdx
const char *v14; // r8
int v15; // eax

if ( !a5 )
return 0LL;
if ( a4 <= 0 )
{
if ( access(a5, 4) )
{
v10 = access(a5, 0);
v11 = a5;
if ( !v10 )
{
v7 = 0LL;
elog_fprintf(1LL, "iiab/rt_file.c", 168LL, "rt_fileov_open", "file %s accessable but no read permission ", a5);
return v7;
}
v14 = "file %s inaccessable; check permission of the leading path";
v13 = 172LL;
}
else
{
v12 = open(a5, 0);
v11 = a5;
v13 = 163LL;
v14 = "should be able to open file %s for reading but can't";
v6 = v12;
if ( v12 != -1 )
goto LABEL_4;
}
}
else
{
v6 = open(a5, 706, 420LL);
if ( v6 != -1 )
{
LABEL_4:
v7 = nm_nmalloc(48LL, "iiab/rt_file.c", 178LL, "rt_fileov_open");
*(_DWORD *)v7 = rt_fileov_magic();
*(_QWORD *)(v7 + 8) = rt_fileov_prefix();
v8 = rt_fileov_description();
*(_DWORD *)(v7 + 24) = v6;
*(_QWORD *)(v7 + 16) = v8;
*(_QWORD *)(v7 + 32) = a1;
*(_QWORD *)(v7 + 40) = a5;
return v7;
}
if ( access(a5, 6) )
{
v11 = a5;
v14 = "can't open file %s for writing";
v13 = 154LL;
}
else
{
v15 = open(a5, 514, 420LL);
v11 = a5;
v13 = 148LL;
v14 = "should be able to open file %s for writing but can't";
v6 = v15;
if ( v15 != -1 )
goto LABEL_4;
}
}
elog_fprintf(1LL, "iiab/rt_file.c", v13, "rt_fileov_open", v14, v11);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1, __int64 a2, __int64 a3, int a4, const char *a5)
{
int v6; // ebp
__int64 v7; // r12
const char *v8; // rax
int v10; // eax
const char *v11; // r9
int v12; // eax
__int64 v13; // rdx
const char *v14; // r8
int v15; // eax

if ( !a5 )
return 0LL;
if ( a4 <= 0 )
{
if ( access(a5, 4) )
{
v10 = access(a5, 0);
v11 = a5;
if ( !v10 )
{
v7 = 0LL;
elog_fprintf(1LL, "iiab/rt_file.c", 168LL, "rt_fileov_open", "file %s accessable but no read permission ", a5);
return v7;
}
v14 = "file %s inaccessable; check permission of the leading path";
v13 = 172LL;
}
else
{
v12 = open(a5, 0);
v11 = a5;
v13 = 163LL;
v14 = "should be able to open file %s for reading but can't";
v6 = v12;
if ( v12 != -1 )
goto LABEL_4;
}
}
else
{
v6 = open(a5, 706, 420LL);
if ( v6 != -1 )
{
LABEL_4:
v7 = nm_nmalloc(48LL, "iiab/rt_file.c", 178LL, "rt_fileov_open");
*(_DWORD *)v7 = func3();
*(_QWORD *)(v7 + 8) = func4();
v8 = func5();
*(_DWORD *)(v7 + 24) = v6;
*(_QWORD *)(v7 + 16) = v8;
*(_QWORD *)(v7 + 32) = a1;
*(_QWORD *)(v7 + 40) = a5;
return v7;
}
if ( access(a5, 6) )
{
v11 = a5;
v14 = "can't open file %s for writing";
v13 = 154LL;
}
else
{
v15 = open(a5, 514, 420LL);
v11 = a5;
v13 = 148LL;
v14 = "should be able to open file %s for writing but can't";
v6 = v15;
if ( v15 != -1 )
goto LABEL_4;
}
}
elog_fprintf(1LL, "iiab/rt_file.c", v13, "rt_fileov_open", v14, v11);
return 0LL;
}

original_code:
RT_LLD rt_fileov_open (char *p_url, char *comment, char *password, int keep,
         char *basename)
{
     RT_FILED rt;
     int fd;
     if ( ! basename)
   return ((void *)0);
     if (keep > 0) {
          fd = open(basename, (02 | 01000 | 0100 | 0200), 0644);
   if (fd == -1) {
        if (access(basename, (4 |2)) == 0) {
      fd = open(basename, (02 | 01000), 0644);
      if (fd == -1) {
           elog_fprintf(DEBUG,"iiab/rt_file.c",148,__PRETTY_FUNCTION__,"should be able to open " "file %s for writing but can't", basename);
    return ((void *)0);
      }
        } else {
      elog_fprintf(DEBUG,"iiab/rt_file.c",154,__PRETTY_FUNCTION__,"can't open file %s for writing", basename);
      return ((void *)0);
        }
   }
     } else {
          if (access(basename, 4) == 0) {
        fd = open(basename, 00);
        if (fd == -1) {
      elog_fprintf(DEBUG,"iiab/rt_file.c",163,__PRETTY_FUNCTION__,"should be able to open " "file %s for reading but can't", basename);
      return ((void *)0);
        }
   } else if (access(basename, 0) == 0) {
        elog_fprintf(DEBUG,"iiab/rt_file.c",168,__PRETTY_FUNCTION__,"file %s accessable but no read " "permission ", basename);
        return ((void *)0);
   } else {
        elog_fprintf(DEBUG,"iiab/rt_file.c",172,__PRETTY_FUNCTION__,"file %s inaccessable; check permission " "of the leading path", basename);
        return ((void *)0);
   }
     }
     rt = nm_nmalloc(sizeof(struct rt_file_desc),"iiab/rt_file.c",178,__PRETTY_FUNCTION__);
     rt->magic = rt_fileov_magic();
     rt->prefix = rt_fileov_prefix();
     rt->description = rt_fileov_description();
     rt->fd = fd;
     rt->p_url = p_url;
     rt->filepath = basename;
     return rt;
}

canonical_original_code:
void *rt_fileov_open(char *p_url, char *comment, char *password, int keep, char *basename)
{
     struct rt_file_desc *rt;
     int fd;
     if ( ! basename)
   return ((void *)0);
     if (keep > 0) {
          fd = open(basename, (02 | 01000 | 0100 | 0200), 0644);
   if (fd == -1) {
        if (access(basename, (4 |2)) == 0) {
      fd = open(basename, (02 | 01000), 0644);
      if (fd == -1) {
           elog_fprintf(DEBUG,"iiab/rt_file.c",148,__PRETTY_FUNCTION__,"should be able to open " "file %s for writing but can't", basename);
    return ((void *)0);
      }
        } else {
      elog_fprintf(DEBUG,"iiab/rt_file.c",154,__PRETTY_FUNCTION__,"can't open file %s for writing", basename);
      return ((void *)0);
        }
   }
     } else {
          if (access(basename, 4) == 0) {
        fd = open(basename, 00);
        if (fd == -1) {
      elog_fprintf(DEBUG,"iiab/rt_file.c",163,__PRETTY_FUNCTION__,"should be able to open " "file %s for reading but can't", basename);
      return ((void *)0);
        }
   } else if (access(basename, 0) == 0) {
        elog_fprintf(DEBUG,"iiab/rt_file.c",168,__PRETTY_FUNCTION__,"file %s accessable but no read " "permission ", basename);
        return ((void *)0);
   } else {
        elog_fprintf(DEBUG,"iiab/rt_file.c",172,__PRETTY_FUNCTION__,"file %s inaccessable; check permission " "of the leading path", basename);
        return ((void *)0);
   }
     }
     rt = nm_nmalloc(sizeof(struct rt_file_desc),"iiab/rt_file.c",178,__PRETTY_FUNCTION__);
     rt->magic = rt_fileov_magic();
     rt->prefix = rt_fileov_prefix();
     rt->description = rt_fileov_description();
     rt->fd = fd;
     rt->p_url = p_url;
     rt->filepath = basename;
     return rt;
}

user_defined_types: struct rt_file_desc { int magic; char *prefix; char *description; int fd; char *p_url; char *filepath; }


decompiled_code:
__int64 __fastcall rt_file_from_lld(__int64 a1)
{
const char *v2; // r13
const char *v3; // rbp
const char *v4; // rbx
const char *v5; // rax

if ( !a1 )
elog_fdie(6LL, "iiab/rt_file.c", 409LL, "rt_file_from_lld", "passed NULL low level descriptor");
if ( *(_DWORD *)a1 == 5592885 || *(_DWORD *)a1 == 9224581 )
return a1;
v2 = rt_fileov_description();
v3 = rt_fileov_prefix();
v4 = rt_filea_description();
v5 = rt_filea_prefix();
elog_fdie(
6LL,
"iiab/rt_file.c",
412LL,
"rt_file_from_lld",
"magic type mismatch: we were given %s (%s) but can only handle either %s (%s) or %s (%s)",
*(const char **)(a1 + 8),
*(const char **)(a1 + 16),
v5,
v4,
v3,
v2);
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1)
{
const char *v2; // r13
const char *v3; // rbp
const char *v4; // rbx
const char *v5; // rax

if ( !a1 )
elog_fdie(6LL, "iiab/rt_file.c", 409LL, "rt_file_from_lld", "passed NULL low level descriptor");
if ( *(_DWORD *)a1 == 5592885 || *(_DWORD *)a1 == 9224581 )
return a1;
v2 = func5();
v3 = func4();
v4 = func2();
v5 = func1();
elog_fdie(
6LL,
"iiab/rt_file.c",
412LL,
"rt_file_from_lld",
"magic type mismatch: we were given %s (%s) but can only handle either %s (%s) or %s (%s)",
*(const char **)(a1 + 8),
*(const char **)(a1 + 16),
v5,
v4,
v3,
v2);
return a1;
}

original_code:
RT_FILED rt_file_from_lld(RT_LLD lld )
{
     if (!lld)
   elog_fdie(FATAL,"iiab/rt_file.c",409,__PRETTY_FUNCTION__,"passed NULL low level descriptor");
     if ( (((RT_FILED)lld)->magic != 5592885) &&
   (((RT_FILED)lld)->magic != 9224581) )
   elog_fdie(FATAL,"iiab/rt_file.c",412,__PRETTY_FUNCTION__,"magic type mismatch: we were given " "%s (%s) but can only handle either %s (%s) or %s (%s)", ((RT_FILED)lld)->prefix, ((RT_FILED)lld)->description, rt_filea_prefix(), rt_filea_description(), rt_fileov_prefix(), rt_fileov_description());
     return (RT_FILED) lld;
}

canonical_original_code:
struct rt_file_desc *rt_file_from_lld(void *lld)
{
     if (!lld)
   elog_fdie(FATAL,"iiab/rt_file.c",409,__PRETTY_FUNCTION__,"passed NULL low level descriptor");
     if ( (((struct rt_file_desc *)lld)->magic != 5592885) &&
   (((struct rt_file_desc *)lld)->magic != 9224581) )
   elog_fdie(FATAL,"iiab/rt_file.c",412,__PRETTY_FUNCTION__,"magic type mismatch: we were given " "%s (%s) but can only handle either %s (%s) or %s (%s)", ((struct rt_file_desc *)lld)->prefix, ((struct rt_file_desc *)lld)->description, rt_filea_prefix(), rt_filea_description(), rt_fileov_prefix(), rt_fileov_description());
     return (struct rt_file_desc *) lld;
}

variable_types:
lld
void *

return_type: struct rt_file_desc { int magic; char *prefix; char *description; int fd; char *p_url; char *filepath; } *


decompiled_code:
__int64 __fastcall rt_file_close(__int64 a1)
{
_DWORD *v1; // rbp

v1 = (_DWORD *)rt_file_from_lld(a1);
close(v1[6]);
*v1 = 0;
return nm_nfree(v1, "iiab/rt_file.c", 197LL, "rt_file_close");
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1)
{
_DWORD *v1; // rbp

v1 = (_DWORD *)func12(a1);
close(v1[6]);
*v1 = 0;
return nm_nfree(v1, "iiab/rt_file.c", 197LL, "rt_file_close");
}

original_code:
void rt_file_close (RT_LLD lld)
{
     RT_FILED rt;
     rt = rt_file_from_lld(lld);
     close(rt->fd);
     rt->magic = 0;
     nm_nfree(rt,"iiab/rt_file.c",197,__PRETTY_FUNCTION__);
}

canonical_original_code:
void rt_file_close(void *lld)
{
     struct rt_file_desc *rt;
     rt = rt_file_from_lld(lld);
     close(rt->fd);
     rt->magic = 0;
     nm_nfree(rt,"iiab/rt_file.c",197,__PRETTY_FUNCTION__);
}


decompiled_code:
__int64 __fastcall rt_file_write(__int64 a1, const void *a2, int a3)
{
__int64 v4; // rax
__int64 result; // rax
int *v6; // rax
char *v7; // rax

v4 = rt_file_from_lld(a1);
LODWORD(result) = write(*(_DWORD *)(v4 + 24), a2, a3);
if ( (_DWORD)result != -1 )
return (unsigned int)result;
v6 = _errno_location();
v7 = strerror(*v6);
elog_fprintf(5LL, "iiab/rt_file.c", 209LL, "rt_file_write", "write() system call returns -1: %s", v7);
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, const void *a2, int a3)
{
__int64 v4; // rax
__int64 result; // rax
int *v6; // rax
char *v7; // rax

v4 = func12(a1);
LODWORD(result) = write(*(_DWORD *)(v4 + 24), a2, a3);
if ( (_DWORD)result != -1 )
return (unsigned int)result;
v6 = _errno_location();
v7 = strerror(*v6);
elog_fprintf(5LL, "iiab/rt_file.c", 209LL, "rt_file_write", "write() system call returns -1: %s", v7);
return 0xFFFFFFFFLL;
}

original_code:
int rt_file_write (RT_LLD lld, const void *buf, int buflen)
{
     int n;
     RT_FILED rt;
     rt = rt_file_from_lld(lld);
     n = write(rt->fd, buf, buflen);
     if (n == -1)
   elog_fprintf(ERROR,"iiab/rt_file.c",209,__PRETTY_FUNCTION__,"write() system call returns -1: %s", strerror((*__errno_location ())));
     return n;
}

canonical_original_code:
int rt_file_write(void *lld, void *buf, int buflen)
{
     int n;
     struct rt_file_desc *rt;
     rt = rt_file_from_lld(lld);
     n = write(rt->fd, buf, buflen);
     if (n == -1)
   elog_fprintf(ERROR,"iiab/rt_file.c",209,__PRETTY_FUNCTION__,"write() system call returns -1: %s", strerror((*__errno_location ())));
     return n;
}

variable_types:
buf
void *

variable_types: buflen int


decompiled_code:
__int64 __fastcall rt_file_twrite(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
const char *v3; // rax
const char *v4; // rbp
size_t v5; // rax
int v6; // ebx
int *v8; // rax
char *v9; // rax

v2 = rt_file_from_lld(a1);
v3 = (const char *)table_outtable(a2);
if ( !v3 )
return 1LL;
v4 = v3;
v5 = strlen(v3);
v6 = write(*(_DWORD *)(v2 + 24), v4, v5);
nm_nfree(v4, "iiab/rt_file.c", 227LL, "rt_file_twrite");
if ( v6 != -1 )
return 1LL;
v8 = _errno_location();
v9 = strerror(*v8);
elog_fprintf(5LL, "iiab/rt_file.c", 229LL, "rt_file_twrite", "write() system call returns -1: %s", v9);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
const char *v3; // rax
const char *v4; // rbp
size_t v5; // rax
int v6; // ebx
int *v8; // rax
char *v9; // rax

v2 = func12(a1);
v3 = (const char *)table_outtable(a2);
if ( !v3 )
return 1LL;
v4 = v3;
v5 = strlen(v3);
v6 = write(*(_DWORD *)(v2 + 24), v4, v5);
nm_nfree(v4, "iiab/rt_file.c", 227LL, "rt_file_twrite");
if ( v6 != -1 )
return 1LL;
v8 = _errno_location();
v9 = strerror(*v8);
elog_fprintf(5LL, "iiab/rt_file.c", 229LL, "rt_file_twrite", "write() system call returns -1: %s", v9);
return 0LL;
}

original_code:
int rt_file_twrite (RT_LLD lld, TABLE tab)
{
     RT_FILED rt;
     char *buf;
     int n;
     rt = rt_file_from_lld(lld);
     buf = table_outtable(tab);
     if ( ! buf)
       return 1;
     n = write(rt->fd, buf, strlen(buf));
     nm_nfree(buf,"iiab/rt_file.c",227,__PRETTY_FUNCTION__);
     if (n == -1) {
   elog_fprintf(ERROR,"iiab/rt_file.c",229,__PRETTY_FUNCTION__,"write() system call returns -1: %s", strerror((*__errno_location ())));
   return 0;
     }
     return 1;
}

canonical_original_code:
int rt_file_twrite(void *lld, struct table_info *tab)
{
     struct rt_file_desc *rt;
     char *buf;
     int n;
     rt = rt_file_from_lld(lld);
     buf = table_outtable(tab);
     if ( ! buf)
       return 1;
     n = write(rt->fd, buf, strlen(buf));
     nm_nfree(buf,"iiab/rt_file.c",227,__PRETTY_FUNCTION__);
     if (n == -1) {
   elog_fprintf(ERROR,"iiab/rt_file.c",229,__PRETTY_FUNCTION__,"write() system call returns -1: %s", strerror((*__errno_location ())));
   return 0;
     }
     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; } *

variable_types:
buf
char *

variable_types: n int

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


decompiled_code:
__int64 __fastcall rt_file_tell(__int64 a1, _DWORD *a2, _DWORD *a3, __time_t *a4)
{
__int64 v6; // rbx
int v7; // eax
__int64 result; // rax
struct stat v9; // [rsp+0h] [rbp-B8h] BYREF

v6 = rt_file_from_lld(a1);
if ( fstat(*(_DWORD *)(v6 + 24), &v9) == -1 )
{
elog_fprintf(5LL, "iiab/rt_file.c", 249LL, "rt_file_tell", "unable to stat %s", *(const char **)(v6 + 32));
result = 0LL;
}
else
{
v7 = v9.st_size;
*a2 = -1;
*a3 = v7;
*a4 = v9.st_mtim.tv_sec;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1, _DWORD *a2, _DWORD *a3, __time_t *a4)
{
__int64 v6; // rbx
int v7; // eax
__int64 result; // rax
struct stat v9; // [rsp+0h] [rbp-B8h] BYREF

v6 = func12(a1);
if ( fstat(*(_DWORD *)(v6 + 24), &v9) == -1 )
{
elog_fprintf(5LL, "iiab/rt_file.c", 249LL, "rt_file_tell", "unable to stat %s", *(const char **)(v6 + 32));
result = 0LL;
}
else
{
v7 = v9.st_size;
*a2 = -1;
*a3 = v7;
*a4 = v9.st_mtim.tv_sec;
result = 1LL;
}
return result;
}

original_code:
int rt_file_tell (RT_LLD lld, int *seq, int *size, time_t *modt)
{
     struct stat sbuf;
     int r;
     RT_FILED rt;
     rt = rt_file_from_lld(lld);
     r = fstat(rt->fd, &sbuf);
     if (r == -1) {
   elog_fprintf(ERROR,"iiab/rt_file.c",249,__PRETTY_FUNCTION__,"unable to stat %s", rt->p_url);
   return 0;
     } else {
   *seq = -1;
   *size = sbuf.st_size;
   *modt = sbuf.st_mtim.tv_sec;
   return 1;
     }
}

canonical_original_code:
int rt_file_tell(void *lld, int *seq, int *size, long *modt)
{
     struct stat sbuf;
     int r;
     struct rt_file_desc *rt;
     rt = rt_file_from_lld(lld);
     r = fstat(rt->fd, &sbuf);
     if (r == -1) {
   elog_fprintf(ERROR,"iiab/rt_file.c",249,__PRETTY_FUNCTION__,"unable to stat %s", rt->p_url);
   return 0;
     } else {
   *seq = -1;
   *size = sbuf.st_size;
   *modt = sbuf.st_mtim.tv_sec;
   return 1;
     }
}

variable_types:
seq
int *

variable_types:
size
int *

variable_types:
modt
long *

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: r 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]; }


decompiled_code:
__int64 __fastcall rt_file_read(__int64 a1, __int64 a2, int a3)
{
__int64 v4; // rbx
__int64 v5; // r12
_BYTE *v7; // rax
_BYTE *v8; // r13
__int64 v9; // r14
__int64 v10; // rax
__int64 v11; // rdi
__int64 v12; // rdi
struct stat v13; // [rsp+0h] [rbp-B8h] BYREF

v4 = rt_file_from_lld(a1);
if ( fstat(*(_DWORD *)(v4 + 24), &v13) == -1 )
{
v5 = 0LL;
elog_fprintf(5LL, "iiab/rt_file.c", 278LL, "rt_file_read", "unable to stat %s", *(const char **)(v4 + 32));
}
else
{
v5 = itree_really_create("iiab/rt_file.c", 282LL, "rt_file_read");
if ( a3 < v13.st_size )
{
lseek(*(_DWORD *)(v4 + 24), a3, 0);
v7 = (_BYTE *)nm_nmalloc(v13.st_size - a3 + 1, "iiab/rt_file.c", 287LL, "rt_file_read");
v8 = v7;
if ( v7 )
{
v9 = (unsigned int)(LODWORD(v13.st_size) - a3);
if ( read(*(_DWORD *)(v4 + 24), v7, (int)v9) == -1 )
{
elog_fprintf(
5LL,
"iiab/rt_file.c",
297LL,
"rt_file_read",
"unable to read(%d, %p, %d) from %s\n",
*(unsigned int *)(v4 + 24),
v8,
v9,
*(const char **)(v4 + 32));
v11 = v5;
v5 = 0LL;
itree_really_destroy(v11, "iiab/rt_file.c", 299LL, "rt_file_read");
nm_nfree(v8, "iiab/rt_file.c", 300LL, "rt_file_read");
}
else
{
v8[(int)v9] = 0;
v10 = nm_xnmalloc(16LL, "iiab/rt_file.c", 306LL, "rt_file_read");
*(_QWORD *)(v10 + 8) = v8;
*(_DWORD *)v10 = v9;
itree_append(v5, v10);
}
}
else
{
elog_fprintf(
5LL,
"iiab/rt_file.c",
289LL,
"rt_file_read",
"unable to nmalloc(%d) for %s data\n",
v13.st_size - a3 + 1,
*(const char **)(v4 + 32));
v12 = v5;
v5 = 0LL;
itree_really_destroy(v12, "iiab/rt_file.c", 291LL, "rt_file_read");
}
}
}
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1, __int64 a2, int a3)
{
__int64 v4; // rbx
__int64 v5; // r12
_BYTE *v7; // rax
_BYTE *v8; // r13
__int64 v9; // r14
__int64 v10; // rax
__int64 v11; // rdi
__int64 v12; // rdi
struct stat v13; // [rsp+0h] [rbp-B8h] BYREF

v4 = func12(a1);
if ( fstat(*(_DWORD *)(v4 + 24), &v13) == -1 )
{
v5 = 0LL;
elog_fprintf(5LL, "iiab/rt_file.c", 278LL, "rt_file_read", "unable to stat %s", *(const char **)(v4 + 32));
}
else
{
v5 = itree_really_create("iiab/rt_file.c", 282LL, "rt_file_read");
if ( a3 < v13.st_size )
{
lseek(*(_DWORD *)(v4 + 24), a3, 0);
v7 = (_BYTE *)nm_nmalloc(v13.st_size - a3 + 1, "iiab/rt_file.c", 287LL, "rt_file_read");
v8 = v7;
if ( v7 )
{
v9 = (unsigned int)(LODWORD(v13.st_size) - a3);
if ( read(*(_DWORD *)(v4 + 24), v7, (int)v9) == -1 )
{
elog_fprintf(
5LL,
"iiab/rt_file.c",
297LL,
"rt_file_read",
"unable to read(%d, %p, %d) from %s\n",
*(unsigned int *)(v4 + 24),
v8,
v9,
*(const char **)(v4 + 32));
v11 = v5;
v5 = 0LL;
itree_really_destroy(v11, "iiab/rt_file.c", 299LL, "rt_file_read");
nm_nfree(v8, "iiab/rt_file.c", 300LL, "rt_file_read");
}
else
{
v8[(int)v9] = 0;
v10 = nm_xnmalloc(16LL, "iiab/rt_file.c", 306LL, "rt_file_read");
*(_QWORD *)(v10 + 8) = v8;
*(_DWORD *)v10 = v9;
itree_append(v5, v10);
}
}
else
{
elog_fprintf(
5LL,
"iiab/rt_file.c",
289LL,
"rt_file_read",
"unable to nmalloc(%d) for %s data\n",
v13.st_size - a3 + 1,
*(const char **)(v4 + 32));
v12 = v5;
v5 = 0LL;
itree_really_destroy(v12, "iiab/rt_file.c", 291LL, "rt_file_read");
}
}
}
return v5;
}

original_code:
ITREE *rt_file_read (RT_LLD lld, int seq, int offset)
{
     ROUTE_BUF rtbuf, *storebuf;
     struct stat sbuf;
     int r;
     ITREE *buflist;
     RT_FILED rt;
     rt = rt_file_from_lld(lld);
     r = fstat(rt->fd, &sbuf);
     if (r == -1) {
          elog_fprintf(ERROR,"iiab/rt_file.c",278,__PRETTY_FUNCTION__,"unable to stat %s", rt->p_url);
          return ((void *)0);
     }
     buflist = itree_really_create("iiab/rt_file.c",282,__PRETTY_FUNCTION__);
     if (offset >= sbuf.st_size)
          return buflist;
     lseek(rt->fd, offset, 0);
     rtbuf.buffer = nm_nmalloc(sbuf.st_size - offset + 1,"iiab/rt_file.c",287,__PRETTY_FUNCTION__);
     if (rtbuf.buffer == ((void *)0)) {
          elog_fprintf(ERROR,"iiab/rt_file.c",289,__PRETTY_FUNCTION__,"unable to nmalloc(%d) for %s data\n", sbuf.st_size - offset + 1, rt->p_url);
          itree_really_destroy(buflist,"iiab/rt_file.c",291,__PRETTY_FUNCTION__);
          return ((void *)0);
     }
     rtbuf.buflen = sbuf.st_size - offset;
     if (read(rt->fd, rtbuf.buffer, rtbuf.buflen) == -1) {
          elog_fprintf(ERROR,"iiab/rt_file.c",297,__PRETTY_FUNCTION__,"unable to read(%d, %p, %d) from %s\n", rt->fd, rtbuf.buffer, rtbuf.buflen, rt->p_url);
          itree_really_destroy(buflist,"iiab/rt_file.c",299,__PRETTY_FUNCTION__);
          nm_nfree(rtbuf.buffer,"iiab/rt_file.c",300,__PRETTY_FUNCTION__);
          return ((void *)0);
     }
     rtbuf.buffer[rtbuf.buflen] = '\0';
     storebuf = nm_xnmalloc(sizeof(ROUTE_BUF),"iiab/rt_file.c",306,__PRETTY_FUNCTION__);
     storebuf->buffer = rtbuf.buffer;
     storebuf->buflen = rtbuf.buflen;
     itree_append(buflist, storebuf);
     return buflist;
}

canonical_original_code:
struct itree_head *rt_file_read(void *lld, int seq, int offset)
{
     struct route_buffer rtbuf; struct route_buffer *storebuf;
     struct stat sbuf;
     int r;
     struct itree_head *buflist;
     struct rt_file_desc *rt;
     rt = rt_file_from_lld(lld);
     r = fstat(rt->fd, &sbuf);
     if (r == -1) {
          elog_fprintf(ERROR,"iiab/rt_file.c",278,__PRETTY_FUNCTION__,"unable to stat %s", rt->p_url);
          return ((void *)0);
     }
     buflist = itree_really_create("iiab/rt_file.c",282,__PRETTY_FUNCTION__);
     if (offset >= sbuf.st_size)
          return buflist;
     lseek(rt->fd, offset, 0);
     rtbuf.buffer = nm_nmalloc(sbuf.st_size - offset + 1,"iiab/rt_file.c",287,__PRETTY_FUNCTION__);
     if (rtbuf.buffer == ((void *)0)) {
          elog_fprintf(ERROR,"iiab/rt_file.c",289,__PRETTY_FUNCTION__,"unable to nmalloc(%d) for %s data\n", sbuf.st_size - offset + 1, rt->p_url);
          itree_really_destroy(buflist,"iiab/rt_file.c",291,__PRETTY_FUNCTION__);
          return ((void *)0);
     }
     rtbuf.buflen = sbuf.st_size - offset;
     if (read(rt->fd, rtbuf.buffer, rtbuf.buflen) == -1) {
          elog_fprintf(ERROR,"iiab/rt_file.c",297,__PRETTY_FUNCTION__,"unable to read(%d, %p, %d) from %s\n", rt->fd, rtbuf.buffer, rtbuf.buflen, rt->p_url);
          itree_really_destroy(buflist,"iiab/rt_file.c",299,__PRETTY_FUNCTION__);
          nm_nfree(rtbuf.buffer,"iiab/rt_file.c",300,__PRETTY_FUNCTION__);
          return ((void *)0);
     }
     rtbuf.buffer[rtbuf.buflen] = '\0';
     storebuf = nm_xnmalloc(sizeof(ROUTE_BUF),"iiab/rt_file.c",306,__PRETTY_FUNCTION__);
     storebuf->buffer = rtbuf.buffer;
     storebuf->buflen = rtbuf.buflen;
     itree_append(buflist, storebuf);
     return buflist;
}

variable_types: seq int

variable_types: offset int

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

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

user_defined_types: struct timespec { long tv_sec; long tv_nsec; }


decompiled_code:
__int64 __fastcall rt_file_tread(__int64 a1, __int64 a2, int a3)
{
__int64 v4; // rbx
__int64 v5; // r12
_BYTE *v7; // rax
_BYTE *v8; // r13
__int64 v9; // r14
__int64 v10; // rax
__int64 v11; // rdi
__int64 v12; // rdi
struct stat v13; // [rsp+0h] [rbp-B8h] BYREF

v4 = rt_file_from_lld(a1);
if ( fstat(*(_DWORD *)(v4 + 24), &v13) == -1 )
{
v5 = 0LL;
elog_fprintf(5LL, "iiab/rt_file.c", 331LL, "rt_file_tread", "unable to stat %s", *(const char **)(v4 + 32));
}
else
{
v5 = table_create_a(rt_file_tabschema);
if ( a3 < v13.st_size )
{
lseek(*(_DWORD *)(v4 + 24), a3, 0);
v7 = (_BYTE *)nm_nmalloc(v13.st_size - a3 + 1, "iiab/rt_file.c", 342LL, "rt_file_tread");
v8 = v7;
if ( v7 )
{
v9 = (unsigned int)(LODWORD(v13.st_size) - a3);
if ( read(*(_DWORD *)(v4 + 24), v7, (int)v9) == -1 )
{
elog_fprintf(
5LL,
"iiab/rt_file.c",
353LL,
"rt_file_tread",
"unable to read(%d, %p, %d) from %s\n",
*(unsigned int *)(v4 + 24),
v8,
v9,
*(const char **)(v4 + 32));
v11 = v5;
v5 = 0LL;
table_destroy(v11);
nm_nfree(v8, "iiab/rt_file.c", 356LL, "rt_file_tread");
}
else
{
v8[(int)v9] = 0;
table_addemptyrow(v5);
table_replacecurrentcell(v5, "data", v8);
v10 = util_i32toa(v13.st_mtim.tv_sec);
table_replacecurrentcell_alloc(v5, "_time", v10);
table_freeondestroy(v5, v8);
}
}
else
{
elog_fprintf(
5LL,
"iiab/rt_file.c",
344LL,
"rt_file_tread",
"unable to nmalloc(%d) for %s data\n",
v13.st_size - a3 + 1,
*(const char **)(v4 + 32));
v12 = v5;
v5 = 0LL;
table_destroy(v12);
}
}
}
return v5;
}

canonical_decompiled_code:
__int64 __fastcall func18(__int64 a1, __int64 a2, int a3)
{
__int64 v4; // rbx
__int64 v5; // r12
_BYTE *v7; // rax
_BYTE *v8; // r13
__int64 v9; // r14
__int64 v10; // rax
__int64 v11; // rdi
__int64 v12; // rdi
struct stat v13; // [rsp+0h] [rbp-B8h] BYREF

v4 = func12(a1);
if ( fstat(*(_DWORD *)(v4 + 24), &v13) == -1 )
{
v5 = 0LL;
elog_fprintf(5LL, "iiab/rt_file.c", 331LL, "rt_file_tread", "unable to stat %s", *(const char **)(v4 + 32));
}
else
{
v5 = table_create_a(rt_file_tabschema);
if ( a3 < v13.st_size )
{
lseek(*(_DWORD *)(v4 + 24), a3, 0);
v7 = (_BYTE *)nm_nmalloc(v13.st_size - a3 + 1, "iiab/rt_file.c", 342LL, "rt_file_tread");
v8 = v7;
if ( v7 )
{
v9 = (unsigned int)(LODWORD(v13.st_size) - a3);
if ( read(*(_DWORD *)(v4 + 24), v7, (int)v9) == -1 )
{
elog_fprintf(
5LL,
"iiab/rt_file.c",
353LL,
"rt_file_tread",
"unable to read(%d, %p, %d) from %s\n",
*(unsigned int *)(v4 + 24),
v8,
v9,
*(const char **)(v4 + 32));
v11 = v5;
v5 = 0LL;
table_destroy(v11);
nm_nfree(v8, "iiab/rt_file.c", 356LL, "rt_file_tread");
}
else
{
v8[(int)v9] = 0;
table_addemptyrow(v5);
table_replacecurrentcell(v5, "data", v8);
v10 = util_i32toa(v13.st_mtim.tv_sec);
table_replacecurrentcell_alloc(v5, "_time", v10);
table_freeondestroy(v5, v8);
}
}
else
{
elog_fprintf(
5LL,
"iiab/rt_file.c",
344LL,
"rt_file_tread",
"unable to nmalloc(%d) for %s data\n",
v13.st_size - a3 + 1,
*(const char **)(v4 + 32));
v12 = v5;
v5 = 0LL;
table_destroy(v12);
}
}
}
return v5;
}

original_code:
TABLE rt_file_tread (RT_LLD lld, int seq, int offset)
{
     RT_FILED rt;
     struct stat sbuf;
     TABLE tab;
     char *buf;
     int r, buflen;
     rt = rt_file_from_lld(lld);
     r = fstat(rt->fd, &sbuf);
     if (r == -1) {
   elog_fprintf(ERROR,"iiab/rt_file.c",331,__PRETTY_FUNCTION__,"unable to stat %s", rt->p_url);
   return ((void *)0);
     }
     tab = table_create_a(rt_file_tabschema);
     if (offset >= sbuf.st_size)
   return tab;
     lseek(rt->fd, offset, 0);
     buf = nm_nmalloc(sbuf.st_size - offset + 1,"iiab/rt_file.c",342,__PRETTY_FUNCTION__);
     if (buf == ((void *)0)) {
   elog_fprintf(ERROR,"iiab/rt_file.c",344,__PRETTY_FUNCTION__,"unable to nmalloc(%d) for %s data\n", sbuf.st_size - offset + 1, rt->p_url);
   table_destroy(tab);
   return ((void *)0);
     }
     buflen = sbuf.st_size - offset;
     if (read(rt->fd, buf, buflen) == -1) {
   elog_fprintf(ERROR,"iiab/rt_file.c",353,__PRETTY_FUNCTION__,"unable to read(%d, %p, %d) from %s\n", rt->fd,buf, buflen, rt->p_url);
   table_destroy(tab);
   nm_nfree(buf,"iiab/rt_file.c",356,__PRETTY_FUNCTION__);
   return ((void *)0);
     }
     *(buf+buflen) = '\0';
     table_addemptyrow(tab);
     table_replacecurrentcell(tab, "data", buf);
     table_replacecurrentcell_alloc(tab, "_time", util_i32toa(sbuf.st_mtim.tv_sec));
     table_freeondestroy(tab, buf);
     return tab;
}

canonical_original_code:
struct table_info *rt_file_tread(void *lld, int seq, int offset)
{
     struct rt_file_desc *rt;
     struct stat sbuf;
     struct table_info *tab;
     char *buf;
     int r; int buflen;
     rt = rt_file_from_lld(lld);
     r = fstat(rt->fd, &sbuf);
     if (r == -1) {
   elog_fprintf(ERROR,"iiab/rt_file.c",331,__PRETTY_FUNCTION__,"unable to stat %s", rt->p_url);
   return ((void *)0);
     }
     tab = table_create_a(rt_file_tabschema);
     if (offset >= sbuf.st_size)
   return tab;
     lseek(rt->fd, offset, 0);
     buf = nm_nmalloc(sbuf.st_size - offset + 1,"iiab/rt_file.c",342,__PRETTY_FUNCTION__);
     if (buf == ((void *)0)) {
   elog_fprintf(ERROR,"iiab/rt_file.c",344,__PRETTY_FUNCTION__,"unable to nmalloc(%d) for %s data\n", sbuf.st_size - offset + 1, rt->p_url);
   table_destroy(tab);
   return ((void *)0);
     }
     buflen = sbuf.st_size - offset;
     if (read(rt->fd, buf, buflen) == -1) {
   elog_fprintf(ERROR,"iiab/rt_file.c",353,__PRETTY_FUNCTION__,"unable to read(%d, %p, %d) from %s\n", rt->fd,buf, buflen, rt->p_url);
   table_destroy(tab);
   nm_nfree(buf,"iiab/rt_file.c",356,__PRETTY_FUNCTION__);
   return ((void *)0);
     }
     *(buf+buflen) = '\0';
     table_addemptyrow(tab);
     table_replacecurrentcell(tab, "data", buf);
     table_replacecurrentcell_alloc(tab, "_time", util_i32toa(sbuf.st_mtim.tv_sec));
     table_freeondestroy(tab, buf);
     return tab;
}

variable_types: struct rt_file_desc { int magic; char *prefix; char *description; int fd; char *p_url; char *filepath; } *

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:
_BOOL8 __fastcall rt_file_checkpoint(__int64 a1)
{
__int64 v1; // rax

v1 = rt_file_from_lld(a1);
return fsync(*(_DWORD *)(v1 + 24)) == 0;
}

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

v1 = func12(a1);
return fsync(*(_DWORD *)(v1 + 24)) == 0;
}

original_code:
int rt_file_checkpoint (RT_LLD lld)
{
     RT_FILED rt;
     int r;
     rt = rt_file_from_lld(lld);
     r = fsync(rt->fd);
     if (r)
          return 0;
     else
   return 1;
}

canonical_original_code:
int rt_file_checkpoint(void *lld)
{
     struct rt_file_desc *rt;
     int r;
     rt = rt_file_from_lld(lld);
     r = fsync(rt->fd);
     if (r)
          return 0;
     else
   return 1;
}


decompiled_code:
void uipref_fini()
{
;
}

canonical_decompiled_code:
void func4()
{
;
}

original_code:
void uipref_fini()
{
}

canonical_original_code:
void uipref_fini()
{
}


decompiled_code:
char **plinup_getcols()
{
return &plinup_cols;
}

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

original_code: struct probe_sampletab *plinup_getcols() {return plinup_cols;}

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


decompiled_code:
void *plinup_getrowdiff()
{
return &plinup_diffs;
}

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

original_code: struct probe_rowdiff *plinup_getrowdiff() {return plinup_diffs;}

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


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

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

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

return_type: char **


decompiled_code:
void plinup_fini()
{
;
}

original_code:
void plinup_fini()
{
}

canonical_original_code:
void plinup_fini()
{
}


decompiled_code:
__int64 __fastcall plinup_col_cpuinfo(__int64 a1, char *a2)
{
char *v3; // rdi
int v4; // er12
char *v5; // rax
const char *v6; // r14
char *v7; // rax
char *v8; // r15
const unsigned __int16 *v9; // rcx
__int64 v10; // rdi
__int64 v11; // rax

if ( !a2 )
{
v10 = 0LL;
goto LABEL_19;
}
v3 = a2;
v4 = 0;
while ( 1 )
{
v5 = strtok(v3, "\t:");
if ( !v5 )
break;
if ( !strcmp(v5, "vendor_id") )
{
v6 = "vendor";
goto LABEL_12;
}
if ( !strcmp(v5, "model name") )
{
v6 = "model";
goto LABEL_12;
}
if ( !strcmp(v5, "cpu MHz") )
{
v6 = "mhz";
goto LABEL_12;
}
if ( !strcmp(v5, "cache size") )
{
v6 = "cache";
goto LABEL_12;
}
v6 = "fpu";
if ( !strcmp(v5, "fpu") )
{
LABEL_12:
v8 = strtok(0LL, "\n");
v9 = *_ctype_b_loc();
while ( (v9[*v8] & 8) == 0 )
++v8;
table_replacecurrentcell(a1, v6, v8);
v3 = &v8[strlen(v8) + 1];
}
else
{
v4 += strcmp(v5, "processor") == 0;
v7 = strtok(0LL, "\n");
if ( !v7 )
break;
v3 = &v7[strlen(v7) + 1];
}
}
v10 = v4;
LABEL_19:
v11 = util_i32toa(v10);
return table_replacecurrentcell_alloc(a1, "nproc", v11);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, char *a2)
{
char *v3; // rdi
int v4; // er12
char *v5; // rax
const char *v6; // r14
char *v7; // rax
char *v8; // r15
const unsigned __int16 *v9; // rcx
__int64 v10; // rdi
__int64 v11; // rax

if ( !a2 )
{
v10 = 0LL;
goto LABEL_19;
}
v3 = a2;
v4 = 0;
while ( 1 )
{
v5 = strtok(v3, "\t:");
if ( !v5 )
break;
if ( !strcmp(v5, "vendor_id") )
{
v6 = "vendor";
goto LABEL_12;
}
if ( !strcmp(v5, "model name") )
{
v6 = "model";
goto LABEL_12;
}
if ( !strcmp(v5, "cpu MHz") )
{
v6 = "mhz";
goto LABEL_12;
}
if ( !strcmp(v5, "cache size") )
{
v6 = "cache";
goto LABEL_12;
}
v6 = "fpu";
if ( !strcmp(v5, "fpu") )
{
LABEL_12:
v8 = strtok(0LL, "\n");
v9 = *_ctype_b_loc();
while ( (v9[*v8] & 8) == 0 )
++v8;
table_replacecurrentcell(a1, v6, v8);
v3 = &v8[strlen(v8) + 1];
}
else
{
v4 += strcmp(v5, "processor") == 0;
v7 = strtok(0LL, "\n");
if ( !v7 )
break;
v3 = &v7[strlen(v7) + 1];
}
}
v10 = v4;
LABEL_19:
v11 = util_i32toa(v10);
return table_replacecurrentcell_alloc(a1, "nproc", v11);
}

original_code:
void plinup_col_cpuinfo(TABLE tab, char *data)
{
     char *linecheck, *name;
     int nproc=0;
     linecheck = data;
     while (linecheck != ((void *)0)) {
   linecheck = strtok(linecheck, "\t:");
   if (linecheck == ((void *)0))
        break;
   else if (strcmp(linecheck, "vendor_id") == 0)
        name = "vendor";
   else if (strcmp(linecheck, "model name") == 0)
        name = "model";
   else if (strcmp(linecheck, "cpu MHz") == 0)
        name = "mhz";
   else if (strcmp(linecheck, "cache size") == 0)
        name = "cache";
   else if (strcmp(linecheck, "fpu") == 0)
        name = "fpu";
   else {
        if (strcmp(linecheck, "processor") == 0)
      nproc++;
        linecheck = strtok(((void *)0), "\n");
        if (linecheck == ((void *)0))
      break;
        linecheck += strlen(linecheck)+1;
        continue;
   }
   linecheck = strtok(((void *)0), "\n");
   while (!((*__ctype_b_loc ())[(int) ((*linecheck))] & (unsigned short int) _ISalnum))
        linecheck++;
   table_replacecurrentcell(tab, name, linecheck);
   linecheck += strlen(linecheck)+1;
     }
     table_replacecurrentcell_alloc(tab, "nproc", util_i32toa(nproc));
}

canonical_original_code:
void plinup_col_cpuinfo(struct table_info *tab, char *data)
{
     char *linecheck; char *name;
     int nproc = 0;
     linecheck = data;
     while (linecheck != ((void *)0)) {
   linecheck = strtok(linecheck, "\t:");
   if (linecheck == ((void *)0))
        break;
   else if (strcmp(linecheck, "vendor_id") == 0)
        name = "vendor";
   else if (strcmp(linecheck, "model name") == 0)
        name = "model";
   else if (strcmp(linecheck, "cpu MHz") == 0)
        name = "mhz";
   else if (strcmp(linecheck, "cache size") == 0)
        name = "cache";
   else if (strcmp(linecheck, "fpu") == 0)
        name = "fpu";
   else {
        if (strcmp(linecheck, "processor") == 0)
      nproc++;
        linecheck = strtok(((void *)0), "\n");
        if (linecheck == ((void *)0))
      break;
        linecheck += strlen(linecheck)+1;
        continue;
   }
   linecheck = strtok(((void *)0), "\n");
   while (!((*__ctype_b_loc ())[(int) ((*linecheck))] & (unsigned short) _ISalnum))
        linecheck++;
   table_replacecurrentcell(tab, name, linecheck);
   linecheck += strlen(linecheck)+1;
     }
     table_replacecurrentcell_alloc(tab, "nproc", util_i32toa(nproc));
}

variable_types:
data
char *

variable_types:
linecheck
char *

variable_types:
name
char *

variable_types: nproc int


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

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

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

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

original_code:
int plinup_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/plinup.c",230,__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/plinup.c",237,__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 plinup_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/plinup.c",230,__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/plinup.c",237,__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 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 *

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 plinup_col_uptime(__int64 a1, char *a2)
{
char *v2; // r12
time_t v3; // rbx
__int64 v4; // rax
__int64 v5; // rax
__int64 v7; // rax
time_t v8; // rbx
__int64 v9; // rax
__int64 v10; // rax
time_t timer; // [rsp+8h] [rbp-30h] BYREF
__int64 v12; // [rsp+10h] [rbp-28h] BYREF
__int64 v13[4]; // [rsp+18h] [rbp-20h] BYREF

v2 = strtok(a2, " ");
table_replacecurrentcell(a1, "uptime", v2);
v13[0] = 0LL;
time(&timer);
if ( !access("/var/run/utmp", 4) )
{
if ( (unsigned int)plinup_getutmpuptime(&v12, v13, "/var/run/utmp") )
{
v7 = util_i32toa(v13[0]);
table_replacecurrentcell_alloc(a1, "boot", v7);
if ( v13[0] )
goto LABEL_3;
LABEL_6:
v8 = timer;
v9 = strtol(v2, 0LL, 10);
v10 = util_i32toa(v8 - v9);
table_replacecurrentcell_alloc(a1, "boot", v10);
goto LABEL_3;
}
elog_fsend(4LL, "probe/plinup.c", 118LL, "plinup_col_uptime", "Unable to read downtime from utmp");
}
if ( !v13[0] )
goto LABEL_6;
LABEL_3:
v3 = timer;
v4 = strtol(v2, 0LL, 10);
v5 = util_i32toa(v3 - v4 - v13[0]);
return table_replacecurrentcell_alloc(a1, "suspend", v5);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, char *a2)
{
char *v2; // r12
time_t v3; // rbx
__int64 v4; // rax
__int64 v5; // rax
__int64 v7; // rax
time_t v8; // rbx
__int64 v9; // rax
__int64 v10; // rax
time_t timer; // [rsp+8h] [rbp-30h] BYREF
__int64 v12; // [rsp+10h] [rbp-28h] BYREF
__int64 v13[4]; // [rsp+18h] [rbp-20h] BYREF

v2 = strtok(a2, " ");
table_replacecurrentcell(a1, "uptime", v2);
v13[0] = 0LL;
time(&timer);
if ( !access("/var/run/utmp", 4) )
{
if ( (unsigned int)func6(&v12, v13, "/var/run/utmp") )
{
v7 = util_i32toa(v13[0]);
table_replacecurrentcell_alloc(a1, "boot", v7);
if ( v13[0] )
goto LABEL_3;
LABEL_6:
v8 = timer;
v9 = strtol(v2, 0LL, 10);
v10 = util_i32toa(v8 - v9);
table_replacecurrentcell_alloc(a1, "boot", v10);
goto LABEL_3;
}
elog_fsend(4LL, "probe/plinup.c", 118LL, "plinup_col_uptime", "Unable to read downtime from utmp");
}
if ( !v13[0] )
goto LABEL_6;
LABEL_3:
v3 = timer;
v4 = strtol(v2, 0LL, 10);
v5 = util_i32toa(v3 - v4 - v13[0]);
return table_replacecurrentcell_alloc(a1, "suspend", v5);
}

original_code:
void plinup_col_uptime(TABLE tab, char *data)
{
     char *uptime;
     time_t now, down, boot;
     uptime = strtok(data, " ");
     table_replacecurrentcell(tab, "uptime", uptime);
     boot=0;
     time(&now);
     if (access("/var/run/utmp", 4) == 0) {
   if (plinup_getutmpuptime(&down, &boot, "/var/run/utmp"))
        table_replacecurrentcell_alloc(tab, "boot", util_i32toa(boot));
   else
        elog_fsend(WARNING,"probe/plinup.c",118,__PRETTY_FUNCTION__,"Unable to read downtime from utmp");
     }
     if (boot == 0)
   table_replacecurrentcell_alloc(tab, "boot",
      util_i32toa(now-strtol(uptime, ((void *)0), 10)));
     table_replacecurrentcell_alloc(tab, "suspend",
        util_i32toa((now-strtol(uptime, ((void *)0), 10))-boot));
}

canonical_original_code:
void plinup_col_uptime(struct table_info *tab, char *data)
{
     char *uptime;
     long now; long down; long boot;
     uptime = strtok(data, " ");
     table_replacecurrentcell(tab, "uptime", uptime);
     boot=0;
     time(&now);
     if (access("/var/run/utmp", 4) == 0) {
   if (plinup_getutmpuptime(&down, &boot, "/var/run/utmp"))
        table_replacecurrentcell_alloc(tab, "boot", util_i32toa(boot));
   else
        elog_fsend(WARNING,"probe/plinup.c",118,__PRETTY_FUNCTION__,"Unable to read downtime from utmp");
     }
     if (boot == 0)
   table_replacecurrentcell_alloc(tab, "boot",
      util_i32toa(now-strtol(uptime, ((void *)0), 10)));
     table_replacecurrentcell_alloc(tab, "suspend",
        util_i32toa((now-strtol(uptime, ((void *)0), 10))-boot));
}

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:
uptime
char *

variable_types: now long

variable_types: down long

variable_types: boot long


decompiled_code:
char *__fastcall plinup_collect(__int64 a1)
{
__int64 v1; // rax
char *v2; // r12
char *result; // rax
char *v4; // r12

v1 = probe_readfile("/proc/uptime");
if ( !v1 )
return (char *)elog_fsend(
5LL,
"probe/plinup.c",
68LL,
"plinup_collect",
"no data from uptime; no further sampling will take place");
v2 = (char *)v1;
table_addemptyrow(a1);
plinup_col_uptime(a1, v2);
table_freeondestroy(a1, v2);
result = (char *)probe_readfile("/proc/cpuinfo");
v4 = result;
if ( result )
{
plinup_col_cpuinfo(a1, result);
result = (char *)table_freeondestroy(a1, v4);
}
return result;
}

canonical_decompiled_code:
char *__fastcall func8(__int64 a1)
{
__int64 v1; // rax
char *v2; // r12
char *result; // rax
char *v4; // r12

v1 = probe_readfile("/proc/uptime");
if ( !v1 )
return (char *)elog_fsend(
5LL,
"probe/plinup.c",
68LL,
"plinup_collect",
"no data from uptime; no further sampling will take place");
v2 = (char *)v1;
table_addemptyrow(a1);
func7(a1, v2);
table_freeondestroy(a1, v2);
result = (char *)probe_readfile("/proc/cpuinfo");
v4 = result;
if ( result )
{
func5(a1, result);
result = (char *)table_freeondestroy(a1, v4);
}
return result;
}

original_code:
void plinup_collect(TABLE tab) {
     char * data;
     data = probe_readfile("/proc/uptime");
     if (data) {
   table_addemptyrow(tab);
   plinup_col_uptime(tab, data);
   table_freeondestroy(tab, data);
     } else {
   elog_fsend(ERROR,"probe/plinup.c",68,__PRETTY_FUNCTION__,"no data from uptime; no further sampling " "will take place");
   return;
     }
     data = probe_readfile("/proc/cpuinfo");
     if (data) {
   plinup_col_cpuinfo(tab, data);
   table_freeondestroy(tab, data);
     }
}

canonical_original_code:
void plinup_collect(struct table_info *tab) {
     char *data;
     data = probe_readfile("/proc/uptime");
     if (data) {
   table_addemptyrow(tab);
   plinup_col_uptime(tab, data);
   table_freeondestroy(tab, data);
     } else {
   elog_fsend(ERROR,"probe/plinup.c",68,__PRETTY_FUNCTION__,"no data from uptime; no further sampling " "will take place");
   return;
     }
     data = probe_readfile("/proc/cpuinfo");
     if (data) {
   plinup_col_cpuinfo(tab, data);
   table_freeondestroy(tab, data);
     }
}


decompiled_code:
void plinup_derive()
{
;
}

canonical_decompiled_code:
void func9()
{
;
}

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

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

variable_types:
cur
struct table_info *


decompiled_code:
void uiabout_fini()
{
;
}

canonical_decompiled_code:
void func1()
{
;
}

original_code:
void uiabout_fini() {
}

canonical_original_code:
void uiabout_fini() {
}


decompiled_code:
__int64 __fastcall uiabout_browse_web(const char *a1)
{
char *v2; // rax
char **v3; // rbx
char *v4; // rdi
char *v5; // r12
const char *v6; // rbp
__int64 result; // rax
int v8; // ebx
char v9[5160]; // [rsp+0h] [rbp-1428h] BYREF

v2 = getenv("PATH");
v3 = uiabout_browsers;
v4 = uiabout_browsers[0];
if ( !uiabout_browsers[0] )
{
LABEL_7:
elog_fprintf(4LL, "myhabitat/uiabout.c", 115LL, "uiabout_browse_web", "Unable to find a known browser in the PATH");
return 0LL;
}
v5 = v2;
while ( 1 )
{
v6 = (const char *)util_whichdir(v4, v5);
if ( v6 )
break;
LABEL_6:
v4 = v3[1];
++v3;
if ( !v4 )
goto LABEL_7;
}
if ( !access(*v3, 1) )
{
nm_nfree(v6, "myhabitat/uiabout.c", 111LL, "uiabout_browse_web");
goto LABEL_6;
}
elog_fprintf(3LL, "myhabitat/uiabout.c", 99LL, "uiabout_browse_web", "Starting browser...");
snprintf(v9, 0x1400uLL, "%s %s &", v6, a1);
v8 = system(v9);
nm_nfree(v6, "myhabitat/uiabout.c", 102LL, "uiabout_browse_web");
result = 1LL;
if ( v8 == -1 )
{
elog_fprintf(5LL, "myhabitat/uiabout.c", 104LL, "uiabout_browse_web", "Unable to run browser (using %s)", v9);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(const char *a1)
{
char *v2; // rax
char **v3; // rbx
char *v4; // rdi
char *v5; // r12
const char *v6; // rbp
__int64 result; // rax
int v8; // ebx
char v9[5160]; // [rsp+0h] [rbp-1428h] BYREF

v2 = getenv("PATH");
v3 = uiabout_browsers;
v4 = uiabout_browsers[0];
if ( !uiabout_browsers[0] )
{
LABEL_7:
elog_fprintf(4LL, "myhabitat/uiabout.c", 115LL, "uiabout_browse_web", "Unable to find a known browser in the PATH");
return 0LL;
}
v5 = v2;
while ( 1 )
{
v6 = (const char *)util_whichdir(v4, v5);
if ( v6 )
break;
LABEL_6:
v4 = v3[1];
++v3;
if ( !v4 )
goto LABEL_7;
}
if ( !access(*v3, 1) )
{
nm_nfree(v6, "myhabitat/uiabout.c", 111LL, "uiabout_browse_web");
goto LABEL_6;
}
elog_fprintf(3LL, "myhabitat/uiabout.c", 99LL, "uiabout_browse_web", "Starting browser...");
snprintf(v9, 0x1400uLL, "%s %s &", v6, a1);
v8 = system(v9);
nm_nfree(v6, "myhabitat/uiabout.c", 102LL, "uiabout_browse_web");
result = 1LL;
if ( v8 == -1 )
{
elog_fprintf(5LL, "myhabitat/uiabout.c", 104LL, "uiabout_browse_web", "Unable to run browser (using %s)", v9);
result = 0LL;
}
return result;
}

original_code:
int uiabout_browse_web(char *url)
{
     char **b, *pathenv, *match, cmd[4096 +1024];
     int r;
     pathenv = getenv("PATH");
     for (b = uiabout_browsers; *b; b++) {
   match = util_whichdir(*b, pathenv);
   if (match) {
        r = access(*b, 1);
        if (r != 0) {
      elog_fprintf(INFO,"myhabitat/uiabout.c",99,__PRETTY_FUNCTION__,"Starting browser...");
      snprintf(cmd, 4096 +1024, "%s %s &", match, url);
      r = system(cmd);
      nm_nfree(match,"myhabitat/uiabout.c",102,__PRETTY_FUNCTION__);
      if (r == -1) {
           elog_fprintf(ERROR,"myhabitat/uiabout.c",104,__PRETTY_FUNCTION__,"Unable to run browser (using %s)", cmd);
    return 0;
      } else {
    return 1;
      }
        }
        nm_nfree(match,"myhabitat/uiabout.c",111,__PRETTY_FUNCTION__);
   }
     }
     elog_fprintf(WARNING,"myhabitat/uiabout.c",115,__PRETTY_FUNCTION__,"Unable to find a known browser in the PATH");
     return 0;
}

canonical_original_code:
int uiabout_browse_web(char *url)
{
     char **b; char *pathenv; char *match; char cmd[-1];
     int r;
     pathenv = getenv("PATH");
     for (b = uiabout_browsers; *b; b++) {
   match = util_whichdir(*b, pathenv);
   if (match) {
        r = access(*b, 1);
        if (r != 0) {
      elog_fprintf(INFO,"myhabitat/uiabout.c",99,__PRETTY_FUNCTION__,"Starting browser...");
      snprintf(cmd, 4096 +1024, "%s %s &", match, url);
      r = system(cmd);
      nm_nfree(match,"myhabitat/uiabout.c",102,__PRETTY_FUNCTION__);
      if (r == -1) {
           elog_fprintf(ERROR,"myhabitat/uiabout.c",104,__PRETTY_FUNCTION__,"Unable to run browser (using %s)", cmd);
    return 0;
      } else {
    return 1;
      }
        }
        nm_nfree(match,"myhabitat/uiabout.c",111,__PRETTY_FUNCTION__);
   }
     }
     elog_fprintf(WARNING,"myhabitat/uiabout.c",115,__PRETTY_FUNCTION__,"Unable to find a known browser in the PATH");
     return 0;
}

variable_types:
url
char *

variable_types:
b
char **

variable_types:
pathenv
char *

variable_types:
match
char *

variable_types:
cmd
char [-1]

variable_types: r int


decompiled_code:
__int64 __fastcall uiabout_browse_help(__int64 a1)
{
const char *v1; // rbp
__int64 v2; // rcx
const char *v3; // r13
unsigned int v4; // er12
__int64 result; // rax

v1 = (const char *)util_strjoin(iiab_dir_lib, "/help/", a1, 0LL);
if ( access(v1, 4) )
{
elog_fprintf(3LL, "myhabitat/uiabout.c", 134LL, "uiabout_browse_help", "Unable to show help %s", v1);
nm_nfree(v1, "myhabitat/uiabout.c", 135LL, "uiabout_browse_help");
v1 = (const char *)util_strjoin(iiab_dir_bin, "/../help/html/", a1, 0LL);
}
if ( access(v1, 4) )
{
elog_fprintf(5LL, "myhabitat/uiabout.c", 141LL, "uiabout_browse_help", "Unable to show help %s", v1);
nm_nfree(v1, "myhabitat/uiabout.c", 142LL, "uiabout_browse_help");
result = 0LL;
}
else
{
v3 = (const char *)util_strjoin("file://localhost", v1, 0LL, v2);
nm_nfree(v1, "myhabitat/uiabout.c", 148LL, "uiabout_browse_help");
v4 = uiabout_browse_web(v3);
nm_nfree(v3, "myhabitat/uiabout.c", 152LL, "uiabout_browse_help");
result = v4;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
const char *v1; // rbp
__int64 v2; // rcx
const char *v3; // r13
unsigned int v4; // er12
__int64 result; // rax

v1 = (const char *)util_strjoin(iiab_dir_lib, "/help/", a1, 0LL);
if ( access(v1, 4) )
{
elog_fprintf(3LL, "myhabitat/uiabout.c", 134LL, "uiabout_browse_help", "Unable to show help %s", v1);
nm_nfree(v1, "myhabitat/uiabout.c", 135LL, "uiabout_browse_help");
v1 = (const char *)util_strjoin(iiab_dir_bin, "/../help/html/", a1, 0LL);
}
if ( access(v1, 4) )
{
elog_fprintf(5LL, "myhabitat/uiabout.c", 141LL, "uiabout_browse_help", "Unable to show help %s", v1);
nm_nfree(v1, "myhabitat/uiabout.c", 142LL, "uiabout_browse_help");
result = 0LL;
}
else
{
v3 = (const char *)util_strjoin("file://localhost", v1, 0LL, v2);
nm_nfree(v1, "myhabitat/uiabout.c", 148LL, "uiabout_browse_help");
v4 = func3(v3);
nm_nfree(v3, "myhabitat/uiabout.c", 152LL, "uiabout_browse_help");
result = v4;
}
return result;
}

original_code:
int uiabout_browse_help(char *helpfile)
{
     char *url, *file;
     int r;
     file = util_strjoin(iiab_dir_lib, "/help/", helpfile, ((void *)0));
     if (access(file, 4) != 0) {
   elog_fprintf(INFO,"myhabitat/uiabout.c",134,__PRETTY_FUNCTION__,"Unable to show help %s", file);
   nm_nfree(file,"myhabitat/uiabout.c",135,__PRETTY_FUNCTION__);
   file = util_strjoin(iiab_dir_bin, "/../help/html/", helpfile,
         ((void *)0));
     }
     if (access(file, 4) != 0) {
   elog_fprintf(ERROR,"myhabitat/uiabout.c",141,__PRETTY_FUNCTION__,"Unable to show help %s", file);
   nm_nfree(file,"myhabitat/uiabout.c",142,__PRETTY_FUNCTION__);
   return 0;
     }
     url = util_strjoin("file://localhost", file, ((void *)0));
     nm_nfree(file,"myhabitat/uiabout.c",148,__PRETTY_FUNCTION__);
     r = uiabout_browse_web(url);
     nm_nfree(url,"myhabitat/uiabout.c",152,__PRETTY_FUNCTION__);
     return r;
}

canonical_original_code:
int uiabout_browse_help(char *helpfile)
{
     char *url; char *file;
     int r;
     file = util_strjoin(iiab_dir_lib, "/help/", helpfile, ((void *)0));
     if (access(file, 4) != 0) {
   elog_fprintf(INFO,"myhabitat/uiabout.c",134,__PRETTY_FUNCTION__,"Unable to show help %s", file);
   nm_nfree(file,"myhabitat/uiabout.c",135,__PRETTY_FUNCTION__);
   file = util_strjoin(iiab_dir_bin, "/../help/html/", helpfile,
         ((void *)0));
     }
     if (access(file, 4) != 0) {
   elog_fprintf(ERROR,"myhabitat/uiabout.c",141,__PRETTY_FUNCTION__,"Unable to show help %s", file);
   nm_nfree(file,"myhabitat/uiabout.c",142,__PRETTY_FUNCTION__);
   return 0;
     }
     url = util_strjoin("file://localhost", file, ((void *)0));
     nm_nfree(file,"myhabitat/uiabout.c",148,__PRETTY_FUNCTION__);
     r = uiabout_browse_web(url);
     nm_nfree(url,"myhabitat/uiabout.c",152,__PRETTY_FUNCTION__);
     return r;
}

variable_types:
helpfile
char *

variable_types:
file
char *


decompiled_code:
__int64 __fastcall uiabout_browse_man(const char *a1)
{
const char *v1; // rbp
__int64 v2; // rcx
const char *v3; // r13
unsigned int v4; // er12
__int64 result; // rax

v1 = (const char *)util_strjoin(iiab_dir_lib, "/html/", a1, 0LL);
if ( access(v1, 4) )
{
elog_fprintf(
3LL,
"myhabitat/uiabout.c",
171LL,
"uiabout_browse_man",
"Unable to show manpage in production location %s (%s)",
a1,
v1);
nm_nfree(v1, "myhabitat/uiabout.c", 173LL, "uiabout_browse_man");
v1 = (const char *)util_strjoin(iiab_dir_bin, "/../html/", a1, 0LL);
}
if ( access(v1, 4) )
{
elog_fprintf(
5LL,
"myhabitat/uiabout.c",
178LL,
"uiabout_browse_man",
"Unable to show manpage %s in development locations (%s)",
a1,
v1);
nm_nfree(v1, "myhabitat/uiabout.c", 180LL, "uiabout_browse_man");
result = 0LL;
}
else
{
v3 = (const char *)util_strjoin("file://", v1, 0LL, v2);
nm_nfree(v1, "myhabitat/uiabout.c", 186LL, "uiabout_browse_man");
v4 = uiabout_browse_web(v3);
nm_nfree(v3, "myhabitat/uiabout.c", 190LL, "uiabout_browse_man");
result = v4;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1)
{
const char *v1; // rbp
__int64 v2; // rcx
const char *v3; // r13
unsigned int v4; // er12
__int64 result; // rax

v1 = (const char *)util_strjoin(iiab_dir_lib, "/html/", a1, 0LL);
if ( access(v1, 4) )
{
elog_fprintf(
3LL,
"myhabitat/uiabout.c",
171LL,
"uiabout_browse_man",
"Unable to show manpage in production location %s (%s)",
a1,
v1);
nm_nfree(v1, "myhabitat/uiabout.c", 173LL, "uiabout_browse_man");
v1 = (const char *)util_strjoin(iiab_dir_bin, "/../html/", a1, 0LL);
}
if ( access(v1, 4) )
{
elog_fprintf(
5LL,
"myhabitat/uiabout.c",
178LL,
"uiabout_browse_man",
"Unable to show manpage %s in development locations (%s)",
a1,
v1);
nm_nfree(v1, "myhabitat/uiabout.c", 180LL, "uiabout_browse_man");
result = 0LL;
}
else
{
v3 = (const char *)util_strjoin("file://", v1, 0LL, v2);
nm_nfree(v1, "myhabitat/uiabout.c", 186LL, "uiabout_browse_man");
v4 = func3(v3);
nm_nfree(v3, "myhabitat/uiabout.c", 190LL, "uiabout_browse_man");
result = v4;
}
return result;
}

original_code:
int uiabout_browse_man(char *manpage)
{
     char *url, *file;
     int r;
     file = util_strjoin(iiab_dir_lib, "/html/", manpage, ((void *)0));
     if (access(file, 4) != 0) {
   elog_fprintf(INFO,"myhabitat/uiabout.c",171,__PRETTY_FUNCTION__,"Unable to show manpage in production location " "%s (%s)", manpage, file);
   nm_nfree(file,"myhabitat/uiabout.c",173,__PRETTY_FUNCTION__);
   file = util_strjoin(iiab_dir_bin, "/../html/", manpage, ((void *)0));
     }
     if (access(file, 4) != 0) {
   elog_fprintf(ERROR,"myhabitat/uiabout.c",178,__PRETTY_FUNCTION__,"Unable to show manpage %s in development " "locations (%s)", manpage, file);
   nm_nfree(file,"myhabitat/uiabout.c",180,__PRETTY_FUNCTION__);
   return 0;
     }
     url = util_strjoin("file://", file, ((void *)0));
     nm_nfree(file,"myhabitat/uiabout.c",186,__PRETTY_FUNCTION__);
     r = uiabout_browse_web(url);
     nm_nfree(url,"myhabitat/uiabout.c",190,__PRETTY_FUNCTION__);
     return r;
}

canonical_original_code:
int uiabout_browse_man(char *manpage)
{
     char *url; char *file;
     int r;
     file = util_strjoin(iiab_dir_lib, "/html/", manpage, ((void *)0));
     if (access(file, 4) != 0) {
   elog_fprintf(INFO,"myhabitat/uiabout.c",171,__PRETTY_FUNCTION__,"Unable to show manpage in production location " "%s (%s)", manpage, file);
   nm_nfree(file,"myhabitat/uiabout.c",173,__PRETTY_FUNCTION__);
   file = util_strjoin(iiab_dir_bin, "/../html/", manpage, ((void *)0));
     }
     if (access(file, 4) != 0) {
   elog_fprintf(ERROR,"myhabitat/uiabout.c",178,__PRETTY_FUNCTION__,"Unable to show manpage %s in development " "locations (%s)", manpage, file);
   nm_nfree(file,"myhabitat/uiabout.c",180,__PRETTY_FUNCTION__);
   return 0;
     }
     url = util_strjoin("file://", file, ((void *)0));
     nm_nfree(file,"myhabitat/uiabout.c",186,__PRETTY_FUNCTION__);
     r = uiabout_browse_web(url);
     nm_nfree(url,"myhabitat/uiabout.c",190,__PRETTY_FUNCTION__);
     return r;
}

variable_types:
manpage
char *


decompiled_code:
__int64 rt_http_magic()
{
return 998544LL;
}

original_code: int rt_http_magic() { return 998544; }

canonical_original_code: int rt_http_magic() { return 998544; }


decompiled_code:
const char *rt_http_prefix()
{
return "http";
}

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

original_code: char * rt_http_prefix() { return "http"; }


decompiled_code:
const char *rt_http_description()
{
return "http client access using curl";
}

canonical_decompiled_code:
const char *func2()
{
return "http client access using curl";
}

original_code: char * rt_http_description() { return "http client access using curl"; }


decompiled_code:
__int64 rt_https_magic()
{
return 998545LL;
}

original_code: int rt_https_magic() { return 998545; }

canonical_original_code: int rt_https_magic() { return 998545; }


decompiled_code:
const char *rt_https_prefix()
{
return "https";
}

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

original_code: char * rt_https_prefix() { return "https"; }


decompiled_code:
const char *rt_https_description()
{
return "secure http client access using curl";
}

canonical_decompiled_code:
const char *func5()
{
return "secure http client access using curl";
}

original_code: char * rt_https_description() { return "secure http client access using curl"; }


decompiled_code:
void rt_http_init()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

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

canonical_original_code: void rt_http_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_http_fini()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code: void rt_http_fini () {}

canonical_original_code: void rt_http_fini() {}


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

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

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

variable_types:
password
char *

variable_types:
basename
char *

variable_types: flag int


decompiled_code:
__int64 rt_http_twrite()
{
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func9()
{
return 0xFFFFFFFFLL;
}

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

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

variable_types:
lld
void *

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_http_tell(__int64 a1, _DWORD *a2, _DWORD *a3, _QWORD *a4)
{
__int64 result; // rax

*a2 = 0;
result = 1LL;
*a3 = 0;
*a4 = 0LL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, _DWORD *a2, _DWORD *a3, _QWORD *a4)
{
__int64 result; // rax

*a2 = 0;
result = 1LL;
*a3 = 0;
*a4 = 0LL;
return result;
}

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

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

variable_types:
seq
int *

variable_types:
size
int *

variable_types:
modt
long *


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

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

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

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


decompiled_code:
__int64 __fastcall rt_http_from_lld(__int64 a1)
{
const char *v1; // r13
const char *v2; // rbp
const char *v3; // rbx
const char *v4; // rax

if ( !a1 )
elog_fdie(6LL, "iiab/rt_http.c", 261LL, "rt_http_from_lld", "passed NULL low level descriptor");
if ( (unsigned int)(*(_DWORD *)a1 - 998544) > 1 )
{
v1 = rt_https_description();
v2 = rt_https_prefix();
v3 = rt_http_description();
v4 = rt_http_prefix();
elog_fdie(
6LL,
"iiab/rt_http.c",
264LL,
"rt_http_from_lld",
"magic type mismatch: we were given %s (%s) but can handle only %s (%s) or %s (%d)",
*(const char **)(a1 + 8),
*(const char **)(a1 + 16),
v4,
v3,
v2,
v1);
}
return a1;
}

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

if ( !a1 )
elog_fdie(6LL, "iiab/rt_http.c", 261LL, "rt_http_from_lld", "passed NULL low level descriptor");
if ( (unsigned int)(*(_DWORD *)a1 - 998544) > 1 )
{
v1 = func5();
v2 = func4();
v3 = func2();
v4 = func1();
elog_fdie(
6LL,
"iiab/rt_http.c",
264LL,
"rt_http_from_lld",
"magic type mismatch: we were given %s (%s) but can handle only %s (%s) or %s (%d)",
*(const char **)(a1 + 8),
*(const char **)(a1 + 16),
v4,
v3,
v2,
v1);
}
return a1;
}

original_code:
RT_HTTPD rt_http_from_lld(RT_LLD lld )
{
     if (!lld)
   elog_fdie(FATAL,"iiab/rt_http.c",261,__PRETTY_FUNCTION__,"passed NULL low level descriptor");
     if ( (((RT_HTTPD)lld)->magic != 998544) &&
   (((RT_HTTPD)lld)->magic != 998545) )
   elog_fdie(FATAL,"iiab/rt_http.c",264,__PRETTY_FUNCTION__,"magic type mismatch: we were given " "%s (%s) but can handle only %s (%s) or %s (%d)", ((RT_HTTPD)lld)->prefix, ((RT_HTTPD)lld)->description, rt_http_prefix(), rt_http_description(), rt_https_prefix(), rt_https_description());
     return (RT_HTTPD) lld;
}

canonical_original_code:
struct rt_http_desc *rt_http_from_lld(void *lld)
{
     if (!lld)
   elog_fdie(FATAL,"iiab/rt_http.c",261,__PRETTY_FUNCTION__,"passed NULL low level descriptor");
     if ( (((struct rt_http_desc *)lld)->magic != 998544) &&
   (((struct rt_http_desc *)lld)->magic != 998545) )
   elog_fdie(FATAL,"iiab/rt_http.c",264,__PRETTY_FUNCTION__,"magic type mismatch: we were given " "%s (%s) but can handle only %s (%s) or %s (%d)", ((struct rt_http_desc *)lld)->prefix, ((struct rt_http_desc *)lld)->description, rt_http_prefix(), rt_http_description(), rt_https_prefix(), rt_https_description());
     return (struct rt_http_desc *) lld;
}

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


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

v1 = (_DWORD *)rt_http_from_lld(a1);
*v1 = 0;
return nm_nfree(v1, "iiab/rt_http.c", 89LL, "rt_http_close");
}

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

v1 = (_DWORD *)func14(a1);
*v1 = 0;
return nm_nfree(v1, "iiab/rt_http.c", 89LL, "rt_http_close");
}

original_code:
void rt_http_close (RT_LLD lld)
{
     RT_HTTPD rt;
     rt = rt_http_from_lld(lld);
     rt->magic = 0;
     nm_nfree(rt,"iiab/rt_http.c",89,__PRETTY_FUNCTION__);
}

canonical_original_code:
void rt_http_close(void *lld)
{
     struct rt_http_desc *rt;
     rt = rt_http_from_lld(lld);
     rt->magic = 0;
     nm_nfree(rt,"iiab/rt_http.c",89,__PRETTY_FUNCTION__);
}

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


decompiled_code:
__int64 __fastcall rt_http_write(__int64 a1, __int64 a2, unsigned int a3)
{
__int64 v4; // rax
bool v5; // zf
__int64 result; // rax

v4 = rt_http_from_lld(a1);
v5 = http_post(*(_QWORD *)(v4 + 24), 0LL, 0LL, 0LL, 0LL, &LC7, 0LL, 0LL) == 0;
result = 0xFFFFFFFFLL;
if ( !v5 )
result = a3;
return result;
}

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

v4 = func14(a1);
v5 = http_post(*(_QWORD *)(v4 + 24), 0LL, 0LL, 0LL, 0LL, &LC7, 0LL, 0LL) == 0;
result = 0xFFFFFFFFLL;
if ( !v5 )
result = a3;
return result;
}

original_code:
int rt_http_write (RT_LLD lld, const void *buf, int buflen)
{
     RT_HTTPD rt;
     char *rtext;
     rt = rt_http_from_lld(lld);
     rtext = http_post(rt->url, ((void *)0), ((void *)0), ((void *)0), ((void *)0), "", ((void *)0), 0);
     if (!rtext)
   return -1;
     else
   return buflen;
}

canonical_original_code:
int rt_http_write(void *lld, void *buf, int buflen)
{
     struct rt_http_desc *rt;
     char *rtext;
     rt = rt_http_from_lld(lld);
     rtext = http_post(rt->url, ((void *)0), ((void *)0), ((void *)0), ((void *)0), "", ((void *)0), 0);
     if (!rtext)
   return -1;
     else
   return buflen;
}

variable_types:
buf
void *

variable_types: buflen int

variable_types:
rtext
char *

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


decompiled_code:
__int64 __fastcall rt_http_read(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rax
const char *v3; // rbp
__int64 v4; // r13
__int64 v5; // rax
__int64 v6; // r12

v1 = rt_http_from_lld(a1);
v2 = http_get(*(_QWORD *)(v1 + 24), 0LL, 0LL, 0LL, 0LL);
if ( !v2 )
return 0LL;
v3 = (const char *)v2;
v4 = itree_really_create("iiab/rt_http.c", 180LL, "rt_http_read");
v5 = nm_xnmalloc(16LL, "iiab/rt_http.c", 181LL, "rt_http_read");
*(_QWORD *)(v5 + 8) = v3;
v6 = v5;
*(_DWORD *)v5 = strlen(v3);
itree_append(v4, v6);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rax
const char *v3; // rbp
__int64 v4; // r13
__int64 v5; // rax
__int64 v6; // r12

v1 = func14(a1);
v2 = http_get(*(_QWORD *)(v1 + 24), 0LL, 0LL, 0LL, 0LL);
if ( !v2 )
return 0LL;
v3 = (const char *)v2;
v4 = itree_really_create("iiab/rt_http.c", 180LL, "rt_http_read");
v5 = nm_xnmalloc(16LL, "iiab/rt_http.c", 181LL, "rt_http_read");
*(_QWORD *)(v5 + 8) = v3;
v6 = v5;
*(_DWORD *)v5 = strlen(v3);
itree_append(v4, v6);
return v4;
}

original_code:
ITREE *rt_http_read (RT_LLD lld, int seq, int offset)
{
     ROUTE_BUF *storebuf;
     ITREE *buflist;
     RT_HTTPD rt;
     char *text;
     rt = rt_http_from_lld(lld);
     text = http_get(rt->url, ((void *)0), ((void *)0), ((void *)0), 0);
     if (!text)
   return ((void *)0);
     buflist = itree_really_create("iiab/rt_http.c",180,__PRETTY_FUNCTION__);
     storebuf = nm_xnmalloc(sizeof(ROUTE_BUF),"iiab/rt_http.c",181,__PRETTY_FUNCTION__);
     storebuf->buffer = text;
     storebuf->buflen = strlen(text);
     itree_append(buflist, storebuf);
     return buflist;
}

canonical_original_code:
struct itree_head *rt_http_read(void *lld, int seq, int offset)
{
     struct route_buffer *storebuf;
     struct itree_head *buflist;
     struct rt_http_desc *rt;
     char *text;
     rt = rt_http_from_lld(lld);
     text = http_get(rt->url, ((void *)0), ((void *)0), ((void *)0), 0);
     if (!text)
   return ((void *)0);
     buflist = itree_really_create("iiab/rt_http.c",180,__PRETTY_FUNCTION__);
     storebuf = nm_xnmalloc(sizeof(ROUTE_BUF),"iiab/rt_http.c",181,__PRETTY_FUNCTION__);
     storebuf->buffer = text;
     storebuf->buflen = strlen(text);
     itree_append(buflist, storebuf);
     return buflist;
}

variable_types: seq int

variable_types: offset int

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

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:
text
char *


decompiled_code:
__int64 __fastcall rt_http_tread(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rax
__int64 v3; // rbp
__int64 v4; // r12
int v5; // ebx

v1 = rt_http_from_lld(a1);
v2 = http_get(*(_QWORD *)(v1 + 24), 0LL, 0LL, 0LL, 0LL);
if ( !v2 )
return 0LL;
v3 = v2;
v4 = table_create();
v5 = table_scan(v4, v3, "\t", 0LL, 1LL, 1LL);
table_freeondestroy(v4, v3);
if ( v5 > 0 )
return v4;
table_destroy(v4);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func18(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rax
__int64 v3; // rbp
__int64 v4; // r12
int v5; // ebx

v1 = func14(a1);
v2 = http_get(*(_QWORD *)(v1 + 24), 0LL, 0LL, 0LL, 0LL);
if ( !v2 )
return 0LL;
v3 = v2;
v4 = table_create();
v5 = table_scan(v4, v3, "\t", 0LL, 1LL, 1LL);
table_freeondestroy(v4, v3);
if ( v5 > 0 )
return v4;
table_destroy(v4);
return 0LL;
}

original_code:
TABLE rt_http_tread (RT_LLD lld, int seq, int offset)
{
     RT_HTTPD rt;
     char *text;
     TABLE tab;
     int r;
     rt = rt_http_from_lld(lld);
     text = http_get(rt->url, ((void *)0), ((void *)0), ((void *)0), 0);
     if (!text)
   return ((void *)0);
     tab = table_create();
     r = table_scan(tab, text, "\t", 0, 1,
      1);
     table_freeondestroy(tab, text);
     if (r < 1) {
   table_destroy(tab);
   tab = ((void *)0);
     }
     return tab;
}

canonical_original_code:
struct table_info *rt_http_tread(void *lld, int seq, int offset)
{
     struct rt_http_desc *rt;
     char *text;
     struct table_info *tab;
     int r;
     rt = rt_http_from_lld(lld);
     text = http_get(rt->url, ((void *)0), ((void *)0), ((void *)0), 0);
     if (!text)
   return ((void *)0);
     tab = table_create();
     r = table_scan(tab, text, "\t", 0, 1,
      1);
     table_freeondestroy(tab, text);
     if (r < 1) {
   table_destroy(tab);
   tab = ((void *)0);
     }
     return tab;
}

variable_types: r int


decompiled_code:
__int64 rt_stdin_magic()
{
return 4299644LL;
}

original_code: int rt_stdin_magic() { return 4299644; }


decompiled_code:
const char *rt_stdin_prefix()
{
return "stdin";
}

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

original_code: char * rt_stdin_prefix() { return "stdin"; }


decompiled_code:
const char *rt_stdin_description()
{
return "standard input";
}

canonical_decompiled_code:
const char *func2()
{
return "standard input";
}

original_code: char * rt_stdin_description() { return "standard input"; }


decompiled_code:
__int64 rt_stdout_magic()
{
return 7822399LL;
}

original_code: int rt_stdout_magic() { return 7822399; }


decompiled_code:
const char *rt_stdout_prefix()
{
return "stdout";
}

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

original_code: char * rt_stdout_prefix() { return "stdout"; }


decompiled_code:
const char *rt_stdout_description()
{
return "standard output";
}

canonical_decompiled_code:
const char *func5()
{
return "standard output";
}

original_code: char * rt_stdout_description() { return "standard output"; }


decompiled_code:
__int64 rt_stderr_magic()
{
return 1053976LL;
}

original_code: int rt_stderr_magic() { return 1053976; }


decompiled_code:
const char *rt_stderr_prefix()
{
return "stderr";
}

canonical_decompiled_code:
const char *func7()
{
return "stderr";
}

original_code: char * rt_stderr_prefix() { return "stderr"; }


decompiled_code:
const char *rt_stderr_description()
{
return "standard error";
}

canonical_decompiled_code:
const char *func8()
{
return "standard error";
}

original_code: char * rt_stderr_description() { return "standard error"; }


decompiled_code:
void rt_std_init()
{
;
}

canonical_decompiled_code:
void func9()
{
;
}

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

canonical_original_code: void rt_std_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_std_fini()
{
;
}

canonical_decompiled_code:
void func10()
{
;
}

original_code: void rt_std_fini () {}

canonical_original_code: void rt_std_fini() {}


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

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

original_code:
int rt_std_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_std_tell()
{
return 0LL;
}

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

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

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

variable_types:
lld
void *

variable_types:
seq
int *

variable_types:
size
int *