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

v4 = *(_QWORD *)(a1 + 32);
if ( a2 )
result = *(_QWORD *)(v4 + 16);
else
result = *(_QWORD *)(v4 + 8);
*(_QWORD *)(result + 8 * a3) = a4;
return result;
}

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

v4 = *(_QWORD *)(a1 + 32);
if ( a2 )
result = *(_QWORD *)(v4 + 16);
else
result = *(_QWORD *)(v4 + 8);
*(_QWORD *)(result + 8 * a3) = a4;
return result;
}

original_code:
void
syck_map_assign( SyckNode *map, enum map_part p, long idx, unsigned long id )
{
    struct SyckMap *m;
    ((void)0);
    m = map->data.pairs;
    ((void)0);
    if ( p == map_key )
    {
        m->keys[idx] = id;
    }
    else
    {
        m->values[idx] = id;
    }
}

canonical_original_code:
void syck_map_assign(struct _syck_node *map, enum map_part p, long idx, unsigned long id)
{
    struct SyckMap *m;
    ((void)0);
    m = map->data.pairs;
    ((void)0);
    if ( p == map_key )
    {
        m->keys[idx] = id;
    }
    else
    {
        m->values[idx] = id;
    }
}

variable_types: enum map_part { map_key=0, map_value=1 }

variable_types: idx long

variable_types:
id
unsigned long


decompiled_code:
__int64 __fastcall syck_map_read(__int64 a1, int a2, __int64 a3)
{
__int64 v3; // rax
__int64 result; // rax

v3 = *(_QWORD *)(a1 + 32);
if ( a2 )
result = *(_QWORD *)(*(_QWORD *)(v3 + 16) + 8 * a3);
else
result = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 8 * a3);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1, int a2, __int64 a3)
{
__int64 v3; // rax
__int64 result; // rax

v3 = *(_QWORD *)(a1 + 32);
if ( a2 )
result = *(_QWORD *)(*(_QWORD *)(v3 + 16) + 8 * a3);
else
result = *(_QWORD *)(*(_QWORD *)(v3 + 8) + 8 * a3);
return result;
}

original_code:
unsigned long
syck_map_read( SyckNode *map, enum map_part p, long idx )
{
    struct SyckMap *m;
    ((void)0);
    m = map->data.pairs;
    ((void)0);
    if ( p == map_key )
    {
        return m->keys[idx];
    }
    else
    {
        return m->values[idx];
    }
}

canonical_original_code:
unsigned long syck_map_read(struct _syck_node *map, enum map_part p, long idx)
{
    struct SyckMap *m;
    ((void)0);
    m = map->data.pairs;
    ((void)0);
    if ( p == map_key )
    {
        return m->keys[idx];
    }
    else
    {
        return m->values[idx];
    }
}

variable_types: struct _syck_node { unsigned long id; enum syck_kind_tag { syck_map_kind=0, syck_seq_kind=1, syck_str_kind=2 } kind; char *type_id; char *anchor; union { struct SyckMap { enum map_style { map_none=0, map_inline=1 } style; unsigned long *keys; unsigned long *values; long capa; long idx; } *pairs; struct SyckSeq { enum seq_style { seq_none=0, seq_inline=1 } style; unsigned long *items; long capa; long idx; } *list; struct SyckStr { enum scalar_style { scalar_none=0, scalar_1quote=1, scalar_2quote=2, scalar_fold=3, scalar_literal=4, scalar_plain=5 } style; char *ptr; long len; } *str; } data; void *shortcut; } *

return_type: unsigned long

user_defined_types: enum map_part { map_key=0, map_value=1 }

user_defined_types: struct _syck_node { unsigned long id; enum syck_kind_tag kind; char *type_id; char *anchor; union { struct SyckMap *pairs; struct SyckSeq *list; struct SyckStr *str; } data; void *shortcut; }

user_defined_types: struct SyckMap { enum map_style style; unsigned long *keys; unsigned long *values; long capa; long idx; }

user_defined_types: struct SyckSeq { enum seq_style style; unsigned long *items; long capa; long idx; }

user_defined_types: struct SyckStr { enum scalar_style style; char *ptr; long len; }


decompiled_code:
__int64 __fastcall syck_seq_count(__int64 a1)
{
return *(_QWORD *)(*(_QWORD *)(a1 + 32) + 24LL);
}

original_code:
long
syck_seq_count( SyckNode *seq )
{
    ((void)0);
    ((void)0);
    return seq->data.list->idx;
}

canonical_original_code:
long syck_seq_count(struct _syck_node *seq)
{
    ((void)0);
    ((void)0);
    return seq->data.list->idx;
}

return_type: long

user_defined_types: enum syck_kind_tag { syck_map_kind=0, syck_seq_kind=1, syck_str_kind=2 }

user_defined_types: enum map_style { map_none=0, map_inline=1 }

user_defined_types: enum seq_style { seq_none=0, seq_inline=1 }

user_defined_types: enum scalar_style { scalar_none=0, scalar_1quote=1, scalar_2quote=2, scalar_fold=3, scalar_literal=4, scalar_plain=5 }


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

result = *(_QWORD *)(*(_QWORD *)(a1 + 32) + 8LL);
*(_QWORD *)(result + 8 * a2) = a3;
return result;
}

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

result = *(_QWORD *)(*(_QWORD *)(a1 + 32) + 8LL);
*(_QWORD *)(result + 8 * a2) = a3;
return result;
}

original_code:
void
syck_seq_assign( SyckNode *seq, long idx, unsigned long id )
{
    struct SyckSeq *s;
    ((void)0);
    s = seq->data.list;
    ((void)0);
    s->items[idx] = id;
}

canonical_original_code:
void syck_seq_assign(struct _syck_node *seq, long idx, unsigned long id)
{
    struct SyckSeq *s;
    ((void)0);
    s = seq->data.list;
    ((void)0);
    s->items[idx] = id;
}

variable_types: struct SyckSeq { enum seq_style { seq_none=0, seq_inline=1 } style; unsigned long *items; long capa; long idx; } *

return_type: void


decompiled_code:
__int64 __fastcall syck_seq_read(__int64 a1, __int64 a2)
{
return *(_QWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 32) + 8LL) + 8 * a2);
}

original_code:
unsigned long
syck_seq_read( SyckNode *seq, long idx )
{
    struct SyckSeq *s;
    ((void)0);
    s = seq->data.list;
    ((void)0);
    return s->items[idx];
}

canonical_original_code:
unsigned long syck_seq_read(struct _syck_node *seq, long idx)
{
    struct SyckSeq *s;
    ((void)0);
    s = seq->data.list;
    ((void)0);
    return s->items[idx];
}


original_code:
void
syck_free_members( SyckNode *n )
{
    if ( n == ((void *)0) ) return;
    switch ( n->kind )
    {
        case syck_str_kind:
            if ( n->data.str != ((void *)0) )
            {
                if (n->data.str->ptr) { free(n->data.str->ptr); n->data.str->ptr = ((void *)0); };
                n->data.str->ptr = ((void *)0);
                n->data.str->len = 0;
                if (n->data.str) { free(n->data.str); n->data.str = ((void *)0); };
                n->data.str = ((void *)0);
            }
        break;
        case syck_seq_kind:
            if ( n->data.list != ((void *)0) )
            {
                if (n->data.list->items) { free(n->data.list->items); n->data.list->items = ((void *)0); };
                if (n->data.list) { free(n->data.list); n->data.list = ((void *)0); };
                n->data.list = ((void *)0);
            }
        break;
        case syck_map_kind:
            if ( n->data.pairs != ((void *)0) )
            {
                if (n->data.pairs->keys) { free(n->data.pairs->keys); n->data.pairs->keys = ((void *)0); };
                if (n->data.pairs->values) { free(n->data.pairs->values); n->data.pairs->values = ((void *)0); };
                if (n->data.pairs) { free(n->data.pairs); n->data.pairs = ((void *)0); };
                n->data.pairs = ((void *)0);
            }
        break;
    }
}

canonical_original_code:
void syck_free_members(struct _syck_node *n)
{
    if ( n == ((void *)0) ) return;
    switch ( n->kind )
    {
        case syck_str_kind:
            if ( n->data.str != ((void *)0) )
            {
                if (n->data.str->ptr) { free(n->data.str->ptr); n->data.str->ptr = ((void *)0); };
                n->data.str->ptr = ((void *)0);
                n->data.str->len = 0;
                if (n->data.str) { free(n->data.str); n->data.str = ((void *)0); };
                n->data.str = ((void *)0);
            }
        break;
        case syck_seq_kind:
            if ( n->data.list != ((void *)0) )
            {
                if (n->data.list->items) { free(n->data.list->items); n->data.list->items = ((void *)0); };
                if (n->data.list) { free(n->data.list); n->data.list = ((void *)0); };
                n->data.list = ((void *)0);
            }
        break;
        case syck_map_kind:
            if ( n->data.pairs != ((void *)0) )
            {
                if (n->data.pairs->keys) { free(n->data.pairs->keys); n->data.pairs->keys = ((void *)0); };
                if (n->data.pairs->values) { free(n->data.pairs->values); n->data.pairs->values = ((void *)0); };
                if (n->data.pairs) { free(n->data.pairs); n->data.pairs = ((void *)0); };
                n->data.pairs = ((void *)0);
            }
        break;
    }
}


decompiled_code:
void __fastcall syck_free_node(void *ptr)
{
void *v2; // rdi
void *v3; // rdi

syck_free_members((__int64)ptr);
v2 = (void *)*((_QWORD *)ptr + 2);
if ( v2 )
free(v2);
v3 = (void *)*((_QWORD *)ptr + 3);
if ( v3 )
free(v3);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func19(void *ptr)
{
void *v2; // rdi
void *v3; // rdi

func18((__int64)ptr);
v2 = (void *)*((_QWORD *)ptr + 2);
if ( v2 )
free(v2);
v3 = (void *)*((_QWORD *)ptr + 3);
if ( v3 )
free(v3);
free(ptr);
}

original_code:
void
syck_free_node( SyckNode *n )
{
    syck_free_members( n );
    if ( n->type_id != ((void *)0) )
    {
        if (n->type_id) { free(n->type_id); n->type_id = ((void *)0); };
        n->type_id = ((void *)0);
    }
    if ( n->anchor != ((void *)0) )
    {
        if (n->anchor) { free(n->anchor); n->anchor = ((void *)0); };
        n->anchor = ((void *)0);
    }
    if (n) { free(n); n = ((void *)0); };
}

canonical_original_code:
void syck_free_node(struct _syck_node *n)
{
    syck_free_members( n );
    if ( n->type_id != ((void *)0) )
    {
        if (n->type_id) { free(n->type_id); n->type_id = ((void *)0); };
        n->type_id = ((void *)0);
    }
    if ( n->anchor != ((void *)0) )
    {
        if (n->anchor) { free(n->anchor); n->anchor = ((void *)0); };
        n->anchor = ((void *)0);
    }
    if (n) { free(n); n = ((void *)0); };
}


decompiled_code:
__int64 __fastcall INT2NUM(int a1)
{
return 2LL * a1 + 1;
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
return 2LL * a1 + 1;
}

original_code:
static inline VALUE
INT2NUM(int v)
{
    if (!(((v) < (0x7fffffffffffffffL>>1)+1) && ((v) >= (((long)(-0x7fffffffffffffffL - 1L))>>(int)1))))
 return rb_int2big(v);
    return ((VALUE)(((long)(v))<<1 | RUBY_FIXNUM_FLAG));
}

canonical_original_code:
static inline unsigned long INT2NUM(int v)
{
    if (!(((v) < (0x7fffffffffffffffL>>1)+1) && ((v) >= (((long)(-0x7fffffffffffffffL - 1L))>>(int)1))))
 return rb_int2big(v);
    return ((VALUE)(((long)(v))<<1 | RUBY_FIXNUM_FLAG));
}

variable_types: v int


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

if ( (a1 & 3) != 0 )
{
if ( (a1 & 1) != 0 )
{
result = rb_cFixnum;
}
else if ( a1 == 2 )
{
result = rb_cTrueClass;
}
else
{
if ( (_BYTE)a1 != 14 )
return *(_QWORD *)(a1 + 8);
result = rb_cSymbol;
}
}
else
{
if ( (a1 & 0xFFFFFFFFFFFFFFFBLL) != 0 )
return *(_QWORD *)(a1 + 8);
if ( a1 == 4 )
{
result = rb_cNilClass;
}
else
{
if ( a1 )
return *(_QWORD *)(a1 + 8);
result = rb_cFalseClass;
}
}
return result;
}

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

if ( (a1 & 3) != 0 )
{
if ( (a1 & 1) != 0 )
{
result = rb_cFixnum;
}
else if ( a1 == 2 )
{
result = rb_cTrueClass;
}
else
{
if ( (_BYTE)a1 != 14 )
return *(_QWORD *)(a1 + 8);
result = rb_cSymbol;
}
}
else
{
if ( (a1 & 0xFFFFFFFFFFFFFFFBLL) != 0 )
return *(_QWORD *)(a1 + 8);
if ( a1 == 4 )
{
result = rb_cNilClass;
}
else
{
if ( a1 )
return *(_QWORD *)(a1 + 8);
result = rb_cFalseClass;
}
}
return result;
}

original_code:
static inline VALUE
rb_class_of(VALUE obj)
{
    if (((VALUE)(obj) & RUBY_IMMEDIATE_MASK)) {
 if ((((long)(obj))&RUBY_FIXNUM_FLAG)) return rb_cFixnum;
 if (obj == ((VALUE)RUBY_Qtrue)) return rb_cTrueClass;
 if ((((VALUE)(obj)&~(~(VALUE)0<<RUBY_SPECIAL_SHIFT))==RUBY_SYMBOL_FLAG)) return rb_cSymbol;
    }
    else if (!(((VALUE)(obj) & ~((VALUE)RUBY_Qnil)) != 0)) {
 if (obj == ((VALUE)RUBY_Qnil)) return rb_cNilClass;
 if (obj == ((VALUE)RUBY_Qfalse)) return rb_cFalseClass;
    }
    return ((struct RBasic*)(obj))->klass;
}

canonical_original_code:
static inline unsigned long rb_class_of(unsigned long obj)
{
    if (((VALUE)(obj) & RUBY_IMMEDIATE_MASK)) {
 if ((((long)(obj))&RUBY_FIXNUM_FLAG)) return rb_cFixnum;
 if (obj == ((unsigned long)RUBY_Qtrue)) return rb_cTrueClass;
 if ((((VALUE)(obj)&~(~(unsigned long)0<<RUBY_SPECIAL_SHIFT))==RUBY_SYMBOL_FLAG)) return rb_cSymbol;
    }
    else if (!(((VALUE)(obj) & ~((unsigned long)RUBY_Qnil)) != 0)) {
 if (obj == ((unsigned long)RUBY_Qnil)) return rb_cNilClass;
 if (obj == ((unsigned long)RUBY_Qfalse)) return rb_cFalseClass;
    }
    return ((struct RBasic *)(obj))->klass;
}

variable_types:
obj
unsigned long

