decompiled_code:
void __fastcall PrintStringOutline16(unsigned __int8 *a1, __int16 a2, __int16 a3, __int64 a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11)
{
int v13; // ebp
unsigned int v14; // er14
unsigned int i; // ebx

v13 = 0;
v14 = a9 - 2;
do
{
for ( i = 1; ; ++i )
{
if ( v13 != 1 || i != 2 )
{
PrintString16(a1, a3, a4, a5, a6 + v13, i + a7 - 1, a8 - 2, v14, a10, a11);
if ( i > 2 )
break;
}
}
++v13;
}
while ( v13 != 3 );
PrintString16(a1, a2, a4, a5, a6 + 1, a7 + 1, a8 - 2, v14, a10, a11);
}

original_code:
void PrintStringOutline16(const char* String, uint16_t TextColor, uint16_t OutlineColor,
 void* Dest, uint32_t DestPitch, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height,
 enum HorizontalAlignment HorizontalAlignment, enum VerticalAlignment VerticalAlignment)
{
 uint32_t sx, sy;
 for (sx = 0; sx <= 2; sx++)
  for (sy = 0; sy <= 2; sy++)
   if (!(sx == 1 && sy == 1))
    PrintString16(String, OutlineColor, Dest, DestPitch, X + sx, Y + sy, Width - 2, Height - 2, HorizontalAlignment, VerticalAlignment);
 PrintString16(String, TextColor, Dest, DestPitch, X + 1, Y + 1, Width - 2, Height - 2, HorizontalAlignment, VerticalAlignment);
}

canonical_original_code:
void PrintStringOutline16(char *String, unsigned short TextColor, unsigned short OutlineColor, void *Dest, unsigned int DestPitch, unsigned int X, unsigned int Y, unsigned int Width, unsigned int Height, enum HorizontalAlignment HorizontalAlignment, enum VerticalAlignment VerticalAlignment)
{
 unsigned int sx; unsigned int sy;
 for (sx = 0; sx <= 2; sx++)
  for (sy = 0; sy <= 2; sy++)
   if (!(sx == 1 && sy == 1))
    PrintString16(String, OutlineColor, Dest, DestPitch, X + sx, Y + sy, Width - 2, Height - 2, HorizontalAlignment, VerticalAlignment);
 PrintString16(String, TextColor, Dest, DestPitch, X + 1, Y + 1, Width - 2, Height - 2, HorizontalAlignment, VerticalAlignment);
}

variable_types:
TextColor
unsigned short

variable_types:
OutlineColor
unsigned short

variable_types:
Dest
void *

variable_types:
DestPitch
unsigned int

variable_types:
X
unsigned int

variable_types:
Y
unsigned int

variable_types:
sx
unsigned int

variable_types:
sy
unsigned int


repo: Nebuleon/hocoslamfy

decompiled_code:
void __fastcall PrintStringOutline32(unsigned __int8 *a1, int a2, int a3, __int64 a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11)
{
int v13; // ebp
unsigned int v14; // er14
unsigned int i; // ebx

v13 = 0;
v14 = a9 - 2;
do
{
for ( i = 1; ; ++i )
{
if ( v13 != 1 || i != 2 )
{
PrintString32(a1, a3, a4, a5, a6 + v13, i + a7 - 1, a8 - 2, v14, a10, a11);
if ( i > 2 )
break;
}
}
++v13;
}
while ( v13 != 3 );
PrintString32(a1, a2, a4, a5, a6 + 1, a7 + 1, a8 - 2, v14, a10, a11);
}

original_code:
void PrintStringOutline32(const char* String, uint32_t TextColor, uint32_t OutlineColor,
 void* Dest, uint32_t DestPitch, uint32_t X, uint32_t Y, uint32_t Width, uint32_t Height,
 enum HorizontalAlignment HorizontalAlignment, enum VerticalAlignment VerticalAlignment)
{
 uint32_t sx, sy;
 for (sx = 0; sx <= 2; sx++)
  for (sy = 0; sy <= 2; sy++)
   if (!(sx == 1 && sy == 1))
    PrintString32(String, OutlineColor, Dest, DestPitch, X + sx, Y + sy, Width - 2, Height - 2, HorizontalAlignment, VerticalAlignment);
 PrintString32(String, TextColor, Dest, DestPitch, X + 1, Y + 1, Width - 2, Height - 2, HorizontalAlignment, VerticalAlignment);
}

canonical_original_code:
void PrintStringOutline32(char *String, unsigned int TextColor, unsigned int OutlineColor, void *Dest, unsigned int DestPitch, unsigned int X, unsigned int Y, unsigned int Width, unsigned int Height, enum HorizontalAlignment HorizontalAlignment, enum VerticalAlignment VerticalAlignment)
{
 unsigned int sx; unsigned int sy;
 for (sx = 0; sx <= 2; sx++)
  for (sy = 0; sy <= 2; sy++)
   if (!(sx == 1 && sy == 1))
    PrintString32(String, OutlineColor, Dest, DestPitch, X + sx, Y + sy, Width - 2, Height - 2, HorizontalAlignment, VerticalAlignment);
 PrintString32(String, TextColor, Dest, DestPitch, X + 1, Y + 1, Width - 2, Height - 2, HorizontalAlignment, VerticalAlignment);
}

variable_types:
String
char *

variable_types:
TextColor
unsigned int

variable_types:
OutlineColor
unsigned int

variable_types:
Width
unsigned int

variable_types:
Height
unsigned int

variable_types: enum HorizontalAlignment { LEFT=0, CENTER=1, RIGHT=2 }

variable_types: enum VerticalAlignment { TOP=0, MIDDLE=1, BOTTOM=2 }

return_type: void


repo: Nehmulos/ascension-switch

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

result = malloc(0x10uLL);
*result = 0LL;
result[1] = 0LL;
return result;
}

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

result = malloc(0x10uLL);
*result = 0LL;
result[1] = 0LL;
return result;
}

original_code:
List* List_create() {
    List* this = malloc(sizeof(List));
    this->first = ((void *)0);
    this->last = ((void *)0);
    return this;
}

canonical_original_code:
struct List *List_create() {
    struct List *this = malloc(sizeof(List));
    this->first = ((void *)0);
    this->last = ((void *)0);
    return this;
}

variable_types: struct List { struct ListNode { struct ListNode *previous; struct ListNode *next; void *data; } *first; struct ListNode *last; } *

user_defined_types: struct List { struct ListNode *first; struct ListNode *last; }


decompiled_code:
__int64 __fastcall List_getIndexForData(__int64 *a1, __int64 a2)
{
__int64 v2; // rax
unsigned int v3; // edx

v2 = *a1;
if ( !*a1 )
return (unsigned int)-1;
v3 = 0;
while ( *(_QWORD *)(v2 + 16) != a2 )
{
++v3;
v2 = *(_QWORD *)(v2 + 8);
if ( !v2 )
return (unsigned int)-1;
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 *a1, __int64 a2)
{
__int64 v2; // rax
unsigned int v3; // edx

v2 = *a1;
if ( !*a1 )
return (unsigned int)-1;
v3 = 0;
while ( *(_QWORD *)(v2 + 16) != a2 )
{
++v3;
v2 = *(_QWORD *)(v2 + 8);
if ( !v2 )
return (unsigned int)-1;
}
return v3;
}

original_code:
int List_getIndexForData(List* this, void* data) {
    int i = 0;
    ListNode* it = this->first;
    while (it) {
        if (it->data == data) {
            return i;
        }
        ++i;
        it = it->next;
    }
    return -1;
}

canonical_original_code:
int List_getIndexForData(struct List *this, void *data) {
    int i = 0;
    struct ListNode *it = this->first;
    while (it) {
        if (it->data == data) {
            return i;
        }
        ++i;
        it = it->next;
    }
    return -1;
}

variable_types:
data
void *

variable_types: i int

variable_types: struct ListNode { struct ListNode *previous; struct ListNode *next; void *data; } *

return_type: int


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

for ( result = *a1; result; result = *(_QWORD *)(result + 8) )
{
if ( *(_QWORD *)(result + 16) == a2 )
break;
}
return result;
}

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

for ( result = *a1; result; result = *(_QWORD *)(result + 8) )
{
if ( *(_QWORD *)(result + 16) == a2 )
break;
}
return result;
}

original_code:
ListNode* List_getNodeForData(List* this, void* data) {
    ListNode* it = this->first;
    while (it) {
        if (it->data == data) {
            return it;
        }
        it = it->next;
    }
    return ((void *)0);
}

canonical_original_code:
struct ListNode *List_getNodeForData(struct List *this, void *data) {
    struct ListNode *it = this->first;
    while (it) {
        if (it->data == data) {
            return it;
        }
        it = it->next;
    }
    return ((void *)0);
}

variable_types: struct List { struct ListNode *first; struct ListNode *last; } *

return_type: struct ListNode { struct ListNode *previous; struct ListNode *next; void *data; } *


decompiled_code:
void __fastcall ListNode_destroy(void *a1)
{
free(a1);
}

canonical_decompiled_code:
void __fastcall func3(void *a1)
{
free(a1);
}

original_code:
void ListNode_destroy(ListNode* this) {
    free(this);
}

canonical_original_code:
void ListNode_destroy(struct ListNode *this) {
    free(this);
}

user_defined_types: struct ListNode { struct ListNode *previous; struct ListNode *next; void *data; }


decompiled_code:
void __fastcall List_destroy(void *ptr)
{
_QWORD *v2; // rbx
void *v3; // rdi

v2 = *(_QWORD **)ptr;
if ( *(_QWORD *)ptr )
{
do
{
v3 = v2;
v2 = (_QWORD *)v2[1];
ListNode_destroy(v3);
}
while ( v2 );
}
free(ptr);
}

canonical_decompiled_code:
void __fastcall func4(void *ptr)
{
_QWORD *v2; // rbx
void *v3; // rdi

v2 = *(_QWORD **)ptr;
if ( *(_QWORD *)ptr )
{
do
{
v3 = v2;
v2 = (_QWORD *)v2[1];
func3(v3);
}
while ( v2 );
}
free(ptr);
}

original_code:
void List_destroy(List* this) {
    ListNode* it = this->first;
    while (it) {
        ListNode* next = it->next;
        ListNode_destroy(it);
        it = next;
    }
    free(this);
}

canonical_original_code:
void List_destroy(struct List *this) {
    struct ListNode *it = this->first;
    while (it) {
        struct ListNode *next = it->next;
        ListNode_destroy(it);
        it = next;
    }
    free(this);
}


original_code:
void List_eraseByData(List* this, void* data) {
    ListNode* it = this->first;
    while (it) {
        if (it->data == data) {
            if (it->previous) {
                it->previous->next = it->next;
            }
            if (it->next) {
                it->next->previous = it->previous;
            }
            if (it == this->first) {
                this->first = it->next;
            }
            if (it == this->last) {
                this->last = it->previous;
            }
            ListNode_destroy(it);
            return;
        }
        it = it->next;
    }
}

canonical_original_code:
void List_eraseByData(struct List *this, void *data) {
    struct ListNode *it = this->first;
    while (it) {
        if (it->data == data) {
            if (it->previous) {
                it->previous->next = it->next;
            }
            if (it->next) {
                it->next->previous = it->previous;
            }
            if (it == this->first) {
                this->first = it->next;
            }
            if (it == this->last) {
                this->last = it->previous;
            }
            ListNode_destroy(it);
            return;
        }
        it = it->next;
    }
}


decompiled_code:
__int64 __fastcall List_length(__int64 *a1)
{
__int64 v1; // rax
unsigned int v2; // edx

v1 = *a1;
if ( !*a1 )
return 0;
v2 = 0;
do
{
++v2;
v1 = *(_QWORD *)(v1 + 8);
}
while ( v1 );
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 *a1)
{
__int64 v1; // rax
unsigned int v2; // edx

v1 = *a1;
if ( !*a1 )
return 0;
v2 = 0;
do
{
++v2;
v1 = *(_QWORD *)(v1 + 8);
}
while ( v1 );
return v2;
}

original_code:
int List_length(List* this) {
    int n = 0;
    for (ListNode* it = this->first; it; it = it->next) {
 ++n;
    }
    return n;
}

canonical_original_code:
int List_length(struct List *this) {
    int n = 0;
    for (struct ListNode *it = this->first; it; it = it->next) {
 ++n;
    }
    return n;
}

variable_types: n int


