decompiled_code:
unsigned int *__fastcall find_shortest(__int64 a1, __int64 a2, int a3, unsigned int a4, int a5)
{
void *v7; // rax

v7 = init_path_cache(a3);
return find_shortest_(a1, (__int64)v7, a2, a4, a5);
}

canonical_decompiled_code:
unsigned int *__fastcall func15(__int64 a1, __int64 a2, int a3, unsigned int a4, int a5)
{
void *v7; // rax

v7 = func13(a3);
return func14(a1, (__int64)v7, a2, a4, a5);
}

original_code:
struct path *find_shortest (int **weights, struct node **graph, int num_nodes, int id1, int id2) {
    struct path **path_cache = init_path_cache (num_nodes);
    return find_shortest_ (weights, path_cache, graph, id1, id2);
}

canonical_original_code:
struct path *find_shortest(int **weights, struct node **graph, int num_nodes, int id1, int id2) {
    struct path **path_cache = init_path_cache (num_nodes);
    return find_shortest_ (weights, path_cache, graph, id1, id2);
}

user_defined_types: struct node { int num_back; int *back; int id; }


cmdBufferGrow

repo: michael-grunder/buffer-optimize

decompiled_code:
__int64 __fastcall cmdBufferGrow(__int64 a1, __int64 a2)
{
unsigned __int64 v3; // rsi
void *v4; // rdi
size_t v5; // rbp
void *v6; // rax

v3 = *(_QWORD *)(a1 + 16) + a2;
v4 = *(void **)a1;
v5 = v3 + 0x100000;
if ( v3 <= 0xFFFFF )
v5 = 2 * v3;
v6 = realloc(v4, v5);
if ( !v6 )
return 0xFFFFFFFFLL;
*(_QWORD *)(a1 + 8) = v5;
*(_QWORD *)a1 = v6;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
unsigned __int64 v3; // rsi
void *v4; // rdi
size_t v5; // rbp
void *v6; // rax

v3 = *(_QWORD *)(a1 + 16) + a2;
v4 = *(void **)a1;
v5 = v3 + 0x100000;
if ( v3 <= 0xFFFFF )
v5 = 2 * v3;
v6 = realloc(v4, v5);
if ( !v6 )
return 0xFFFFFFFFLL;
*(_QWORD *)(a1 + 8) = v5;
*(_QWORD *)a1 = v6;
return 0LL;
}

original_code:
static inline int cmdBufferGrow(cmdBuffer *buffer, size_t addlen) {
    size_t newlen = buffer->pos+addlen;
    char *newbuf;
    if(newlen < (1024*1024)) {
        newlen *= 2;
    } else {
        newlen += (1024*1024);
    }
    if((newbuf = realloc(buffer->buf, newlen)) == ((void *)0))
        return -1;
    buffer->size = newlen;
    buffer->buf = newbuf;
    return 0;
}

canonical_original_code:
static inline int cmdBufferGrow(struct _cmdBuffer *buffer, unsigned long addlen) {
    unsigned long newlen = buffer->pos+addlen;
    char *newbuf;
    if(newlen < (1024*1024)) {
        newlen *= 2;
    } else {
        newlen += (1024*1024);
    }
    if((newbuf = realloc(buffer->buf, newlen)) == ((void *)0))
        return -1;
    buffer->size = newlen;
    buffer->buf = newbuf;
    return 0;
}

variable_types: struct _cmdBuffer { char *buf; unsigned long size; unsigned long pos; unsigned int cmd_count; } *

variable_types:
addlen
unsigned long

variable_types:
newlen
unsigned long

variable_types:
newbuf
char *

return_type: int


cmdBufferCreate

decompiled_code:
_QWORD *cmdBufferCreate()
{
_QWORD *v0; // r12
void *v1; // rax
void *v3; // rdi

v0 = calloc(1uLL, 0x20uLL);
if ( v0 )
{
v1 = malloc(0x8000uLL);
*v0 = v1;
if ( v1 )
{
v0[1] = 0x8000LL;
}
else
{
v3 = v0;
v0 = 0LL;
free(v3);
}
}
return v0;
}

canonical_decompiled_code:
_QWORD *func1()
{
_QWORD *v0; // r12
void *v1; // rax
void *v3; // rdi

v0 = calloc(1uLL, 0x20uLL);
if ( v0 )
{
v1 = malloc(0x8000uLL);
*v0 = v1;
if ( v1 )
{
v0[1] = 0x8000LL;
}
else
{
v3 = v0;
v0 = 0LL;
free(v3);
}
}
return v0;
}

original_code:
cmdBuffer* cmdBufferCreate(void) {
    cmdBuffer *buffer;
    if((buffer = calloc(1, sizeof(cmdBuffer))) == ((void *)0))
        return ((void *)0);
    if((buffer->buf = malloc(32768)) == ((void *)0)) {
        free(buffer);
        return ((void *)0);
    }
    buffer->size = 32768;
    return buffer;
}

canonical_original_code:
struct _cmdBuffer *cmdBufferCreate() {
    struct _cmdBuffer *buffer;
    if((buffer = calloc(1, sizeof(cmdBuffer))) == ((void *)0))
        return ((void *)0);
    if((buffer->buf = malloc(32768)) == ((void *)0)) {
        free(buffer);
        return ((void *)0);
    }
    buffer->size = 32768;
    return buffer;
}

return_type: struct _cmdBuffer { char *buf; unsigned long size; unsigned long pos; unsigned int cmd_count; } *


cmdBufferFree