user_defined_types: struct RBasic { unsigned long flags; unsigned long klass; }


decompiled_code:
__int64 mSyslog_isopen()
{
return 2LL * (syslog_opened != 0);
}

canonical_decompiled_code:
__int64 func2()
{
return 2LL * (syslog_opened != 0);
}

original_code:
static VALUE mSyslog_isopen(VALUE self)
{
    return syslog_opened ? ((VALUE)RUBY_Qtrue) : ((VALUE)RUBY_Qfalse);
}

canonical_original_code:
static unsigned long mSyslog_isopen(unsigned long self)
{
    return syslog_opened ? ((unsigned long)RUBY_Qtrue) : ((unsigned long)RUBY_Qfalse);
}

variable_types:
self
unsigned long


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

result = 4LL;
if ( syslog_opened )
result = INT2NUM(syslog_options);
return result;
}

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

result = 4LL;
if ( syslog_opened )
result = func0(syslog_options);
return result;
}

original_code:
static VALUE mSyslog_options(VALUE self)
{
    return syslog_opened ? INT2NUM(syslog_options) : ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long mSyslog_options(unsigned long self)
{
    return syslog_opened ? INT2NUM(syslog_options) : ((unsigned long)RUBY_Qnil);
}


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

result = 4LL;
if ( syslog_opened )
result = INT2NUM(syslog_facility);
return result;
}

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

result = 4LL;
if ( syslog_opened )
result = func0(syslog_facility);
return result;
}

original_code:
static VALUE mSyslog_facility(VALUE self)
{
    return syslog_opened ? INT2NUM(syslog_facility) : ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long mSyslog_facility(unsigned long self)
{
    return syslog_opened ? INT2NUM(syslog_facility) : ((unsigned long)RUBY_Qnil);
}


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

result = 4LL;
if ( syslog_opened )
result = INT2NUM(syslog_mask);
return result;
}

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

result = 4LL;
if ( syslog_opened )
result = func0(syslog_mask);
return result;
}

original_code:
static VALUE mSyslog_get_mask(VALUE self)
{
    return syslog_opened ? INT2NUM(syslog_mask) : ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long mSyslog_get_mask(unsigned long self)
{
    return syslog_opened ? INT2NUM(syslog_mask) : ((unsigned long)RUBY_Qnil);
}


decompiled_code:
__int64 __fastcall mSyslog_instance(__int64 a1)
{
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
return a1;
}

original_code:
static VALUE mSyslog_instance(VALUE self)
{
    return self;
}

canonical_original_code:
static unsigned long mSyslog_instance(unsigned long self)
{
    return self;
}


decompiled_code:
void __fastcall syslog_write(int pri, int a2, __int64 a3)
{
_QWORD *v4; // rax
const char *v5; // rdx

rb_secure(4LL);
if ( a2 <= 0 )
{
rb_raise(rb_eArgError, "no log message supplied");
goto LABEL_7;
}
if ( !syslog_opened )
{
LABEL_7:
rb_raise(rb_eRuntimeError, "must open syslog before write");
mSyslog_debug();
return;
}
v4 = (_QWORD *)rb_f_sprintf((unsigned int)a2, a3);
v5 = (const char *)(v4 + 2);
if ( (*v4 & 0x2000LL) != 0 )
v5 = (const char *)v4[3];
syslog(pri, "%s", v5);
}

canonical_decompiled_code:
void __fastcall func7(int pri, int a2, __int64 a3)
{
_QWORD *v4; // rax
const char *v5; // rdx

rb_secure(4LL);
if ( a2 <= 0 )
{
rb_raise(rb_eArgError, "no log message supplied");
goto LABEL_7;
}
if ( !syslog_opened )
{
LABEL_7:
rb_raise(rb_eRuntimeError, "must open syslog before write");
func8();
return;
}
v4 = (_QWORD *)rb_f_sprintf((unsigned int)a2, a3);
v5 = (const char *)(v4 + 2);
if ( (*v4 & 0x2000LL) != 0 )
v5 = (const char *)v4[3];
syslog(pri, "%s", v5);
}

original_code:
static void syslog_write(int pri, int argc, VALUE *argv)
{
    VALUE str;
    rb_secure(4);
    if (argc < 1) {
        rb_raise(rb_eArgError, "no log message supplied");
    }
    if (!syslog_opened) {
        rb_raise(rb_eRuntimeError, "must open syslog before write");
    }
    str = rb_f_sprintf(argc, argv);
    syslog(pri, "%s", (!(((struct RBasic*)(str))->flags & (((VALUE)1)<<(12 +1))) ? ((struct RString*)(str))->as.ary : ((struct RString*)(str))->as.heap.ptr));
}

canonical_original_code:
static void syslog_write(int pri, int argc, unsigned long *argv)
{
    unsigned long str;
    rb_secure(4);
    if (argc < 1) {
        rb_raise(rb_eArgError, "no log message supplied");
    }
    if (!syslog_opened) {
        rb_raise(rb_eRuntimeError, "must open syslog before write");
    }
    str = rb_f_sprintf(argc, argv);
    syslog(pri, "%s", (!(((struct RBasic *)(str))->flags & (((unsigned long)1)<<(12 +1))) ? ((struct RString *)(str))->as.ary : ((struct RString *)(str))->as.heap.ptr));
}

variable_types: pri int

variable_types: argc int

variable_types:
argv
unsigned long *

variable_types:
str
unsigned long

user_defined_types: struct RString { struct RBasic basic; union { struct { long len; char *ptr; union { long capa; unsigned long shared; } aux; } heap; char ary[-1]; } as; }


decompiled_code:
__int64 __fastcall mSyslog_debug(int a1, __int64 a2, __int64 a3)
{
syslog_write(7, a1, a2);
return a3;
}

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

original_code: static VALUE mSyslog_debug(int argc, VALUE *argv, VALUE self) { syslog_write(7, argc, argv); return self; }

canonical_original_code: static unsigned long mSyslog_debug(int argc, unsigned long *argv, unsigned long self) { syslog_write(7, argc, argv); return self; }


decompiled_code:
__int64 __fastcall mSyslog_info(int a1, __int64 a2, __int64 a3)
{
syslog_write(6, a1, a2);
return a3;
}

canonical_decompiled_code:
__int64 __fastcall func9(int a1, __int64 a2, __int64 a3)
{
func7(6, a1, a2);
return a3;
}

original_code: static VALUE mSyslog_info(int argc, VALUE *argv, VALUE self) { syslog_write(6, argc, argv); return self; }

canonical_original_code: static unsigned long mSyslog_info(int argc, unsigned long *argv, unsigned long self) { syslog_write(6, argc, argv); return self; }


decompiled_code:
__int64 __fastcall mSyslog_notice(int a1, __int64 a2, __int64 a3)
{
syslog_write(5, a1, a2);
return a3;
}

canonical_decompiled_code:
__int64 __fastcall func10(int a1, __int64 a2, __int64 a3)
{
func7(5, a1, a2);
return a3;
}

original_code: static VALUE mSyslog_notice(int argc, VALUE *argv, VALUE self) { syslog_write(5, argc, argv); return self; }

canonical_original_code: static unsigned long mSyslog_notice(int argc, unsigned long *argv, unsigned long self) { syslog_write(5, argc, argv); return self; }


decompiled_code:
__int64 __fastcall mSyslog_warning(int a1, __int64 a2, __int64 a3)
{
syslog_write(4, a1, a2);
return a3;
}

canonical_decompiled_code:
__int64 __fastcall func11(int a1, __int64 a2, __int64 a3)
{
func7(4, a1, a2);
return a3;
}

original_code: static VALUE mSyslog_warning(int argc, VALUE *argv, VALUE self) { syslog_write(4, argc, argv); return self; }

canonical_original_code: static unsigned long mSyslog_warning(int argc, unsigned long *argv, unsigned long self) { syslog_write(4, argc, argv); return self; }


decompiled_code:
__int64 __fastcall mSyslog_err(int a1, __int64 a2, __int64 a3)
{
syslog_write(3, a1, a2);
return a3;
}

canonical_decompiled_code:
__int64 __fastcall func12(int a1, __int64 a2, __int64 a3)
{
func7(3, a1, a2);
return a3;
}

original_code: static VALUE mSyslog_err(int argc, VALUE *argv, VALUE self) { syslog_write(3, argc, argv); return self; }

canonical_original_code: static unsigned long mSyslog_err(int argc, unsigned long *argv, unsigned long self) { syslog_write(3, argc, argv); return self; }


decompiled_code:
__int64 __fastcall mSyslog_crit(int a1, __int64 a2, __int64 a3)
{
syslog_write(2, a1, a2);
return a3;
}

canonical_decompiled_code:
__int64 __fastcall func13(int a1, __int64 a2, __int64 a3)
{
func7(2, a1, a2);
return a3;
}

original_code: static VALUE mSyslog_crit(int argc, VALUE *argv, VALUE self) { syslog_write(2, argc, argv); return self; }

canonical_original_code: static unsigned long mSyslog_crit(int argc, unsigned long *argv, unsigned long self) { syslog_write(2, argc, argv); return self; }


decompiled_code:
__int64 __fastcall mSyslog_alert(int a1, __int64 a2, __int64 a3)
{
syslog_write(1, a1, a2);
return a3;
}

canonical_decompiled_code:
__int64 __fastcall func14(int a1, __int64 a2, __int64 a3)
{
func7(1, a1, a2);
return a3;
}

original_code: static VALUE mSyslog_alert(int argc, VALUE *argv, VALUE self) { syslog_write(1, argc, argv); return self; }

canonical_original_code: static unsigned long mSyslog_alert(int argc, unsigned long *argv, unsigned long self) { syslog_write(1, argc, argv); return self; }


decompiled_code:
__int64 __fastcall mSyslog_emerg(int a1, __int64 a2, __int64 a3)
{
syslog_write(0, a1, a2);
return a3;
}

canonical_decompiled_code:
__int64 __fastcall func15(int a1, __int64 a2, __int64 a3)
{
func7(0, a1, a2);
return a3;
}

original_code: static VALUE mSyslog_emerg(int argc, VALUE *argv, VALUE self) { syslog_write(0, argc, argv); return self; }

canonical_original_code: static unsigned long mSyslog_emerg(int argc, unsigned long *argv, unsigned long self) { syslog_write(0, argc, argv); return self; }


decompiled_code:
__int64 __fastcall mSyslog_log(int a1, __int64 *a2, __int64 a3)
{
unsigned __int64 v5; // rsi
__int64 v6; // rdi
__int64 v8; // rdx
__int64 v9; // rax
const char *v10; // rax

if ( a1 <= 1 )
{
v8 = (unsigned int)a1;
v5 = (unsigned __int64)"wrong number of arguments (%d for 2+)";
v6 = rb_eArgError;
rb_raise(rb_eArgError, "wrong number of arguments (%d for 2+)", v8);
}
else
{
v5 = (unsigned int)(a1 - 1);
v6 = *a2;
if ( (*a2 & 1) != 0 )
{
syslog_write(v6 >> 1, v5, (__int64)(a2 + 1));
return a3;
}
}
v9 = rb_class_of(v6);
v10 = (const char *)rb_class2name(v9, v5);
rb_raise(rb_eTypeError, "type mismatch: %s given", v10);
return mSyslog_inspect();
}

canonical_decompiled_code:
__int64 __fastcall func16(int a1, __int64 *a2, __int64 a3)
{
unsigned __int64 v5; // rsi
__int64 v6; // rdi
__int64 v8; // rdx
__int64 v9; // rax
const char *v10; // rax

if ( a1 <= 1 )
{
v8 = (unsigned int)a1;
v5 = (unsigned __int64)"wrong number of arguments (%d for 2+)";
v6 = rb_eArgError;
rb_raise(rb_eArgError, "wrong number of arguments (%d for 2+)", v8);
}
else
{
v5 = (unsigned int)(a1 - 1);
v6 = *a2;
if ( (*a2 & 1) != 0 )
{
func7(v6 >> 1, v5, (__int64)(a2 + 1));
return a3;
}
}
v9 = func1(v6);
v10 = (const char *)rb_class2name(v9, v5);
rb_raise(rb_eTypeError, "type mismatch: %s given", v10);
return func17();
}

original_code:
static VALUE mSyslog_log(int argc, VALUE *argv, VALUE self)
{
    VALUE pri;
    if (argc < 2) {
        rb_raise(rb_eArgError, "wrong number of arguments (%d for 2+)", argc);
    }
    argc--;
    pri = *argv++;
    if (!(((long)(pri))&RUBY_FIXNUM_FLAG)) {
      rb_raise(rb_eTypeError, "type mismatch: %s given", rb_class2name(rb_class_of((VALUE)(pri))));
    }
    syslog_write(((int)(((long)pri)>>(int)1)), argc, argv);
    return self;
}

canonical_original_code:
static unsigned long mSyslog_log(int argc, unsigned long *argv, unsigned long self)
{
    unsigned long pri;
    if (argc < 2) {
        rb_raise(rb_eArgError, "wrong number of arguments (%d for 2+)", argc);
    }
    argc--;
    pri = *argv++;
    if (!(((long)(pri))&RUBY_FIXNUM_FLAG)) {
      rb_raise(rb_eTypeError, "type mismatch: %s given", rb_class2name(rb_class_of((VALUE)(pri))));
    }
    syslog_write(((int)(((long)pri)>>(int)1)), argc, argv);
    return self;
}

variable_types:
pri
unsigned long


decompiled_code:
__int64 __fastcall mSyslog_inspect(__int64 a1, __int64 a2)
{
__int64 v2; // r13
__int64 v3; // r12
unsigned int v4; // ebp
const char *v5; // rbx
const char *v6; // rax
const char *v8; // rax
char v9[1064]; // [rsp+0h] [rbp-428h] BYREF

if ( syslog_opened )
{
v2 = (unsigned int)syslog_mask;
v3 = (unsigned int)syslog_facility;
v4 = syslog_options;
v5 = syslog_ident;
v6 = (const char *)rb_class2name(a1, a2);
snprintf(v9, 0x400uLL, "<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>", v6, v5, v4, v3, v2);
}
else
{
v8 = (const char *)rb_class2name(a1, a2);
snprintf(v9, 0x400uLL, "<#%s: opened=false>", v8);
}
return rb_str_new_cstr(v9);
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1, __int64 a2)
{
__int64 v2; // r13
__int64 v3; // r12
unsigned int v4; // ebp
const char *v5; // rbx
const char *v6; // rax
const char *v8; // rax
char v9[1064]; // [rsp+0h] [rbp-428h] BYREF

if ( syslog_opened )
{
v2 = (unsigned int)syslog_mask;
v3 = (unsigned int)syslog_facility;
v4 = syslog_options;
v5 = syslog_ident;
v6 = (const char *)rb_class2name(a1, a2);
snprintf(v9, 0x400uLL, "<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>", v6, v5, v4, v3, v2);
}
else
{
v8 = (const char *)rb_class2name(a1, a2);
snprintf(v9, 0x400uLL, "<#%s: opened=false>", v8);
}
return rb_str_new_cstr(v9);
}

original_code:
static VALUE mSyslog_inspect(VALUE self)
{
    char buf[1024];
    if (syslog_opened) {
 snprintf(buf, sizeof(buf),
   "<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
   rb_class2name(self),
   syslog_ident,
   syslog_options,
   syslog_facility,
   syslog_mask);
    } else {
 snprintf(buf, sizeof(buf),
   "<#%s: opened=false>", rb_class2name(self));
    }
    return __extension__ ( { (__builtin_constant_p(buf)) ? rb_str_new(buf, strlen(buf)) : rb_str_new_cstr(buf); });
}

canonical_original_code:
static unsigned long mSyslog_inspect(unsigned long self)
{
    char buf[1024];
    if (syslog_opened) {
 snprintf(buf, sizeof(buf),
   "<#%s: opened=true, ident=\"%s\", options=%d, facility=%d, mask=%d>",
   rb_class2name(self),
   syslog_ident,
   syslog_options,
   syslog_facility,
   syslog_mask);
    } else {
 snprintf(buf, sizeof(buf),
   "<#%s: opened=false>", rb_class2name(self));
    }
    return __extension__ ( { (__builtin_constant_p(buf)) ? rb_str_new(buf, strlen(buf)) : rb_str_new_cstr(buf); });
}

variable_types:
buf
char [1024]


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

result = 4LL;
if ( syslog_opened )
result = rb_str_new_cstr(syslog_ident);
return result;
}

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