original_code:
void List_qSortIt(List* this, int (*compare)(void* a, void* b), ListNode* start, ListNode* end) {
    if (start == end) {
 return;
    }
    ListNode* it = start;
    ListNode* jt = end->previous ? end->previous : it;
    void* pivot = end->data;
    while (it != jt) {
 while (1 != compare(it->data, pivot) && it != jt) {
     it = it->next;
 }
 while (-1 != compare(jt->data, pivot) && jt != it) {
     jt = jt->previous;
 }
 if (it != jt) {
     void* swapCache = it->data;
     it->data = jt->data;
     jt->data = swapCache;
 }
    }
    if (1 == compare(it->data, pivot)) {
 void* swapCache = it->data;
 it->data = end->data;
 end->data = swapCache;
    }
    if (it->previous && start != it) {
 List_qSortIt(this, compare, start, it->previous);
    }
    if (it->next && end != it) {
 List_qSortIt(this, compare, it->next, end);
    }
}

canonical_original_code:
void List_qSortIt(struct List *this, int (*compare)(void *a, void *b), struct ListNode *start, struct ListNode *end) {
    if (start == end) {
 return;
    }
    struct ListNode *it = start;
    struct ListNode *jt = end->previous ? end->previous : it;
    void *pivot = end->data;
    while (it != jt) {
 while (1 != compare(it->data, pivot) && it != jt) {
     it = it->next;
 }
 while (-1 != compare(jt->data, pivot) && jt != it) {
     jt = jt->previous;
 }
 if (it != jt) {
     void *swapCache = it->data;
     it->data = jt->data;
     jt->data = swapCache;
 }
    }
    if (1 == compare(it->data, pivot)) {
 void *swapCache = it->data;
 it->data = end->data;
 end->data = swapCache;
    }
    if (it->previous && start != it) {
 List_qSortIt(this, compare, start, it->previous);
    }
    if (it->next && end != it) {
 List_qSortIt(this, compare, it->next, end);
    }
}

variable_types:
compare
int (*)(void *a, void *b)

variable_types:
start
struct ListNode *

variable_types:
end
struct ListNode *

variable_types:
pivot
void *

variable_types:
swapCache
void *


decompiled_code:
void __fastcall List_qSort(__int64 a1, unsigned int (__fastcall *a2)(_QWORD, __int64))
{
_QWORD *v2; // rcx

v2 = *(_QWORD **)(a1 + 8);
if ( *(_QWORD *)a1 )
{
if ( v2 )
List_qSortIt(a1, a2, *(_QWORD **)a1, v2);
}
}

canonical_decompiled_code:
void __fastcall func8(__int64 a1, unsigned int (__fastcall *a2)(_QWORD, __int64))
{
_QWORD *v2; // rcx

v2 = *(_QWORD **)(a1 + 8);
if ( *(_QWORD *)a1 )
{
if ( v2 )
func7(a1, a2, *(_QWORD **)a1, v2);
}
}

original_code:
void List_qSort(List* this, int (*compare)(void* a, void* b)) {
    ListNode* a = this->first;
    ListNode* b = this->last;
    if (a && b) {
 List_qSortIt(this, compare, a, b);
    }
}

canonical_original_code:
void List_qSort(struct List *this, int (*compare)(void *a, void *b)) {
    struct ListNode *a = this->first;
    struct ListNode *b = this->last;
    if (a && b) {
 List_qSortIt(this, compare, a, b);
    }
}


decompiled_code:
_DWORD *Vector_Create()
{
_DWORD *result; // rax

result = malloc(0x10uLL);
*(_QWORD *)result = 0LL;
result[2] = 0;
result[3] = 0;
return result;
}

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

result = malloc(0x10uLL);
*(_QWORD *)result = 0LL;
result[2] = 0;
result[3] = 0;
return result;
}

original_code:
Vector* Vector_Create(void) {
    Vector* this = malloc(sizeof(Vector));
 this->elements = ((void *)0);
    this->usedElements = 0;
    this->_allocatedElements = 0;
    return this;
}

canonical_original_code:
struct Vector *Vector_Create() {
    struct Vector *this = malloc(sizeof(Vector));
 this->elements = ((void *)0);
    this->usedElements = 0;
    this->_allocatedElements = 0;
    return this;
}

variable_types: struct Vector { void **elements; unsigned int usedElements; unsigned int _allocatedElements; } *


decompiled_code:
__int64 __fastcall Vector_getLastElement(__int64 a1)
{
int v1; // edx
__int64 *v2; // rax
__int64 v3; // rcx
__int64 v4; // rdx

v1 = *(_DWORD *)(a1 + 8);
if ( !v1 )
return 0LL;
v2 = *(__int64 **)a1;
v3 = *(_QWORD *)a1 + 8LL * (unsigned int)(v1 - 1) + 8;
do
{
v4 = *v2;
if ( *v2 )
break;
++v2;
}
while ( v2 != (__int64 *)v3 );
return v4;
}

original_code:
void* Vector_getLastElement(Vector* this) {
 for (int i=0; i < this->usedElements; ++i) {
  if (this->elements[i] != ((void *)0)) {
   return this->elements[i];
  }
 }
 return ((void *)0);
}

canonical_original_code:
void *Vector_getLastElement(struct Vector *this) {
 for (int i = 0; i < this->usedElements; ++i) {
  if (this->elements[i] != ((void *)0)) {
   return this->elements[i];
  }
 }
 return ((void *)0);
}

return_type: void *

user_defined_types: struct Vector { void **elements; unsigned int usedElements; unsigned int _allocatedElements; }


decompiled_code:
__int64 __fastcall Vector_Get(__int64 a1, unsigned int a2)
{
__int64 result; // rax

result = 0LL;
if ( *(_DWORD *)(a1 + 8) > a2 )
result = *(_QWORD *)(*(_QWORD *)a1 + 8LL * a2);
return result;
}

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

result = 0LL;
if ( *(_DWORD *)(a1 + 8) > a2 )
result = *(_QWORD *)(*(_QWORD *)a1 + 8LL * a2);
return result;
}

original_code:
void* Vector_Get(Vector* this, unsigned int i) {
    if (i < this->usedElements) {
        return this->elements[i];
    }
    return ((void *)0);
}

canonical_original_code:
void *Vector_Get(struct Vector *this, unsigned int i) {
    if (i < this->usedElements) {
        return this->elements[i];
    }
    return ((void *)0);
}

variable_types:
i
unsigned int


decompiled_code:
__int64 __fastcall Vector_Set(__int64 *a1, unsigned int a2, __int64 a3)
{
__int64 result; // rax

if ( *((_DWORD *)a1 + 2) > a2 )
{
result = *a1;
*(_QWORD *)(*a1 + 8LL * a2) = a3;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 *a1, unsigned int a2, __int64 a3)
{
__int64 result; // rax

if ( *((_DWORD *)a1 + 2) > a2 )
{
result = *a1;
*(_QWORD *)(*a1 + 8LL * a2) = a3;
}
return result;
}

original_code:
void Vector_Set(Vector* this, unsigned int i, void* element) {
    if (i < this->usedElements) {
        this->elements[i] = element;
    }
}

canonical_original_code:
void Vector_Set(struct Vector *this, unsigned int i, void *element) {
    if (i < this->usedElements) {
        this->elements[i] = element;
    }
}

variable_types:
element
void *


decompiled_code:
void __fastcall Vector_Destroy(void **a1)
{
void *v1; // rdi

v1 = *a1;
if ( v1 )
free(v1);
}

canonical_decompiled_code:
void __fastcall func4(void **a1)
{
void *v1; // rdi

v1 = *a1;
if ( v1 )
free(v1);
}

original_code:
void Vector_Destroy(Vector* this) {
    if (this->elements) {
        free(this->elements);
    }
}

canonical_original_code:
void Vector_Destroy(struct Vector *this) {
    if (this->elements) {
        free(this->elements);
    }
}


decompiled_code:
__int64 __fastcall Vector_AddElement(__int64 a1, __int64 a2)
{
unsigned int v3; // esi

v3 = *(_DWORD *)(a1 + 12);
if ( v3 <= *(_DWORD *)(a1 + 8) )
Vector_RecreateWithoutSizeCheck(a1, v3 + 8);
return Vector_AddElementWithoutSizeCheck((__int64 *)a1, a2);
}

original_code:
void Vector_AddElement(Vector* this, void* element) {
    if (this->_allocatedElements <= this->usedElements) {
        _Vector_RecreateWithoutSizeCheck(this, this->_allocatedElements + 8);
    }
    _Vector_AddElementWithoutSizeCheck(this, element);
}

canonical_original_code:
void Vector_AddElement(struct Vector *this, void *element) {
    if (this->_allocatedElements <= this->usedElements) {
        _Vector_RecreateWithoutSizeCheck(this, this->_allocatedElements + 8);
    }
    _Vector_AddElementWithoutSizeCheck(this, element);
}


decompiled_code:
void __fastcall Vector_ShrinkCache(__int64 a1, char a2)
{
unsigned int v3; // edx
unsigned int v4; // esi

v3 = *(_DWORD *)(a1 + 12);
v4 = *(_DWORD *)(a1 + 8);
if ( v3 - 8 > v4 )
{
Vector_RecreateWithoutSizeCheck(a1, v4 + 8);
}
else if ( v3 > v4 )
{
if ( a2 )
Vector_RecreateWithoutSizeCheck(a1, v4);
}
}

canonical_decompiled_code:
void __fastcall func8(__int64 a1, char a2)
{
unsigned int v3; // edx
unsigned int v4; // esi

v3 = *(_DWORD *)(a1 + 12);
v4 = *(_DWORD *)(a1 + 8);
if ( v3 - 8 > v4 )
{
func6(a1, v4 + 8);
}
else if ( v3 > v4 )
{
if ( a2 )
func6(a1, v4);
}
}

original_code:
void Vector_ShrinkCache(Vector* this, _Bool maximumShrink) {
    if (this->_allocatedElements - 8 > this->usedElements) {
        _Vector_RecreateWithoutSizeCheck(this, this->usedElements+8);
    } else if (maximumShrink && this->_allocatedElements > this->usedElements) {
        _Vector_RecreateWithoutSizeCheck(this, this->usedElements);
    }
}

canonical_original_code:
void Vector_ShrinkCache(struct Vector *this, _Bool maximumShrink) {
    if (this->_allocatedElements - 8 > this->usedElements) {
        _Vector_RecreateWithoutSizeCheck(this, this->usedElements+8);
    } else if (maximumShrink && this->_allocatedElements > this->usedElements) {
        _Vector_RecreateWithoutSizeCheck(this, this->usedElements);
    }
}


repo: Neil-UWA/Algorithm

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

for ( result = *(_QWORD *)(a1 + 8); result; result = *(_QWORD *)(result + 8) )
{
if ( *(_DWORD *)result == a2 )
break;
}
return result;
}

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

for ( result = *(_QWORD *)(a1 + 8); result; result = *(_QWORD *)(result + 8) )
{
if ( *(_DWORD *)result == a2 )
break;
}
return result;
}

original_code:
LinkNode* find_element(LinkNode *head, int item)
{
 LinkNode *p = ((void *)0);
 p = head->next;
 while(((void *)0) != p){
  if (item == p->item) {
   return p;
  }
  p = p->next;
 }
 return p;
}

canonical_original_code:
struct _LinkNode *find_element(struct _LinkNode *head, int item)
{
 struct _LinkNode *p = ((void *)0);
 p = head->next;
 while(((void *)0) != p){
  if (item == p->item) {
   return p;
  }
  p = p->next;
 }
 return p;
}

variable_types:
head
struct _LinkNode *

variable_types: item int

variable_types: struct _LinkNode { int item; struct _LinkNode *next; } *


decompiled_code:
int __fastcall show_link(__int64 a1)
{
unsigned int *i; // rbx
int result; // eax

for ( i = *(unsigned int **)(a1 + 8); i; i = (unsigned int *)*((_QWORD *)i + 1) )
result = printf("%d\n", *i);
return result;
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1)
{
unsigned int *i; // rbx
int result; // eax

for ( i = *(unsigned int **)(a1 + 8); i; i = (unsigned int *)*((_QWORD *)i + 1) )
result = printf("%d\n", *i);
return result;
}

original_code:
void show_link(LinkNode *head)
{
 LinkNode *p = ((void *)0);
 p = head->next;
 while(((void *)0) != p){
  printf("%d\n", p->item);
  p = p->next;
 }
}

canonical_original_code:
void show_link(struct _LinkNode *head)
{
 struct _LinkNode *p = ((void *)0);
 p = head->next;
 while(((void *)0) != p){
  printf("%d\n", p->item);
  p = p->next;
 }
}

user_defined_types: struct _LinkNode { int item; struct _LinkNode *next; }


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
return -1;
}

original_code:
int main(int argc, const char *argv[])
{
 return -1;
}

canonical_original_code:
int main(int argc, char *argv[])
{
 return -1;
}

variable_types: argc int

variable_types:
argv
char *[]


preOrderTraverse

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