decompiled_code:
__int64 __fastcall cmdBufferFree(void *ptr)
{
void *v2; // rdi

if ( !ptr )
return 0xFFFFFFFFLL;
v2 = *(void **)ptr;
if ( v2 )
free(v2);
free(ptr);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(void *ptr)
{
void *v2; // rdi

if ( !ptr )
return 0xFFFFFFFFLL;
v2 = *(void **)ptr;
if ( v2 )
free(v2);
free(ptr);
return 0LL;
}

original_code:
int cmdBufferFree(cmdBuffer *buffer) {
    if(!buffer)
        return -1;
    if(buffer->buf)
        free(buffer->buf);
    free(buffer);
    return 0;
}

canonical_original_code:
int cmdBufferFree(struct _cmdBuffer *buffer) {
    if(!buffer)
        return -1;
    if(buffer->buf)
        free(buffer->buf);
    free(buffer);
    return 0;
}

user_defined_types: struct _cmdBuffer { char *buf; unsigned long size; unsigned long pos; unsigned int cmd_count; }


cmdBufferAppend

decompiled_code:
__int64 __fastcall cmdBufferAppend(__int64 a1, const void *a2, size_t a3, int a4)
{
__int64 v7; // rdi
__int64 result; // rax

v7 = *(_QWORD *)(a1 + 16);
if ( v7 + a3 <= *(_QWORD *)(a1 + 8) )
goto LABEL_4;
if ( !(unsigned int)cmdBufferGrow(a1, a3) )
{
v7 = *(_QWORD *)(a1 + 16);
LABEL_4:
memcpy((void *)(*(_QWORD *)a1 + v7), a2, a3);
*(_QWORD *)(a1 + 16) += a3;
result = 0LL;
*(_DWORD *)(a1 + 24) += a4;
return result;
}
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, const void *a2, size_t a3, int a4)
{
__int64 v7; // rdi
__int64 result; // rax

v7 = *(_QWORD *)(a1 + 16);
if ( v7 + a3 <= *(_QWORD *)(a1 + 8) )
goto LABEL_4;
if ( !(unsigned int)func0(a1, a3) )
{
v7 = *(_QWORD *)(a1 + 16);
LABEL_4:
memcpy((void *)(*(_QWORD *)a1 + v7), a2, a3);
*(_QWORD *)(a1 + 16) += a3;
result = 0LL;
*(_DWORD *)(a1 + 24) += a4;
return result;
}
return 0xFFFFFFFFLL;
}

original_code:
int cmdBufferAppend(cmdBuffer *buffer, char *str, size_t len,
                    unsigned int cmd_count)
{
    if(buffer->pos + len > buffer->size && cmdBufferGrow(buffer, len)!=0)
        return -1;
    memcpy(buffer->buf+buffer->pos, str, len);
    buffer->pos += len;
    buffer->cmd_count += cmd_count;
    return 0;
}

canonical_original_code:
int cmdBufferAppend(struct _cmdBuffer *buffer, char *str, unsigned long len, unsigned int cmd_count)
{
    if(buffer->pos + len > buffer->size && cmdBufferGrow(buffer, len)!=0)
        return -1;
    memcpy(buffer->buf+buffer->pos, str, len);
    buffer->pos += len;
    buffer->cmd_count += cmd_count;
    return 0;
}

variable_types:
str
char *

variable_types:
len
unsigned long


cmdBufferAddReply

decompiled_code:
__int64 __fastcall cmdBufferAddReply(__int64 a1, _QWORD *a2)
{
unsigned __int64 v2; // r15
void *v3; // rsp
char *v4; // r12
void *v5; // rsp
_QWORD *v6; // r14
__int64 v7; // r9
unsigned __int64 i; // rbx
__int64 v9; // rcx
int v10; // eax
__int64 v11; // rdx
unsigned int v12; // eax
unsigned int v13; // er12
__int64 v15; // [rsp+0h] [rbp-50h] BYREF
__int64 *v16; // [rsp+8h] [rbp-48h]
void *ptr; // [rsp+18h] [rbp-38h] BYREF

v15 = a1;
if ( !a1 )
return (unsigned int)-1;
if ( !a2 )
return (unsigned int)-1;
v2 = a2[4];
v3 = alloca(33 * v2);
v4 = (char *)&v15;
v5 = alloca(8 * v2);
v16 = &v15;
if ( (v6 = malloc(8 * v2)) == 0LL )
return (unsigned int)-1;
v7 = (__int64)v16;
if ( v2 )
{
for ( i = 0LL; i < v2; ++i )
{
v11 = *(_QWORD *)(a2[5] + 8 * i);
if ( *(_DWORD *)v11 == 1 )
{
v6[i] = *(_QWORD *)(v11 + 24);
*(_QWORD *)(v7 + 8 * i) = *(_QWORD *)(v11 + 16);
}
else if ( *(_DWORD *)v11 == 3 )
{
v9 = a2[1];
v16 = (__int64 *)v7;
v10 = snprintf(v4, 0x21uLL, "%lld", v9);
v7 = (__int64)v16;
v6[i] = v4;
*(_QWORD *)(v7 + 8 * i) = v10;
}
v2 = a2[4];
v4 += 33;
}
}
v12 = redisFormatCommandArgv(&ptr, (unsigned int)v2, v6, v7);
v13 = cmdBufferAppend(v15, ptr, v12, 1);
free(v6);
free(ptr);
return v13;
}

original_code:
int cmdBufferAddReply(cmdBuffer *buffer, redisReply *reply) {
    if(!buffer || !reply)
        return -1;
    char **argv, *cmd, intargv[reply->elements][33];
    size_t argvlen[reply->elements];
    unsigned int len;
    int i, retval;
    if((argv = malloc(sizeof(char*)*reply->elements)) == ((void *)0))
        return -1;
    for(i=0;i<reply->elements;i++) {
        switch(reply->element[i]->type) {
            case 1:
                argv[i] = reply->element[i]->str;
                argvlen[i] = reply->element[i]->len;
                break;
            case 3:
                argvlen[i] = snprintf(intargv[i], sizeof(intargv[i]), "%lld",
                                      reply->integer);
                argv[i] = (char*)intargv[i];
                break;
        }
    }
    if((len = redisFormatCommandArgv(&cmd, reply->elements, (const char **)argv, (const size_t*)argvlen))<0)
        return -1;
    retval = cmdBufferAppend(buffer, cmd, len, 1);
    free(argv);
    free(cmd);
    return retval;
}

canonical_original_code:
int cmdBufferAddReply(struct _cmdBuffer *buffer, struct redisReply *reply) {
    if(!buffer || !reply)
        return -1;
    char **argv; char *cmd; char intargv[-1][33];
    unsigned long argvlen[-1];
    unsigned int len;
    int i; int retval;
    if((argv = malloc(sizeof(char *)*reply->elements)) == ((void *)0))
        return -1;
    for(i=0;i<reply->elements;i++) {
        switch(reply->element[i]->type) {
            case 1:
                argv[i] = reply->element[i]->str;
                argvlen[i] = reply->element[i]->len;
                break;
            case 3:
                argvlen[i] = snprintf(intargv[i], sizeof(intargv[i]), "%lld",
                                      reply->integer);
                argv[i] = (char *)intargv[i];
                break;
        }
    }
    if((len = redisFormatCommandArgv(&cmd, reply->elements, (char **)argv, (unsigned long *)argvlen))<0)
        return -1;
    retval = cmdBufferAppend(buffer, cmd, len, 1);
    free(argv);
    free(cmd);
    return retval;
}

variable_types: struct redisReply { int type; long long integer; unsigned long len; char *str; unsigned long elements; struct redisReply **element; } *

variable_types:
argv
char **

variable_types:
cmd
char *

variable_types:
intargv
char [-1][33]

variable_types:
argvlen
unsigned long [-1]

variable_types:
len
unsigned int

variable_types: i int

variable_types: retval int


printUsage

decompiled_code:
int __fastcall printUsage(const char *a1)
{
printf("%s: [OPTIONS] INFILE OUTFILE\n", a1);
puts(" --stat Display statistics but don't write anything");
puts(" --gzip Compress output file with gzip");
puts(" --version Print version number");
puts(" --quiet Don't output information about compression");
return puts(" --help This message");
}

canonical_decompiled_code:
int __fastcall func5(const char *a1)
{
printf("%s: [OPTIONS] INFILE OUTFILE\n", a1);
puts(" --stat Display statistics but don't write anything");
puts(" --gzip Compress output file with gzip");
puts(" --version Print version number");
puts(" --quiet Don't output information about compression");
return puts(" --help This message");
}

original_code:
void printUsage(char *cmd) {
    printf("%s: [OPTIONS] INFILE OUTFILE\n", cmd);
    printf("   --stat     Display statistics but don't write anything\n");
    printf("   --gzip     Compress output file with gzip\n");
    printf("   --version  Print version number\n");
    printf("   --quiet    Don't output information about compression\n");
    printf("   --help     This message\n");
}

return_type: void


decompiled_code:
__int64 __fastcall ring_buffer_check(unsigned __int64 *a1)
{
unsigned __int64 v2; // rax
_BOOL8 v3; // rdi
unsigned __int64 v4; // rax
_BOOL8 v5; // rdi

v2 = a1[2];
v3 = 0LL;
if ( v2 >= *a1 )
v3 = v2 < a1[1];
CU_assertImplementation(
v3,
10LL,
"(ring->start >= ring->upper) && (ring->start < ring->lower)",
"ring_buffer-test.c",
&unk_D71,
0LL);
v4 = a1[3];
v5 = 0LL;
if ( v4 >= *a1 )
v5 = v4 < a1[1];
return CU_assertImplementation(
v5,
11LL,
"(ring->end >= ring->upper) && (ring->end < ring->lower)",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned __int64 *a1)
{
unsigned __int64 v2; // rax
_BOOL8 v3; // rdi
unsigned __int64 v4; // rax
_BOOL8 v5; // rdi

v2 = a1[2];
v3 = 0LL;
if ( v2 >= *a1 )
v3 = v2 < a1[1];
CU_assertImplementation(
v3,
10LL,
"(ring->start >= ring->upper) && (ring->start < ring->lower)",
"ring_buffer-test.c",
&unk_D71,
0LL);
v4 = a1[3];
v5 = 0LL;
if ( v4 >= *a1 )
v5 = v4 < a1[1];
return CU_assertImplementation(
v5,
11LL,
"(ring->end >= ring->upper) && (ring->end < ring->lower)",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

original_code:
static void ring_buffer_check(struct ring_buffer *ring) {
  { CU_assertImplementation(((ring->start >= ring->upper) && (ring->start < ring->lower)), 10, "(ring->start >= ring->upper) && (ring->start < ring->lower)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation(((ring->end >= ring->upper) && (ring->end < ring->lower)), 11, "(ring->end >= ring->upper) && (ring->end < ring->lower)", "ring_buffer-test.c", "", 0); };
}

variable_types: struct ring_buffer { char *upper; char *lower; char *start; char *end; int circled; } *


decompiled_code:
char **get_ring_buffer_test_cases_array()
{
return &test_cases_array;
}

canonical_decompiled_code:
char **func15()
{
return &test_cases_array;
}

original_code:
CU_TestInfo* get_ring_buffer_test_cases_array() {
  return test_cases_array;
}

canonical_original_code:
struct CU_TestInfo *get_ring_buffer_test_cases_array() {
  return test_cases_array;
}

return_type: struct CU_TestInfo { char *pName; void (*pTestFunc)(); } *


decompiled_code:
__int64 get_ring_buffer_test_cases_count()
{
return 13LL;
}

canonical_decompiled_code:
__int64 func16()
{
return 13LL;
}

original_code:
int get_ring_buffer_test_cases_count() {
  return sizeof(test_cases_array)/sizeof(CU_TestInfo);
}


decompiled_code:
__int64 test_case_13()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx
__int64 v3; // rbx

v0 = 7168;
v1 = kernel_ring_buffer;
ring_buffer_reset(kernel_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 2048;
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
ring_buffer_reset(user_ring_buffer);
ring_buffer_copy(user_ring_buffer, v1);
v3 = user_ring_buffer;
ring_buffer_check(user_ring_buffer);
CU_assertImplementation(
*(_QWORD *)(v3 + 16) == *(_QWORD *)v3,
251LL,
"ring->start == ring->upper",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v3 + 24) == *(_QWORD *)v3 + 2048LL,
252LL,
"ring->end == (ring->upper + 2*1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v3 + 32) == 0,
253LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

canonical_decompiled_code:
__int64 func1()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx
__int64 v3; // rbx

v0 = 7168;
v1 = kernel_ring_buffer;
ring_buffer_reset(kernel_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 2048;
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
ring_buffer_reset(user_ring_buffer);
ring_buffer_copy(user_ring_buffer, v1);
v3 = user_ring_buffer;
func0(user_ring_buffer);
CU_assertImplementation(
*(_QWORD *)(v3 + 16) == *(_QWORD *)v3,
251LL,
"ring->start == ring->upper",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v3 + 24) == *(_QWORD *)v3 + 2048LL,
252LL,
"ring->end == (ring->upper + 2*1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v3 + 32) == 0,
253LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

original_code:
static void test_case_13(void) {
  struct ring_buffer *ring = kernel_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 7*1024; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  for(i = 0; i < 2*1024; i++) {
 ring_buffer_get_char(ring);
  }
  ring_buffer_reset(user_ring_buffer);
  ring_buffer_copy(user_ring_buffer, ring);
  ring = user_ring_buffer;
  ring_buffer_check(ring);
  { CU_assertImplementation((ring->start == ring->upper), 251, "ring->start == ring->upper", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 2*1024)), 252, "ring->end == (ring->upper + 2*1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 0), 253, "ring->circled == 0", "ring_buffer-test.c", "", 0); };
  return;
}

canonical_original_code:
static void test_case_13() {
  struct ring_buffer *ring = kernel_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 7*1024; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  for(i = 0; i < 2*1024; i++) {
 ring_buffer_get_char(ring);
  }
  ring_buffer_reset(user_ring_buffer);
  ring_buffer_copy(user_ring_buffer, ring);
  ring = user_ring_buffer;
  ring_buffer_check(ring);
  { CU_assertImplementation((ring->start == ring->upper), 251, "ring->start == ring->upper", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 2*1024)), 252, "ring->end == (ring->upper + 2*1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 0), 253, "ring->circled == 0", "ring_buffer-test.c", "", 0); };
  return;
}

user_defined_types: struct ring_buffer { char *upper; char *lower; char *start; char *end; int circled; }


decompiled_code:
__int64 test_case_08()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx

v0 = 5120;
v1 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 6144;
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
166LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
167LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(*(_DWORD *)(v1 + 32) == 1, 168LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D71, 0LL);
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
173LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
174LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v1 + 32) == 0,
175LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

canonical_decompiled_code:
__int64 func2()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx

v0 = 5120;
v1 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 6144;
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
166LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
167LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(*(_DWORD *)(v1 + 32) == 1, 168LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D71, 0LL);
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
173LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
174LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v1 + 32) == 0,
175LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

original_code:
static void test_case_08(void) {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 5*1024; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 166, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 167, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 168, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  for(i = 0; i < 6*1024; i++) {
 ring_buffer_get_char(ring);
  }
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 173, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 174, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 0), 175, "ring->circled == 0", "ring_buffer-test.c", "", 0); };
  return;
}

canonical_original_code:
static void test_case_08() {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 5*1024; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 166, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 167, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 168, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  for(i = 0; i < 6*1024; i++) {
 ring_buffer_get_char(ring);
  }
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 173, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 174, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 0), 175, "ring->circled == 0", "ring_buffer-test.c", "", 0); };
  return;
}


decompiled_code:
__int64 test_case_07()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx

v0 = 5120;
v1 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 4096;
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
144LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
145LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(*(_DWORD *)(v1 + 32) == 1, 146LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D71, 0LL);
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
151LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
152LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v1 + 32) == 0,
153LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

canonical_decompiled_code:
__int64 func3()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx

v0 = 5120;
v1 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 4096;
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
144LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
145LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(*(_DWORD *)(v1 + 32) == 1, 146LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D71, 0LL);
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
151LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
152LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v1 + 32) == 0,
153LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

original_code:
static void test_case_07(void) {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 5*1024; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 144, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 145, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 146, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  for(i = 0; i < 4*1024; i++) {
 ring_buffer_get_char(ring);
  }
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 151, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 152, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 0), 153, "ring->circled == 0", "ring_buffer-test.c", "", 0); };
  return;
}

canonical_original_code:
static void test_case_07() {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 5*1024; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 144, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 145, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 146, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  for(i = 0; i < 4*1024; i++) {
 ring_buffer_get_char(ring);
  }
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 151, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 152, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 0), 153, "ring->circled == 0", "ring_buffer-test.c", "", 0); };
  return;
}


decompiled_code:
__int64 test_case_06()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx

v0 = 5120;
v1 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 3072;
ring_buffer_check((unsigned __int64 *)v1);
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
121LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
122LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(*(_DWORD *)(v1 + 32) == 1, 123LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D71, 0LL);
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
ring_buffer_check((unsigned __int64 *)v1);
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1,
129LL,
"ring->start == (ring->upper)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
130LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v1 + 32) == 0,
131LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