result = 4LL;
if ( syslog_opened )
result = rb_str_new_cstr(syslog_ident);
return result;
}

original_code:
static VALUE mSyslog_ident(VALUE self)
{
    return syslog_opened ? __extension__ ( { (__builtin_constant_p(syslog_ident)) ? rb_str_new(syslog_ident, strlen(syslog_ident)) : rb_str_new_cstr(syslog_ident); }) : ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long mSyslog_ident(unsigned long self)
{
    return syslog_opened ? __extension__ ( { (__builtin_constant_p(syslog_ident)) ? rb_str_new(syslog_ident, strlen(syslog_ident)) : rb_str_new_cstr(syslog_ident); }) : ((unsigned long)RUBY_Qnil);
}


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

if ( (a1 & 1) != 0 )
result = a1 >> 1;
else
result = rb_num2long();
return result;
}

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

if ( (a1 & 1) != 0 )
result = a1 >> 1;
else
result = rb_num2long();
return result;
}

original_code:
static inline long
NUM2LONG(VALUE x)
{
    return (((long)(x))&RUBY_FIXNUM_FLAG) ? (((long)x)>>(int)1) : rb_num2long(x);
}

canonical_original_code:
static inline long NUM2LONG(unsigned long x)
{
    return (((long)(x))&RUBY_FIXNUM_FLAG) ? (((long)x)>>(int)1) : rb_num2long(x);
}

variable_types:
x
unsigned long


decompiled_code:
__int64 __fastcall mSyslogConstants_LOG_UPTO(__int64 a1, __int64 a2)
{
return 2LL * ((1 << (NUM2LONG(a2) + 1)) - 1) + 1;
}

original_code:
static VALUE mSyslogConstants_LOG_UPTO(VALUE klass, VALUE pri)
{
    return ((VALUE)(((long)(((1 << ((((int)NUM2LONG(pri)))+1)) - 1)))<<1 | RUBY_FIXNUM_FLAG));
}

canonical_original_code:
static unsigned long mSyslogConstants_LOG_UPTO(unsigned long klass, unsigned long pri)
{
    return ((VALUE)(((long)(((1 << ((((int)NUM2LONG(pri)))+1)) - 1)))<<1 | RUBY_FIXNUM_FLAG));
}

variable_types:
klass
unsigned long


decompiled_code:
__int64 __fastcall mSyslogConstants_LOG_MASK(__int64 a1, __int64 a2)
{
return 2LL * (1 << NUM2LONG(a2)) + 1;
}

original_code:
static VALUE mSyslogConstants_LOG_MASK(VALUE klass, VALUE pri)
{
    return ((VALUE)(((long)((1 << (((int)NUM2LONG(pri))))))<<1 | RUBY_FIXNUM_FLAG));
}

canonical_original_code:
static unsigned long mSyslogConstants_LOG_MASK(unsigned long klass, unsigned long pri)
{
    return ((VALUE)(((long)((1 << (((int)NUM2LONG(pri))))))<<1 | RUBY_FIXNUM_FLAG));
}


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

rb_secure(4LL);
if ( syslog_opened )
{
syslog_mask = NUM2LONG(a2);
setlogmask(syslog_mask);
result = a2;
}
else
{
rb_raise(rb_eRuntimeError, "must open syslog before setting log mask");
result = mSyslog_close();
}
return result;
}

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

rb_secure(4LL);
if ( syslog_opened )
{
syslog_mask = func19(a2);
setlogmask(syslog_mask);
result = a2;
}
else
{
rb_raise(rb_eRuntimeError, "must open syslog before setting log mask");
result = func23();
}
return result;
}

original_code:
static VALUE mSyslog_set_mask(VALUE self, VALUE mask)
{
    rb_secure(4);
    if (!syslog_opened) {
        rb_raise(rb_eRuntimeError, "must open syslog before setting log mask");
    }
    setlogmask(syslog_mask = ((int)NUM2LONG(mask)));
    return mask;
}

canonical_original_code:
static unsigned long mSyslog_set_mask(unsigned long self, unsigned long mask)
{
    rb_secure(4);
    if (!syslog_opened) {
        rb_raise(rb_eRuntimeError, "must open syslog before setting log mask");
    }
    setlogmask(syslog_mask = ((int)NUM2LONG(mask)));
    return mask;
}

variable_types:
mask
unsigned long


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

rb_secure(4LL);
if ( syslog_opened )
{
closelog();
free(syslog_ident);
syslog_ident = 0LL;
syslog_mask = -1;
syslog_facility = -1;
syslog_options = -1;
syslog_opened = 0;
result = 4LL;
}
else
{
rb_raise(rb_eRuntimeError, "syslog not opened");
result = mSyslog_open();
}
return result;
}

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

rb_secure(4LL);
if ( syslog_opened )
{
closelog();
free(syslog_ident);
syslog_ident = 0LL;
syslog_mask = -1;
syslog_facility = -1;
syslog_options = -1;
syslog_opened = 0;
result = 4LL;
}
else
{
rb_raise(rb_eRuntimeError, "syslog not opened");
result = func24();
}
return result;
}