if ( a1 )
{
printf("%d\n", *a1);
preOrderTraverse(*((_QWORD *)a1 + 1));
result = preOrderTraverse(*((_QWORD *)a1 + 2));
}
return result;
}

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

if ( a1 )
{
printf("%d\n", *a1);
func7(*((_QWORD *)a1 + 1));
result = func7(*((_QWORD *)a1 + 2));
}
return result;
}

original_code:
void preOrderTraverse(btree_t *t) {
 if (((void *)0) == t) {
  return;
 }
 printf("%d\n", t->key);
 preOrderTraverse(t->left);
 preOrderTraverse(t->right);
}

canonical_original_code:
void preOrderTraverse(struct _btree_t *t) {
 if (((void *)0) == t) {
  return;
 }
 printf("%d\n", t->key);
 preOrderTraverse(t->left);
 preOrderTraverse(t->right);
}

variable_types: struct _btree_t { int key; struct _btree_t *left; } *


inOrderTraverse

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

if ( a1 )
{
preOrderTraverse(a1[1]);
printf("%d\n", *(unsigned int *)a1);
result = preOrderTraverse(a1[2]);
}
return result;
}

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

if ( a1 )
{
func7(a1[1]);
printf("%d\n", *(unsigned int *)a1);
result = func7(a1[2]);
}
return result;
}

original_code:
void inOrderTraverse(btree_t *t){
 if (((void *)0) == t) {
  return;
 }
 preOrderTraverse(t->left);
 printf("%d\n", t->key);
 preOrderTraverse(t->right);
}

canonical_original_code:
void inOrderTraverse(struct _btree_t *t){
 if (((void *)0) == t) {
  return;
 }
 preOrderTraverse(t->left);
 printf("%d\n", t->key);
 preOrderTraverse(t->right);
}

user_defined_types: struct _btree_t { int key; struct _btree_t *left; }


postOrderTraverse

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

if ( a1 )
{
preOrderTraverse(a1[2]);
printf("%d\n", *(unsigned int *)a1);
result = preOrderTraverse(a1[1]);
}
return result;
}

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

if ( a1 )
{
func7(a1[2]);
printf("%d\n", *(unsigned int *)a1);
result = func7(a1[1]);
}
return result;
}

original_code:
void postOrderTraverse(btree_t *t){
 if (((void *)0) == t) {
  return;
 }
 preOrderTraverse(t->right);
 printf("%d\n", t->key);
 preOrderTraverse(t->left);
}

canonical_original_code:
void postOrderTraverse(struct _btree_t *t){
 if (((void *)0) == t) {
  return;
 }
 preOrderTraverse(t->right);
 printf("%d\n", t->key);
 preOrderTraverse(t->left);
}


minimum

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

do
{
result = a1;
a1 = *(_QWORD *)(a1 + 8);
}
while ( a1 );
return result;
}

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

do
{
result = a1;
a1 = *(_QWORD *)(a1 + 8);
}
while ( a1 );
return result;
}

original_code:
btree_t* minimum(btree_t *t){
 while(((void *)0) != t->left){
  t = t->left;
 }
 return t;
}

canonical_original_code:
struct _btree_t *minimum(struct _btree_t *t){
 while(((void *)0) != t->left){
  t = t->left;
 }
 return t;
}

variable_types:
t
struct _btree_t *

return_type: struct _btree_t { int key; struct _btree_t *left; } *


maximum

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

do
{
result = a1;
a1 = *(_QWORD *)(a1 + 16);
}
while ( a1 );
return result;
}

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

do
{
result = a1;
a1 = *(_QWORD *)(a1 + 16);
}
while ( a1 );
return result;
}

original_code:
btree_t* maximum(btree_t *t){
 while(((void *)0) != t->right){
  t = t->right;
 }
 return t;
}

canonical_original_code:
struct _btree_t *maximum(struct _btree_t *t){
 while(((void *)0) != t->right){
  t = t->right;
 }
 return t;
}


decompiled_code:
void __fastcall delete_tree(void *ptr)
{
if ( ptr )
{
delete_tree(*((void **)ptr + 1));
delete_tree(*((void **)ptr + 2));
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func14(void *ptr)
{
if ( ptr )
{
func14(*((void **)ptr + 1));
func14(*((void **)ptr + 2));
free(ptr);
}
}

original_code:
void delete_tree(btree_t *t) {
 if (t) {
  delete_tree(t->left);
  delete_tree(t->right);
  free(t);
  t = ((void *)0);
 }
}

canonical_original_code:
void delete_tree(struct _btree_t *t) {
 if (t) {
  delete_tree(t->left);
  delete_tree(t->right);
  free(t);
  t = ((void *)0);
 }
}


original_code:
void tree_test(void (*f)(btree_t **, int), btree_t *t, int i, ...) {
 va_list parg;
 int value;
 f(&t, i);
 __builtin_va_start(parg,i);
 while((value = __builtin_va_arg(parg,int))){
  f(&t, value);
 }
 __builtin_va_end(parg);
}

canonical_original_code:
void tree_test(void (*f)(struct _btree_t **, int), struct _btree_t *t, int i, ...) {
 __builtin_va_list parg;
 int value;
 f(&t, i);
 __builtin_va_start(parg,i);
 while((value = __builtin_va_arg(parg,int))){
  f(&t, value);
 }
 __builtin_va_end(parg);
}

variable_types: void (*)(struct _btree_t { int key; struct _btree_t *left; } **, int)

variable_types: i int

variable_types: value int


repo: Nekrofage/KomandoMap

original_code:
s16b player_place(int y, int x)
{
 Thing t;
 t.x = x * 64 + 32;
 t.y = y * 64 + 32;
 t.angle = ((s32b)(rand()%(360)));
 t.type = 1;
 t.options = 0x7;
 add_thing(&t);
}

canonical_original_code:
short player_place(int y, int x)
{
 struct Thing t;
 t.x = x * 64 + 32;
 t.y = y * 64 + 32;
 t.angle = ((s32b)(rand()%(360)));
 t.type = 1;
 t.options = 0x7;
 add_thing(&t);
}

variable_types: y int

variable_types: x int

variable_types: struct Thing { short x; short y; short angle; short type; short options; }

return_type: short


variable_types: good char

variable_types: great char

user_defined_types: struct Thing { short x; short y; short angle; short type; short options; }


decompiled_code:
void place_gold()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

original_code:
void place_gold(int y, int x)
{
 printf("");
}


original_code:
bool_hack place_monster(int y, int x, bool_hack slp, bool_hack grp)
{
 Thing t;
 int fun_monsters[11] = {0x0bbc,
       0x0009,
       0x0bb9,
       0x0bba,
       0x003a,
       0x0bbe,
       0x0bbd,
       0x0045,
       0x0bbb,
       0x0042,
       0x0047};
 t.x = x * 64 + 32;
 t.y = y * 64 + 32;
 t.angle = ((s32b)(rand()%(360)))-1;
 t.type = fun_monsters[((s32b)(rand()%(11)))];
 t.options = 0x7;
 cave_m_idx[y][x]=t.type + 1;
 add_thing(&t);
}

canonical_original_code:
char place_monster(int y, int x, char slp, char grp)
{
 struct Thing t;
 int fun_monsters[11] = {0x0bbc,
       0x0009,
       0x0bb9,
       0x0bba,
       0x003a,
       0x0bbe,
       0x0bbd,
       0x0045,
       0x0bbb,
       0x0042,
       0x0047};
 t.x = x * 64 + 32;
 t.y = y * 64 + 32;
 t.angle = ((s32b)(rand()%(360)))-1;
 t.type = fun_monsters[((s32b)(rand()%(11)))];
 t.options = 0x7;
 cave_m_idx[y][x]=t.type + 1;
 add_thing(&t);
}

variable_types: slp char

variable_types: grp char

return_type: char


decompiled_code:
void place_monster_aux()
{
;
}

canonical_decompiled_code:
void func4()
{
;
}

original_code:
bool_hack place_monster_aux(int y, int x, int r_idx, bool_hack slp, bool_hack grp)
{
 printf("");
}

canonical_original_code:
char place_monster_aux(int y, int x, int r_idx, char slp, char grp)
{
 printf("");
}


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

cave_set_feat(a1, a2, 16);
result = (unsigned int)(sector_counter + 1);
sector_counter = result;
cave_sector_map[198 * a1 + a2] = result;
return result;
}

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

func5(a1, a2, 16);
result = (unsigned int)(sector_counter + 1);
sector_counter = result;
cave_sector_map[198 * a1 + a2] = result;
return result;
}

original_code:
void place_trap(int y, int x)
{
 cave_set_feat(y, x, 0x10);
 cave_sector_map[y][x]=++sector_counter;
}


distance

decompiled_code:
__int64 __fastcall distance(int a1, int a2, int a3, int a4)
{
int v4; // eax
int v5; // edx

v4 = a3 - a1;
if ( a1 > a3 )
v4 = a1 - a3;
v5 = a4 - a2;
if ( a2 > a4 )
v5 = a2 - a4;
if ( v4 <= v5 )
v4 >>= 1;
else
v5 >>= 1;
return (unsigned int)(v5 + v4);
}

canonical_decompiled_code:
__int64 __fastcall func7(int a1, int a2, int a3, int a4)
{
int v4; // eax
int v5; // edx

v4 = a3 - a1;
if ( a1 > a3 )
v4 = a1 - a3;
v5 = a4 - a2;
if ( a2 > a4 )
v5 = a2 - a4;
if ( v4 <= v5 )
v4 >>= 1;
else
v5 >>= 1;
return (unsigned int)(v5 + v4);
}

variable_types: ay int

variable_types: ax int


los

variable_types: dx int

variable_types: dy int

variable_types: sx int

variable_types: sy int

variable_types: qx int

variable_types: qy int

variable_types: tx int

variable_types: ty int

variable_types: m int


scatter

decompiled_code:
int *__fastcall scatter(int *a1, int *a2, int a3, int a4, int a5)
{
unsigned int v8; // er15
int v9; // ebx
int v10; // ecx
int v11; // ebp
int v12; // ebx
int *result; // rax
unsigned int v14; // [rsp+8h] [rbp-50h]
int v15; // [rsp+Ch] [rbp-4Ch]

v8 = a3 - 1;
v14 = a4 - 1;
v15 = 2 * a5 + 1;
while ( 1 )
{
do
{
v9 = rand();
v10 = rand();
}
while ( v8 > 0x81 );
if ( v14 <= 0xC3 )
{
v11 = v9 % v15 + a3 - a5;
v12 = v10 % v15 + a4 - a5;
if ( a5 <= 1 || (int)distance(a3, a4, v11, v12) <= a5 )
{
if ( (unsigned __int8)los(a3, a4, v11, v12) )
break;
}
}
}
*a1 = v11;
result = a2;
*a2 = v12;
return result;
}

canonical_decompiled_code:
int *__fastcall func9(int *a1, int *a2, int a3, int a4, int a5)
{
unsigned int v8; // er15
int v9; // ebx
int v10; // ecx
int v11; // ebp
int v12; // ebx
int *result; // rax
unsigned int v14; // [rsp+8h] [rbp-50h]
int v15; // [rsp+Ch] [rbp-4Ch]

v8 = a3 - 1;
v14 = a4 - 1;
v15 = 2 * a5 + 1;
while ( 1 )
{
do
{
v9 = rand();
v10 = rand();
}
while ( v8 > 0x81 );
if ( v14 <= 0xC3 )
{
v11 = v9 % v15 + a3 - a5;
v12 = v10 % v15 + a4 - a5;
if ( a5 <= 1 || (int)func7(a3, a4, v11, v12) <= a5 )
{
if ( (unsigned __int8)func8(a3, a4, v11, v12) )
break;
}
}
}
*a1 = v11;
result = a2;
*a2 = v12;
return result;
}

variable_types:
yp
int *

variable_types:
xp
int *

variable_types: y int

variable_types: x int

variable_types: d int

variable_types: nx int

variable_types: ny int


decompiled_code:
__int64 get_mon_num()
{
return (unsigned int)(rand() % 10);
}

canonical_decompiled_code:
__int64 func10()
{
return (unsigned int)(rand() % 10);
}

original_code:
s16b get_mon_num(int level)
{
 return ((s32b)(rand()%(10)));
}

canonical_original_code:
short get_mon_num(int level)
{
 return ((s32b)(rand()%(10)));
}

variable_types: level int


decompiled_code:
bool alloc_monster()
{
int v0; // ebx
int v1; // esi

do
{
do
{
v0 = rand() % 132;
v1 = rand() % 198;
}
while ( cave_feat[198 * v0 + v1] != 1 );
}
while ( cave_o_idx[198 * v0 + v1] || cave_m_idx[198 * v0 + v1] );
return (unsigned __int8)place_monster(v0, v1) != 0;
}