canonical_decompiled_code:
__int64 func4()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx

v0 = 5120;
v1 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 3072;
func0((unsigned __int64 *)v1);
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
121LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
122LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(*(_DWORD *)(v1 + 32) == 1, 123LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D71, 0LL);
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
func0((unsigned __int64 *)v1);
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1,
129LL,
"ring->start == (ring->upper)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
130LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v1 + 32) == 0,
131LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

original_code:
static void test_case_06(void) {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 5*1024; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  ring_buffer_check(ring);
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 121, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 122, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 123, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  for(i = 0; i < 3*1024; i++) {
 ring_buffer_get_char(ring);
  }
  ring_buffer_check(ring);
  { CU_assertImplementation((ring->start == (ring->upper)), 129, "ring->start == (ring->upper)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 130, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 0), 131, "ring->circled == 0", "ring_buffer-test.c", "", 0); };
  return;
}

canonical_original_code:
static void test_case_06() {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 5*1024; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  ring_buffer_check(ring);
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 121, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 122, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 123, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  for(i = 0; i < 3*1024; i++) {
 ring_buffer_get_char(ring);
  }
  ring_buffer_check(ring);
  { CU_assertImplementation((ring->start == (ring->upper)), 129, "ring->start == (ring->upper)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 130, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 0), 131, "ring->circled == 0", "ring_buffer-test.c", "", 0); };
  return;
}


decompiled_code:
__int64 test_case_05()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx

v0 = 5120;
v1 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 2048;
ring_buffer_check((unsigned __int64 *)v1);
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
97LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
98LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(*(_DWORD *)(v1 + 32) == 1, 99LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D71, 0LL);
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
ring_buffer_check((unsigned __int64 *)v1);
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 3072LL,
105LL,
"ring->start == (ring->upper + 3*1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
106LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v1 + 32) == 1,
107LL,
"ring->circled == 1",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

canonical_decompiled_code:
__int64 func5()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx

v0 = 5120;
v1 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 2048;
func0((unsigned __int64 *)v1);
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 1024LL,
97LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
98LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(*(_DWORD *)(v1 + 32) == 1, 99LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D71, 0LL);
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
func0((unsigned __int64 *)v1);
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1 + 3072LL,
105LL,
"ring->start == (ring->upper + 3*1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1 + 1024LL,
106LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v1 + 32) == 1,
107LL,
"ring->circled == 1",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

original_code:
static void test_case_05(void) {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 5*1024; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  ring_buffer_check(ring);
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 97, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 98, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 99, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  for(i = 0; i < 2*1024; i++) {
 ring_buffer_get_char(ring);
  }
  ring_buffer_check(ring);
  { CU_assertImplementation((ring->start == (ring->upper + 3*1024)), 105, "ring->start == (ring->upper + 3*1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 106, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 107, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  return;
}

canonical_original_code:
static void test_case_05() {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 5*1024; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  ring_buffer_check(ring);
  { CU_assertImplementation((ring->start == (ring->upper + 1024)), 97, "ring->start == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 98, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 99, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  for(i = 0; i < 2*1024; i++) {
 ring_buffer_get_char(ring);
  }
  ring_buffer_check(ring);
  { CU_assertImplementation((ring->start == (ring->upper + 3*1024)), 105, "ring->start == (ring->upper + 3*1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 1024)), 106, "ring->end == (ring->upper + 1024)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 107, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  return;
}


decompiled_code:
__int64 test_case_04()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx

v0 = 4096;
v1 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 4096;
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1,
74LL,
"ring->start == (ring->upper)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1,
75LL,
"ring->end == (ring->upper)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(*(_DWORD *)(v1 + 32) == 1, 76LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D71, 0LL);
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1,
81LL,
"ring->start == (ring->upper)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1,
82LL,
"ring->end == (ring->upper)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v1 + 32) == 0,
83LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

canonical_decompiled_code:
__int64 func6()
{
int v0; // ebx
__int64 v1; // rbp
int v2; // ebx

v0 = 4096;
v1 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
--v0;
}
while ( v0 );
v2 = 4096;
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1,
74LL,
"ring->start == (ring->upper)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1,
75LL,
"ring->end == (ring->upper)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(*(_DWORD *)(v1 + 32) == 1, 76LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D71, 0LL);
do
{
ring_buffer_get_char(v1);
--v2;
}
while ( v2 );
CU_assertImplementation(
*(_QWORD *)(v1 + 16) == *(_QWORD *)v1,
81LL,
"ring->start == (ring->upper)",
"ring_buffer-test.c",
&unk_D71,
0LL);
CU_assertImplementation(
*(_QWORD *)(v1 + 24) == *(_QWORD *)v1,
82LL,
"ring->end == (ring->upper)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v1 + 32) == 0,
83LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

original_code:
static void test_case_04(void) {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 0x1000; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  { CU_assertImplementation((ring->start == (ring->upper)), 74, "ring->start == (ring->upper)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper)), 75, "ring->end == (ring->upper)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 76, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  for(i = 0; i < 0x1000; i++) {
 ring_buffer_get_char(ring);
  }
  { CU_assertImplementation((ring->start == (ring->upper)), 81, "ring->start == (ring->upper)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper)), 82, "ring->end == (ring->upper)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 0), 83, "ring->circled == 0", "ring_buffer-test.c", "", 0); };
  return;
}

canonical_original_code:
static void test_case_04() {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 0x1000; i++) {
 ring_buffer_put_char(ring, 'c');
  }
  { CU_assertImplementation((ring->start == (ring->upper)), 74, "ring->start == (ring->upper)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper)), 75, "ring->end == (ring->upper)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 1), 76, "ring->circled == 1", "ring_buffer-test.c", "", 0); };
  for(i = 0; i < 0x1000; i++) {
 ring_buffer_get_char(ring);
  }
  { CU_assertImplementation((ring->start == (ring->upper)), 81, "ring->start == (ring->upper)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper)), 82, "ring->end == (ring->upper)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->circled == 0), 83, "ring->circled == 0", "ring_buffer-test.c", "", 0); };
  return;
}


decompiled_code:
__int64 test_case_03()
{
int v0; // ebp
unsigned __int64 *v1; // rbx
int v2; // ebp

v0 = 20;
v1 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
ring_buffer_check(v1);
--v0;
}
while ( v0 );
v2 = 30;
do
{
ring_buffer_get_char(v1);
ring_buffer_check(v1);
--v2;
}
while ( v2 );
CU_assertImplementation(
v1[2] == *v1 + 20,
61LL,
"ring->start == (ring->upper + 20)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
v1[3] == *v1 + 20,
62LL,
"ring->end == (ring->upper + 20)",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

canonical_decompiled_code:
__int64 func7()
{
int v0; // ebp
unsigned __int64 *v1; // rbx
int v2; // ebp

v0 = 20;
v1 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
func0(v1);
--v0;
}
while ( v0 );
v2 = 30;
do
{
ring_buffer_get_char(v1);
func0(v1);
--v2;
}
while ( v2 );
CU_assertImplementation(
v1[2] == *v1 + 20,
61LL,
"ring->start == (ring->upper + 20)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
v1[3] == *v1 + 20,
62LL,
"ring->end == (ring->upper + 20)",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

original_code:
static void test_case_03(void) {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 20; i++) {
 ring_buffer_put_char(ring, 'c');
 ring_buffer_check(ring);
  }
  for(i = 0; i < 30; i++) {
 ring_buffer_get_char(ring);
 ring_buffer_check(ring);
  }
  { CU_assertImplementation((ring->start == (ring->upper + 20)), 61, "ring->start == (ring->upper + 20)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 20)), 62, "ring->end == (ring->upper + 20)", "ring_buffer-test.c", "", 0); };
  return;
}

canonical_original_code:
static void test_case_03() {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 20; i++) {
 ring_buffer_put_char(ring, 'c');
 ring_buffer_check(ring);
  }
  for(i = 0; i < 30; i++) {
 ring_buffer_get_char(ring);
 ring_buffer_check(ring);
  }
  { CU_assertImplementation((ring->start == (ring->upper + 20)), 61, "ring->start == (ring->upper + 20)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 20)), 62, "ring->end == (ring->upper + 20)", "ring_buffer-test.c", "", 0); };
  return;
}


decompiled_code:
__int64 test_case_02()
{
int v0; // ebp
unsigned __int64 *v1; // rbx
int v2; // ebp

v0 = 10;
v1 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
ring_buffer_check(v1);
--v0;
}
while ( v0 );
v2 = 8;
do
{
ring_buffer_get_char(v1);
ring_buffer_check(v1);
--v2;
}
while ( v2 );
CU_assertImplementation(
v1[2] == *v1 + 8,
42LL,
"ring->start == (ring->upper + 8)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
v1[3] == *v1 + 10,
43LL,
"ring->end == (ring->upper + 10)",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

canonical_decompiled_code:
__int64 func8()
{
int v0; // ebp
unsigned __int64 *v1; // rbx
int v2; // ebp

v0 = 10;
v1 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
func0(v1);
--v0;
}
while ( v0 );
v2 = 8;
do
{
ring_buffer_get_char(v1);
func0(v1);
--v2;
}
while ( v2 );
CU_assertImplementation(
v1[2] == *v1 + 8,
42LL,
"ring->start == (ring->upper + 8)",
"ring_buffer-test.c",
&unk_D71,
0LL);
return CU_assertImplementation(
v1[3] == *v1 + 10,
43LL,
"ring->end == (ring->upper + 10)",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

original_code:
static void test_case_02(void) {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 10; i++) {
 ring_buffer_put_char(ring, 'c');
 ring_buffer_check(ring);
  }
  for(i = 0; i < 8; i++) {
 ring_buffer_get_char(ring);
 ring_buffer_check(ring);
  }
  { CU_assertImplementation((ring->start == (ring->upper + 8)), 42, "ring->start == (ring->upper + 8)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 10)), 43, "ring->end == (ring->upper + 10)", "ring_buffer-test.c", "", 0); };
  return;
}

canonical_original_code:
static void test_case_02() {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 10; i++) {
 ring_buffer_put_char(ring, 'c');
 ring_buffer_check(ring);
  }
  for(i = 0; i < 8; i++) {
 ring_buffer_get_char(ring);
 ring_buffer_check(ring);
  }
  { CU_assertImplementation((ring->start == (ring->upper + 8)), 42, "ring->start == (ring->upper + 8)", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 10)), 43, "ring->end == (ring->upper + 10)", "ring_buffer-test.c", "", 0); };
  return;
}


decompiled_code:
__int64 test_case_01()
{
int v0; // ebx
unsigned __int64 *v1; // rbp

v0 = 10;
v1 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
ring_buffer_check(v1);
--v0;
}
while ( v0 );
CU_assertImplementation(v1[2] == *v1, 23LL, "ring->start == ring->upper", "ring_buffer-test.c", &unk_D71, 0LL);
return CU_assertImplementation(
v1[3] == *v1 + 10,
24LL,
"ring->end == (ring->upper + 10)",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

canonical_decompiled_code:
__int64 func9()
{
int v0; // ebx
unsigned __int64 *v1; // rbp

v0 = 10;
v1 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
do
{
ring_buffer_put_char(v1, 99LL);
func0(v1);
--v0;
}
while ( v0 );
CU_assertImplementation(v1[2] == *v1, 23LL, "ring->start == ring->upper", "ring_buffer-test.c", &unk_D71, 0LL);
return CU_assertImplementation(
v1[3] == *v1 + 10,
24LL,
"ring->end == (ring->upper + 10)",
"ring_buffer-test.c",
&unk_D71,
0LL);
}

original_code:
static void test_case_01(void) {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 10; i++) {
 ring_buffer_put_char(ring, 'c');
 ring_buffer_check(ring);
  }
  { CU_assertImplementation((ring->start == ring->upper), 23, "ring->start == ring->upper", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 10)), 24, "ring->end == (ring->upper + 10)", "ring_buffer-test.c", "", 0); };
  return;
}

canonical_original_code:
static void test_case_01() {
  struct ring_buffer *ring = user_ring_buffer;
  int i = 0;
  ring_buffer_reset(ring);
  for(i = 0; i < 10; i++) {
 ring_buffer_put_char(ring, 'c');
 ring_buffer_check(ring);
  }
  { CU_assertImplementation((ring->start == ring->upper), 23, "ring->start == ring->upper", "ring_buffer-test.c", "", 0); };
  { CU_assertImplementation((ring->end == (ring->upper + 10)), 24, "ring->end == (ring->upper + 10)", "ring_buffer-test.c", "", 0); };
  return;
}


decompiled_code:
__int64 test_case_12()
{
return ring_buffer_presure_test(user_ring_buffer, 4094);
}

canonical_decompiled_code:
__int64 func11()
{
return func10(user_ring_buffer, 4094);
}

original_code:
static void test_case_12(void) {
  ring_buffer_presure_test(user_ring_buffer, 4094);
  return;
}

canonical_original_code:
static void test_case_12() {
  ring_buffer_presure_test(user_ring_buffer, 4094);
  return;
}


decompiled_code:
__int64 test_case_11()
{
return ring_buffer_presure_test(user_ring_buffer, 256);
}

canonical_decompiled_code:
__int64 func12()
{
return func10(user_ring_buffer, 256);
}

original_code:
static void test_case_11(void) {
  ring_buffer_presure_test(user_ring_buffer, 256);
  return;
}

canonical_original_code:
static void test_case_11() {
  ring_buffer_presure_test(user_ring_buffer, 256);
  return;
}


decompiled_code:
__int64 test_case_10()
{
return ring_buffer_presure_test(user_ring_buffer, 32);
}

canonical_decompiled_code:
__int64 func13()
{
return func10(user_ring_buffer, 32);
}

original_code:
static void test_case_10(void) {
  ring_buffer_presure_test(user_ring_buffer, 32);
  return;
}

canonical_original_code:
static void test_case_10() {
  ring_buffer_presure_test(user_ring_buffer, 32);
  return;
}


decompiled_code:
__int64 test_case_09()
{
unsigned __int64 *v0; // rbp
unsigned int v1; // eax

v0 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
ring_buffer_check(v0);
v1 = ring_buffer_empty(v0);
return CU_assertImplementation(v1, 184LL, "ring_buffer_empty(ring)", "ring_buffer-test.c", &unk_D71, 0LL);
}

canonical_decompiled_code:
__int64 func14()
{
unsigned __int64 *v0; // rbp
unsigned int v1; // eax

v0 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
func0(v0);
v1 = ring_buffer_empty(v0);
return CU_assertImplementation(v1, 184LL, "ring_buffer_empty(ring)", "ring_buffer-test.c", &unk_D71, 0LL);
}

original_code:
static void test_case_09(void) {
  struct ring_buffer *ring = user_ring_buffer;
  ring_buffer_reset(ring);
  ring_buffer_check(ring);
  { CU_assertImplementation((ring_buffer_empty(ring)), 184, "ring_buffer_empty(ring)", "ring_buffer-test.c", "", 0); };
  return;
}

canonical_original_code:
static void test_case_09() {
  struct ring_buffer *ring = user_ring_buffer;
  ring_buffer_reset(ring);
  ring_buffer_check(ring);
  { CU_assertImplementation((ring_buffer_empty(ring)), 184, "ring_buffer_empty(ring)", "ring_buffer-test.c", "", 0); };
  return;
}


decompiled_code:
_QWORD *create_ring_buffer()
{
_QWORD *v0; // rax
_QWORD *v1; // r12
char *v2; // rax

v0 = malloc(0x28uLL);
if ( !v0 )
return 0LL;
v1 = v0;
v2 = (char *)malloc(0x1000uLL);
*v1 = v2;
if ( !v2 )
return 0LL;
v1[2] = v2;
v1[1] = v2 + 4096;
v1[3] = v2;
*((_DWORD *)v1 + 8) = 0;
return v1;
}

original_code:
struct ring_buffer *create_ring_buffer() {
  struct ring_buffer *ring = (struct ring_buffer *)malloc(sizeof(struct ring_buffer));
  if (((void *)0) == ring)
 return ((void *)0);
  ring->upper = (char *)malloc(0x1000);
  if (((void *)0) == ring->upper)
 return ((void *)0);
  else {
 ring->lower = ring->upper + 0x1000;
 ring->start = ring->upper;
 ring->end = ring->upper;
 ring->circled = 0;
 return ring;
  }
}

return_type: struct ring_buffer { char *upper; char *lower; char *start; char *end; int circled; } *


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

kernel_ring_buffer = (__int64)create_ring_buffer();
if ( !kernel_ring_buffer )
{
printk(0LL, 16LL, "%s: kernel ring buffer init failure\n", "ring_buffer_init");
while ( 1 )
;
}
result = create_ring_buffer();
user_ring_buffer = (__int64)result;
if ( !result )
{
printk(0LL, 16LL, "%s: user ring buffer init failure\n", "ring_buffer_init");
while ( 1 )
;
}
ring_buffer_enabled = 1;
return result;
}

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

kernel_ring_buffer = (__int64)func0();
if ( !kernel_ring_buffer )
{
printk(0LL, 16LL, "%s: kernel ring buffer init failure\n", "ring_buffer_init");
while ( 1 )
;
}
result = func0();
user_ring_buffer = (__int64)result;
if ( !result )
{
printk(0LL, 16LL, "%s: user ring buffer init failure\n", "ring_buffer_init");
while ( 1 )
;
}
ring_buffer_enabled = 1;
return result;
}

original_code:
void ring_buffer_init() {
  kernel_ring_buffer = create_ring_buffer();
  if (((void *)0) == kernel_ring_buffer) {
 printk(0x00, 0x10, "%s: kernel ring buffer init failure\n", __func__);
 while(1);
  }
  user_ring_buffer = create_ring_buffer();
  if (((void *)0) == user_ring_buffer) {
 printk(0x00, 0x10, "%s: user ring buffer init failure\n", __func__);
 while(1);
  }
  ring_buffer_enabled = 1;
}


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

result = *a1;
*((_DWORD *)a1 + 8) = 0;
a1[2] = result;
a1[3] = result;
return result;
}

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

result = *a1;
*((_DWORD *)a1 + 8) = 0;
a1[2] = result;
a1[3] = result;
return result;
}

original_code:
void ring_buffer_reset(struct ring_buffer *ring) {
  ring->start = ring->upper;
  ring->end = ring->upper;
  ring->circled = 0;
}


decompiled_code:
unsigned __int64 __fastcall ring_buffer_put_char(__int64 *a1, char a2)
{
_BYTE *v2; // rax
int v3; // ecx
unsigned __int64 result; // rax
unsigned __int64 v5; // rdx
bool v6; // cf

v2 = (_BYTE *)a1[3];
v3 = *((_DWORD *)a1 + 8);
a1[3] = (__int64)(v2 + 1);
*v2 = a2;
if ( !v3 )
{
result = a1[1];
if ( a1[3] >= result )
{
result = *a1;
*((_DWORD *)a1 + 8) = 1;
a1[3] = result;
}
return result;
}
result = a1[3];
if ( result > a1[2] )
{
v5 = a1[1];
a1[2] = result;
if ( result < v5 )
return result;
}
else
{
v5 = a1[1];
v6 = result < v5;
result = a1[2];
if ( v6 )
goto LABEL_7;
}
a1[3] = *a1;
LABEL_7:
if ( v5 <= result )
{
result = *a1;
a1[2] = *a1;
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func3(__int64 *a1, char a2)
{
_BYTE *v2; // rax
int v3; // ecx
unsigned __int64 result; // rax
unsigned __int64 v5; // rdx
bool v6; // cf

v2 = (_BYTE *)a1[3];
v3 = *((_DWORD *)a1 + 8);
a1[3] = (__int64)(v2 + 1);
*v2 = a2;
if ( !v3 )
{
result = a1[1];
if ( a1[3] >= result )
{
result = *a1;
*((_DWORD *)a1 + 8) = 1;
a1[3] = result;
}
return result;
}
result = a1[3];
if ( result > a1[2] )
{
v5 = a1[1];
a1[2] = result;
if ( result < v5 )
return result;
}
else
{
v5 = a1[1];
v6 = result < v5;
result = a1[2];
if ( v6 )
goto LABEL_7;
}
a1[3] = *a1;
LABEL_7:
if ( v5 <= result )
{
result = *a1;
a1[2] = *a1;
}
return result;
}

original_code:
void ring_buffer_put_char(struct ring_buffer *ring, char ch) {
  if (0 == ring->circled) {
 *(ring->end++) = ch;
 if (ring->end >= ring->lower) {
   ring->end = ring->upper;
   ring->circled = 1;
 }
  } else {
 *(ring->end++) = ch;
 if (ring->end > ring->start)
   ring->start = ring->end;
 if (ring->end >= ring->lower)
   ring->end = ring->upper;
 if (ring->start >= ring->lower)
   ring->start = ring->upper;
  }
}

variable_types: ch char


original_code:
char ring_buffer_get_char(struct ring_buffer *ring) {
  char ch;
  if (0 == ring->circled) {
 if (ring->start == ring->end)
   ch = '\0';
 else {
   ch = *(ring->start++);
 }
 if (ring->start >= ring->lower) {
   ring->start = ring->upper;
   ring->end = ring->upper;
 }
  } else {
 ch = *(ring->start++);
 if (ring->start >= ring->lower) {
   ring->start = ring->upper;
   ring->circled = 0;
 }
  }
  return ch;
}

return_type: char


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

result = 0LL;
if ( !*(_DWORD *)(a1 + 32) )
result = *(_QWORD *)(a1 + 16) == *(_QWORD *)(a1 + 24);
return result;
}

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

result = 0LL;
if ( !*(_DWORD *)(a1 + 32) )
result = *(_QWORD *)(a1 + 16) == *(_QWORD *)(a1 + 24);
return result;
}

original_code:
int ring_buffer_empty(struct ring_buffer *ring) {
  if ((0 == ring->circled) && (ring->start == ring->end))
 return 1;
  else
 return 0;
}


decompiled_code:
_BOOL8 __fastcall ring_buffer_copy(__int64 a1, __int64 a2)
{
char v3; // al
__int64 *v4; // r9
_BOOL8 result; // rax
__int64 *v6; // r8

while ( 1 )
{
result = ring_buffer_empty(a2);
if ( result )
break;
v3 = ring_buffer_get_char(v6);
ring_buffer_put_char(v4, v3);
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func6(__int64 a1, __int64 a2)
{
char v3; // al
__int64 *v4; // r9
_BOOL8 result; // rax
__int64 *v6; // r8

while ( 1 )
{
result = func5(a2);
if ( result )
break;
v3 = func4(v6);
func3(v4, v3);
}
return result;
}

original_code:
void ring_buffer_copy(struct ring_buffer *des, struct ring_buffer *src) {
  char ch;
  while (!ring_buffer_empty(src)) {
 ch = ring_buffer_get_char(src);
 ring_buffer_put_char(des, ch);
  }
}

variable_types:
src
struct ring_buffer *


decompiled_code:
__int64 __fastcall listfs_parser_tag_size_head_found(const char *a1)
{
return printk(3LL, 34LL, "tag <size> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1)
{
return printk(3LL, 34LL, "tag <size> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_size_head_found (char *buffer) {
  printk(0x03, 0x22, "tag <size> found, buffer = %s\n", buffer);
}

canonical_original_code:
static void listfs_parser_tag_size_head_found(char *buffer) {
  printk(0x03, 0x22, "tag <size> found, buffer = %s\n", buffer);
}

variable_types:
buffer
char *


decompiled_code:
__int64 __fastcall listfs_parser_tag_offset_head_found(const char *a1)
{
return printk(3LL, 34LL, "tag <offset> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func1(const char *a1)
{
return printk(3LL, 34LL, "tag <offset> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_offset_head_found (char *buffer) {
  printk(0x03, 0x22, "tag <offset> found, buffer = %s\n", buffer);
}

canonical_original_code:
static void listfs_parser_tag_offset_head_found(char *buffer) {
  printk(0x03, 0x22, "tag <offset> found, buffer = %s\n", buffer);
}


decompiled_code:
__int64 __fastcall listfs_parser_tag_date_head_found(const char *a1)
{
return printk(3LL, 34LL, "tag <date> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func2(const char *a1)
{
return printk(3LL, 34LL, "tag <date> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_date_head_found (char *buffer) {
  printk(0x03, 0x22, "tag <date> found, buffer = %s\n", buffer);
}

canonical_original_code:
static void listfs_parser_tag_date_head_found(char *buffer) {
  printk(0x03, 0x22, "tag <date> found, buffer = %s\n", buffer);
}


decompiled_code:
__int64 __fastcall listfs_parser_tag_name_head_found(const char *a1)
{
return printk(3LL, 34LL, "tag <name> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func3(const char *a1)
{
return printk(3LL, 34LL, "tag <name> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_name_head_found (char *buffer) {
  printk(0x03, 0x22, "tag <name> found, buffer = %s\n", buffer);
}

canonical_original_code:
static void listfs_parser_tag_name_head_found(char *buffer) {
  printk(0x03, 0x22, "tag <name> found, buffer = %s\n", buffer);
}


decompiled_code:
__int64 __fastcall listfs_parser_tag_file_tail_found(const char *a1)
{
current_node = (void *)*((_QWORD *)current_node + 6);
return printk(3LL, 34LL, "tag </file> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func4(const char *a1)
{
current_node = (void *)*((_QWORD *)current_node + 6);
return printk(3LL, 34LL, "tag </file> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_file_tail_found (char *buffer) {
  current_node = current_node->parent;
  printk(0x03, 0x22, "tag </file> found, buffer = %s\n", buffer);
}

canonical_original_code:
static void listfs_parser_tag_file_tail_found(char *buffer) {
  current_node = current_node->parent;
  printk(0x03, 0x22, "tag </file> found, buffer = %s\n", buffer);
}


decompiled_code:
__int64 __fastcall listfs_parser_tag_dir_tail_found(const char *a1)
{
if ( *((_QWORD *)current_node + 6) )
current_node = (void *)*((_QWORD *)current_node + 6);
return printk(3LL, 34LL, "tag </dir> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func5(const char *a1)
{
if ( *((_QWORD *)current_node + 6) )
current_node = (void *)*((_QWORD *)current_node + 6);
return printk(3LL, 34LL, "tag </dir> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_dir_tail_found (char *buffer) {
  if (((void *)0) != current_node->parent)
 current_node = current_node->parent;
  printk(0x03, 0x22, "tag </dir> found, buffer = %s\n", buffer);
}

canonical_original_code:
static void listfs_parser_tag_dir_tail_found(char *buffer) {
  if (((void *)0) != current_node->parent)
 current_node = current_node->parent;
  printk(0x03, 0x22, "tag </dir> found, buffer = %s\n", buffer);
}


decompiled_code:
__int64 __fastcall listfs_parser_tag_size_tail_found(const char *a1)
{
*((_DWORD *)current_node + 22) = atoi(a1);
return printk(3LL, 34LL, "tag </size> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func6(const char *a1)
{
*((_DWORD *)current_node + 22) = atoi(a1);
return printk(3LL, 34LL, "tag </size> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_size_tail_found (char *buffer) {
  current_node->file.size = atoi(buffer);
  printk(0x03, 0x22, "tag </size> found, buffer = %s\n", buffer);
}

canonical_original_code:
static void listfs_parser_tag_size_tail_found(char *buffer) {
  current_node->file.size = atoi(buffer);
  printk(0x03, 0x22, "tag </size> found, buffer = %s\n", buffer);
}


decompiled_code:
__int64 __fastcall listfs_parser_tag_offset_tail_found(const char *a1)
{
*((_QWORD *)current_node + 10) = listfs_parser_buffer + atoi(a1) + (__int64)listfs_parser_buffer_len;
return printk(3LL, 34LL, "tag </offset> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1)
{
*((_QWORD *)current_node + 10) = listfs_parser_buffer + atoi(a1) + (__int64)listfs_parser_buffer_len;
return printk(3LL, 34LL, "tag </offset> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_offset_tail_found (char *buffer) {
  current_node->file.addr = atoi(buffer) + listfs_parser_buffer + listfs_parser_buffer_len;
  printk(0x03, 0x22, "tag </offset> found, buffer = %s\n", buffer);
}

canonical_original_code:
static void listfs_parser_tag_offset_tail_found(char *buffer) {
  current_node->file.addr = atoi(buffer) + listfs_parser_buffer + listfs_parser_buffer_len;
  printk(0x03, 0x22, "tag </offset> found, buffer = %s\n", buffer);
}


decompiled_code:
__int64 __fastcall listfs_parser_tag_name_tail_found(void *src)
{
memcpy(current_node, src, 0xFuLL);
return printk(3LL, 34LL, "tag </name> found, buffer = %s\n", (const char *)src);
}

canonical_decompiled_code:
__int64 __fastcall func8(void *src)
{
memcpy(current_node, src, 0xFuLL);
return printk(3LL, 34LL, "tag </name> found, buffer = %s\n", (const char *)src);
}

original_code:
static void listfs_parser_tag_name_tail_found (char *buffer) {
  memcpy(current_node->name, buffer, 15);
  printk(0x03, 0x22, "tag </name> found, buffer = %s\n", buffer);
}

canonical_original_code:
static void listfs_parser_tag_name_tail_found(char *buffer) {
  memcpy(current_node->name, buffer, 15);
  printk(0x03, 0x22, "tag </name> found, buffer = %s\n", buffer);
}


decompiled_code:
__int64 __fastcall listfs_parser_tag_date_tail_found(const char *a1)
{
__m128i *v1; // rbx
__m128i v3; // [rsp+0h] [rbp-38h] BYREF
__int64 v4; // [rsp+10h] [rbp-28h]

v1 = (__m128i *)current_node;
date_parse_format_iso(&v3, a1);
v1[1] = _mm_loadu_si128(&v3);
v1[2].m128i_i64[0] = v4;
return printk(3LL, 34LL, "tag </date> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func9(const char *a1)
{
__m128i *v1; // rbx
__m128i v3; // [rsp+0h] [rbp-38h] BYREF
__int64 v4; // [rsp+10h] [rbp-28h]

v1 = (__m128i *)current_node;
date_parse_format_iso(&v3, a1);
v1[1] = _mm_loadu_si128(&v3);
v1[2].m128i_i64[0] = v4;
return printk(3LL, 34LL, "tag </date> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_date_tail_found (char *buffer) {
  current_node->date = date_parse_format_iso(buffer);
  printk(0x03, 0x22, "tag </date> found, buffer = %s\n", buffer);
}

canonical_original_code:
static void listfs_parser_tag_date_tail_found(char *buffer) {
  current_node->date = date_parse_format_iso(buffer);
  printk(0x03, 0x22, "tag </date> found, buffer = %s\n", buffer);
}


decompiled_code:
__int64 __fastcall listfs_parser_tag_file_head_found(const char *a1)
{
void *v1; // rbx

v1 = (void *)vfs_new_file();
vfs_add_node_to_dir(current_node, v1);
current_node = v1;
return printk(3LL, 34LL, "tag <file> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func10(const char *a1)
{
void *v1; // rbx

v1 = (void *)vfs_new_file();
vfs_add_node_to_dir(current_node, v1);
current_node = v1;
return printk(3LL, 34LL, "tag <file> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_file_head_found (char *buffer) {
  vfs_node *new_node = ((void *)0);
  new_node = vfs_new_file();
  vfs_add_node_to_dir(current_node, new_node);
  current_node = new_node;
  printk(0x03, 0x22, "tag <file> found, buffer = %s\n", buffer);
  return;
}

canonical_original_code:
static void listfs_parser_tag_file_head_found(char *buffer) {
  struct _vfs_node *new_node = ((void *)0);
  new_node = vfs_new_file();
  vfs_add_node_to_dir(current_node, new_node);
  current_node = new_node;
  printk(0x03, 0x22, "tag <file> found, buffer = %s\n", buffer);
  return;
}

variable_types: struct _vfs_node { char name[16]; struct _date_t { int year; int month; int day; int hour; int minute; int second; } date; enum vfs_node_type { VFS_NODE_TYPE_FILE=0, VFS_NODE_TYPE_DIR=1 } type; struct _vfs_node *parent; struct list_head { struct list_head *next; } list; union { struct _vfs_file { enum vfs_file_type { FILE_TYPE_REGULAR=0, FILE_TYPE_EXE=1 } type; void *addr; int size; } file; struct _vfs_dir { struct list_head nodes; } dir; }; } *

user_defined_types: struct _vfs_node { char name[16]; struct _date_t date; enum vfs_node_type type; struct _vfs_node *parent; struct list_head list; union { struct _vfs_file file; struct _vfs_dir dir; }; }

user_defined_types: struct _vfs_file { enum vfs_file_type type; void *addr; int size; }


decompiled_code:
__int64 __fastcall listfs_parser_tag_dir_head_found(const char *a1)
{
__int64 v1; // rax
void *v2; // rbx

v1 = vfs_new_dir();
v2 = (void *)v1;
if ( root_node )
vfs_add_node_to_dir(current_node, v1);
else
root_node = v1;
current_node = v2;
return printk(3LL, 34LL, "tag <dir> found, buffer = %s\n", a1);
}

canonical_decompiled_code:
__int64 __fastcall func11(const char *a1)
{
__int64 v1; // rax
void *v2; // rbx

v1 = vfs_new_dir();
v2 = (void *)v1;
if ( root_node )
vfs_add_node_to_dir(current_node, v1);
else
root_node = v1;
current_node = v2;
return printk(3LL, 34LL, "tag <dir> found, buffer = %s\n", a1);
}

original_code:
static void listfs_parser_tag_dir_head_found (char *buffer) {
  vfs_node *new_node = ((void *)0);
  new_node = vfs_new_dir();
  if (((void *)0) == root_node)
 root_node = new_node;
  else
 vfs_add_node_to_dir(current_node, new_node);
  current_node = new_node;
  printk(0x03, 0x22, "tag <dir> found, buffer = %s\n", buffer);
  return;
}

canonical_original_code:
static void listfs_parser_tag_dir_head_found(char *buffer) {
  struct _vfs_node *new_node = ((void *)0);
  new_node = vfs_new_dir();
  if (((void *)0) == root_node)
 root_node = new_node;
  else
 vfs_add_node_to_dir(current_node, new_node);
  current_node = new_node;
  printk(0x03, 0x22, "tag <dir> found, buffer = %s\n", buffer);
  return;
}

user_defined_types: struct _date_t { int year; int month; int day; int hour; int minute; int second; }

user_defined_types: enum vfs_node_type { VFS_NODE_TYPE_FILE=0, VFS_NODE_TYPE_DIR=1 }

user_defined_types: struct list_head { struct list_head *next; }

user_defined_types: struct _vfs_dir { struct list_head nodes; }

user_defined_types: enum vfs_file_type { FILE_TYPE_REGULAR=0, FILE_TYPE_EXE=1 }


decompiled_code:
void *__fastcall listfs_parser_set_buffer(__int64 a1)
{
void *result; // rax

if ( a1 )
{
listfs_parser_buffer = a1;
listfs_parser_buffer_len = 0;
result = memset(&saved_line, 0, 0x100uLL);
root_node = 0LL;
current_node = 0LL;
}
return result;
}

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

if ( a1 )
{
listfs_parser_buffer = a1;
listfs_parser_buffer_len = 0;
result = memset(&saved_line, 0, 0x100uLL);
root_node = 0LL;
current_node = 0LL;
}
return result;
}

original_code:
void listfs_parser_set_buffer(char *buffer) {
  if (((void *)0) == buffer)
 return;
  listfs_parser_buffer = buffer;
  listfs_parser_buffer_len = 0;
  memset(saved_line, 0, 256);
  root_node = ((void *)0);
  current_node = ((void *)0);
}


decompiled_code:
__int64 listfs_parser_get_root()
{
return root_node;
}

canonical_decompiled_code:
__int64 func14()
{
return root_node;
}

original_code:
vfs_node* listfs_parser_get_root() {
  return root_node;
}

canonical_original_code:
struct _vfs_node *listfs_parser_get_root() {
  return root_node;
}

return_type: struct _vfs_node { char name[16]; struct _date_t { int year; int month; int day; int hour; int minute; int second; } date; enum vfs_node_type { VFS_NODE_TYPE_FILE=0, VFS_NODE_TYPE_DIR=1 } type; struct _vfs_node *parent; struct list_head { struct list_head *next; } list; union { struct _vfs_file { enum vfs_file_type { FILE_TYPE_REGULAR=0, FILE_TYPE_EXE=1 } type; void *addr; int size; } file; struct _vfs_dir { struct list_head nodes; } dir; }; } *


decompiled_code:
char *listfs_parser_parse_buffer()
{
char *v0; // rbx
char *v1; // rbp
char i; // al
char *v3; // rbx
char *result; // rax
char v5; // dl
char *v6; // rax
char nptr[280]; // [rsp+0h] [rbp-118h] BYREF

v0 = (char *)listfs_parser_buffer;
*(_OWORD *)nptr = 0LL;
*(_OWORD *)&nptr[16] = 0LL;
v1 = nptr;
*(_OWORD *)&nptr[32] = 0LL;
*(_OWORD *)&nptr[48] = 0LL;
*(_OWORD *)&nptr[64] = 0LL;
*(_OWORD *)&nptr[80] = 0LL;
*(_OWORD *)&nptr[96] = 0LL;
*(_OWORD *)&nptr[112] = 0LL;
*(_OWORD *)&nptr[128] = 0LL;
*(_OWORD *)&nptr[144] = 0LL;
*(_OWORD *)&nptr[160] = 0LL;
*(_OWORD *)&nptr[176] = 0LL;
*(_OWORD *)&nptr[192] = 0LL;
*(_OWORD *)&nptr[208] = 0LL;
*(_OWORD *)&nptr[224] = 0LL;
*(_OWORD *)&nptr[240] = 0LL;
for ( i = *(_BYTE *)listfs_parser_buffer; *v0 != 10; i = *v0 )
{
++v0;
*v1++ = i;
}
v3 = v0 + 1;
printk(3LL, 34LL, "first line captured: %s\n", nptr);
*(v1 - 3) = 0;
listfs_parser_buffer_len = atoi(&nptr[4]);
printk(3LL, 34LL, "index file length: %d\n", (unsigned int)listfs_parser_buffer_len);
for ( result = (char *)(listfs_parser_buffer + listfs_parser_buffer_len);
v3 < result;
result = (char *)(listfs_parser_buffer + listfs_parser_buffer_len) )
{
memset(nptr, 0, 0x100uLL);
v5 = *v3;
result = nptr;
if ( *v3 != 10 )
{
while ( 1 )
{
++v3;
*result++ = v5;
v5 = *v3;
if ( *v3 == 10 )
break;
if ( result - nptr > 255 )
return result;
}
}
++v3;
v6 = (char *)strim(nptr);
parse_line_isra_0(v6);
}
return result;
}

canonical_decompiled_code:
char *func15()
{
char *v0; // rbx
char *v1; // rbp
char i; // al
char *v3; // rbx
char *result; // rax
char v5; // dl
char *v6; // rax
char nptr[280]; // [rsp+0h] [rbp-118h] BYREF

v0 = (char *)listfs_parser_buffer;
*(_OWORD *)nptr = 0LL;
*(_OWORD *)&nptr[16] = 0LL;
v1 = nptr;
*(_OWORD *)&nptr[32] = 0LL;
*(_OWORD *)&nptr[48] = 0LL;
*(_OWORD *)&nptr[64] = 0LL;
*(_OWORD *)&nptr[80] = 0LL;
*(_OWORD *)&nptr[96] = 0LL;
*(_OWORD *)&nptr[112] = 0LL;
*(_OWORD *)&nptr[128] = 0LL;
*(_OWORD *)&nptr[144] = 0LL;
*(_OWORD *)&nptr[160] = 0LL;
*(_OWORD *)&nptr[176] = 0LL;
*(_OWORD *)&nptr[192] = 0LL;
*(_OWORD *)&nptr[208] = 0LL;
*(_OWORD *)&nptr[224] = 0LL;
*(_OWORD *)&nptr[240] = 0LL;
for ( i = *(_BYTE *)listfs_parser_buffer; *v0 != 10; i = *v0 )
{
++v0;
*v1++ = i;
}
v3 = v0 + 1;
printk(3LL, 34LL, "first line captured: %s\n", nptr);
*(v1 - 3) = 0;
listfs_parser_buffer_len = atoi(&nptr[4]);
printk(3LL, 34LL, "index file length: %d\n", (unsigned int)listfs_parser_buffer_len);
for ( result = (char *)(listfs_parser_buffer + listfs_parser_buffer_len);
v3 < result;
result = (char *)(listfs_parser_buffer + listfs_parser_buffer_len) )
{
memset(nptr, 0, 0x100uLL);
v5 = *v3;
result = nptr;
if ( *v3 != 10 )
{
while ( 1 )
{
++v3;
*result++ = v5;
v5 = *v3;
if ( *v3 == 10 )
break;
if ( result - nptr > 255 )
return result;
}
}
++v3;
v6 = (char *)strim(nptr);
func12(v6);
}
return result;
}

original_code:
void listfs_parser_parse_buffer() {
  char line[256] = {(char)0};
  char *cursor = listfs_parser_buffer;
  char *line_cursor = line;
  while ('\n' != *cursor) {
 *(line_cursor++) = *(cursor++);
  }
  cursor++;
  printk(0x03, 0x22, "first line captured: %s\n", line);
  *(line_cursor-3) = '\0';
  listfs_parser_buffer_len = atoi((line+4));
  printk(0x03, 0x22, "index file length: %d\n", listfs_parser_buffer_len);
  while (cursor < (listfs_parser_buffer + listfs_parser_buffer_len)) {
    line_cursor = line;
    memset(line, 0, 256);
 for(; '\n' != *cursor; cursor++, line_cursor++) {
   if ((line_cursor - line) >= 256)
  return;
   *line_cursor = *cursor;
 }
    cursor++;
 line_cursor = strim(line);
 parse_line(line_cursor);
  }
}

variable_types:
line
char [256]

variable_types:
cursor
char *


decompiled_code:
__int64 __fastcall cmd_parameters_check(const char *a1, __int64 a2)
{
__int64 result; // rax
unsigned __int8 *v3; // rdx
int v4; // eax
int v5; // eax

result = test_id;
switch ( test_id )
{
case 0:
result = CU_assertImplementation(0LL, 10LL, "0", "shell_handler-test.c", &unk_7C0, 0LL);
break;
case 1:
result = CU_assertImplementation(0LL, 13LL, "0", "shell_handler-test.c", &unk_7C0, 0LL);
break;
case 2:
result = CU_assertImplementation(0LL, 16LL, "0", "shell_handler-test.c", &unk_7C0, 0LL);
break;
case 3:
CU_assertImplementation(
strcmp(a1, "/bin/demo_1") == 0,
19LL,
"0 == strcmp(primary_parameter, \"/bin/demo_1\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
strcmp(*(const char **)a2, "abc") == 0,
20LL,
"0 == strcmp(secondary_parameters[0], \"abc\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
result = CU_assertImplementation(
strcmp(*(const char **)(a2 + 8), "def") == 0,
21LL,
"0 == strcmp(secondary_parameters[1], \"def\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
break;
case 4:
case 5:
case 6:
CU_assertImplementation(
strcmp(a1, "/bin/demo_1") == 0,
26LL,
"0 == strcmp(primary_parameter, \"/bin/demo_1\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
strcmp(*(const char **)a2, "abc") == 0,
27LL,
"0 == strcmp(secondary_parameters[0], \"abc\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
strcmp(*(const char **)(a2 + 8), "def") == 0,
28LL,
"0 == strcmp(secondary_parameters[1], \"def\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
strcmp(*(const char **)(a2 + 16), "098") == 0,
29LL,
"0 == strcmp(secondary_parameters[2], \"098\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
v3 = *(unsigned __int8 **)(a2 + 24);
v4 = *v3 - 38;
if ( *v3 == 38 )
{
v4 = v3[1] - 38;
if ( v3[1] == 38 )
v4 = v3[2];
}
result = CU_assertImplementation(
v4 == 0,
30LL,
"0 == strcmp(secondary_parameters[3], \"&&\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
break;
case 7:
CU_assertImplementation(
strcmp(a1, "/bin") == 0,
33LL,
"0 == strcmp(primary_parameter, \"/bin\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)a2 == 0LL,
34LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 8) == 0LL,
35LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 16) == 0LL,
36LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7C0,
0LL);
result = CU_assertImplementation(
*(_QWORD *)(a2 + 24) == 0LL,
37LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7C0,
0LL);
break;
case 8:
case 9:
case 0xA:
case 0xB:
case 0xC:
case 0xD:
CU_assertImplementation(a1 == 0LL, 45LL, "NULL == primary_parameter", "shell_handler-test.c", &unk_7C0, 0LL);
CU_assertImplementation(
*(_QWORD *)a2 == 0LL,
46LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 8) == 0LL,
47LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 16) == 0LL,
48LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7C0,
0LL);
result = CU_assertImplementation(
*(_QWORD *)(a2 + 24) == 0LL,
49LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7C0,
0LL);
break;
case 0xE:
v5 = *(unsigned __int8 *)a1 - 108;
if ( *a1 == 108 )
{
v5 = *((unsigned __int8 *)a1 + 1) - 115;
if ( a1[1] == 115 )
v5 = *((unsigned __int8 *)a1 + 2);
}
CU_assertImplementation(
v5 == 0,
52LL,
"0 == strcmp(primary_parameter, \"ls\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)a2 == 0LL,
53LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 8) == 0LL,
54LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 16) == 0LL,
55LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7C0,
0LL);
result = CU_assertImplementation(
*(_QWORD *)(a2 + 24) == 0LL,
56LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7C0,
0LL);
break;
default:
return result;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, __int64 a2)
{
__int64 result; // rax
unsigned __int8 *v3; // rdx
int v4; // eax
int v5; // eax

result = test_id;
switch ( test_id )
{
case 0:
result = CU_assertImplementation(0LL, 10LL, "0", "shell_handler-test.c", &unk_7C0, 0LL);
break;
case 1:
result = CU_assertImplementation(0LL, 13LL, "0", "shell_handler-test.c", &unk_7C0, 0LL);
break;
case 2:
result = CU_assertImplementation(0LL, 16LL, "0", "shell_handler-test.c", &unk_7C0, 0LL);
break;
case 3:
CU_assertImplementation(
strcmp(a1, "/bin/demo_1") == 0,
19LL,
"0 == strcmp(primary_parameter, \"/bin/demo_1\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
strcmp(*(const char **)a2, "abc") == 0,
20LL,
"0 == strcmp(secondary_parameters[0], \"abc\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
result = CU_assertImplementation(
strcmp(*(const char **)(a2 + 8), "def") == 0,
21LL,
"0 == strcmp(secondary_parameters[1], \"def\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
break;
case 4:
case 5:
case 6:
CU_assertImplementation(
strcmp(a1, "/bin/demo_1") == 0,
26LL,
"0 == strcmp(primary_parameter, \"/bin/demo_1\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
strcmp(*(const char **)a2, "abc") == 0,
27LL,
"0 == strcmp(secondary_parameters[0], \"abc\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
strcmp(*(const char **)(a2 + 8), "def") == 0,
28LL,
"0 == strcmp(secondary_parameters[1], \"def\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
strcmp(*(const char **)(a2 + 16), "098") == 0,
29LL,
"0 == strcmp(secondary_parameters[2], \"098\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
v3 = *(unsigned __int8 **)(a2 + 24);
v4 = *v3 - 38;
if ( *v3 == 38 )
{
v4 = v3[1] - 38;
if ( v3[1] == 38 )
v4 = v3[2];
}
result = CU_assertImplementation(
v4 == 0,
30LL,
"0 == strcmp(secondary_parameters[3], \"&&\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
break;
case 7:
CU_assertImplementation(
strcmp(a1, "/bin") == 0,
33LL,
"0 == strcmp(primary_parameter, \"/bin\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)a2 == 0LL,
34LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 8) == 0LL,
35LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 16) == 0LL,
36LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7C0,
0LL);
result = CU_assertImplementation(
*(_QWORD *)(a2 + 24) == 0LL,
37LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7C0,
0LL);
break;
case 8:
case 9:
case 0xA:
case 0xB:
case 0xC:
case 0xD:
CU_assertImplementation(a1 == 0LL, 45LL, "NULL == primary_parameter", "shell_handler-test.c", &unk_7C0, 0LL);
CU_assertImplementation(
*(_QWORD *)a2 == 0LL,
46LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 8) == 0LL,
47LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 16) == 0LL,
48LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7C0,
0LL);
result = CU_assertImplementation(
*(_QWORD *)(a2 + 24) == 0LL,
49LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7C0,
0LL);
break;
case 0xE:
v5 = *(unsigned __int8 *)a1 - 108;
if ( *a1 == 108 )
{
v5 = *((unsigned __int8 *)a1 + 1) - 115;
if ( a1[1] == 115 )
v5 = *((unsigned __int8 *)a1 + 2);
}
CU_assertImplementation(
v5 == 0,
52LL,
"0 == strcmp(primary_parameter, \"ls\")",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)a2 == 0LL,
53LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 8) == 0LL,
54LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7C0,
0LL);
CU_assertImplementation(
*(_QWORD *)(a2 + 16) == 0LL,
55LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7C0,
0LL);
result = CU_assertImplementation(
*(_QWORD *)(a2 + 24) == 0LL,
56LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7C0,
0LL);
break;
default:
return result;
}
return result;
}

original_code:
static void cmd_parameters_check(char *primary_parameter, char **secondary_parameters) {
  switch(test_id) {
  case 0:
 { CU_assertImplementation((0), 10, "0", "shell_handler-test.c", "", 0); };
 break;
  case 1:
 { CU_assertImplementation((0), 13, "0", "shell_handler-test.c", "", 0); };
 break;
  case 2:
 { CU_assertImplementation((0), 16, "0", "shell_handler-test.c", "", 0); };
 break;
  case 3:
 { CU_assertImplementation((0 == strcmp(primary_parameter, "/bin/demo_1")), 19, "0 == strcmp(primary_parameter, \"/bin/demo_1\")", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((0 == strcmp(secondary_parameters[0], "abc")), 20, "0 == strcmp(secondary_parameters[0], \"abc\")", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((0 == strcmp(secondary_parameters[1], "def")), 21, "0 == strcmp(secondary_parameters[1], \"def\")", "shell_handler-test.c", "", 0); };
 break;
  case 4:
  case 5:
  case 6:
 { CU_assertImplementation((0 == strcmp(primary_parameter, "/bin/demo_1")), 26, "0 == strcmp(primary_parameter, \"/bin/demo_1\")", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((0 == strcmp(secondary_parameters[0], "abc")), 27, "0 == strcmp(secondary_parameters[0], \"abc\")", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((0 == strcmp(secondary_parameters[1], "def")), 28, "0 == strcmp(secondary_parameters[1], \"def\")", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((0 == strcmp(secondary_parameters[2], "098")), 29, "0 == strcmp(secondary_parameters[2], \"098\")", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((0 == strcmp(secondary_parameters[3], "&&")), 30, "0 == strcmp(secondary_parameters[3], \"&&\")", "shell_handler-test.c", "", 0); };
 break;
  case 7:
 { CU_assertImplementation((0 == strcmp(primary_parameter, "/bin")), 33, "0 == strcmp(primary_parameter, \"/bin\")", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[0]), 34, "NULL == secondary_parameters[0]", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[1]), 35, "NULL == secondary_parameters[1]", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[2]), 36, "NULL == secondary_parameters[2]", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[3]), 37, "NULL == secondary_parameters[3]", "shell_handler-test.c", "", 0); };
 break;
  case 8:
  case 9:
  case 10:
  case 11:
  case 12:
  case 13:
 { CU_assertImplementation((((void *)0) == primary_parameter), 45, "NULL == primary_parameter", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[0]), 46, "NULL == secondary_parameters[0]", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[1]), 47, "NULL == secondary_parameters[1]", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[2]), 48, "NULL == secondary_parameters[2]", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[3]), 49, "NULL == secondary_parameters[3]", "shell_handler-test.c", "", 0); };
 break;
  case 14:
 { CU_assertImplementation((0 == strcmp(primary_parameter, "ls")), 52, "0 == strcmp(primary_parameter, \"ls\")", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[0]), 53, "NULL == secondary_parameters[0]", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[1]), 54, "NULL == secondary_parameters[1]", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[2]), 55, "NULL == secondary_parameters[2]", "shell_handler-test.c", "", 0); };
 { CU_assertImplementation((((void *)0) == secondary_parameters[3]), 56, "NULL == secondary_parameters[3]", "shell_handler-test.c", "", 0); };
 break;
  }
  return;
}


decompiled_code:
__int64 __fastcall handle_cmd_elf(const char *a1, __int64 a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 3) <= 1,
63LL,
"(3 == test_id) || (4 == test_id)",
"shell_handler-test.c",
&unk_7C0,
0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func2(const char *a1, __int64 a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 3) <= 1,
63LL,
"(3 == test_id) || (4 == test_id)",
"shell_handler-test.c",
&unk_7C0,
0LL);
return func0(a1, a2);
}

original_code:
void handle_cmd_elf(char *primary_parameter, char **secondary_parameters) {
  { CU_assertImplementation(((3 == test_id) || (4 == test_id)), 63, "(3 == test_id) || (4 == test_id)", "shell_handler-test.c", "", 0); };
  cmd_parameters_check(primary_parameter, secondary_parameters);
  return;
}


decompiled_code:
__int64 __fastcall handle_cmd_elfs(const char *a1, __int64 a2)
{
CU_assertImplementation(test_id == 5, 69LL, "5 == test_id", "shell_handler-test.c", &unk_7C0, 0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func3(const char *a1, __int64 a2)
{
CU_assertImplementation(test_id == 5, 69LL, "5 == test_id", "shell_handler-test.c", &unk_7C0, 0LL);
return func0(a1, a2);
}

original_code:
void handle_cmd_elfs(char *primary_parameter, char **secondary_parameters) {
  { CU_assertImplementation((5 == test_id), 69, "5 == test_id", "shell_handler-test.c", "", 0); };
  cmd_parameters_check(primary_parameter, secondary_parameters);
  return;
}


decompiled_code:
__int64 __fastcall handle_cmd_elfa(const char *a1, __int64 a2)
{
CU_assertImplementation(test_id == 6, 75LL, "6 == test_id", "shell_handler-test.c", &unk_7C0, 0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func4(const char *a1, __int64 a2)
{
CU_assertImplementation(test_id == 6, 75LL, "6 == test_id", "shell_handler-test.c", &unk_7C0, 0LL);
return func0(a1, a2);
}

original_code:
void handle_cmd_elfa(char *primary_parameter, char **secondary_parameters) {
  { CU_assertImplementation((6 == test_id), 75, "6 == test_id", "shell_handler-test.c", "", 0); };
  cmd_parameters_check(primary_parameter, secondary_parameters);
  return;
}


decompiled_code:
__int64 __fastcall handle_cmd_ls(const char *a1, __int64 a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 7) <= 1,
81LL,
"(7 == test_id) || (8 == test_id)",
"shell_handler-test.c",
&unk_7C0,
0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func5(const char *a1, __int64 a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 7) <= 1,
81LL,
"(7 == test_id) || (8 == test_id)",
"shell_handler-test.c",
&unk_7C0,
0LL);
return func0(a1, a2);
}

original_code:
void handle_cmd_ls(char *primary_parameter, char **secondary_parameters) {
  { CU_assertImplementation(((7 == test_id) || (8 == test_id)), 81, "(7 == test_id) || (8 == test_id)", "shell_handler-test.c", "", 0); };
  cmd_parameters_check(primary_parameter, secondary_parameters);
  return;
}


decompiled_code:
void handle_cmd_tree()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

original_code:
void handle_cmd_tree(char *primary_parameter, char **secondary_parameters) {
  return;
}


decompiled_code:
__int64 __fastcall handle_cmd_jiffies(const char *a1, __int64 a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 9) <= 1,
91LL,
"(9 == test_id) || (10 == test_id)",
"shell_handler-test.c",
&unk_7C0,
0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1, __int64 a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 9) <= 1,
91LL,
"(9 == test_id) || (10 == test_id)",
"shell_handler-test.c",
&unk_7C0,
0LL);
return func0(a1, a2);
}

original_code:
void handle_cmd_jiffies(char *primary_parameter, char **secondary_parameters) {
  { CU_assertImplementation(((9 == test_id) || (10 == test_id)), 91, "(9 == test_id) || (10 == test_id)", "shell_handler-test.c", "", 0); };
  cmd_parameters_check(primary_parameter, secondary_parameters);
  return;
}


decompiled_code:
__int64 __fastcall handle_cmd_cat(const char *a1, __int64 a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 11) <= 1,
97LL,
"(11 == test_id) || (12 == test_id)",
"shell_handler-test.c",
&unk_7C0,
0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func8(const char *a1, __int64 a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 11) <= 1,
97LL,
"(11 == test_id) || (12 == test_id)",
"shell_handler-test.c",
&unk_7C0,
0LL);
return func0(a1, a2);
}

original_code:
void handle_cmd_cat(char *primary_parameter, char **secondary_parameters) {
  { CU_assertImplementation(((11 == test_id) || (12 == test_id)), 97, "(11 == test_id) || (12 == test_id)", "shell_handler-test.c", "", 0); };
  cmd_parameters_check(primary_parameter, secondary_parameters);
  return;
}


decompiled_code:
void handle_cmd_kmsg()
{
;
}

canonical_decompiled_code:
void func9()
{
;
}

original_code:
void handle_cmd_kmsg(char *primary_parameter, char **secondary_parameters) {
  return;
}


decompiled_code:
void handle_cmd_ps()
{
;
}

canonical_decompiled_code:
void func10()
{
;
}

original_code:
void handle_cmd_ps(char *primary_parameter, char **secondary_parameters) {
  return;
}


decompiled_code:
void handle_cmd_kill()
{
;
}

canonical_decompiled_code:
void func11()
{
;
}

original_code:
void handle_cmd_kill(char *primary_parameter, char **secondary_parameters) {
  return;
}


decompiled_code:
void handle_cmd_log()
{
;
}

canonical_decompiled_code:
void func12()
{
;
}

original_code:
void handle_cmd_log(char *primary_parameter, char **secondary_parameters) {
  return;
}


decompiled_code:
void handle_cmd_reset()
{
;
}

canonical_decompiled_code:
void func13()
{
;
}

original_code:
void handle_cmd_reset(char *primary_parameter, char **secondary_parameters) {
  return;
}


decompiled_code:
__int64 __fastcall handle_cmd_help(const char *a1, __int64 a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 13) <= 1,
123LL,
"(13 == test_id) || (14 == test_id)",
"shell_handler-test.c",
&unk_7C0,
0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func14(const char *a1, __int64 a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 13) <= 1,
123LL,
"(13 == test_id) || (14 == test_id)",
"shell_handler-test.c",
&unk_7C0,
0LL);
return func0(a1, a2);
}

original_code:
void handle_cmd_help(char *primary_parameter, char **secondary_parameters) {
  { CU_assertImplementation(((13 == test_id) || (14 == test_id)), 123, "(13 == test_id) || (14 == test_id)", "shell_handler-test.c", "", 0); };
  cmd_parameters_check(primary_parameter, secondary_parameters);
  return;
}


decompiled_code:
void *get_fs_vfs_test_cases_array()
{
return &test_cases_array;
}

canonical_decompiled_code:
void *func0()
{
return &test_cases_array;
}

original_code:
CU_TestInfo* get_fs_vfs_test_cases_array() {
  return test_cases_array;
}

canonical_original_code:
struct CU_TestInfo *get_fs_vfs_test_cases_array() {
  return test_cases_array;
}

user_defined_types: struct CU_TestInfo { char *pName; void (*pTestFunc)(); }


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

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

original_code:
int get_fs_vfs_test_cases_count() {
  return sizeof(test_cases_array)/sizeof(CU_TestInfo);
}


decompiled_code:
void glibc_test_initialize()
{
int v0; // ebp
const __m128i *v1; // rax

v0 = get_glibc_malloc_test_cases_count();
v1 = (const __m128i *)get_glibc_malloc_test_cases_array();
add_test_cases_isra_0(v1, v0);
}

canonical_decompiled_code:
void func3()
{
int v0; // ebp
const __m128i *v1; // rax

v0 = get_glibc_malloc_test_cases_count();
v1 = (const __m128i *)get_glibc_malloc_test_cases_array();
func2(v1, v0);
}

original_code:
void glibc_test_initialize() {
  _add_test_cases(get_glibc_malloc_test_cases_array(), get_glibc_malloc_test_cases_count());
}


decompiled_code:
void glibc_test_finalize()
{
;
}

canonical_decompiled_code:
void func4()
{
;
}

original_code:
void glibc_test_finalize() {
}

canonical_original_code:
void glibc_test_finalize() {
}


decompiled_code:
__int64 test_suite_clean()
{
free(sim_heap_start);
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
free(sim_heap_start);
return 0LL;
}

original_code:
static int test_suite_clean(void) {
  free((void *)sim_heap_start);
  return 0;
}

canonical_original_code:
static int test_suite_clean() {
  free((void *)sim_heap_start);
  return 0;
}


decompiled_code:
__int64 test_suite_init()
{
void *v0; // rax

v0 = malloc(0x20000uLL);
sim_heap_start = v0;
if ( !v0 )
return 0xFFFFFFFFLL;
sim_heap_end = v0;
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
void *v0; // rax

v0 = malloc(0x20000uLL);
sim_heap_start = v0;
if ( !v0 )
return 0xFFFFFFFFLL;
sim_heap_end = v0;
return 0LL;
}

original_code:
static int test_suite_init(void) {
  sim_heap_start = (unsigned long)malloc(128*1024);
  if ((unsigned long)((void *)0) == sim_heap_start)
    return -1;
  sim_heap_end = sim_heap_start;
  return 0;
}

canonical_original_code:
static int test_suite_init() {
  sim_heap_start = (unsigned long)malloc(128*1024);
  if ((unsigned long)((void *)0) == sim_heap_start)
    return -1;
  sim_heap_end = sim_heap_start;
  return 0;
}


decompiled_code:
void mm_test_initialize()
{
int v0; // ebp
const __m128i *v1; // rax
int v2; // ebp
const __m128i *v3; // rdi
int v4; // ebp
const __m128i *v5; // rax

v0 = get_mm_page_allocator_test_cases_count();
v1 = (const __m128i *)get_mm_page_allocator_test_cases_array();
add_test_cases_isra_0(v1, v0);
v2 = get_mm_slab_allocator_test_cases_count();
v3 = (const __m128i *)get_mm_slab_allocator_test_cases_array();
add_test_cases_isra_0(v3, v2);
v4 = get_mm_allocator_test_cases_count();
v5 = (const __m128i *)get_mm_allocator_test_cases_array();
add_test_cases_isra_0(v5, v4);
}

canonical_decompiled_code:
void func3()
{
int v0; // ebp
const __m128i *v1; // rax
int v2; // ebp
const __m128i *v3; // rdi
int v4; // ebp
const __m128i *v5; // rax

v0 = get_mm_page_allocator_test_cases_count();
v1 = (const __m128i *)get_mm_page_allocator_test_cases_array();
func2(v1, v0);
v2 = get_mm_slab_allocator_test_cases_count();
v3 = (const __m128i *)get_mm_slab_allocator_test_cases_array();
func2(v3, v2);
v4 = get_mm_allocator_test_cases_count();
v5 = (const __m128i *)get_mm_allocator_test_cases_array();
func2(v5, v4);
}

original_code:
void mm_test_initialize() {
  _add_test_cases(get_mm_page_allocator_test_cases_array(), get_mm_page_allocator_test_cases_count());
  _add_test_cases(get_mm_slab_allocator_test_cases_array(), get_mm_slab_allocator_test_cases_count());
  _add_test_cases(get_mm_allocator_test_cases_array(), get_mm_allocator_test_cases_count());
}


decompiled_code:
void mm_test_finalize()
{
;
}

original_code:
void mm_test_finalize() {
}

canonical_original_code:
void mm_test_finalize() {
}


decompiled_code:
__int64 test_suite_clean()
{
free(pages_map);
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
free(pages_map);
return 0LL;
}

original_code:
static int test_suite_clean(void) {
  free(pages_map);
  return 0;
}

canonical_original_code:
static int test_suite_clean() {
  free(pages_map);
  return 0;
}


decompiled_code:
__int64 test_suite_init()
{
pages_map = malloc(0xC0000uLL);
if ( !pages_map )
return 0xFFFFFFFFLL;
test_page_offset = (__int64)malloc(0x4000000uLL);
return (unsigned int)-(test_page_offset == 0);
}

canonical_decompiled_code:
__int64 func1()
{
pages_map = malloc(0xC0000uLL);
if ( !pages_map )
return 0xFFFFFFFFLL;
test_page_offset = (__int64)malloc(0x4000000uLL);
return (unsigned int)-(test_page_offset == 0);
}

original_code:
static int test_suite_init(void) {
  pages_map = (struct page *)malloc((0x4000000 >> 12) * sizeof(struct page));
  if (((void *)0) == pages_map)
    return -1;
  test_page_offset = (void *)malloc((0x4000000 >> 12) * (1UL<<12));
  if (((void *)0) == test_page_offset)
    return -1;
  return 0;
}

canonical_original_code:
static int test_suite_init() {
  pages_map = (struct page *)malloc((0x4000000 >> 12) * sizeof(struct page));
  if (((void *)0) == pages_map)
    return -1;
  test_page_offset = (void *)malloc((0x4000000 >> 12) * (1UL<<12));
  if (((void *)0) == test_page_offset)
    return -1;
  return 0;
}

user_defined_types: struct page { unsigned long virtual; char allocated; char order; struct list_head manage; struct list_head list; }


original_code:
static void slabset_add_slab(struct page* slab, struct slabset* set) {
  set->slabs.prev->next = &slab->manage;
  set->slabs.prev = &slab->manage;
  slab->manage.next = &set->slabs;
  slab->manage.prev = &set->slabs;
  set->slab_count ++;
}

canonical_original_code:
static void slabset_add_slab(struct page *slab, struct slabset *set) {
  set->slabs.prev->next = &slab->manage;
  set->slabs.prev = &slab->manage;
  slab->manage.next = &set->slabs;
  slab->manage.prev = &set->slabs;
  set->slab_count ++;
}

variable_types: struct page { unsigned long virtual; char allocated; char order; struct list_head { struct list_head *next; } manage; struct list_head list; } *

variable_types: struct slabset { struct kcache { int object_size; int slab_size; int objects_per_slab; unsigned long align; struct slabset full_set; struct slabset partial_set; struct slabset empty_set; } *parent; int slab_count; int objects_free; struct list_head slabs; } *

user_defined_types: struct slabset { struct kcache *parent; int slab_count; int objects_free; struct list_head slabs; }