original_code:
static VALUE mSyslog_close(VALUE self)
{
    rb_secure(4);
    if (!syslog_opened) {
        rb_raise(rb_eRuntimeError, "syslog not opened");
    }
    closelog();
    free((void *)syslog_ident);
    syslog_ident = ((void *)0);
    syslog_options = syslog_facility = syslog_mask = -1;
    syslog_opened = 0;
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long mSyslog_close(unsigned long self)
{
    rb_secure(4);
    if (!syslog_opened) {
        rb_raise(rb_eRuntimeError, "syslog not opened");
    }
    closelog();
    free((void *)syslog_ident);
    syslog_ident = ((void *)0);
    syslog_options = syslog_facility = syslog_mask = -1;
    syslog_opened = 0;
    return ((unsigned long)RUBY_Qnil);
}


decompiled_code:
__int64 __fastcall mSyslog_open(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // rdi
__int64 v6; // [rsp+8h] [rbp-20h] BYREF
__int64 v7; // [rsp+10h] [rbp-18h] BYREF
__int64 v8[2]; // [rsp+18h] [rbp-10h] BYREF

if ( syslog_opened )
{
rb_raise(rb_eRuntimeError, "syslog already open");
}
else
{
rb_scan_args(a1, a2, "03", v8, &v7, &v6);
if ( v8[0] != 4 )
goto LABEL_3;
}
v8[0] = rb_gv_get("$0");
LABEL_3:
rb_string_value(v8);
rb_check_safe_obj(v8[0]);
if ( (*(_QWORD *)v8[0] & 0x2000LL) != 0 )
v4 = *(_QWORD *)(v8[0] + 24);
else
v4 = v8[0] + 16;
syslog_ident = (char *)ruby_strdup(v4);
if ( v7 == 4 )
syslog_options = 3;
else
syslog_options = NUM2LONG(v7);
if ( v6 == 4 )
syslog_facility = 8;
else
syslog_facility = NUM2LONG(v6);
openlog(syslog_ident, syslog_options, syslog_facility);
syslog_opened = 1;
syslog_mask = setlogmask(0);
setlogmask(syslog_mask);
if ( (unsigned int)rb_block_given_p() )
rb_ensure(&rb_yield, a3, mSyslog_close, a3);
return a3;
}

canonical_decompiled_code:
__int64 __fastcall func24(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // rdi
__int64 v6; // [rsp+8h] [rbp-20h] BYREF
__int64 v7; // [rsp+10h] [rbp-18h] BYREF
__int64 v8[2]; // [rsp+18h] [rbp-10h] BYREF

if ( syslog_opened )
{
rb_raise(rb_eRuntimeError, "syslog already open");
}
else
{
rb_scan_args(a1, a2, "03", v8, &v7, &v6);
if ( v8[0] != 4 )
goto LABEL_3;
}
v8[0] = rb_gv_get("$0");
LABEL_3:
rb_string_value(v8);
rb_check_safe_obj(v8[0]);
if ( (*(_QWORD *)v8[0] & 0x2000LL) != 0 )
v4 = *(_QWORD *)(v8[0] + 24);
else
v4 = v8[0] + 16;
syslog_ident = (char *)ruby_strdup(v4);
if ( v7 == 4 )
syslog_options = 3;
else
syslog_options = func19(v7);
if ( v6 == 4 )
syslog_facility = 8;
else
syslog_facility = func19(v6);
openlog(syslog_ident, syslog_options, syslog_facility);
syslog_opened = 1;
syslog_mask = setlogmask(0);
setlogmask(syslog_mask);
if ( (unsigned int)rb_block_given_p() )
rb_ensure(&rb_yield, a3, mSyslog_close, a3);
return a3;
}

original_code:
static VALUE mSyslog_open(int argc, VALUE *argv, VALUE self)
{
    VALUE ident, opt, fac;
    if (syslog_opened) {
        rb_raise(rb_eRuntimeError, "syslog already open");
    }
    rb_scan_args(argc, argv, "03", &ident, &opt, &fac);
    if (((VALUE)(ident) == ((VALUE)RUBY_Qnil))) {
        ident = rb_gv_get("$0");
    }
    do { rb_string_value(&(ident)); rb_check_safe_obj(ident);} while (0);
    syslog_ident = ruby_strdup((!(((struct RBasic*)(ident))->flags & (((VALUE)1)<<(12 +1))) ? ((struct RString*)(ident))->as.ary : ((struct RString*)(ident))->as.heap.ptr));
    if (((VALUE)(opt) == ((VALUE)RUBY_Qnil))) {
 syslog_options = 0x01 | 0x02;
    } else {
 syslog_options = ((int)NUM2LONG(opt));
    }
    if (((VALUE)(fac) == ((VALUE)RUBY_Qnil))) {
 syslog_facility = (1<<3);
    } else {
 syslog_facility = ((int)NUM2LONG(fac));
    }
    openlog(syslog_ident, syslog_options, syslog_facility);
    syslog_opened = 1;
    setlogmask(syslog_mask = setlogmask(0));
    if (rb_block_given_p()) {
        rb_ensure(rb_yield, self, mSyslog_close, self);
    }
    return self;
}

canonical_original_code:
static unsigned long mSyslog_open(int argc, unsigned long *argv, unsigned long self)
{
    unsigned long ident; unsigned long opt; unsigned long fac;
    if (syslog_opened) {
        rb_raise(rb_eRuntimeError, "syslog already open");
    }
    rb_scan_args(argc, argv, "03", &ident, &opt, &fac);
    if (((VALUE)(ident) == ((unsigned long)RUBY_Qnil))) {
        ident = rb_gv_get("$0");
    }
    do { rb_string_value(&(ident)); rb_check_safe_obj(ident);} while (0);
    syslog_ident = ruby_strdup((!(((struct RBasic *)(ident))->flags & (((unsigned long)1)<<(12 +1))) ? ((struct RString *)(ident))->as.ary : ((struct RString *)(ident))->as.heap.ptr));
    if (((VALUE)(opt) == ((unsigned long)RUBY_Qnil))) {
 syslog_options = 0x01 | 0x02;
    } else {
 syslog_options = ((int)NUM2LONG(opt));
    }
    if (((VALUE)(fac) == ((unsigned long)RUBY_Qnil))) {
 syslog_facility = (1<<3);
    } else {
 syslog_facility = ((int)NUM2LONG(fac));
    }
    openlog(syslog_ident, syslog_options, syslog_facility);
    syslog_opened = 1;
    setlogmask(syslog_mask = setlogmask(0));
    if (rb_block_given_p()) {
        rb_ensure(rb_yield, self, mSyslog_close, self);
    }
    return self;
}

variable_types:
ident
unsigned long

variable_types:
opt
unsigned long

variable_types:
fac
unsigned long


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

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

original_code:
static VALUE mSyslog_reopen(int argc, VALUE *argv, VALUE self)
{
    mSyslog_close(self);
    return mSyslog_open(argc, argv, self);
}

canonical_original_code:
static unsigned long mSyslog_reopen(int argc, unsigned long *argv, unsigned long self)
{
    mSyslog_close(self);
    return mSyslog_open(argc, argv, self);
}


decompiled_code:
__int64 Init_syslog()
{
__int64 v0; // r12
__int64 v1; // rbp
__int64 v2; // rbx
__int64 v3; // r14
__int64 v4; // r15
__int64 v5; // r13
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // r13
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rax
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rax
__int64 v18; // rax
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rax
__int64 v24; // rax
__int64 v25; // rax
__int64 v26; // rax

mSyslog = rb_define_module("Syslog");
mSyslogConstants = rb_define_module_under(mSyslog, "Constants");
rb_include_module(mSyslog, mSyslogConstants);
rb_define_module_function(mSyslog, "open", mSyslog_open, 0xFFFFFFFFLL);
rb_define_module_function(mSyslog, "reopen", mSyslog_reopen, 0xFFFFFFFFLL);
rb_define_module_function(mSyslog, "open!", mSyslog_reopen, 0xFFFFFFFFLL);
rb_define_module_function(mSyslog, "opened?", mSyslog_isopen, 0LL);
rb_define_module_function(mSyslog, "ident", mSyslog_ident, 0LL);
rb_define_module_function(mSyslog, "options", mSyslog_options, 0LL);
rb_define_module_function(mSyslog, "facility", mSyslog_facility, 0LL);
rb_define_module_function(mSyslog, "log", mSyslog_log, 0xFFFFFFFFLL);
rb_define_module_function(mSyslog, "close", mSyslog_close, 0LL);
rb_define_module_function(mSyslog, "mask", mSyslog_get_mask, 0LL);
rb_define_module_function(mSyslog, "mask=", mSyslog_set_mask, 1LL);
rb_define_module_function(mSyslog, "LOG_MASK", mSyslogConstants_LOG_MASK, 1LL);
rb_define_module_function(mSyslog, "LOG_UPTO", mSyslogConstants_LOG_UPTO, 1LL);
rb_define_module_function(mSyslog, "inspect", mSyslog_inspect, 0LL);
rb_define_module_function(mSyslog, "instance", mSyslog_instance, 0LL);
rb_define_module_function(mSyslogConstants, "LOG_MASK", mSyslogConstants_LOG_MASK, 1LL);
rb_define_module_function(mSyslogConstants, "LOG_UPTO", mSyslogConstants_LOG_UPTO, 1LL);
v0 = INT2NUM(1);
rb_define_const(mSyslogConstants, "LOG_PID", v0);
v1 = INT2NUM(2);
rb_define_const(mSyslogConstants, "LOG_CONS", v1);
v2 = INT2NUM(4);
rb_define_const(mSyslogConstants, "LOG_ODELAY", v2);
v3 = INT2NUM(8);
rb_define_const(mSyslogConstants, "LOG_NDELAY", v3);
v4 = INT2NUM(16);
rb_define_const(mSyslogConstants, "LOG_NOWAIT", v4);
v5 = INT2NUM(32);
rb_define_const(mSyslogConstants, "LOG_PERROR", v5);
rb_define_const(mSyslogConstants, "LOG_AUTH", v5);
v6 = INT2NUM(80);
rb_define_const(mSyslogConstants, "LOG_AUTHPRIV", v6);
v7 = INT2NUM(72);
rb_define_const(mSyslogConstants, "LOG_CRON", v7);
v8 = INT2NUM(24);
rb_define_const(mSyslogConstants, "LOG_DAEMON", v8);
v9 = INT2NUM(88);
rb_define_const(mSyslogConstants, "LOG_FTP", v9);
v10 = INT2NUM(0);
rb_define_const(mSyslogConstants, "LOG_KERN", v10);
v11 = INT2NUM(48);
rb_define_const(mSyslogConstants, "LOG_LPR", v11);
rb_define_const(mSyslogConstants, "LOG_MAIL", v4);
v12 = INT2NUM(56);
rb_define_const(mSyslogConstants, "LOG_NEWS", v12);
v13 = INT2NUM(40);
rb_define_const(mSyslogConstants, "LOG_SYSLOG", v13);
rb_define_const(mSyslogConstants, "LOG_USER", v3);
v14 = INT2NUM(64);
rb_define_const(mSyslogConstants, "LOG_UUCP", v14);
v15 = INT2NUM(128);
rb_define_const(mSyslogConstants, "LOG_LOCAL0", v15);
v16 = INT2NUM(136);
rb_define_const(mSyslogConstants, "LOG_LOCAL1", v16);
v17 = INT2NUM(144);
rb_define_const(mSyslogConstants, "LOG_LOCAL2", v17);
v18 = INT2NUM(152);
rb_define_const(mSyslogConstants, "LOG_LOCAL3", v18);
v19 = INT2NUM(160);
rb_define_const(mSyslogConstants, "LOG_LOCAL4", v19);
v20 = INT2NUM(168);
rb_define_const(mSyslogConstants, "LOG_LOCAL5", v20);
v21 = INT2NUM(176);
rb_define_const(mSyslogConstants, "LOG_LOCAL6", v21);
v22 = INT2NUM(184);
rb_define_const(mSyslogConstants, "LOG_LOCAL7", v22);
rb_define_const(mSyslogConstants, "LOG_EMERG", v10);
rb_define_module_function(mSyslog, "emerg", mSyslog_emerg, 0xFFFFFFFFLL);
rb_define_const(mSyslogConstants, "LOG_ALERT", v0);
rb_define_module_function(mSyslog, "alert", mSyslog_alert, 0xFFFFFFFFLL);
rb_define_const(mSyslogConstants, "LOG_CRIT", v1);
rb_define_module_function(mSyslog, "crit", mSyslog_crit, 0xFFFFFFFFLL);
v23 = INT2NUM(3);
rb_define_const(mSyslogConstants, "LOG_ERR", v23);
rb_define_module_function(mSyslog, "err", mSyslog_err, 0xFFFFFFFFLL);
rb_define_const(mSyslogConstants, "LOG_WARNING", v2);
rb_define_module_function(mSyslog, "warning", mSyslog_warning, 0xFFFFFFFFLL);
v24 = INT2NUM(5);
rb_define_const(mSyslogConstants, "LOG_NOTICE", v24);
rb_define_module_function(mSyslog, "notice", mSyslog_notice, 0xFFFFFFFFLL);
v25 = INT2NUM(6);
rb_define_const(mSyslogConstants, "LOG_INFO", v25);
rb_define_module_function(mSyslog, "info", mSyslog_info, 0xFFFFFFFFLL);
v26 = INT2NUM(7);
rb_define_const(mSyslogConstants, "LOG_DEBUG", v26);
return rb_define_module_function(mSyslog, "debug", mSyslog_debug, 0xFFFFFFFFLL);
}

canonical_decompiled_code:
__int64 func26()
{
__int64 v0; // r12
__int64 v1; // rbp
__int64 v2; // rbx
__int64 v3; // r14
__int64 v4; // r15
__int64 v5; // r13
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // r13
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rax
__int64 v15; // rax
__int64 v16; // rax
__int64 v17; // rax
__int64 v18; // rax
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rax
__int64 v24; // rax
__int64 v25; // rax
__int64 v26; // rax

mSyslog = rb_define_module("Syslog");
mSyslogConstants = rb_define_module_under(mSyslog, "Constants");
rb_include_module(mSyslog, mSyslogConstants);
rb_define_module_function(mSyslog, "open", mSyslog_open, 0xFFFFFFFFLL);
rb_define_module_function(mSyslog, "reopen", mSyslog_reopen, 0xFFFFFFFFLL);
rb_define_module_function(mSyslog, "open!", mSyslog_reopen, 0xFFFFFFFFLL);
rb_define_module_function(mSyslog, "opened?", mSyslog_isopen, 0LL);
rb_define_module_function(mSyslog, "ident", mSyslog_ident, 0LL);
rb_define_module_function(mSyslog, "options", mSyslog_options, 0LL);
rb_define_module_function(mSyslog, "facility", mSyslog_facility, 0LL);
rb_define_module_function(mSyslog, "log", mSyslog_log, 0xFFFFFFFFLL);
rb_define_module_function(mSyslog, "close", mSyslog_close, 0LL);
rb_define_module_function(mSyslog, "mask", mSyslog_get_mask, 0LL);
rb_define_module_function(mSyslog, "mask=", mSyslog_set_mask, 1LL);
rb_define_module_function(mSyslog, "LOG_MASK", mSyslogConstants_LOG_MASK, 1LL);
rb_define_module_function(mSyslog, "LOG_UPTO", mSyslogConstants_LOG_UPTO, 1LL);
rb_define_module_function(mSyslog, "inspect", mSyslog_inspect, 0LL);
rb_define_module_function(mSyslog, "instance", mSyslog_instance, 0LL);
rb_define_module_function(mSyslogConstants, "LOG_MASK", mSyslogConstants_LOG_MASK, 1LL);
rb_define_module_function(mSyslogConstants, "LOG_UPTO", mSyslogConstants_LOG_UPTO, 1LL);
v0 = func0(1);
rb_define_const(mSyslogConstants, "LOG_PID", v0);
v1 = func0(2);
rb_define_const(mSyslogConstants, "LOG_CONS", v1);
v2 = func0(4);
rb_define_const(mSyslogConstants, "LOG_ODELAY", v2);
v3 = func0(8);
rb_define_const(mSyslogConstants, "LOG_NDELAY", v3);
v4 = func0(16);
rb_define_const(mSyslogConstants, "LOG_NOWAIT", v4);
v5 = func0(32);
rb_define_const(mSyslogConstants, "LOG_PERROR", v5);
rb_define_const(mSyslogConstants, "LOG_AUTH", v5);
v6 = func0(80);
rb_define_const(mSyslogConstants, "LOG_AUTHPRIV", v6);
v7 = func0(72);
rb_define_const(mSyslogConstants, "LOG_CRON", v7);
v8 = func0(24);
rb_define_const(mSyslogConstants, "LOG_DAEMON", v8);
v9 = func0(88);
rb_define_const(mSyslogConstants, "LOG_FTP", v9);
v10 = func0(0);
rb_define_const(mSyslogConstants, "LOG_KERN", v10);
v11 = func0(48);
rb_define_const(mSyslogConstants, "LOG_LPR", v11);
rb_define_const(mSyslogConstants, "LOG_MAIL", v4);
v12 = func0(56);
rb_define_const(mSyslogConstants, "LOG_NEWS", v12);
v13 = func0(40);
rb_define_const(mSyslogConstants, "LOG_SYSLOG", v13);
rb_define_const(mSyslogConstants, "LOG_USER", v3);
v14 = func0(64);
rb_define_const(mSyslogConstants, "LOG_UUCP", v14);
v15 = func0(128);
rb_define_const(mSyslogConstants, "LOG_LOCAL0", v15);
v16 = func0(136);
rb_define_const(mSyslogConstants, "LOG_LOCAL1", v16);
v17 = func0(144);
rb_define_const(mSyslogConstants, "LOG_LOCAL2", v17);
v18 = func0(152);
rb_define_const(mSyslogConstants, "LOG_LOCAL3", v18);
v19 = func0(160);
rb_define_const(mSyslogConstants, "LOG_LOCAL4", v19);
v20 = func0(168);
rb_define_const(mSyslogConstants, "LOG_LOCAL5", v20);
v21 = func0(176);
rb_define_const(mSyslogConstants, "LOG_LOCAL6", v21);
v22 = func0(184);
rb_define_const(mSyslogConstants, "LOG_LOCAL7", v22);
rb_define_const(mSyslogConstants, "LOG_EMERG", v10);
rb_define_module_function(mSyslog, "emerg", mSyslog_emerg, 0xFFFFFFFFLL);
rb_define_const(mSyslogConstants, "LOG_ALERT", v0);
rb_define_module_function(mSyslog, "alert", mSyslog_alert, 0xFFFFFFFFLL);
rb_define_const(mSyslogConstants, "LOG_CRIT", v1);
rb_define_module_function(mSyslog, "crit", mSyslog_crit, 0xFFFFFFFFLL);
v23 = func0(3);
rb_define_const(mSyslogConstants, "LOG_ERR", v23);
rb_define_module_function(mSyslog, "err", mSyslog_err, 0xFFFFFFFFLL);
rb_define_const(mSyslogConstants, "LOG_WARNING", v2);
rb_define_module_function(mSyslog, "warning", mSyslog_warning, 0xFFFFFFFFLL);
v24 = func0(5);
rb_define_const(mSyslogConstants, "LOG_NOTICE", v24);
rb_define_module_function(mSyslog, "notice", mSyslog_notice, 0xFFFFFFFFLL);
v25 = func0(6);
rb_define_const(mSyslogConstants, "LOG_INFO", v25);
rb_define_module_function(mSyslog, "info", mSyslog_info, 0xFFFFFFFFLL);
v26 = func0(7);
rb_define_const(mSyslogConstants, "LOG_DEBUG", v26);
return rb_define_module_function(mSyslog, "debug", mSyslog_debug, 0xFFFFFFFFLL);
}

original_code:
void Init_syslog()
{
    mSyslog = rb_define_module("Syslog");
    mSyslogConstants = rb_define_module_under(mSyslog, "Constants");
    rb_include_module(mSyslog, mSyslogConstants);
    rb_define_module_function(mSyslog, "open", mSyslog_open, -1);
    rb_define_module_function(mSyslog, "reopen", mSyslog_reopen, -1);
    rb_define_module_function(mSyslog, "open!", mSyslog_reopen, -1);
    rb_define_module_function(mSyslog, "opened?", mSyslog_isopen, 0);
    rb_define_module_function(mSyslog, "ident", mSyslog_ident, 0);
    rb_define_module_function(mSyslog, "options", mSyslog_options, 0);
    rb_define_module_function(mSyslog, "facility", mSyslog_facility, 0);
    rb_define_module_function(mSyslog, "log", mSyslog_log, -1);
    rb_define_module_function(mSyslog, "close", mSyslog_close, 0);
    rb_define_module_function(mSyslog, "mask", mSyslog_get_mask, 0);
    rb_define_module_function(mSyslog, "mask=", mSyslog_set_mask, 1);
    rb_define_module_function(mSyslog, "LOG_MASK", mSyslogConstants_LOG_MASK, 1);
    rb_define_module_function(mSyslog, "LOG_UPTO", mSyslogConstants_LOG_UPTO, 1);
    rb_define_module_function(mSyslog, "inspect", mSyslog_inspect, 0);
    rb_define_module_function(mSyslog, "instance", mSyslog_instance, 0);
    rb_define_module_function(mSyslogConstants, "LOG_MASK", mSyslogConstants_LOG_MASK, 1);
    rb_define_module_function(mSyslogConstants, "LOG_UPTO", mSyslogConstants_LOG_UPTO, 1);
    rb_define_const(mSyslogConstants, "LOG_PID", INT2NUM(0x01));
    rb_define_const(mSyslogConstants, "LOG_CONS", INT2NUM(0x02));
    rb_define_const(mSyslogConstants, "LOG_ODELAY", INT2NUM(0x04));
    rb_define_const(mSyslogConstants, "LOG_NDELAY", INT2NUM(0x08));
    rb_define_const(mSyslogConstants, "LOG_NOWAIT", INT2NUM(0x10));
    rb_define_const(mSyslogConstants, "LOG_PERROR", INT2NUM(0x20));
    rb_define_const(mSyslogConstants, "LOG_AUTH", INT2NUM((4<<3)));
    rb_define_const(mSyslogConstants, "LOG_AUTHPRIV", INT2NUM((10<<3)));
    rb_define_const(mSyslogConstants, "LOG_CRON", INT2NUM((9<<3)));
    rb_define_const(mSyslogConstants, "LOG_DAEMON", INT2NUM((3<<3)));
    rb_define_const(mSyslogConstants, "LOG_FTP", INT2NUM((11<<3)));
    rb_define_const(mSyslogConstants, "LOG_KERN", INT2NUM((0<<3)));
    rb_define_const(mSyslogConstants, "LOG_LPR", INT2NUM((6<<3)));
    rb_define_const(mSyslogConstants, "LOG_MAIL", INT2NUM((2<<3)));
    rb_define_const(mSyslogConstants, "LOG_NEWS", INT2NUM((7<<3)));
    rb_define_const(mSyslogConstants, "LOG_SYSLOG", INT2NUM((5<<3)));
    rb_define_const(mSyslogConstants, "LOG_USER", INT2NUM((1<<3)));
    rb_define_const(mSyslogConstants, "LOG_UUCP", INT2NUM((8<<3)));
    rb_define_const(mSyslogConstants, "LOG_LOCAL0", INT2NUM((16<<3)));
    rb_define_const(mSyslogConstants, "LOG_LOCAL1", INT2NUM((17<<3)));
    rb_define_const(mSyslogConstants, "LOG_LOCAL2", INT2NUM((18<<3)));
    rb_define_const(mSyslogConstants, "LOG_LOCAL3", INT2NUM((19<<3)));
    rb_define_const(mSyslogConstants, "LOG_LOCAL4", INT2NUM((20<<3)));
    rb_define_const(mSyslogConstants, "LOG_LOCAL5", INT2NUM((21<<3)));
    rb_define_const(mSyslogConstants, "LOG_LOCAL6", INT2NUM((22<<3)));
    rb_define_const(mSyslogConstants, "LOG_LOCAL7", INT2NUM((23<<3)));
    rb_define_const(mSyslogConstants, "LOG_EMERG", INT2NUM(0));
    rb_define_module_function(mSyslog, "emerg", mSyslog_emerg, -1);
    rb_define_const(mSyslogConstants, "LOG_ALERT", INT2NUM(1));
    rb_define_module_function(mSyslog, "alert", mSyslog_alert, -1);
    rb_define_const(mSyslogConstants, "LOG_CRIT", INT2NUM(2));
    rb_define_module_function(mSyslog, "crit", mSyslog_crit, -1);
    rb_define_const(mSyslogConstants, "LOG_ERR", INT2NUM(3));
    rb_define_module_function(mSyslog, "err", mSyslog_err, -1);
    rb_define_const(mSyslogConstants, "LOG_WARNING", INT2NUM(4));
    rb_define_module_function(mSyslog, "warning", mSyslog_warning, -1);
    rb_define_const(mSyslogConstants, "LOG_NOTICE", INT2NUM(5));
    rb_define_module_function(mSyslog, "notice", mSyslog_notice, -1);
    rb_define_const(mSyslogConstants, "LOG_INFO", INT2NUM(6));
    rb_define_module_function(mSyslog, "info", mSyslog_info, -1);
    rb_define_const(mSyslogConstants, "LOG_DEBUG", INT2NUM(7));
    rb_define_module_function(mSyslog, "debug", mSyslog_debug, -1);
}


decompiled_code:
__int64 __fastcall echild_status(__int64 a1)
{
if ( !rb_intern_id_cache_2 )
rb_intern_id_cache_2 = rb_intern2("status", 6LL);
return rb_ivar_get(a1, rb_intern_id_cache_2);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
if ( !rb_intern_id_cache_2 )
rb_intern_id_cache_2 = rb_intern2("status", 6LL);
return rb_ivar_get(a1, rb_intern_id_cache_2);
}

original_code:
static VALUE
echild_status(VALUE self)
{
    return rb_ivar_get(self, (__builtin_constant_p("status") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2("status", strlen("status")); rb_intern_id_cache; }) : rb_intern("status")));
}