canonical_decompiled_code:
bool func11()
{
int v0; // ebx
int v1; // esi

do
{
do
{
v0 = rand() % 132;
v1 = rand() % 198;
}
while ( cave_feat[198 * v0 + v1] != 1 );
}
while ( cave_o_idx[198 * v0 + v1] || cave_m_idx[198 * v0 + v1] );
return (unsigned __int8)func3(v0, v1) != 0;
}

original_code:
bool_hack alloc_monster(int dis, int slp)
{
 int y, x;
 while (1)
 {
  y = ((s32b)(rand()%(132)));
  x = ((s32b)(rand()%(198)));
  if (!((cave_feat[y][x] == 0x01) && (cave_o_idx[y][x] == 0) && (cave_m_idx[y][x] == 0))) continue;
  else break;
 }
 if (place_monster(y, x, slp, 1)) return (1);
 return (0);
}

canonical_original_code:
char alloc_monster(int dis, int slp)
{
 int y; int x;
 while (1)
 {
  y = ((s32b)(rand()%(132)));
  x = ((s32b)(rand()%(198)));
  if (!((cave_feat[y][x] == 0x01) && (cave_o_idx[y][x] == 0) && (cave_m_idx[y][x] == 0))) continue;
  else break;
 }
 if (place_monster(y, x, slp, 1)) return (1);
 return (0);
}

variable_types: dis int

variable_types: slp int


decompiled_code:
__int64 __fastcall Rand_normal(unsigned int a1, int a2)
{
__int64 result; // rax
int v4; // esi
__int16 v5; // cx
__int16 v6; // dx
int v7; // eax
__int64 v8; // rbx
int v9; // edx

result = a1;
if ( a2 > 0 )
{
v4 = rand() % 0x8000;
v5 = 256;
v6 = 0;
do
{
v7 = (v5 + v6) >> 1;
if ( Rand_normal_table[v7] >= (__int16)v4 )
v5 = (v5 + v6) >> 1;
else
v6 = v7 + 1;
}
while ( v5 > v6 );
v8 = a2 * (__int64)v6 / 64;
v9 = rand() % 100;
result = a1 - (unsigned int)v8;
if ( v9 > 49 )
result = (unsigned int)v8 + a1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(unsigned int a1, int a2)
{
__int64 result; // rax
int v4; // esi
__int16 v5; // cx
__int16 v6; // dx
int v7; // eax
__int64 v8; // rbx
int v9; // edx

result = a1;
if ( a2 > 0 )
{
v4 = rand() % 0x8000;
v5 = 256;
v6 = 0;
do
{
v7 = (v5 + v6) >> 1;
if ( Rand_normal_table[v7] >= (__int16)v4 )
v5 = (v5 + v6) >> 1;
else
v6 = v7 + 1;
}
while ( v5 > v6 );
v8 = a2 * (__int64)v6 / 64;
v9 = rand() % 100;
result = a1 - (unsigned int)v8;
if ( v9 > 49 )
result = (unsigned int)v8 + a1;
}
return result;
}

original_code:
s16b Rand_normal(int mean, int stand)
{
 s16b tmp;
 s16b offset;
 s16b low = 0;
 s16b high = 256;
 if (stand < 1) return (mean);
 tmp = ((s32b)(rand()%(32768)));
 while (low < high)
 {
  int mid = (low + high) >> 1;
  if (Rand_normal_table[mid] < tmp)
  {
   low = mid + 1;
  }
  else
  {
   high = mid;
  }
 }
 offset = (long)stand * (long)low / 64;
 if (((s32b)(rand()%(100))) < 50) return (mean - offset);
 return (mean + offset);
}

canonical_original_code:
short Rand_normal(int mean, int stand)
{
 short tmp;
 short offset;
 short low = 0;
 short high = 256;
 if (stand < 1) return (mean);
 tmp = ((s32b)(rand()%(32768)));
 while (low < high)
 {
  int mid = (low + high) >> 1;
  if (Rand_normal_table[mid] < tmp)
  {
   low = mid + 1;
  }
  else
  {
   high = mid;
  }
 }
 offset = (long)stand * (long)low / 64;
 if (((s32b)(rand()%(100))) < 50) return (mean - offset);
 return (mean + offset);
}

variable_types: mean int

variable_types: stand int

variable_types: tmp short

variable_types: offset short

variable_types: low short

variable_types: high short

variable_types: mid int


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // eax
__int64 v4; // rdi

v3 = time(0LL);
v4 = v3;
srand(v3);
generate_cave(v4, argv);
vectorize();
return 0;
}

original_code:
int main(int argc, char** argv)
{
 int x, y;
 srand(time(((void *)0)));
 generate_cave();
 vectorize();
 return 0;
}

canonical_original_code:
int main(int argc, char **argv)
{
 int x; int y;
 srand(time(((void *)0)));
 generate_cave();
 vectorize();
 return 0;
}

variable_types: argc int

variable_types:
argv
char **


printUsage

repo: NerdyProjects/HS--PixInvader

decompiled_code:
int printUsage()
{
return puts("Usage: program <data layout file> <output binary file>");
}

canonical_decompiled_code:
int func7()
{
return puts("Usage: program <data layout file> <output binary file>");
}

original_code:
void printUsage(void)
{
  printf("Usage: program <data layout file> <output binary file>\n");
}

canonical_original_code:
void printUsage()
{
  printf("Usage: program <data layout file> <output binary file>\n");
}


repo: NetAngels/redirector

decompiled_code:
__int64 __fastcall get_options(int argc, char **argv, __int64 a3, _QWORD *a4)
{
unsigned int v6; // er14
__int16 v7; // ax
char *v8; // rax
struct passwd *v9; // rax
int v10; // eax
int longind[11]; // [rsp+Ch] [rbp-2Ch] BYREF

*(_QWORD *)(a3 + 8) = "0.0.0.0";
*(_WORD *)(a3 + 32) = 80;
v6 = 0;
while ( 1 )
{
longind[0] = 0;
v10 = getopt_long(argc, argv, options_1, &long_options_0, longind);
if ( v10 == -1 || v6 )
break;
switch ( v10 )
{
case 'f':
*(_QWORD *)a3 = strdup(optarg);
v6 = 0;
break;
case 'i':
*(_QWORD *)(a3 + 8) = strdup(optarg);
v6 = 0;
break;
case 'p':
v7 = atoi(optarg);
*(_WORD *)(a3 + 32) = v7;
v6 = 0;
if ( !v7 )
{
*a4 = "incorrect port number";
v6 = 1;
}
break;
case 'u':
v8 = strdup(optarg);
*(_QWORD *)(a3 + 16) = v8;
v9 = getpwnam(v8);
if ( v9 )
{
*(_DWORD *)(a3 + 24) = v9->pw_uid;
*(_DWORD *)(a3 + 28) = v9->pw_gid;
v6 = 0;
}
else
{
*a4 = "user with given name not found";
v6 = 1;
}
break;
case 'v':
++*(_DWORD *)(a3 + 36);
v6 = 0;
break;
default:
v6 = 1;
break;
}
}
if ( !v6 && !*(_QWORD *)a3 )
{
*a4 = "required option --file (-f) is not set";
v6 = 1;
}
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func0(int argc, char **argv, __int64 a3, _QWORD *a4)
{
unsigned int v6; // er14
__int16 v7; // ax
char *v8; // rax
struct passwd *v9; // rax
int v10; // eax
int longind[11]; // [rsp+Ch] [rbp-2Ch] BYREF

*(_QWORD *)(a3 + 8) = "0.0.0.0";
*(_WORD *)(a3 + 32) = 80;
v6 = 0;
while ( 1 )
{
longind[0] = 0;
v10 = getopt_long(argc, argv, options_1, &long_options_0, longind);
if ( v10 == -1 || v6 )
break;
switch ( v10 )
{
case 'f':
*(_QWORD *)a3 = strdup(optarg);
v6 = 0;
break;
case 'i':
*(_QWORD *)(a3 + 8) = strdup(optarg);
v6 = 0;
break;
case 'p':
v7 = atoi(optarg);
*(_WORD *)(a3 + 32) = v7;
v6 = 0;
if ( !v7 )
{
*a4 = "incorrect port number";
v6 = 1;
}
break;
case 'u':
v8 = strdup(optarg);
*(_QWORD *)(a3 + 16) = v8;
v9 = getpwnam(v8);
if ( v9 )
{
*(_DWORD *)(a3 + 24) = v9->pw_uid;
*(_DWORD *)(a3 + 28) = v9->pw_gid;
v6 = 0;
}
else
{
*a4 = "user with given name not found";
v6 = 1;
}
break;
case 'v':
++*(_DWORD *)(a3 + 36);
v6 = 0;
break;
default:
v6 = 1;
break;
}
}
if ( !v6 && !*(_QWORD *)a3 )
{
*a4 = "required option --file (-f) is not set";
v6 = 1;
}
return v6;
}

original_code:
int get_options(int ac, char **av, rd_options *opts, char **err)
{
    static char options[] = "f:i:p:u:vh";
    static struct option long_options[] = {
       {"file", 1, 0, 'f'},
       {"ip", 1, 0, 'i'},
       {"port", 1, 0, 'p'},
       {"user", 1, 0, 'u'},
       {"verbose", 0, 0, 'v'},
       {"help", 0, 0, 'h'},
    };
    int c;
    int has_error = 0;
    struct passwd *pwd;
    opts->ip = "0.0.0.0";
    opts->port = 80;
    while (1) {
        int option_index = 0;
        c = getopt_long(ac, av, options, long_options, &option_index);
        if (c == -1 || has_error)
            break;
        switch (c) {
        case 'f':
            opts->filename = strdup(optarg);
            break;
        case 'i':
            opts->ip = strdup(optarg);
            break;
        case 'p':
            opts->port = atoi(optarg);
            if (opts->port <= 0 || opts->port > 65535) {
                *err = "incorrect port number";
                has_error ++;
            }
            break;
        case 'u':
            opts->username = strdup(optarg);
            pwd = getpwnam(opts->username);
            if (!pwd) {
                *err = "user with given name not found";
                has_error ++;
            } else {
                opts->uid = pwd->pw_uid;
                opts->gid = pwd->pw_gid;
            }
            break;
        case 'v':
            opts->verbose ++;
            break;
        case 'h':
            has_error ++;
            break;
        default:
            has_error ++;
            break;
        }
    }
    if (has_error)
        return 1;
    if (!opts->filename) {
        *err = "required option --file (-f) is not set";
        return 1;
    }
    return 0;
}

canonical_original_code:
int get_options(int ac, char **av, struct __rd_options *opts, char **err)
{
    static char options[] = "f:i:p:u:vh";
    static struct option long_options[] = {
       {"file", 1, 0, 'f'},
       {"ip", 1, 0, 'i'},
       {"port", 1, 0, 'p'},
       {"user", 1, 0, 'u'},
       {"verbose", 0, 0, 'v'},
       {"help", 0, 0, 'h'},
    };
    int c;
    int has_error = 0;
    struct passwd *pwd;
    opts->ip = "0.0.0.0";
    opts->port = 80;
    while (1) {
        int option_index = 0;
        c = getopt_long(ac, av, options, long_options, &option_index);
        if (c == -1 || has_error)
            break;
        switch (c) {
        case 'f':
            opts->filename = strdup(optarg);
            break;
        case 'i':
            opts->ip = strdup(optarg);
            break;
        case 'p':
            opts->port = atoi(optarg);
            if (opts->port <= 0 || opts->port > 65535) {
                *err = "incorrect port number";
                has_error ++;
            }
            break;
        case 'u':
            opts->username = strdup(optarg);
            pwd = getpwnam(opts->username);
            if (!pwd) {
                *err = "user with given name not found";
                has_error ++;
            } else {
                opts->uid = pwd->pw_uid;
                opts->gid = pwd->pw_gid;
            }
            break;
        case 'v':
            opts->verbose ++;
            break;
        case 'h':
            has_error ++;
            break;
        default:
            has_error ++;
            break;
        }
    }
    if (has_error)
        return 1;
    if (!opts->filename) {
        *err = "required option --file (-f) is not set";
        return 1;
    }
    return 0;
}

variable_types: ac int

variable_types:
av
char **

variable_types: struct __rd_options { char *filename; char *ip; char *username; unsigned int uid; unsigned int gid; unsigned short port; unsigned int verbose; } *

variable_types:
err
char **

variable_types:
options
char []

variable_types: struct option { char *name; int has_arg; int *flag; int val; } []

variable_types: c int

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


decompiled_code:
size_t __fastcall print_help(const char *a1)
{
if ( a1 )
fprintf(stderr, "Error: %s\n\n", a1);
return fwrite(
"USAGE: redirector [options]\n"
"\n"
"Options: \n"
"-f, --file (required). Set the BDB filename\n"
"-i, --ip (optional, default \"0.0.0.0\"). Set the IP to bind to\n"
"-p, --port (optional, default 80). Set the port number\n"
"-u, --user (optional). Set the effective UID\n"
"-v, --verbose (optional). Make the redirector log every request to stdout\n"
"-h, --help. This help.\n",
1uLL,
0x156uLL,
stderr);
}

canonical_decompiled_code:
size_t __fastcall func1(const char *a1)
{
if ( a1 )
fprintf(stderr, "Error: %s\n\n", a1);
return fwrite(
"USAGE: redirector [options]\n"
"\n"
"Options: \n"
"-f, --file (required). Set the BDB filename\n"
"-i, --ip (optional, default \"0.0.0.0\"). Set the IP to bind to\n"
"-p, --port (optional, default 80). Set the port number\n"
"-u, --user (optional). Set the effective UID\n"
"-v, --verbose (optional). Make the redirector log every request to stdout\n"
"-h, --help. This help.\n",
1uLL,
0x156uLL,
stderr);
}

original_code:
void print_help(const char *err)
{
    if (err)
        fprintf(stderr, "Error: %s\n\n", err);
    fprintf(stderr, ""
        "USAGE: redirector [options]\n"
        "\n"
        "Options: \n"
        "-f, --file (required). Set the BDB filename\n"
        "-i, --ip (optional, default \"0.0.0.0\"). Set the IP to bind to\n"
        "-p, --port (optional, default 80). Set the port number\n"
        "-u, --user (optional). Set the effective UID\n"
        "-v, --verbose (optional). Make the redirector log every request to stdout\n"
        "-h, --help. This help.\n"
    );
}

canonical_original_code:
void print_help(char *err)
{
    if (err)
        fprintf(stderr, "Error: %s\n\n", err);
    fprintf(stderr, ""
        "USAGE: redirector [options]\n"
        "\n"
        "Options: \n"
        "-f, --file (required). Set the BDB filename\n"
        "-i, --ip (optional, default \"0.0.0.0\"). Set the IP to bind to\n"
        "-p, --port (optional, default 80). Set the port number\n"
        "-u, --user (optional). Set the effective UID\n"
        "-v, --verbose (optional). Make the redirector log every request to stdout\n"
        "-h, --help. This help.\n"
    );
}

variable_types:
err
char *


lowercase

decompiled_code:
void __fastcall lowercase(char *a1)
{
char v1; // bl
char *v2; // rbp
const __int32_t **v3; // rdx

v1 = *a1;
if ( *a1 )
{
v2 = a1;
v3 = _ctype_tolower_loc();
do
{
*v2++ = (*v3)[v1];
v1 = *v2;
}
while ( *v2 );
}
}

canonical_decompiled_code:
void __fastcall func2(char *a1)
{
char v1; // bl
char *v2; // rbp
const __int32_t **v3; // rdx

v1 = *a1;
if ( *a1 )
{
v2 = a1;
v3 = _ctype_tolower_loc();
do
{
*v2++ = (*v3)[v1];
v1 = *v2;
}
while ( *v2 );
}
}

original_code:
void lowercase(char *str)
{
   size_t i = 0;
   while (str[i]) {
      str[i] = tolower(str[i]);
      i++;
   }
}

canonical_original_code:
void lowercase(char *str)
{
   unsigned long i = 0;
   while (str[i]) {
      str[i] = tolower(str[i]);
      i++;
   }
}

variable_types:
str
char *

variable_types:
i
unsigned long


repo: NetDirect/nfsshell

decompiled_code:
char *__fastcall mount1_null_1(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_11 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, _QWORD, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
0LL,
&xdr_void,
a1,
&xdr_void,
&clnt_res_11,
TIMEOUT,
0LL) == 0;
result = &clnt_res_11;
if ( !v2 )
result = 0LL;
return result;
}

canonical_decompiled_code:
char *__fastcall func0(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_11 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, _QWORD, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
0LL,
&xdr_void,
a1,
&xdr_void,
&clnt_res_11,
TIMEOUT,
0LL) == 0;
result = &clnt_res_11;
if ( !v2 )
result = 0LL;
return result;
}

original_code:
void *
mount1_null_1(void *argp, CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 0, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

canonical_original_code:
void *mount1_null_1(void *argp, struct CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 0, (int (*)(struct XDR *, void *, ...)) xdr_void, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

variable_types:
argp
void *

variable_types: struct CLIENT { struct AUTH { struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; } ah_cred; struct opaque_auth ah_verf; union des_block { struct { unsigned int high; unsigned int low; } key; char c[8]; } ah_key; struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); } *ah_ops; char *ah_private; } *cl_auth; struct clnt_ops { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval { long tv_sec; long tv_usec; }); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } re_status; union { int RE_errno; enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 } RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; } *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); } *cl_ops; char *cl_private; } *

user_defined_types: struct CLIENT { struct AUTH *cl_auth; struct clnt_ops *cl_ops; char *cl_private; }

user_defined_types: struct AUTH { struct opaque_auth ah_cred; struct opaque_auth ah_verf; union des_block ah_key; struct auth_ops *ah_ops; char *ah_private; }

user_defined_types: struct clnt_ops { enum clnt_stat (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); }

user_defined_types: struct XDR { enum xdr_op x_op; struct xdr_ops *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; }

user_defined_types: struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); }

user_defined_types: struct rpc_err { enum clnt_stat re_status; union { int RE_errno; enum auth_stat RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; }


decompiled_code:
char *__fastcall mount1_umnt_1(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_8 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
3LL,
&xdr_dirpath,
a1,
&xdr_void,
&clnt_res_8,
TIMEOUT,
0LL) == 0;
result = &clnt_res_8;
if ( !v2 )
result = 0LL;
return result;
}

canonical_decompiled_code:
char *__fastcall func1(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_8 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
3LL,
&xdr_dirpath,
a1,
&xdr_void,
&clnt_res_8,
TIMEOUT,
0LL) == 0;
result = &clnt_res_8;
if ( !v2 )
result = 0LL;
return result;
}

original_code:
void *
mount1_umnt_1(dirpath *argp, CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 3, (xdrproc_t) xdr_dirpath, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

canonical_original_code:
void *mount1_umnt_1(char **argp, struct CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 3, (int (*)(struct XDR *, void *, ...)) xdr_dirpath, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

variable_types:
argp
char **

user_defined_types: struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; }

user_defined_types: union des_block { struct { unsigned int high; unsigned int low; } key; char c[8]; }

user_defined_types: enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 }

user_defined_types: struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); }

user_defined_types: enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 }

user_defined_types: struct timeval { long tv_sec; long tv_usec; }

user_defined_types: enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 }


decompiled_code:
char *__fastcall mount1_umntall_1(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_7 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
4LL,
&xdr_void,
a1,
&xdr_void,
&clnt_res_7,
TIMEOUT,
0LL) == 0;
result = &clnt_res_7;
if ( !v2 )
result = 0LL;
return result;
}

canonical_decompiled_code:
char *__fastcall func2(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_7 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
4LL,
&xdr_void,
a1,
&xdr_void,
&clnt_res_7,
TIMEOUT,
0LL) == 0;
result = &clnt_res_7;
if ( !v2 )
result = 0LL;
return result;
}

original_code:
void *
mount1_umntall_1(void *argp, CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 4, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

canonical_original_code:
void *mount1_umntall_1(void *argp, struct CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 4, (int (*)(struct XDR *, void *, ...)) xdr_void, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}


decompiled_code:
char *__fastcall mount3_null_3(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_5 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, _QWORD, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
0LL,
&xdr_void,
a1,
&xdr_void,
&clnt_res_5,
TIMEOUT,
0LL) == 0;
result = &clnt_res_5;
if ( !v2 )
result = 0LL;
return result;
}

canonical_decompiled_code:
char *__fastcall func3(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_5 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, _QWORD, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
0LL,
&xdr_void,
a1,
&xdr_void,
&clnt_res_5,
TIMEOUT,
0LL) == 0;
result = &clnt_res_5;
if ( !v2 )
result = 0LL;
return result;
}

original_code:
void *
mount3_null_3(void *argp, CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 0, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

canonical_original_code:
void *mount3_null_3(void *argp, struct CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 0, (int (*)(struct XDR *, void *, ...)) xdr_void, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}


decompiled_code:
void *__fastcall mount3_mnt_3(__int64 a1, __int64 a2)
{
bool v2; // zf
void *result; // rax

memset(&clnt_res_4, 0, 0x60uLL);
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, void *, void *, __int64, _QWORD))(a2 + 8))(
a2,
1LL,
&xdr_dirpath,
a1,
&xdr_mountres3,
&clnt_res_4,
TIMEOUT,
0LL) == 0;
result = &clnt_res_4;
if ( !v2 )
result = 0LL;
return result;
}

canonical_decompiled_code:
void *__fastcall func4(__int64 a1, __int64 a2)
{
bool v2; // zf
void *result; // rax

memset(&clnt_res_4, 0, 0x60uLL);
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, void *, void *, __int64, _QWORD))(a2 + 8))(
a2,
1LL,
&xdr_dirpath,
a1,
&xdr_mountres3,
&clnt_res_4,
TIMEOUT,
0LL) == 0;
result = &clnt_res_4;
if ( !v2 )
result = 0LL;
return result;
}

original_code:
mountres3 *
mount3_mnt_3(dirpath *argp, CLIENT *clnt)
{
 static mountres3 clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 1, (xdrproc_t) xdr_dirpath, (caddr_t) argp, (xdrproc_t) xdr_mountres3, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return (&clnt_res);
}

canonical_original_code:
struct mountres3 *mount3_mnt_3(char **argp, struct CLIENT *clnt)
{
 static struct mountres3 clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 1, (int (*)(struct XDR *, void *, ...)) xdr_dirpath, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_mountres3, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return (&clnt_res);
}

return_type: struct mountres3 { enum mountstat3 { MNT3_OK=0, MNT3ERR_PERM=1, MNT3ERR_NOENT=2, MNT3ERR_IO=5, MNT3ERR_ACCES=13, MNT3ERR_NOTDIR=20, MNT3ERR_INVAL=22, MNT3ERR_NAMETOOLONG=63, MNT3ERR_NOTSUPP=10004, MNT3ERR_SERVERFAULT=10006 } fhs_status; union { struct mountres3_ok { struct fhandle3 { unsigned int fhandle3_len; char fhandle3_val[64]; } fhandle; struct { unsigned int auth_flavors_len; int *auth_flavors_val; } auth_flavors; } mountinfo; } mountres3_u; } *

user_defined_types: struct mountres3 { enum mountstat3 fhs_status; union { struct mountres3_ok mountinfo; } mountres3_u; }

user_defined_types: struct mountres3_ok { struct fhandle3 fhandle; struct { unsigned int auth_flavors_len; int *auth_flavors_val; } auth_flavors; }


decompiled_code:
char *__fastcall mount3_umnt_3(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_2 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
3LL,
&xdr_dirpath,
a1,
&xdr_void,
&clnt_res_2,
TIMEOUT,
0LL) == 0;
result = &clnt_res_2;
if ( !v2 )
result = 0LL;
return result;
}

canonical_decompiled_code:
char *__fastcall func5(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_2 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(XDR *, dirpath *), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
3LL,
&xdr_dirpath,
a1,
&xdr_void,
&clnt_res_2,
TIMEOUT,
0LL) == 0;
result = &clnt_res_2;
if ( !v2 )
result = 0LL;
return result;
}

original_code:
void *
mount3_umnt_3(dirpath *argp, CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 3, (xdrproc_t) xdr_dirpath, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

canonical_original_code:
void *mount3_umnt_3(char **argp, struct CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 3, (int (*)(struct XDR *, void *, ...)) xdr_dirpath, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}


decompiled_code:
char *__fastcall mount3_umntall_3(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_1 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
4LL,
&xdr_void,
a1,
&xdr_void,
&clnt_res_1,
TIMEOUT,
0LL) == 0;
result = &clnt_res_1;
if ( !v2 )
result = 0LL;
return result;
}

canonical_decompiled_code:
char *__fastcall func6(__int64 a1, __int64 a2)
{
bool v2; // zf
char *result; // rax

clnt_res_1 = 0;
v2 = (**(unsigned int (__fastcall ***)(__int64, __int64, bool_t (**)(void), __int64, bool_t (**)(void), char *, __int64, _QWORD))(a2 + 8))(
a2,
4LL,
&xdr_void,
a1,
&xdr_void,
&clnt_res_1,
TIMEOUT,
0LL) == 0;
result = &clnt_res_1;
if ( !v2 )
result = 0LL;
return result;
}