canonical_original_code:
static unsigned long echild_status(unsigned long self)
{
    return rb_ivar_get(self, (__builtin_constant_p("status") ? __extension__ ({ static unsigned long rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2("status", strlen("status")); rb_intern_id_cache; }) : rb_intern("status")));
}


decompiled_code:
__int64 __fastcall pty_reset_signal(__int64 a1)
{
rb_warn("PTY::reset_signal is no longer needed");
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
rb_warn("PTY::reset_signal is no longer needed");
return a1;
}

original_code:
static VALUE
pty_reset_signal(VALUE self)
{
    rb_warn("PTY::reset_signal is no longer needed");
    return self;
}

canonical_original_code:
static unsigned long pty_reset_signal(unsigned long self)
{
    rb_warn("PTY::reset_signal is no longer needed");
    return self;
}


decompiled_code:
__int64 __fastcall pty_protect(__int64 a1)
{
rb_warn("PTY::protect_signal is no longer needed");
rb_yield(4LL);
return a1;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
rb_warn("PTY::protect_signal is no longer needed");
rb_yield(4LL);
return a1;
}

original_code:
static VALUE
pty_protect(VALUE self)
{
    rb_warn("PTY::protect_signal is no longer needed");
    rb_yield(((VALUE)RUBY_Qnil));
    return self;
}

canonical_original_code:
static unsigned long pty_protect(unsigned long self)
{
    rb_warn("PTY::protect_signal is no longer needed");
    rb_yield(((unsigned long)RUBY_Qnil));
    return self;
}


decompiled_code:
__int64 __fastcall pty_finalize_syswait(__int64 a1)
{
rb_thread_kill(*(_QWORD *)(a1 + 8));
if ( !rb_intern_id_cache_1 )
rb_intern_id_cache_1 = rb_intern2("value", 5LL);
rb_funcall(*(_QWORD *)(a1 + 8), rb_intern_id_cache_1, 0LL);
rb_detach_process(*(unsigned int *)(a1 + 4));
return 4LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
rb_thread_kill(*(_QWORD *)(a1 + 8));
if ( !rb_intern_id_cache_1 )
rb_intern_id_cache_1 = rb_intern2("value", 5LL);
rb_funcall(*(_QWORD *)(a1 + 8), rb_intern_id_cache_1, 0LL);
rb_detach_process(*(unsigned int *)(a1 + 4));
return 4LL;
}

original_code:
static VALUE
pty_finalize_syswait(struct pty_info *info)
{
    rb_thread_kill(info->thread);
    rb_funcall(info->thread, (__builtin_constant_p("value") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2("value", strlen("value")); rb_intern_id_cache; }) : rb_intern("value")), 0);
    rb_detach_process(info->child_pid);
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long pty_finalize_syswait(struct pty_info *info)
{
    rb_thread_kill(info->thread);
    rb_funcall(info->thread, (__builtin_constant_p("value") ? __extension__ ({ static unsigned long rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2("value", strlen("value")); rb_intern_id_cache; }) : rb_intern("value")), 0);
    rb_detach_process(info->child_pid);
    return ((unsigned long)RUBY_Qnil);
}

variable_types: struct pty_info { int fd; int child_pid; unsigned long thread; } *


decompiled_code:
__int64 __fastcall raise_from_wait(const char *a1, __int64 a2)
{
__int64 v2; // rbx
__int64 v3; // rax
char v5[1048]; // [rsp+0h] [rbp-418h] BYREF

snprintf(v5, 0x400uLL, "pty - %s: %ld", a1, *(int *)(a2 + 4));
v2 = rb_exc_new2(eChildExited, v5);
v3 = rb_last_status_get();
rb_iv_set(v2, "status", v3);
if ( !rb_intern_id_cache_0 )
rb_intern_id_cache_0 = rb_intern2("raise", 5LL);
return rb_funcall(*(_QWORD *)(a2 + 8), rb_intern_id_cache_0, 1LL);
}

canonical_decompiled_code:
__int64 __fastcall func4(const char *a1, __int64 a2)
{
__int64 v2; // rbx
__int64 v3; // rax
char v5[1048]; // [rsp+0h] [rbp-418h] BYREF

snprintf(v5, 0x400uLL, "pty - %s: %ld", a1, *(int *)(a2 + 4));
v2 = rb_exc_new2(eChildExited, v5);
v3 = rb_last_status_get();
rb_iv_set(v2, "status", v3);
if ( !rb_intern_id_cache_0 )
rb_intern_id_cache_0 = rb_intern2("raise", 5LL);
return rb_funcall(*(_QWORD *)(a2 + 8), rb_intern_id_cache_0, 1LL);
}

original_code:
static void
raise_from_wait(const char *state, const struct pty_info *info)
{
    char buf[1024];
    VALUE exc;
    snprintf(buf, sizeof(buf), "pty - %s: %ld", state, (long)info->child_pid);
    exc = rb_exc_new2(eChildExited, buf);
    rb_iv_set(exc, "status", rb_last_status_get());
    rb_funcall(info->thread, (__builtin_constant_p("raise") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2("raise", strlen("raise")); rb_intern_id_cache; }) : rb_intern("raise")), 1, exc);
}

canonical_original_code:
static void raise_from_wait(char *state, struct pty_info *info)
{
    char buf[1024];
    unsigned long exc;
    snprintf(buf, sizeof(buf), "pty - %s: %ld", state, (long)info->child_pid);
    exc = rb_exc_new2(eChildExited, buf);
    rb_iv_set(exc, "status", rb_last_status_get());
    rb_funcall(info->thread, (__builtin_constant_p("raise") ? __extension__ ({ static unsigned long rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2("raise", strlen("raise")); rb_intern_id_cache; }) : rb_intern("raise")), 1, exc);
}

variable_types:
state
char *

variable_types:
exc
unsigned long

user_defined_types: struct pty_info { int fd; int child_pid; unsigned long thread; }


decompiled_code:
__int64 __fastcall pty_syswait(__int64 a1)
{
char v2[28]; // [rsp+Ch] [rbp-1Ch] BYREF

while ( (unsigned int)rb_waitpid(*(unsigned int *)(a1 + 4), v2, 2LL) != -1 )
{
if ( v2[0] == 127 )
{
raise_from_wait("stopped", a1);
}
else
{
if ( kill(*(_DWORD *)(a1 + 4), 0) )
{
raise_from_wait("exited", a1);
return 4LL;
}
raise_from_wait("changed", a1);
}
}
return 4LL;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
char v2[28]; // [rsp+Ch] [rbp-1Ch] BYREF

while ( (unsigned int)rb_waitpid(*(unsigned int *)(a1 + 4), v2, 2LL) != -1 )
{
if ( v2[0] == 127 )
{
func4("stopped", a1);
}
else
{
if ( kill(*(_DWORD *)(a1 + 4), 0) )
{
func4("exited", a1);
return 4LL;
}
func4("changed", a1);
}
}
return 4LL;
}

original_code:
static VALUE
pty_syswait(void *arg)
{
    const struct pty_info *const info = arg;
    pid_t cpid;
    int status;
    for (;;) {
 cpid = rb_waitpid(info->child_pid, &status, 2);
 if (cpid == -1) return ((VALUE)RUBY_Qnil);
 if ((((status) & 0xff) == 0x7f)) {
     raise_from_wait("stopped", info);
 }
 else if (kill(info->child_pid, 0) == 0) {
     raise_from_wait("changed", info);
 }
 else {
     raise_from_wait("exited", info);
     return ((VALUE)RUBY_Qnil);
 }
    }
}

canonical_original_code:
static unsigned long pty_syswait(void *arg)
{
    struct pty_info *info = arg;
    int cpid;
    int status;
    for (;;) {
 cpid = rb_waitpid(info->child_pid, &status, 2);
 if (cpid == -1) return ((unsigned long)RUBY_Qnil);
 if ((((status) & 0xff) == 0x7f)) {
     raise_from_wait("stopped", info);
 }
 else if (kill(info->child_pid, 0) == 0) {
     raise_from_wait("changed", info);
 }
 else {
     raise_from_wait("exited", info);
     return ((unsigned long)RUBY_Qnil);
 }
    }
}

variable_types:
arg
void *

variable_types: cpid int

variable_types: status int


chfunc

decompiled_code:
void __fastcall __noreturn chfunc(__int64 a1)
{
int v1; // er13
int v2; // ebx
int v3; // er12
__int64 v4; // rbp
__uid_t v5; // eax
char v6[4]; // [rsp+Ch] [rbp-3Ch] BYREF
int v7; // [rsp+10h] [rbp-38h] BYREF
__int64 v8; // [rsp+18h] [rbp-30h]

v1 = *(_DWORD *)a1;
v2 = *(_DWORD *)(a1 + 4);
v3 = *(_DWORD *)(a1 + 16);
v4 = *(_QWORD *)(a1 + 24);
setsid();
close(v1);
ioctl(v2, 0x540EuLL, 0LL);
write(v2, &LC9, 1uLL);
dup2(v2, 0);
dup2(v2, 1);
dup2(v2, 2);
close(v2);
v5 = getuid();
seteuid(v5);
v7 = v3;
v8 = v4;
rb_protect(pty_exec, &v7, v6);
sleep(1u);
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func6(__int64 a1)
{
int v1; // er13
int v2; // ebx
int v3; // er12
__int64 v4; // rbp
__uid_t v5; // eax
char v6[4]; // [rsp+Ch] [rbp-3Ch] BYREF
int v7; // [rsp+10h] [rbp-38h] BYREF
__int64 v8; // [rsp+18h] [rbp-30h]

v1 = *(_DWORD *)a1;
v2 = *(_DWORD *)(a1 + 4);
v3 = *(_DWORD *)(a1 + 16);
v4 = *(_QWORD *)(a1 + 24);
setsid();
close(v1);
ioctl(v2, 0x540EuLL, 0LL);
write(v2, &LC9, 1uLL);
dup2(v2, 0);
dup2(v2, 1);
dup2(v2, 2);
close(v2);
v5 = getuid();
seteuid(v5);
v7 = v3;
v8 = v4;
rb_protect(pty_exec, &v7, v6);
sleep(1u);
exit(1);
}

original_code:
static int
chfunc(void *data)
{
    struct child_info *carg = data;
    int master = carg->master;
    int slave = carg->slave;
    int argc = carg->argc;
    VALUE *argv = carg->argv;
    struct exec_info arg;
    int status;
    (void) setsid();
    close(master);
    (void) ioctl(slave, 0x540E, (char *)0);
    write(slave, "", 1);
    dup2(slave,0);
    dup2(slave,1);
    dup2(slave,2);
    close(slave);
    seteuid(getuid());
    arg.argc = argc;
    arg.argv = argv;
    rb_protect(pty_exec, (VALUE)&arg, &status);
    sleep(1);
    _exit(1);
}

canonical_original_code:
static int chfunc(void *data)
{
    struct child_info *carg = data;
    int master = carg->master;
    int slave = carg->slave;
    int argc = carg->argc;
    unsigned long *argv = carg->argv;
    struct exec_info arg;
    int status;
    (void) setsid();
    close(master);
    (void) ioctl(slave, 0x540E, (char *)0);
    write(slave, "", 1);
    dup2(slave,0);
    dup2(slave,1);
    dup2(slave,2);
    close(slave);
    seteuid(getuid());
    arg.argc = argc;
    arg.argv = argv;
    rb_protect(pty_exec, (VALUE)&arg, &status);
    sleep(1);
    _exit(1);
}

variable_types:
data
void *

variable_types: struct child_info { int master; char *slavename; int argc; unsigned long *argv; } *

variable_types: master int

variable_types: slave int

variable_types: argc int

variable_types: struct exec_info { int argc; unsigned long *argv; }

return_type: int


decompiled_code:
__int64 __fastcall pty_exec(unsigned int *a1)
{
return rb_f_exec(*a1, *((_QWORD *)a1 + 1));
}

canonical_decompiled_code:
__int64 __fastcall func7(unsigned int *a1)
{
return rb_f_exec(*a1, *((_QWORD *)a1 + 1));
}

original_code:
static VALUE
pty_exec(VALUE v)
{
    struct exec_info *arg = (struct exec_info *)v;
    return rb_f_exec(arg->argc, arg->argv);
}

canonical_original_code:
static unsigned long pty_exec(unsigned long v)
{
    struct exec_info *arg = (struct exec_info *)v;
    return rb_f_exec(arg->argc, arg->argv);
}

variable_types:
v
unsigned long

variable_types: struct exec_info { int argc; unsigned long *argv; } *


decompiled_code:
int __fastcall get_device_once(int *a1, int *a2, char *a3, int a4)
{
int result; // eax

result = openpty(a1, a2, a3, 0LL, 0LL);
if ( result != -1 )
return 0;
if ( a4 )
{
rb_raise(rb_eRuntimeError, "openpty() failed");
result = getDevice();
}
return result;
}

canonical_decompiled_code:
int __fastcall func8(int *a1, int *a2, char *a3, int a4)
{
int result; // eax

result = openpty(a1, a2, a3, 0LL, 0LL);
if ( result != -1 )
return 0;
if ( a4 )
{
rb_raise(rb_eRuntimeError, "openpty() failed");
result = func9();
}
return result;
}

original_code:
static int
get_device_once(int *master, int *slave, char SlaveName[16], int fail)
{
    if (openpty(master, slave, SlaveName,
  (struct termios *)0, (struct winsize *)0) == -1) {
 if (!fail) return -1;
 rb_raise(rb_eRuntimeError, "openpty() failed");
    }
    return 0;
}

variable_types:
master
int *

variable_types:
slave
int *

variable_types:
SlaveName
char [16]

variable_types: fail int

user_defined_types: struct termios { unsigned int c_iflag; unsigned int c_oflag; unsigned int c_cflag; unsigned int c_lflag; unsigned char c_line; unsigned char c_cc[32]; unsigned int c_ispeed; unsigned int c_ospeed; }

user_defined_types: struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; unsigned short ws_ypixel; }


getDevice

decompiled_code:
int __fastcall getDevice(int *a1, int *a2, char *a3)
{
int result; // eax

result = get_device_once(a1, a2, a3, 0);
if ( result )
{
rb_gc();
result = get_device_once(a1, a2, a3, 1);
}
return result;
}

canonical_decompiled_code:
int __fastcall func9(int *a1, int *a2, char *a3)
{
int result; // eax

result = func8(a1, a2, a3, 0);
if ( result )
{
rb_gc();
result = func8(a1, a2, a3, 1);
}
return result;
}

original_code:
static void
getDevice(int *master, int *slave, char SlaveName[16])
{
    if (get_device_once(master, slave, SlaveName, 0)) {
 rb_gc();
 get_device_once(master, slave, SlaveName, 1);
    }
    return;
}


establishShell

decompiled_code:
__int64 __fastcall establishShell(int a1, __int64 *a2, __int64 a3, char *a4)
{
int v4; // ebp
int v8; // ebp
__int64 result; // rax
char *v10; // rdi
__uid_t v11; // eax
struct passwd *v12; // rax
int v13[2]; // [rsp+0h] [rbp-68h] BYREF
char *v14; // [rsp+8h] [rbp-60h]
int v15; // [rsp+10h] [rbp-58h]
__int64 *v16; // [rsp+18h] [rbp-50h]
__int64 v17; // [rsp+28h] [rbp-40h] BYREF
char buf; // [rsp+37h] [rbp-31h] BYREF
int v19; // [rsp+38h] [rbp-30h] BYREF
int fd[11]; // [rsp+3Ch] [rbp-2Ch] BYREF

v4 = a1;
if ( !a1 )
{
v10 = getenv("SHELL");
if ( !v10 )
{
v11 = getuid();
v12 = getpwuid(v11);
v10 = "/bin/sh";
if ( v12 )
{
v10 = v12->pw_shell;
if ( !v10 )
v10 = "/bin/sh";
}
}
v17 = rb_str_new_cstr(v10);
a2 = &v17;
v4 = 1;
}
getDevice(fd, &v19, a4);
v13[0] = fd[0];
v13[1] = v19;
v14 = a4;
v15 = v4;
v16 = a2;
v8 = rb_fork(0LL, chfunc, v13, 4LL);
*(_QWORD *)(a3 + 8) = rb_thread_current();
if ( v8 < 0 )
{
close(fd[0]);
close(v19);
rb_sys_fail("fork failed");
result = LONG2NUM();
}
else
{
read(fd[0], &buf, 1uLL);
close(v19);
*(_DWORD *)(a3 + 4) = v8;
result = (unsigned int)fd[0];
*(_DWORD *)a3 = fd[0];
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(int a1, __int64 *a2, __int64 a3, char *a4)
{
int v4; // ebp
int v8; // ebp
__int64 result; // rax
char *v10; // rdi
__uid_t v11; // eax
struct passwd *v12; // rax
int v13[2]; // [rsp+0h] [rbp-68h] BYREF
char *v14; // [rsp+8h] [rbp-60h]
int v15; // [rsp+10h] [rbp-58h]
__int64 *v16; // [rsp+18h] [rbp-50h]
__int64 v17; // [rsp+28h] [rbp-40h] BYREF
char buf; // [rsp+37h] [rbp-31h] BYREF
int v19; // [rsp+38h] [rbp-30h] BYREF
int fd[11]; // [rsp+3Ch] [rbp-2Ch] BYREF

v4 = a1;
if ( !a1 )
{
v10 = getenv("SHELL");
if ( !v10 )
{
v11 = getuid();
v12 = getpwuid(v11);
v10 = "/bin/sh";
if ( v12 )
{
v10 = v12->pw_shell;
if ( !v10 )
v10 = "/bin/sh";
}
}
v17 = rb_str_new_cstr(v10);
a2 = &v17;
v4 = 1;
}
func9(fd, &v19, a4);
v13[0] = fd[0];
v13[1] = v19;
v14 = a4;
v15 = v4;
v16 = a2;
v8 = rb_fork(0LL, chfunc, v13, 4LL);
*(_QWORD *)(a3 + 8) = rb_thread_current();
if ( v8 < 0 )
{
close(fd[0]);
close(v19);
rb_sys_fail("fork failed");
result = func11();
}
else
{
read(fd[0], &buf, 1uLL);
close(v19);
*(_DWORD *)(a3 + 4) = v8;
result = (unsigned int)fd[0];
*(_DWORD *)a3 = fd[0];
}
return result;
}

original_code:
static void
establishShell(int argc, VALUE *argv, struct pty_info *info,
        char SlaveName[16])
{
    int master,slave;
    pid_t pid;
    char *p, tmp, *getenv();
    struct passwd *pwent;
    VALUE v;
    struct child_info carg;
    if (argc == 0) {
 const char *shellname;
 if ((p = getenv("SHELL")) != ((void *)0)) {
     shellname = p;
 }
 else {
     pwent = getpwuid(getuid());
     if (pwent && pwent->pw_shell)
  shellname = pwent->pw_shell;
     else
  shellname = "/bin/sh";
 }
 v = __extension__ ( { (__builtin_constant_p(shellname)) ? rb_str_new(shellname, strlen(shellname)) : rb_str_new_cstr(shellname); });
 argc = 1;
 argv = &v;
    }
    getDevice(&master, &slave, SlaveName);
    carg.master = master;
    carg.slave = slave;
    carg.slavename = SlaveName;
    carg.argc = argc;
    carg.argv = argv;
    pid = rb_fork(0, chfunc, &carg, ((VALUE)RUBY_Qnil));
    info->thread = rb_thread_current();
    if (pid < 0) {
 close(master);
 close(slave);
 rb_sys_fail("fork failed");
    }
    read(master, &tmp, 1);
    close(slave);
    info->child_pid = pid;
    info->fd = master;
}

canonical_original_code:
static void establishShell(int argc, unsigned long *argv, struct pty_info *info, char SlaveName[16])
{
    int master; int slave;
    int pid;
    char *p; char tmp; char *getenv();
    struct passwd *pwent;
    unsigned long v;
    struct child_info carg;
    if (argc == 0) {
 char *shellname;
 if ((p = getenv("SHELL")) != ((void *)0)) {
     shellname = p;
 }
 else {
     pwent = getpwuid(getuid());
     if (pwent && pwent->pw_shell)
  shellname = pwent->pw_shell;
     else
  shellname = "/bin/sh";
 }
 v = __extension__ ( { (__builtin_constant_p(shellname)) ? rb_str_new(shellname, strlen(shellname)) : rb_str_new_cstr(shellname); });
 argc = 1;
 argv = &v;
    }
    getDevice(&master, &slave, SlaveName);
    carg.master = master;
    carg.slave = slave;
    carg.slavename = SlaveName;
    carg.argc = argc;
    carg.argv = argv;
    pid = rb_fork(0, chfunc, &carg, ((unsigned long)RUBY_Qnil));
    info->thread = rb_thread_current();
    if (pid < 0) {
 close(master);
 close(slave);
 rb_sys_fail("fork failed");
    }
    read(master, &tmp, 1);
    close(slave);
    info->child_pid = pid;
    info->fd = master;
}

variable_types:
argv
unsigned long *

variable_types: struct pty_info { int fd; int child_pid; unsigned long thread; } *

variable_types: pid int

variable_types:
p
char *

variable_types: tmp char

variable_types:
getenv
char *()

variable_types: struct passwd { char *pw_name; char *pw_passwd; unsigned int pw_uid; unsigned int pw_gid; char *pw_gecos; char *pw_dir; char *pw_shell; } *

variable_types: struct child_info { int master; char *slavename; int argc; unsigned long *argv; }

variable_types:
shellname
char *


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

if ( a1 + 0x4000000000000000LL < 0 )
result = rb_int2big();
else
result = 2 * a1 + 1;
return result;
}

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

if ( a1 + 0x4000000000000000LL < 0 )
result = rb_int2big();
else
result = 2 * a1 + 1;
return result;
}

original_code:
static inline VALUE
LONG2NUM(long v)
{
    if ((((v) < (0x7fffffffffffffffL>>1)+1) && ((v) >= (((long)(-0x7fffffffffffffffL - 1L))>>(int)1)))) return ((VALUE)(((long)(v))<<1 | RUBY_FIXNUM_FLAG));
    return rb_int2big(v);
}

canonical_original_code:
static inline unsigned long LONG2NUM(long v)
{
    if ((((v) < (0x7fffffffffffffffL>>1)+1) && ((v) >= (((long)(-0x7fffffffffffffffL - 1L))>>(int)1)))) return ((VALUE)(((long)(v))<<1 | RUBY_FIXNUM_FLAG));
    return rb_int2big(v);
}

variable_types: v long


decompiled_code:
__int64 Init_pty()
{
cPTY = rb_define_module("PTY");
rb_define_module_function(cPTY, "getpty", pty_getpty, 0xFFFFFFFFLL);
rb_define_module_function(cPTY, "spawn", pty_getpty, 0xFFFFFFFFLL);
rb_define_module_function(cPTY, "protect_signal", pty_protect, 0LL);
rb_define_module_function(cPTY, "reset_signal", pty_reset_signal, 0LL);
eChildExited = rb_define_class_under(cPTY, "ChildExited", rb_eRuntimeError);
return rb_define_method(eChildExited, "status", echild_status, 0LL);
}

canonical_decompiled_code:
__int64 func13()
{
cPTY = rb_define_module("PTY");
rb_define_module_function(cPTY, "getpty", pty_getpty, 0xFFFFFFFFLL);
rb_define_module_function(cPTY, "spawn", pty_getpty, 0xFFFFFFFFLL);
rb_define_module_function(cPTY, "protect_signal", pty_protect, 0LL);
rb_define_module_function(cPTY, "reset_signal", pty_reset_signal, 0LL);
eChildExited = rb_define_class_under(cPTY, "ChildExited", rb_eRuntimeError);
return rb_define_method(eChildExited, "status", echild_status, 0LL);
}

original_code:
void
Init_pty()
{
    cPTY = rb_define_module("PTY");
    rb_define_module_function(cPTY,"getpty",pty_getpty,-1);
    rb_define_module_function(cPTY,"spawn",pty_getpty,-1);
    rb_define_module_function(cPTY,"protect_signal",pty_protect,0);
    rb_define_module_function(cPTY,"reset_signal",pty_reset_signal,0);
    eChildExited = rb_define_class_under(cPTY,"ChildExited",rb_eRuntimeError);
    rb_define_method(eChildExited,"status",echild_status,0);
}


original_code:
bytestring_t *bytestring_alloc(void) {
    bytestring_t *ret;
    ret = (bytestring_t*)malloc(sizeof(bytestring_t));
    ret->hash = ((long)0xCAFECAFE);
    ret->length = 64;
    ret->remaining = ret->length;
    ret->buffer = (char*)malloc(sizeof(char)*(ret->length + 1));
    ret->buffer[0] = 0;
    ret->printed = 0;
    return ret;
}

canonical_original_code:
struct bytestring_t *bytestring_alloc() {
    struct bytestring_t *ret;
    ret = (struct bytestring_t *)malloc(sizeof(bytestring_t));
    ret->hash = ((long)0xCAFECAFE);
    ret->length = 64;
    ret->remaining = ret->length;
    ret->buffer = (char *)malloc(sizeof(char)*(ret->length + 1));
    ret->buffer[0] = 0;
    ret->printed = 0;
    return ret;
}

variable_types: struct bytestring_t { long hash; char *buffer; long length; long remaining; int printed; } *


original_code:
void bytestring_append(bytestring_t *str, char code,
                       char *start, char *finish)
{
    long grow;
    long length = 2;
    char *curr;
    ((void) sizeof ((str && ((long)0xCAFECAFE) == str->hash) ? 1 : 0), __extension__ ({ if (str && ((long)0xCAFECAFE) == str->hash) ; else __assert_fail ("str && HASH == str->hash", "yaml2byte.c", 55, __extension__ __PRETTY_FUNCTION__); }));
    if(start) {
        if(!finish)
            finish = start + strlen(start);
        length += (finish-start);
    }
    if(length > str->remaining) {
        grow = (length - str->remaining) + 64;
        str->remaining += grow;
        str->length += grow;
        str->buffer = (str->buffer)=(char*)realloc((char*)(str->buffer),sizeof(char)*(str->length + 1));
        ((void) sizeof ((str->buffer) ? 1 : 0), __extension__ ({ if (str->buffer) ; else __assert_fail ("str->buffer", "yaml2byte.c", 67, __extension__ __PRETTY_FUNCTION__); }));
    }
    curr = str->buffer + (str->length - str->remaining);
    *curr = code;
    curr += 1;
    if(start)
        while(start < finish)
            *curr ++ = *start ++;
    *curr = '\n';
    curr += 1;
    *curr = 0;
    str->remaining = str->remaining - length;
    ((void) sizeof (((str->buffer + str->length) - str->remaining) ? 1 : 0), __extension__ ({ if ((str->buffer + str->length) - str->remaining) ; else __assert_fail ("(str->buffer + str->length) - str->remaining", "yaml2byte.c", 79, __extension__ __PRETTY_FUNCTION__); }));
}