original_code:
void *
mount3_umntall_3(void *argp, CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 4, (xdrproc_t) xdr_void, (caddr_t) argp, (xdrproc_t) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}

canonical_original_code:
void *mount3_umntall_3(void *argp, struct CLIENT *clnt)
{
 static char clnt_res;
 memset((char *)&clnt_res, 0, sizeof(clnt_res));
 if (((*(clnt)->cl_ops->cl_call)(clnt, 4, (int (*)(struct XDR *, void *, ...)) xdr_void, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_void, (caddr_t) &clnt_res, TIMEOUT)) != RPC_SUCCESS) {
  return (((void *)0));
 }
 return ((void *)&clnt_res);
}


decompiled_code:
_BOOL8 __fastcall xdr_fhandle3(XDR *a1, __int64 a2)
{
return xdr_bytes(a1, (char **)(a2 + 4), (u_int *)a2, 0x40u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(XDR *a1, __int64 a2)
{
return xdr_bytes(a1, (char **)(a2 + 4), (u_int *)a2, 0x40u) != 0;
}

original_code:
bool_t
xdr_fhandle3 (XDR *xdrs, fhandle3 *objp)
{
 register int32_t *buf;
  if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (u_int *) &objp->fhandle3_len, 64))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_fhandle3(struct XDR *xdrs, struct fhandle3 *objp)
{
 register int *buf;
  if (!xdr_bytes (xdrs, (char **)&objp->fhandle3_val, (unsigned int *) &objp->fhandle3_len, 64))
   return (0);
 return (1);
}

variable_types: struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *

variable_types: struct fhandle3 { unsigned int fhandle3_len; char fhandle3_val[64]; } *

variable_types:
buf
int *


decompiled_code:
_BOOL8 __fastcall xdr_dirpath(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

original_code:
bool_t
xdr_dirpath (XDR *xdrs, dirpath *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, objp, 1024))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_dirpath(struct XDR *xdrs, char **objp)
{
 register int *buf;
  if (!xdr_string (xdrs, objp, 1024))
   return (0);
 return (1);
}

variable_types:
objp
char **


decompiled_code:
_BOOL8 __fastcall xdr_name(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0xFFu) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0xFFu) != 0;
}

original_code:
bool_t
xdr_name (XDR *xdrs, name *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, objp, 255))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_name(struct XDR *xdrs, char **objp)
{
 register int *buf;
  if (!xdr_string (xdrs, objp, 255))
   return (0);
 return (1);
}


decompiled_code:
_BOOL8 __fastcall xdr_mountstat3(XDR *a1, enum_t *a2)
{
return xdr_enum(a1, a2) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(XDR *a1, enum_t *a2)
{
return xdr_enum(a1, a2) != 0;
}

original_code:
bool_t
xdr_mountstat3 (XDR *xdrs, mountstat3 *objp)
{
 register int32_t *buf;
  if (!xdr_enum (xdrs, (enum_t *) objp))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountstat3(struct XDR *xdrs, enum mountstat3 *objp)
{
 register int *buf;
  if (!xdr_enum (xdrs, (int *) objp))
   return (0);
 return (1);
}

variable_types: enum mountstat3 { MNT3_OK=0, MNT3ERR_PERM=1, MNT3ERR_NOENT=2, MNT3ERR_IO=5, MNT3ERR_ACCES=13, MNT3ERR_NOTDIR=20, MNT3ERR_INVAL=22, MNT3ERR_NAMETOOLONG=63, MNT3ERR_NOTSUPP=10004, MNT3ERR_SERVERFAULT=10006 } *


decompiled_code:
_BOOL8 __fastcall xdr_mountlist(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x18u, xdr_mountbody) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func4(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x18u, xdr_mountbody) != 0;
}

original_code:
bool_t
xdr_mountlist (XDR *xdrs, mountlist *objp)
{
 register int32_t *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountlist(struct XDR *xdrs, struct mountbody **objp)
{
 register int *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct mountbody), (int (*)(struct XDR *, void *, ...)) xdr_mountbody))
   return (0);
 return (1);
}

variable_types: struct mountbody { char *ml_hostname; char *ml_directory; struct mountbody *ml_next; } **


decompiled_code:
_BOOL8 __fastcall xdr_mountbody(XDR *a1, void *a2)
{
_BOOL8 result; // rax

result = xdr_name(a1, (char **)a2);
if ( result )
{
result = xdr_dirpath(a1, (char **)a2 + 1);
if ( result )
result = xdr_mountlist(a1, (char **)a2 + 2);
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func5(XDR *a1, void *a2)
{
_BOOL8 result; // rax

result = func2(a1, (char **)a2);
if ( result )
{
result = func1(a1, (char **)a2 + 1);
if ( result )
result = func4(a1, (char **)a2 + 2);
}
return result;
}

original_code:
bool_t
xdr_mountbody (XDR *xdrs, mountbody *objp)
{
 register int32_t *buf;
  if (!xdr_name (xdrs, &objp->ml_hostname))
   return (0);
  if (!xdr_dirpath (xdrs, &objp->ml_directory))
   return (0);
  if (!xdr_mountlist (xdrs, &objp->ml_next))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountbody(struct XDR *xdrs, struct mountbody *objp)
{
 register int *buf;
  if (!xdr_name (xdrs, &objp->ml_hostname))
   return (0);
  if (!xdr_dirpath (xdrs, &objp->ml_directory))
   return (0);
  if (!xdr_mountlist (xdrs, &objp->ml_next))
   return (0);
 return (1);
}

variable_types: struct mountbody { char *ml_hostname; char *ml_directory; struct mountbody *ml_next; } *


decompiled_code:
_BOOL8 __fastcall xdr_groups(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x10u, xdr_groupnode) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func6(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x10u, xdr_groupnode) != 0;
}

original_code:
bool_t
xdr_groups (XDR *xdrs, groups *objp)
{
 register int32_t *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_groups(struct XDR *xdrs, struct groupnode **objp)
{
 register int *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct groupnode), (int (*)(struct XDR *, void *, ...)) xdr_groupnode))
   return (0);
 return (1);
}

variable_types: struct groupnode { char *gr_name; struct groupnode *gr_next; } **