canonical_original_code:
void bytestring_append(struct bytestring_t *str, char code, char *start, char *finish)
{
    long grow;
    long length = 2;
    char *curr;
    ((void) sizeof ((str && ((long)0xCAFECAFE) == str->hash) ? 1 : 0), __extension__ ({ if (str && ((long)0xCAFECAFE) == str->hash) ; else __assert_fail ("str && HASH == str->hash", "yaml2byte.c", 55, __extension__ __PRETTY_FUNCTION__); }));
    if(start) {
        if(!finish)
            finish = start + strlen(start);
        length += (finish-start);
    }
    if(length > str->remaining) {
        grow = (length - str->remaining) + 64;
        str->remaining += grow;
        str->length += grow;
        str->buffer = (str->buffer)=(char *)realloc((char *)(str->buffer),sizeof(char)*(str->length + 1));
        ((void) sizeof ((str->buffer) ? 1 : 0), __extension__ ({ if (str->buffer) ; else __assert_fail ("str->buffer", "yaml2byte.c", 67, __extension__ __PRETTY_FUNCTION__); }));
    }
    curr = str->buffer + (str->length - str->remaining);
    *curr = code;
    curr += 1;
    if(start)
        while(start < finish)
            *curr ++ = *start ++;
    *curr = '\n';
    curr += 1;
    *curr = 0;
    str->remaining = str->remaining - length;
    ((void) sizeof (((str->buffer + str->length) - str->remaining) ? 1 : 0), __extension__ ({ if ((str->buffer + str->length) - str->remaining) ; else __assert_fail ("(str->buffer + str->length) - str->remaining", "yaml2byte.c", 79, __extension__ __PRETTY_FUNCTION__); }));
}

variable_types: code char

variable_types:
start
char *

variable_types:
finish
char *

variable_types: grow long

variable_types: length long

variable_types:
curr
char *

user_defined_types: struct bytestring_t { long hash; char *buffer; long length; long remaining; int printed; }


original_code:
void bytestring_extend(bytestring_t *str, bytestring_t *ext)
{
    char *from;
    char *curr;
    char *stop;
    long grow;
    long length;
    ((void) sizeof ((str && ((long)0xCAFECAFE) == str->hash) ? 1 : 0), __extension__ ({ if (str && ((long)0xCAFECAFE) == str->hash) ; else __assert_fail ("str && HASH == str->hash", "yaml2byte.c", 88, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof ((ext && ((long)0xCAFECAFE) == ext->hash) ? 1 : 0), __extension__ ({ if (ext && ((long)0xCAFECAFE) == ext->hash) ; else __assert_fail ("ext && HASH == ext->hash", "yaml2byte.c", 89, __extension__ __PRETTY_FUNCTION__); }));
    if(ext->printed) {
        ((void) sizeof ((ext->buffer[0] ==((yamlbyte_char_t)'A')) ? 1 : 0), __extension__ ({ if (ext->buffer[0] ==((yamlbyte_char_t)'A')) ; else __assert_fail ("ext->buffer[0] ==YAMLBYTE_ANCHOR", "yaml2byte.c", 91, __extension__ __PRETTY_FUNCTION__); }));
        curr = ext->buffer;
        while( '\n' != *curr)
            curr++;
        bytestring_append(str, ((yamlbyte_char_t)'R'), ext->buffer + 1, curr);
    } else {
        ext->printed = 1;
        length = (ext->length - ext->remaining);
        if(length > str->remaining) {
            grow = (length - str->remaining) + 64;
            str->remaining += grow;
            str->length += grow;
            str->buffer = (str->buffer)=(char*)realloc((char*)(str->buffer),sizeof(char)*(str->length + 1));
        }
        curr = str->buffer + (str->length - str->remaining);
        from = ext->buffer;
        stop = ext->buffer + length;
        while( from < stop )
            *curr ++ = *from ++;
        *curr = 0;
        str->remaining = str->remaining - length;
        ((void) sizeof (((str->buffer + str->length) - str->remaining) ? 1 : 0), __extension__ ({ if ((str->buffer + str->length) - str->remaining) ; else __assert_fail ("(str->buffer + str->length) - str->remaining", "yaml2byte.c", 112, __extension__ __PRETTY_FUNCTION__); }));
    }
}

canonical_original_code:
void bytestring_extend(struct bytestring_t *str, struct bytestring_t *ext)
{
    char *from;
    char *curr;
    char *stop;
    long grow;
    long length;
    ((void) sizeof ((str && ((long)0xCAFECAFE) == str->hash) ? 1 : 0), __extension__ ({ if (str && ((long)0xCAFECAFE) == str->hash) ; else __assert_fail ("str && HASH == str->hash", "yaml2byte.c", 88, __extension__ __PRETTY_FUNCTION__); }));
    ((void) sizeof ((ext && ((long)0xCAFECAFE) == ext->hash) ? 1 : 0), __extension__ ({ if (ext && ((long)0xCAFECAFE) == ext->hash) ; else __assert_fail ("ext && HASH == ext->hash", "yaml2byte.c", 89, __extension__ __PRETTY_FUNCTION__); }));
    if(ext->printed) {
        ((void) sizeof ((ext->buffer[0] ==((unsigned char)'A')) ? 1 : 0), __extension__ ({ if (ext->buffer[0] ==((unsigned char)'A')) ; else __assert_fail ("ext->buffer[0] ==YAMLBYTE_ANCHOR", "yaml2byte.c", 91, __extension__ __PRETTY_FUNCTION__); }));
        curr = ext->buffer;
        while( '\n' != *curr)
            curr++;
        bytestring_append(str, ((unsigned char)'R'), ext->buffer + 1, curr);
    } else {
        ext->printed = 1;
        length = (ext->length - ext->remaining);
        if(length > str->remaining) {
            grow = (length - str->remaining) + 64;
            str->remaining += grow;
            str->length += grow;
            str->buffer = (str->buffer)=(char *)realloc((char *)(str->buffer),sizeof(char)*(str->length + 1));
        }
        curr = str->buffer + (str->length - str->remaining);
        from = ext->buffer;
        stop = ext->buffer + length;
        while( from < stop )
            *curr ++ = *from ++;
        *curr = 0;
        str->remaining = str->remaining - length;
        ((void) sizeof (((str->buffer + str->length) - str->remaining) ? 1 : 0), __extension__ ({ if ((str->buffer + str->length) - str->remaining) ; else __assert_fail ("(str->buffer + str->length) - str->remaining", "yaml2byte.c", 112, __extension__ __PRETTY_FUNCTION__); }));
    }
}

variable_types:
ext
struct bytestring_t *

variable_types:
from
char *

variable_types:
stop
char *


decompiled_code:
__int64 Init_sha1()
{
__int64 v0; // rbx
__int64 v1; // rax
__int64 v2; // rbx
__int64 v3; // rbp

rb_require("digest");
v0 = rb_path2class("Digest");
v1 = rb_path2class("Digest::Base");
v2 = rb_define_class_under(v0, "SHA1", v1);
v3 = rb_data_object_alloc(rb_cObject, &sha1, 0LL, 0LL);
if ( !rb_intern_id_cache_0 )
rb_intern_id_cache_0 = rb_intern2("metadata", 8LL);
return rb_ivar_set(v2, rb_intern_id_cache_0, v3);
}

canonical_decompiled_code:
__int64 func0()
{
__int64 v0; // rbx
__int64 v1; // rax
__int64 v2; // rbx
__int64 v3; // rbp

rb_require("digest");
v0 = rb_path2class("Digest");
v1 = rb_path2class("Digest::Base");
v2 = rb_define_class_under(v0, "SHA1", v1);
v3 = rb_data_object_alloc(rb_cObject, &sha1, 0LL, 0LL);
if ( !rb_intern_id_cache_0 )
rb_intern_id_cache_0 = rb_intern2("metadata", 8LL);
return rb_ivar_set(v2, rb_intern_id_cache_0, v3);
}

original_code:
void
Init_sha1()
{
    VALUE mDigest, cDigest_Base, cDigest_SHA1;
    rb_require("digest");
    mDigest = rb_path2class("Digest");
    cDigest_Base = rb_path2class("Digest::Base");
    cDigest_SHA1 = rb_define_class_under(mDigest, "SHA1", cDigest_Base);
    rb_ivar_set(cDigest_SHA1, (__builtin_constant_p("metadata") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2("metadata", strlen("metadata")); rb_intern_id_cache; }) : rb_intern("metadata")),
      rb_data_object_alloc(rb_cObject,(void *)&sha1,(RUBY_DATA_FUNC)0,(RUBY_DATA_FUNC)0));
}

canonical_original_code:
void Init_sha1()
{
    unsigned long mDigest; unsigned long cDigest_Base; unsigned long cDigest_SHA1;
    rb_require("digest");
    mDigest = rb_path2class("Digest");
    cDigest_Base = rb_path2class("Digest::Base");
    cDigest_SHA1 = rb_define_class_under(mDigest, "SHA1", cDigest_Base);
    rb_ivar_set(cDigest_SHA1, (__builtin_constant_p("metadata") ? __extension__ ({ static unsigned long rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2("metadata", strlen("metadata")); rb_intern_id_cache; }) : rb_intern("metadata")),
      rb_data_object_alloc(rb_cObject,(void *)&sha1,(void (*)(void *))0,(void (*)(void *))0));
}

variable_types:
mDigest
unsigned long


decompiled_code:
__int64 Init_rmd160()
{
__int64 v0; // rbx
__int64 v1; // rax
__int64 v2; // rbx
__int64 v3; // rbp

rb_require("digest");
v0 = rb_path2class("Digest");
v1 = rb_path2class("Digest::Base");
v2 = rb_define_class_under(v0, "RMD160", v1);
v3 = rb_data_object_alloc(rb_cObject, &rmd160, 0LL, 0LL);
if ( !rb_intern_id_cache_0 )
rb_intern_id_cache_0 = rb_intern2("metadata", 8LL);
return rb_ivar_set(v2, rb_intern_id_cache_0, v3);
}

canonical_decompiled_code:
__int64 func0()
{
__int64 v0; // rbx
__int64 v1; // rax
__int64 v2; // rbx
__int64 v3; // rbp

rb_require("digest");
v0 = rb_path2class("Digest");
v1 = rb_path2class("Digest::Base");
v2 = rb_define_class_under(v0, "RMD160", v1);
v3 = rb_data_object_alloc(rb_cObject, &rmd160, 0LL, 0LL);
if ( !rb_intern_id_cache_0 )
rb_intern_id_cache_0 = rb_intern2("metadata", 8LL);
return rb_ivar_set(v2, rb_intern_id_cache_0, v3);
}

original_code:
void
Init_rmd160()
{
    VALUE mDigest, cDigest_Base, cDigest_RMD160;
    rb_require("digest");
    mDigest = rb_path2class("Digest");
    cDigest_Base = rb_path2class("Digest::Base");
    cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);
    rb_ivar_set(cDigest_RMD160, (__builtin_constant_p("metadata") ? __extension__ ({ static ID rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2("metadata", strlen("metadata")); rb_intern_id_cache; }) : rb_intern("metadata")),
      rb_data_object_alloc(rb_cObject,(void *)&rmd160,(RUBY_DATA_FUNC)0,(RUBY_DATA_FUNC)0));
}

canonical_original_code:
void Init_rmd160()
{
    unsigned long mDigest; unsigned long cDigest_Base; unsigned long cDigest_RMD160;
    rb_require("digest");
    mDigest = rb_path2class("Digest");
    cDigest_Base = rb_path2class("Digest::Base");
    cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);
    rb_ivar_set(cDigest_RMD160, (__builtin_constant_p("metadata") ? __extension__ ({ static unsigned long rb_intern_id_cache; if (!rb_intern_id_cache) rb_intern_id_cache = rb_intern2("metadata", strlen("metadata")); rb_intern_id_cache; }) : rb_intern("metadata")),
      rb_data_object_alloc(rb_cObject,(void *)&rmd160,(void (*)(void *))0,(void (*)(void *))0));
}


decompiled_code:
__int64 passwd_ensure()
{
passwd_blocking = 0;
return 4LL;
}

canonical_decompiled_code:
__int64 func0()
{
passwd_blocking = 0;
return 4LL;
}

original_code:
static VALUE
passwd_ensure(void)
{
    passwd_blocking = ((VALUE)RUBY_Qfalse);
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long passwd_ensure()
{
    passwd_blocking = ((unsigned long)RUBY_Qfalse);
    return ((unsigned long)RUBY_Qnil);
}


decompiled_code:
__int64 group_ensure()
{
group_blocking = 0;
return 4LL;
}

canonical_decompiled_code:
__int64 func1()
{
group_blocking = 0;
return 4LL;
}

original_code:
static VALUE
group_ensure(void)
{
    group_blocking = ((VALUE)RUBY_Qfalse);
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long group_ensure()
{
    group_blocking = ((unsigned long)RUBY_Qfalse);
    return ((unsigned long)RUBY_Qnil);
}


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

if ( a1 > 0x3FFFFFFFFFFFFFFFLL )
result = rb_uint2big();
else
result = 2 * a1 + 1;
return result;
}

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

if ( a1 > 0x3FFFFFFFFFFFFFFFLL )
result = rb_uint2big();
else
result = 2 * a1 + 1;
return result;
}

original_code:
static inline VALUE
ULONG2NUM(unsigned long v)
{
    if (((v) < (0x7fffffffffffffffL>>1)+1)) return ((VALUE)(((long)(v))<<1 | RUBY_FIXNUM_FLAG));
    return rb_uint2big(v);
}

canonical_original_code:
static inline unsigned long ULONG2NUM(unsigned long v)
{
    if (((v) < (0x7fffffffffffffffL>>1)+1)) return ((VALUE)(((long)(v))<<1 | RUBY_FIXNUM_FLAG));
    return rb_uint2big(v);
}

variable_types:
v
unsigned long


decompiled_code:
__int64 __fastcall safe_setup_str(void *a1)
{
if ( !a1 )
a1 = &LC0;
return rb_tainted_str_new_cstr(a1);
}

canonical_decompiled_code:
__int64 __fastcall func3(void *a1)
{
if ( !a1 )
a1 = &LC0;
return rb_tainted_str_new_cstr(a1);
}

original_code:
static VALUE
safe_setup_str(const char *str)
{
    if (str == 0) str = "";
    return __extension__ ( { (__builtin_constant_p(str)) ? rb_tainted_str_new(str, strlen(str)) : rb_tainted_str_new_cstr(str); });
}

canonical_original_code:
static unsigned long safe_setup_str(char *str)
{
    if (str == 0) str = "";
    return __extension__ ( { (__builtin_constant_p(str)) ? rb_tainted_str_new(str, strlen(str)) : rb_tainted_str_new_cstr(str); });
}

variable_types:
str
char *


decompiled_code:
__int64 __fastcall setup_group(__int64 a1)
{
__int64 v2; // rbp
void **v3; // rbx
void *i; // rdi
__int64 v5; // rax
__int64 v6; // r13
__int64 v7; // rbx
__int64 v8; // rax

v2 = rb_ary_new();
v3 = *(void ***)(a1 + 24);
for ( i = *v3; *v3; i = *v3 )
{
v5 = safe_setup_str(i);
rb_ary_push(v2, v5);
++v3;
}
v6 = ULONG2NUM(*(unsigned int *)(a1 + 16));
v7 = safe_setup_str(*(void **)(a1 + 8));
v8 = safe_setup_str(*(void **)a1);
return rb_struct_new(sGroup, v8, v7, v6, v2);
}