decompiled_code:
_BOOL8 __fastcall xdr_groupnode(XDR *a1, void *a2)
{
_BOOL8 result; // rax

result = xdr_name(a1, (char **)a2);
if ( result )
result = xdr_groups(a1, (char **)a2 + 1);
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func7(XDR *a1, void *a2)
{
_BOOL8 result; // rax

result = func2(a1, (char **)a2);
if ( result )
result = func6(a1, (char **)a2 + 1);
return result;
}

original_code:
bool_t
xdr_groupnode (XDR *xdrs, groupnode *objp)
{
 register int32_t *buf;
  if (!xdr_name (xdrs, &objp->gr_name))
   return (0);
  if (!xdr_groups (xdrs, &objp->gr_next))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_groupnode(struct XDR *xdrs, struct groupnode *objp)
{
 register int *buf;
  if (!xdr_name (xdrs, &objp->gr_name))
   return (0);
  if (!xdr_groups (xdrs, &objp->gr_next))
   return (0);
 return (1);
}

variable_types: struct groupnode { char *gr_name; struct groupnode *gr_next; } *


decompiled_code:
_BOOL8 __fastcall xdr_exports(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x18u, xdr_exportnode) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func8(XDR *a1, char **a2)
{
return xdr_pointer(a1, a2, 0x18u, xdr_exportnode) != 0;
}

original_code:
bool_t
xdr_exports (XDR *xdrs, exports *objp)
{
 register int32_t *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_exports(struct XDR *xdrs, struct exportnode **objp)
{
 register int *buf;
  if (!xdr_pointer (xdrs, (char **)objp, sizeof (struct exportnode), (int (*)(struct XDR *, void *, ...)) xdr_exportnode))
   return (0);
 return (1);
}

variable_types: struct exportnode { char *ex_dir; struct groupnode { char *gr_name; struct groupnode *gr_next; } *ex_groups; struct exportnode *ex_next; } **

user_defined_types: struct exportnode { char *ex_dir; struct groupnode *ex_groups; struct exportnode *ex_next; }


decompiled_code:
_BOOL8 __fastcall xdr_exportnode(XDR *a1, void *a2)
{
_BOOL8 result; // rax

result = xdr_dirpath(a1, (char **)a2);
if ( result )
{
result = xdr_groups(a1, (char **)a2 + 1);
if ( result )
result = xdr_exports(a1, (char **)a2 + 2);
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func9(XDR *a1, void *a2)
{
_BOOL8 result; // rax

result = func1(a1, (char **)a2);
if ( result )
{
result = func6(a1, (char **)a2 + 1);
if ( result )
result = func8(a1, (char **)a2 + 2);
}
return result;
}

original_code:
bool_t
xdr_exportnode (XDR *xdrs, exportnode *objp)
{
 register int32_t *buf;
  if (!xdr_dirpath (xdrs, &objp->ex_dir))
   return (0);
  if (!xdr_groups (xdrs, &objp->ex_groups))
   return (0);
  if (!xdr_exports (xdrs, &objp->ex_next))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_exportnode(struct XDR *xdrs, struct exportnode *objp)
{
 register int *buf;
  if (!xdr_dirpath (xdrs, &objp->ex_dir))
   return (0);
  if (!xdr_groups (xdrs, &objp->ex_groups))
   return (0);
  if (!xdr_exports (xdrs, &objp->ex_next))
   return (0);
 return (1);
}

variable_types: struct exportnode { char *ex_dir; struct groupnode { char *gr_name; struct groupnode *gr_next; } *ex_groups; struct exportnode *ex_next; } *


decompiled_code:
__int64 __fastcall xdr_mountres3_ok(XDR *xdrs, __int64 a2)
{
__int64 result; // rax

result = xdr_fhandle3(xdrs, a2);
if ( (_DWORD)result )
result = xdr_array(xdrs, (caddr_t *)(a2 + 80), (u_int *)(a2 + 72), 0xFFFFFFFF, 4u, (xdrproc_t)&xdr_int) != 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(XDR *xdrs, __int64 a2)
{
__int64 result; // rax

result = func0(xdrs, a2);
if ( (_DWORD)result )
result = xdr_array(xdrs, (caddr_t *)(a2 + 80), (u_int *)(a2 + 72), 0xFFFFFFFF, 4u, (xdrproc_t)&xdr_int) != 0;
return result;
}

original_code:
bool_t
xdr_mountres3_ok (XDR *xdrs, mountres3_ok *objp)
{
 register int32_t *buf;
  if (!xdr_fhandle3 (xdrs, &objp->fhandle))
   return (0);
  if (!xdr_array (xdrs, (char **)&objp->auth_flavors.auth_flavors_val, (u_int *) &objp->auth_flavors.auth_flavors_len, ~0,
  sizeof (int), (xdrproc_t) xdr_int))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountres3_ok(struct XDR *xdrs, struct mountres3_ok *objp)
{
 register int *buf;
  if (!xdr_fhandle3 (xdrs, &objp->fhandle))
   return (0);
  if (!xdr_array (xdrs, (char **)&objp->auth_flavors.auth_flavors_val, (unsigned int *) &objp->auth_flavors.auth_flavors_len, ~0,
  sizeof (int), (int (*)(struct XDR *, void *, ...)) xdr_int))
   return (0);
 return (1);
}

variable_types: struct mountres3_ok { struct fhandle3 { unsigned int fhandle3_len; char fhandle3_val[64]; } fhandle; struct { unsigned int auth_flavors_len; int *auth_flavors_val; } auth_flavors; } *


decompiled_code:
__int64 __fastcall xdr_mountres3(XDR *xdrs, enum_t *a2)
{
__int64 result; // rax

result = xdr_mountstat3(xdrs, a2);
if ( (_DWORD)result )
{
result = 1LL;
if ( !*a2 )
result = (unsigned int)xdr_mountres3_ok(xdrs, (__int64)(a2 + 2)) != 0;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(XDR *xdrs, enum_t *a2)
{
__int64 result; // rax

result = func3(xdrs, a2);
if ( (_DWORD)result )
{
result = 1LL;
if ( !*a2 )
result = (unsigned int)func10(xdrs, (__int64)(a2 + 2)) != 0;
}
return result;
}

original_code:
bool_t
xdr_mountres3 (XDR *xdrs, mountres3 *objp)
{
 register int32_t *buf;
  if (!xdr_mountstat3 (xdrs, &objp->fhs_status))
   return (0);
 switch (objp->fhs_status) {
 case MNT3_OK:
   if (!xdr_mountres3_ok (xdrs, &objp->mountres3_u.mountinfo))
    return (0);
  break;
 default:
  break;
 }
 return (1);
}

canonical_original_code:
int xdr_mountres3(struct XDR *xdrs, struct mountres3 *objp)
{
 register int *buf;
  if (!xdr_mountstat3 (xdrs, &objp->fhs_status))
   return (0);
 switch (objp->fhs_status) {
 case MNT3_OK:
   if (!xdr_mountres3_ok (xdrs, &objp->mountres3_u.mountinfo))
    return (0);
  break;
 default:
  break;
 }
 return (1);
}

variable_types: struct mountres3 { enum mountstat3 { MNT3_OK=0, MNT3ERR_PERM=1, MNT3ERR_NOENT=2, MNT3ERR_IO=5, MNT3ERR_ACCES=13, MNT3ERR_NOTDIR=20, MNT3ERR_INVAL=22, MNT3ERR_NAMETOOLONG=63, MNT3ERR_NOTSUPP=10004, MNT3ERR_SERVERFAULT=10006 } fhs_status; union { struct mountres3_ok { struct fhandle3 { unsigned int fhandle3_len; char fhandle3_val[64]; } fhandle; struct { unsigned int auth_flavors_len; int *auth_flavors_val; } auth_flavors; } mountinfo; } mountres3_u; } *


decompiled_code:
_BOOL8 __fastcall xdr_mountstat1(XDR *a1, enum_t *a2)
{
return xdr_enum(a1, a2) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func12(XDR *a1, enum_t *a2)
{
return xdr_enum(a1, a2) != 0;
}

original_code:
bool_t
xdr_mountstat1 (XDR *xdrs, mountstat1 *objp)
{
 register int32_t *buf;
  if (!xdr_enum (xdrs, (enum_t *) objp))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountstat1(struct XDR *xdrs, enum mountstat1 *objp)
{
 register int *buf;
  if (!xdr_enum (xdrs, (int *) objp))
   return (0);
 return (1);
}

variable_types: enum mountstat1 { MNT1_OK=0, MNT1ERR_PERM=1, MNT1ERR_NOENT=2, MNT1ERR_IO=5, MNT1ERR_ACCES=13, MNT1ERR_NOTDIR=20, MNT1ERR_INVAL=22, MNT1ERR_NAMETOOLONG=63, MNT1ERR_NOTSUPP=10004, MNT1ERR_SERVERFAULT=10006 } *


decompiled_code:
_BOOL8 __fastcall xdr_fhandle1(XDR *a1, char *a2)
{
return xdr_opaque(a1, a2, 0x20u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func13(XDR *a1, char *a2)
{
return xdr_opaque(a1, a2, 0x20u) != 0;
}

original_code:
bool_t
xdr_fhandle1 (XDR *xdrs, fhandle1 objp)
{
 register int32_t *buf;
  if (!xdr_opaque (xdrs, objp, 32))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_fhandle1(struct XDR *xdrs, char objp[32])
{
 register int *buf;
  if (!xdr_opaque (xdrs, objp, 32))
   return (0);
 return (1);
}

variable_types:
objp
char [32]


decompiled_code:
_BOOL8 __fastcall xdr_mountres1_ok(XDR *a1, char *a2)
{
return xdr_fhandle1(a1, a2);
}

canonical_decompiled_code:
_BOOL8 __fastcall func14(XDR *a1, char *a2)
{
return func13(a1, a2);
}

original_code:
bool_t
xdr_mountres1_ok (XDR *xdrs, mountres1_ok *objp)
{
 register int32_t *buf;
  if (!xdr_fhandle1 (xdrs, objp->fhandle))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_mountres1_ok(struct XDR *xdrs, struct mountres1_ok *objp)
{
 register int *buf;
  if (!xdr_fhandle1 (xdrs, objp->fhandle))
   return (0);
 return (1);
}

variable_types: struct mountres1_ok { char fhandle[32]; } *


decompiled_code:
_BOOL8 __fastcall xdr_mountres1(XDR *a1, __int64 a2)
{
_BOOL8 result; // rax

result = xdr_mountstat1(a1, (enum_t *)a2);
if ( result )
{
result = 1LL;
if ( !*(_DWORD *)a2 )
result = xdr_mountres1_ok(a1, (char *)(a2 + 4));
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func15(XDR *a1, __int64 a2)
{
_BOOL8 result; // rax

result = func12(a1, (enum_t *)a2);
if ( result )
{
result = 1LL;
if ( !*(_DWORD *)a2 )
result = func14(a1, (char *)(a2 + 4));
}
return result;
}

original_code:
bool_t
xdr_mountres1 (XDR *xdrs, mountres1 *objp)
{
 register int32_t *buf;
  if (!xdr_mountstat1 (xdrs, &objp->fhs_status))
   return (0);
 switch (objp->fhs_status) {
 case MNT1_OK:
   if (!xdr_mountres1_ok (xdrs, &objp->mountres1_u.mountinfo))
    return (0);
  break;
 default:
  break;
 }
 return (1);
}

canonical_original_code:
int xdr_mountres1(struct XDR *xdrs, struct mountres1 *objp)
{
 register int *buf;
  if (!xdr_mountstat1 (xdrs, &objp->fhs_status))
   return (0);
 switch (objp->fhs_status) {
 case MNT1_OK:
   if (!xdr_mountres1_ok (xdrs, &objp->mountres1_u.mountinfo))
    return (0);
  break;
 default:
  break;
 }
 return (1);
}

variable_types: struct mountres1 { enum mountstat1 { MNT1_OK=0, MNT1ERR_PERM=1, MNT1ERR_NOENT=2, MNT1ERR_IO=5, MNT1ERR_ACCES=13, MNT1ERR_NOTDIR=20, MNT1ERR_INVAL=22, MNT1ERR_NAMETOOLONG=63, MNT1ERR_NOTSUPP=10004, MNT1ERR_SERVERFAULT=10006 } fhs_status; union { struct mountres1_ok { char fhandle[32]; } mountinfo; } mountres1_u; } *

user_defined_types: struct mountres1 { enum mountstat1 fhs_status; union { struct mountres1_ok mountinfo; } mountres1_u; }


main

repo: Nexfer/Stegano

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

if ( (unsigned int)(argc - 4) > 1 || (v3 = *argv[1], argc != 4) && v3 == 100 || argc != 5 && v3 == 101 )
{
puts("ERROR: Wrong parameters!");
puts("Usage:");
puts("For encryption: ./stegano [e] [source file] [destination file] [text file]");
puts("For decryption: ./stegano [d] [source file] [text file]");
}
else
{
stegano(argv);
}
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char v3; // al

if ( (unsigned int)(argc - 4) > 1 || (v3 = *argv[1], argc != 4) && v3 == 100 || argc != 5 && v3 == 101 )
{
puts("ERROR: Wrong parameters!");
puts("Usage:");
puts("For encryption: ./stegano [e] [source file] [destination file] [text file]");
puts("For decryption: ./stegano [d] [source file] [text file]");
}
else
{
func7(argv);
}
return 0;
}

original_code:
int main(int argc, char *argv[])
{
 if(argc < 4 || argc > 5 || (argv[1][0] == 'd' && argc != 4) || (argv[1][0] == 'e' && argc != 5))
 {
  printf("ERROR: Wrong parameters!\n");
  printf("Usage:\n");
  printf("For encryption: ./stegano [e] [source file] [destination file] [text file]\n");
  printf("For decryption: ./stegano [d] [source file] [text file]\n");
  return 0;
 }
 stegano(argv);
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]


repo: Nexfer/cifers

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
if ( argc <= 1 )
{
puts("ERROR: Need to type a name of file which will be encrypted");
goto LABEL_9;
}
if ( argc <= 2 )
{
LABEL_9:
puts("ERROR: Need to type a name of file where the result will be written");
goto LABEL_10;
}
if ( argc <= 3 )
{
LABEL_10:
puts("ERROR: Need to type a name of file where the key will be");
goto LABEL_11;
}
if ( argc <= 4 )
{
LABEL_11:
puts("ERROR: Need to type mode (e - enc, d - dec)");
return 0;
}
if ( argc == 5 )
vigenere(argv);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
if ( argc <= 1 )
{
puts("ERROR: Need to type a name of file which will be encrypted");
goto LABEL_9;
}
if ( argc <= 2 )
{
LABEL_9:
puts("ERROR: Need to type a name of file where the result will be written");
goto LABEL_10;
}
if ( argc <= 3 )
{
LABEL_10:
puts("ERROR: Need to type a name of file where the key will be");
goto LABEL_11;
}
if ( argc <= 4 )
{
LABEL_11:
puts("ERROR: Need to type mode (e - enc, d - dec)");
return 0;
}
if ( argc == 5 )
func10(argv);
return 0;
}

original_code:
int main(int argc, char *argv[])
{
 if(argc < 2)
  printf("ERROR: Need to type a name of file which will be encrypted\n");
 if(argc <= 2)
  printf("ERROR: Need to type a name of file where the result will be written\n");
 if(argc <= 3)
  printf("ERROR: Need to type a name of file where the key will be\n");
 if(argc <= 4)
  printf("ERROR: Need to type mode (e - enc, d - dec)\n");
 if(argc == 5)
 {
  vigenere(argv);
 }
 return 0;
}


innum

decompiled_code:
__int64 __fastcall innum(char a1)
{
char v1; // al
unsigned __int8 v3; // dl
char v4; // di

v1 = a1;
if ( (unsigned __int8)(a1 - 65) > 0x19u )
{
v3 = a1 - 97;
v4 = a1 - 71;
if ( v3 < 0x1Au )
v1 = v4;
}
else
{
v1 = a1 - 65;
}
return (unsigned int)v1;
}

canonical_decompiled_code:
__int64 __fastcall func8(char a1)
{
char v1; // al
unsigned __int8 v3; // dl
char v4; // di

v1 = a1;
if ( (unsigned __int8)(a1 - 65) > 0x19u )
{
v3 = a1 - 97;
v4 = a1 - 71;
if ( v3 < 0x1Au )
v1 = v4;
}
else
{
v1 = a1 - 65;
}
return (unsigned int)v1;
}

variable_types: a char


inchar

decompiled_code:
__int64 __fastcall inchar(unsigned __int8 a1)
{
unsigned __int8 v1; // al
unsigned __int8 v3; // dl
unsigned __int8 v4; // di

v1 = a1;
if ( a1 > 0x19u )
{
v3 = a1 - 26;
v4 = a1 + 71;
if ( v3 < 0x1Au )
v1 = v4;
}
else
{
v1 = a1 + 65;
}
return (unsigned int)(char)v1;
}

canonical_decompiled_code:
__int64 __fastcall func9(unsigned __int8 a1)
{
unsigned __int8 v1; // al
unsigned __int8 v3; // dl
unsigned __int8 v4; // di

v1 = a1;
if ( a1 > 0x19u )
{
v3 = a1 - 26;
v4 = a1 + 71;
if ( v3 < 0x1Au )
v1 = v4;
}
else
{
v1 = a1 + 65;
}
return (unsigned int)(char)v1;
}


constr

repo: Neymello/slabAllocator

decompiled_code:
void __fastcall constr(__int64 a1)
{
*(_DWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 0LL;
}

canonical_decompiled_code:
void __fastcall func0(__int64 a1)
{
*(_DWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 0LL;
}

original_code:
void constr(void *buf, int size){
 int s = size;
 s++;
 testBuf_t buffer = (testBuf_t) buf;
 buffer->id=0;
 buffer->value = ((void *)0);
}

canonical_original_code:
void constr(void *buf, int size){
 int s = size;
 s++;
 struct testBuf *buffer = (testBuf_t) buf;
 buffer->id=0;
 buffer->value = ((void *)0);
}

variable_types:
buf
void *

variable_types: size int

variable_types: s int

variable_types: struct testBuf { int id; char *value; int pad[1000]; } *


destruct

decompiled_code:
void __fastcall destruct(__int64 a1)
{
*(_DWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 0LL;
}

canonical_decompiled_code:
void __fastcall func1(__int64 a1)
{
*(_DWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 0LL;
}

original_code:
void destruct(void *buf, int size){
 int s = size;
 s++;
 testBuf_t buffer = (testBuf_t) buf;
 buffer->id=0;
 buffer->value = ((void *)0);
}

canonical_original_code:
void destruct(void *buf, int size){
 int s = size;
 s++;
 struct testBuf *buffer = (testBuf_t) buf;
 buffer->id=0;
 buffer->value = ((void *)0);
}

user_defined_types: struct testBuf { int id; char *value; int pad[1000]; }


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned __int64 v3; // rax
__int64 v4; // rbx
__int64 v5; // r12
unsigned __int64 v6; // rax
unsigned __int64 v7; // rax
__int64 v8; // r15
__int64 *v9; // r14
__int64 *v10; // rbx
__int64 *v11; // r13
unsigned __int64 v12; // rax
unsigned __int64 v13; // rax
__int64 *v14; // r14
__int64 *v15; // r15
unsigned __int64 v16; // rax
unsigned __int64 v17; // rax
__int64 v18; // r14
__int64 *v19; // r15
unsigned __int64 v20; // rax
__int64 v21; // rsi
unsigned __int64 v22; // rax
__int64 v23; // rbx
unsigned __int64 v24; // rax
__int64 v25; // rsi
unsigned __int64 v26; // rax
__int64 v27; // rbx
unsigned __int64 v28; // rax
__int64 v30; // [rsp+0h] [rbp-360h] BYREF
__int64 v31; // [rsp+320h] [rbp-40h]
__int64 *v32; // [rsp+328h] [rbp-38h]

v32 = &v30;
puts("##########################\nThe result will be showed in number of cycles\n##########################");
printf("------------\n\tObjects Size:%d\n\tIterations %d\n------------\n", 1000LL, 100LL);
v3 = __rdtsc();
v4 = (unsigned int)v3;
v5 = kmem_cache_create("first", 4016LL, 0LL, constr, destruct);
v6 = __rdtsc();
printf("Overhead for CACHE_CREATE %lld\n", (unsigned int)v6 - v4);
if ( *(_DWORD *)(v5 + 56) )
_assert_fail(
"cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0",
"main.c",
0x2Du,
"main");
v7 = __rdtsc();
v8 = (unsigned int)v7;
v9 = v32;
v10 = v32;
v11 = v32 + 100;
do
*v9++ = kmem_cache_alloc(v5, 1LL);
while ( v9 != v11 );
v12 = __rdtsc();
printf("Overhead for CACHE_ALLOC %lld\n", ((unsigned __int64)HIDWORD(v12) - v8) / 0x64);
v13 = __rdtsc();
v31 = (unsigned int)v13;
v14 = v32;
v15 = v32 + 50;
do
kmem_cache_free(v5, *v14++);
while ( v14 != v15 );
v16 = __rdtsc();
printf("Overhead for CACHE_FREE %lld\n", ((unsigned __int64)HIDWORD(v16) - v31) / 0x32);
v17 = __rdtsc();
v18 = (unsigned int)v17;
v19 = v32 + 50;
do
*v19++ = kmem_cache_alloc(v5, 1LL);
while ( v19 != v11 );
v20 = __rdtsc();
printf("Overhead for CACHE_ALLOC (pre loaded) %lld\n", ((unsigned __int64)HIDWORD(v20) - v18) / 0x32);
do
{
v21 = *v10;
kmem_cache_free(v5, *v10++);
}
while ( v10 != v11 );
v22 = __rdtsc();
v23 = (unsigned int)v22;
kmem_cache_reap(v5, v21, HIDWORD(v22));
v24 = __rdtsc();
v25 = (unsigned int)v24 - v23;
printf("Overhead for CACHE_REAP %lld\n", v25);
v26 = __rdtsc();
v27 = (unsigned int)v26;
kmem_cache_destroy(v5, v25, HIDWORD(v26));
v28 = __rdtsc();
printf("Overhead for CACHE_DESTROY %lld\n", (unsigned int)v28 - v27);
return 0;
}

original_code:
int main(void) {
 int count;
 int num_loop = 100;
 void *items[num_loop];
 int num_buf;
 unsigned long long start, end;
 printf("##########################\nThe result will be showed in number of cycles\n##########################\n");
 printf("------------\n\tObjects Size:%d\n\tIterations %d\n------------\n",1000, num_loop);
 __asm__ __volatile__("rdtsc" : "=A" (start));
 kmem_cache_t cache_test = kmem_cache_create("first", sizeof(struct testBuf), 0, &constr, &destruct );
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_CREATE %lld\n", (end-start));
 ((void) sizeof ((cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0) ? 1 : 0), __extension__ ({ if (cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0) ; else __assert_fail ("cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0", "main.c", 45, __extension__ __PRETTY_FUNCTION__); }));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=0;count<num_loop;count++){
  items[count] = kmem_cache_alloc(cache_test,KM_SLEEP);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_ALLOC %lld\n", (end-start)/num_loop);
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=0;count<num_loop/2;count++){
  kmem_cache_free(cache_test,items[count]);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_FREE %lld\n", (end-start)/(num_loop/2));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=num_loop/2;count<num_loop;count++){
  items[count] = kmem_cache_alloc(cache_test,KM_SLEEP);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_ALLOC (pre loaded) %lld\n", (end-start)/(num_loop/2));
 for(count=0;count<num_loop;count++){
  kmem_cache_free(cache_test,items[count]);
 }
 __asm__ __volatile__("rdtsc" : "=A" (start));
 kmem_cache_reap(cache_test);
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_REAP %lld\n", (end-start));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 kmem_cache_destroy(cache_test);
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_DESTROY %lld\n", (end-start));
 return 0;
}

canonical_original_code:
int main() {
 int count;
 int num_loop = 100;
 void *items[-1];
 int num_buf;
 unsigned long long start; unsigned long long end;
 printf("##########################\nThe result will be showed in number of cycles\n##########################\n");
 printf("------------\n\tObjects Size:%d\n\tIterations %d\n------------\n",1000, num_loop);
 __asm__ __volatile__("rdtsc" : "=A" (start));
 struct kmem_cache *cache_test = kmem_cache_create("first", sizeof(struct testBuf), 0, &constr, &destruct );
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_CREATE %lld\n", (end-start));
 ((void) sizeof ((cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0) ? 1 : 0), __extension__ ({ if (cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0) ; else __assert_fail ("cache_test->slab_free_count==0 && cache_test->slab_free_count==0 && cache_test->slab_free_count==0", "main.c", 45, __extension__ __PRETTY_FUNCTION__); }));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=0;count<num_loop;count++){
  items[count] = kmem_cache_alloc(cache_test,KM_SLEEP);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_ALLOC %lld\n", (end-start)/num_loop);
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=0;count<num_loop/2;count++){
  kmem_cache_free(cache_test,items[count]);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_FREE %lld\n", (end-start)/(num_loop/2));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 for(count=num_loop/2;count<num_loop;count++){
  items[count] = kmem_cache_alloc(cache_test,KM_SLEEP);
 }
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_ALLOC (pre loaded) %lld\n", (end-start)/(num_loop/2));
 for(count=0;count<num_loop;count++){
  kmem_cache_free(cache_test,items[count]);
 }
 __asm__ __volatile__("rdtsc" : "=A" (start));
 kmem_cache_reap(cache_test);
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_REAP %lld\n", (end-start));
 __asm__ __volatile__("rdtsc" : "=A" (start));
 kmem_cache_destroy(cache_test);
 __asm__ __volatile__("rdtsc" : "=A" (end));
 printf("Overhead for CACHE_DESTROY %lld\n", (end-start));
 return 0;
}

variable_types: count int

variable_types:
items
void *[-1]

variable_types:
start
unsigned long long

variable_types:
end
unsigned long long

variable_types: struct kmem_cache { char *name; int size; int align; void (*constructor)(void *, int); void (*destructor)(void *, int); struct kmem_slab { int buf_free_count; int buf_used_count; void *buffer; struct kmem_slab *next; struct kmem_slab *previous; struct kmem_bufctl { void *buffer; struct kmem_bufctl *next_free; struct kmem_slab *slab; } *buf_free; } *slab_free; struct kmem_slab *slab_used; struct kmem_slab *slab_full; int slab_free_count; int slab_used_count; int slab_full_count; } *

user_defined_types: struct kmem_cache { char *name; int size; int align; void (*constructor)(void *, int); void (*destructor)(void *, int); struct kmem_slab *slab_free; struct kmem_slab *slab_used; struct kmem_slab *slab_full; int slab_free_count; int slab_used_count; int slab_full_count; }

user_defined_types: struct kmem_slab { int buf_free_count; int buf_used_count; void *buffer; struct kmem_slab *next; struct kmem_slab *previous; struct kmem_bufctl *buf_free; }


decompiled_code:
void __fastcall kmem_cache_destroy(__int64 a1)
{
_QWORD *v1; // rbp
int v3; // ebx
void *v4; // rdi

v1 = *(_QWORD **)(a1 + 32);
if ( *(_DWORD *)(a1 + 60) )
_assert_fail("cache->slab_used_count == 0", "kmem.c", 0x54u, "kmem_cache_destroy");
v3 = *(_DWORD *)(a1 + 64);
if ( v3 )
_assert_fail("cache->slab_full_count == 0", "kmem.c", 0x55u, "kmem_cache_destroy");
if ( *(int *)(a1 + 56) > 0 )
{
do
{
v4 = v1;
v1 = (_QWORD *)v1[2];
free(v4);
++v3;
}
while ( *(_DWORD *)(a1 + 56) > v3 );
}
}

canonical_decompiled_code:
void __fastcall func1(__int64 a1)
{
_QWORD *v1; // rbp
int v3; // ebx
void *v4; // rdi

v1 = *(_QWORD **)(a1 + 32);
if ( *(_DWORD *)(a1 + 60) )
_assert_fail("cache->slab_used_count == 0", "kmem.c", 0x54u, "kmem_cache_destroy");
v3 = *(_DWORD *)(a1 + 64);
if ( v3 )
_assert_fail("cache->slab_full_count == 0", "kmem.c", 0x55u, "kmem_cache_destroy");
if ( *(int *)(a1 + 56) > 0 )
{
do
{
v4 = v1;
v1 = (_QWORD *)v1[2];
free(v4);
++v3;
}
while ( *(_DWORD *)(a1 + 56) > v3 );
}
}

original_code:
void kmem_cache_destroy(kmem_cache_t cache){
 if(0)printf("===>Destroying cache\n");
 kmem_slab_t slab = cache->slab_free;
 kmem_slab_t aux;
 int count;
 ((void) sizeof ((cache->slab_used_count == 0) ? 1 : 0), __extension__ ({ if (cache->slab_used_count == 0) ; else __assert_fail ("cache->slab_used_count == 0", "kmem.c", 84, __extension__ __PRETTY_FUNCTION__); }));
 ((void) sizeof ((cache->slab_full_count == 0) ? 1 : 0), __extension__ ({ if (cache->slab_full_count == 0) ; else __assert_fail ("cache->slab_full_count == 0", "kmem.c", 85, __extension__ __PRETTY_FUNCTION__); }));
 for (count = 0; count < cache->slab_free_count; ++count) {
  aux = slab;
  slab = slab->next;
  free(aux);
 }
}

canonical_original_code:
void kmem_cache_destroy(struct kmem_cache *cache){
 if(0)printf("===>Destroying cache\n");
 struct kmem_slab *slab = cache->slab_free;
 struct kmem_slab *aux;
 int count;
 ((void) sizeof ((cache->slab_used_count == 0) ? 1 : 0), __extension__ ({ if (cache->slab_used_count == 0) ; else __assert_fail ("cache->slab_used_count == 0", "kmem.c", 84, __extension__ __PRETTY_FUNCTION__); }));
 ((void) sizeof ((cache->slab_full_count == 0) ? 1 : 0), __extension__ ({ if (cache->slab_full_count == 0) ; else __assert_fail ("cache->slab_full_count == 0", "kmem.c", 85, __extension__ __PRETTY_FUNCTION__); }));
 for (count = 0; count < cache->slab_free_count; ++count) {
  aux = slab;
  slab = slab->next;
  free(aux);
 }
}

variable_types: struct kmem_slab { int buf_free_count; int buf_used_count; void *buffer; struct kmem_slab *next; struct kmem_slab *previous; struct kmem_bufctl { void *buffer; struct kmem_bufctl *next_free; struct kmem_slab *slab; } *buf_free; } *


decompiled_code:
void __fastcall kmem_cache_reap(__int64 a1)
{
void *v1; // rbx
__int64 v2; // [rsp+8h] [rbp-10h] BYREF

v2 = a1;
if ( *(int *)(a1 + 56) > 0 )
{
v1 = *(void **)(a1 + 32);
_remove_from_slab_list(&v2, 0);
free(v1);
}
}

original_code:
void kmem_cache_reap(kmem_cache_t cache){
 if(0)printf("===>Reaping the cache");
 kmem_slab_t slab;
 if(cache->slab_free_count > 0){
  slab = cache->slab_free;
  __remove_from_slab_list(&cache,KM_FREE_LIST);
  free(slab);
 }
}

canonical_original_code:
void kmem_cache_reap(struct kmem_cache *cache){
 if(0)printf("===>Reaping the cache");
 struct kmem_slab *slab;
 if(cache->slab_free_count > 0){
  slab = cache->slab_free;
  __remove_from_slab_list(&cache,KM_FREE_LIST);
  free(slab);
 }
}

user_defined_types: struct kmem_bufctl { void *buffer; struct kmem_bufctl *next_free; struct kmem_slab *slab; }