original_code:
static VALUE
setup_group(struct group *grp)
{
    VALUE mem;
    char **tbl;
    mem = rb_ary_new();
    tbl = grp->gr_mem;
    while (*tbl) {
 rb_ary_push(mem, safe_setup_str(*tbl));
 tbl++;
    }
    return rb_struct_new(sGroup,
    safe_setup_str(grp->gr_name),
    safe_setup_str(grp->gr_passwd),
    ULONG2NUM(grp->gr_gid),
    mem);
}

canonical_original_code:
static unsigned long setup_group(struct group *grp)
{
    unsigned long mem;
    char **tbl;
    mem = rb_ary_new();
    tbl = grp->gr_mem;
    while (*tbl) {
 rb_ary_push(mem, safe_setup_str(*tbl));
 tbl++;
    }
    return rb_struct_new(sGroup,
    safe_setup_str(grp->gr_name),
    safe_setup_str(grp->gr_passwd),
    ULONG2NUM(grp->gr_gid),
    mem);
}

variable_types: struct group { char *gr_name; char *gr_passwd; unsigned int gr_gid; char **gr_mem; } *

variable_types:
mem
unsigned long

variable_types:
tbl
char **


decompiled_code:
__int64 etc_getgrent()
{
struct group *v0; // rdi
__int64 result; // rax

v0 = getgrent();
result = 4LL;
if ( v0 )
result = setup_group((__int64)v0);
return result;
}

canonical_decompiled_code:
__int64 func5()
{
struct group *v0; // rdi
__int64 result; // rax

v0 = getgrent();
result = 4LL;
if ( v0 )
result = func4((__int64)v0);
return result;
}

original_code:
static VALUE
etc_getgrent(VALUE obj)
{
    struct group *gr;
    if (gr = getgrent()) {
 return setup_group(gr);
    }
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long etc_getgrent(unsigned long obj)
{
    struct group *gr;
    if (gr = getgrent()) {
 return setup_group(gr);
    }
    return ((unsigned long)RUBY_Qnil);
}

variable_types:
obj
unsigned long

user_defined_types: struct group { char *gr_name; char *gr_passwd; unsigned int gr_gid; char **gr_mem; }


decompiled_code:
__int64 etc_endgrent()
{
endgrent();
return 4LL;
}

canonical_decompiled_code:
__int64 func6()
{
endgrent();
return 4LL;
}

original_code:
static VALUE
etc_endgrent(VALUE obj)
{
    endgrent();
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long etc_endgrent(unsigned long obj)
{
    endgrent();
    return ((unsigned long)RUBY_Qnil);
}


decompiled_code:
__int64 etc_setgrent()
{
setgrent();
return 4LL;
}

canonical_decompiled_code:
__int64 func7()
{
setgrent();
return 4LL;
}

original_code:
static VALUE
etc_setgrent(VALUE obj)
{
    setgrent();
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long etc_setgrent(unsigned long obj)
{
    setgrent();
    return ((unsigned long)RUBY_Qnil);
}


decompiled_code:
__int64 etc_group()
{
struct group *v0; // rdi
__int64 result; // rax

rb_secure(4LL);
if ( (unsigned int)rb_block_given_p() )
{
if ( group_blocking )
{
rb_raise(rb_eRuntimeError, "parallel group iteration");
return group_iterate();
}
group_blocking = 2;
rb_ensure(group_iterate, 0LL, group_ensure, 0LL);
}
v0 = getgrent();
result = 4LL;
if ( v0 )
result = setup_group((__int64)v0);
return result;
}

canonical_decompiled_code:
__int64 func8()
{
struct group *v0; // rdi
__int64 result; // rax

rb_secure(4LL);
if ( (unsigned int)rb_block_given_p() )
{
if ( group_blocking )
{
rb_raise(rb_eRuntimeError, "parallel group iteration");
return func9();
}
group_blocking = 2;
rb_ensure(group_iterate, 0LL, group_ensure, 0LL);
}
v0 = getgrent();
result = 4LL;
if ( v0 )
result = func4((__int64)v0);
return result;
}

original_code:
static VALUE
etc_group(VALUE obj)
{
    struct group *grp;
    rb_secure(4);
    if (rb_block_given_p()) {
 if (group_blocking) {
     rb_raise(rb_eRuntimeError, "parallel group iteration");
 }
 group_blocking = ((VALUE)RUBY_Qtrue);
 rb_ensure(group_iterate, 0, group_ensure, 0);
    }
    if (grp = getgrent()) {
 return setup_group(grp);
    }
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long etc_group(unsigned long obj)
{
    struct group *grp;
    rb_secure(4);
    if (rb_block_given_p()) {
 if (group_blocking) {
     rb_raise(rb_eRuntimeError, "parallel group iteration");
 }
 group_blocking = ((unsigned long)RUBY_Qtrue);
 rb_ensure(group_iterate, 0, group_ensure, 0);
    }
    if (grp = getgrent()) {
 return setup_group(grp);
    }
    return ((unsigned long)RUBY_Qnil);
}


decompiled_code:
__int64 group_iterate()
{
__int64 v0; // rax
struct group *v1; // rdi

setgrent();
while ( 1 )
{
v1 = getgrent();
if ( !v1 )
break;
v0 = setup_group((__int64)v1);
rb_yield(v0);
}
endgrent();
return 4LL;
}

canonical_decompiled_code:
__int64 func9()
{
__int64 v0; // rax
struct group *v1; // rdi

setgrent();
while ( 1 )
{
v1 = getgrent();
if ( !v1 )
break;
v0 = func4((__int64)v1);
rb_yield(v0);
}
endgrent();
return 4LL;
}

original_code:
static VALUE
group_iterate(void)
{
    struct group *pw;
    setgrent();
    while (pw = getgrent()) {
 rb_yield(setup_group(pw));
    }
    endgrent();
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long group_iterate()
{
    struct group *pw;
    setgrent();
    while (pw = getgrent()) {
 rb_yield(setup_group(pw));
    }
    endgrent();
    return ((unsigned long)RUBY_Qnil);
}


decompiled_code:
__int64 __fastcall etc_getgrnam(__int64 a1, _QWORD *a2)
{
const char *v2; // rdi
struct group *v3; // rdi
const char *v5; // rdx
_QWORD *v6; // [rsp+8h] [rbp-10h] BYREF

v6 = a2;
rb_secure(4LL);
rb_string_value(&v6);
rb_check_safe_obj(v6);
if ( (*v6 & 0x2000LL) != 0 )
v2 = (const char *)v6[3];
else
v2 = (const char *)(v6 + 2);
v3 = getgrnam(v2);
if ( v3 )
return setup_group((__int64)v3);
v5 = (const char *)(v6 + 2);
if ( (*v6 & 0x2000LL) != 0 )
v5 = (const char *)v6[3];
rb_raise(rb_eArgError, "can't find group for %s", v5);
return etc_getgrgid();
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, _QWORD *a2)
{
const char *v2; // rdi
struct group *v3; // rdi
const char *v5; // rdx
_QWORD *v6; // [rsp+8h] [rbp-10h] BYREF

v6 = a2;
rb_secure(4LL);
rb_string_value(&v6);
rb_check_safe_obj(v6);
if ( (*v6 & 0x2000LL) != 0 )
v2 = (const char *)v6[3];
else
v2 = (const char *)(v6 + 2);
v3 = getgrnam(v2);
if ( v3 )
return func4((__int64)v3);
v5 = (const char *)(v6 + 2);
if ( (*v6 & 0x2000LL) != 0 )
v5 = (const char *)v6[3];
rb_raise(rb_eArgError, "can't find group for %s", v5);
return func11();
}

original_code:
static VALUE
etc_getgrnam(VALUE obj, VALUE nam)
{
    struct group *grp;
    rb_secure(4);
    do { rb_string_value(&(nam)); rb_check_safe_obj(nam);} while (0);
    grp = getgrnam((!(((struct RBasic*)(nam))->flags & (((VALUE)1)<<(12 +1))) ? ((struct RString*)(nam))->as.ary : ((struct RString*)(nam))->as.heap.ptr));
    if (grp == 0) rb_raise(rb_eArgError, "can't find group for %s", (!(((struct RBasic*)(nam))->flags & (((VALUE)1)<<(12 +1))) ? ((struct RString*)(nam))->as.ary : ((struct RString*)(nam))->as.heap.ptr));
    return setup_group(grp);
}

canonical_original_code:
static unsigned long etc_getgrnam(unsigned long obj, unsigned long nam)
{
    struct group *grp;
    rb_secure(4);
    do { rb_string_value(&(nam)); rb_check_safe_obj(nam);} while (0);
    grp = getgrnam((!(((struct RBasic *)(nam))->flags & (((unsigned long)1)<<(12 +1))) ? ((struct RString *)(nam))->as.ary : ((struct RString *)(nam))->as.heap.ptr));
    if (grp == 0) rb_raise(rb_eArgError, "can't find group for %s", (!(((struct RBasic *)(nam))->flags & (((unsigned long)1)<<(12 +1))) ? ((struct RString *)(nam))->as.ary : ((struct RString *)(nam))->as.heap.ptr));
    return setup_group(grp);
}

variable_types:
nam
unsigned long


decompiled_code:
__int64 __fastcall etc_getgrgid(unsigned int a1, __int64 a2)
{
__gid_t v2; // ebx
struct group *v3; // rdi
__int64 v5[4]; // [rsp+8h] [rbp-20h] BYREF

rb_secure(4LL);
if ( (unsigned int)rb_scan_args(a1, a2, "01", v5) == 1 )
v2 = rb_num2ulong(v5[0]);
else
v2 = getgid();
v3 = getgrgid(v2);
if ( v3 )
return setup_group((__int64)v3);
rb_raise(rb_eArgError, "can't find group for %d", v2);
return etc_setpwent();
}

canonical_decompiled_code:
__int64 __fastcall func11(unsigned int a1, __int64 a2)
{
__gid_t v2; // ebx
struct group *v3; // rdi
__int64 v5[4]; // [rsp+8h] [rbp-20h] BYREF

rb_secure(4LL);
if ( (unsigned int)rb_scan_args(a1, a2, "01", v5) == 1 )
v2 = rb_num2ulong(v5[0]);
else
v2 = getgid();
v3 = getgrgid(v2);
if ( v3 )
return func4((__int64)v3);
rb_raise(rb_eArgError, "can't find group for %d", v2);
return func12();
}

original_code:
static VALUE
etc_getgrgid(int argc, VALUE *argv, VALUE obj)
{
    VALUE id;
    gid_t gid;
    struct group *grp;
    rb_secure(4);
    if (rb_scan_args(argc, argv, "01", &id) == 1) {
 gid = rb_num2ulong((VALUE)id);
    }
    else {
 gid = getgid();
    }
    grp = getgrgid(gid);
    if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", (int)gid);
    return setup_group(grp);
}

canonical_original_code:
static unsigned long etc_getgrgid(int argc, unsigned long *argv, unsigned long obj)
{
    unsigned long id;
    unsigned int gid;
    struct group *grp;
    rb_secure(4);
    if (rb_scan_args(argc, argv, "01", &id) == 1) {
 gid = rb_num2ulong((unsigned long)id);
    }
    else {
 gid = getgid();
    }
    grp = getgrgid(gid);
    if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", (int)gid);
    return setup_group(grp);
}

variable_types: argc int

variable_types:
argv
unsigned long *

variable_types:
id
unsigned long

variable_types:
gid
unsigned int


decompiled_code:
__int64 etc_setpwent()
{
setpwent();
return 4LL;
}

canonical_decompiled_code:
__int64 func12()
{
setpwent();
return 4LL;
}

original_code:
static VALUE
etc_setpwent(VALUE obj)
{
    setpwent();
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long etc_setpwent(unsigned long obj)
{
    setpwent();
    return ((unsigned long)RUBY_Qnil);
}


decompiled_code:
__int64 etc_endpwent()
{
endpwent();
return 4LL;
}

canonical_decompiled_code:
__int64 func13()
{
endpwent();
return 4LL;
}

original_code:
static VALUE
etc_endpwent(VALUE obj)
{
    endpwent();
    return ((VALUE)RUBY_Qnil);
}

canonical_original_code:
static unsigned long etc_endpwent(unsigned long obj)
{
    endpwent();
    return ((unsigned long)RUBY_Qnil);
}


decompiled_code:
__int64 __fastcall setup_passwd(__int64 a1)
{
__int64 v1; // r12
__int64 v2; // rbp
__int64 v3; // rax
__int64 result; // rax
__int64 v5; // [rsp+8h] [rbp-40h]

if ( a1 )
{
safe_setup_str(*(void **)(a1 + 40));
safe_setup_str(*(void **)(a1 + 32));
safe_setup_str(*(void **)(a1 + 24));
v1 = ULONG2NUM(*(unsigned int *)(a1 + 20));
v2 = ULONG2NUM(*(unsigned int *)(a1 + 16));
v5 = safe_setup_str(*(void **)(a1 + 8));
v3 = safe_setup_str(*(void **)a1);
result = rb_struct_new(sPasswd, v3, v5, v2, v1);
}
else
{
rb_sys_fail("/etc/passwd");
result = etc_passwd();
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1)
{
__int64 v1; // r12
__int64 v2; // rbp
__int64 v3; // rax
__int64 result; // rax
__int64 v5; // [rsp+8h] [rbp-40h]

if ( a1 )
{
func3(*(void **)(a1 + 40));
func3(*(void **)(a1 + 32));
func3(*(void **)(a1 + 24));
v1 = func2(*(unsigned int *)(a1 + 20));
v2 = func2(*(unsigned int *)(a1 + 16));
v5 = func3(*(void **)(a1 + 8));
v3 = func3(*(void **)a1);
result = rb_struct_new(sPasswd, v3, v5, v2, v1);
}
else
{
rb_sys_fail("/etc/passwd");
result = func15();
}
return result;
}

original_code:
static VALUE
setup_passwd(struct passwd *pwd)
{
    if (pwd == 0) rb_sys_fail("/etc/passwd");
    return rb_struct_new(sPasswd,
    safe_setup_str(pwd->pw_name),
    safe_setup_str(pwd->pw_passwd),
    ULONG2NUM(pwd->pw_uid),
    ULONG2NUM(pwd->pw_gid),
    safe_setup_str(pwd->pw_gecos),
    safe_setup_str(pwd->pw_dir),
    safe_setup_str(pwd->pw_shell),
    0
 );
}

canonical_original_code:
static unsigned long setup_passwd(struct passwd *pwd)
{
    if (pwd == 0) rb_sys_fail("/etc/passwd");
    return rb_struct_new(sPasswd,
    safe_setup_str(pwd->pw_name),
    safe_setup_str(pwd->pw_passwd),
    ULONG2NUM(pwd->pw_uid),
    ULONG2NUM(pwd->pw_gid),
    safe_setup_str(pwd->pw_gecos),
    safe_setup_str(pwd->pw_dir),
    safe_setup_str(pwd->pw_shell),
    0
 );
}

variable_types: struct passwd { char *pw_name; char *pw_passwd; unsigned int pw_uid; unsigned int pw_gid; char *pw_gecos; char *pw_dir; char *pw_shell; } *