cmdBufferAddReply

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

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

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

repo: michael-grunder/buffer-optimize

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_D91,
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_D91,
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_D91,
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_D91,
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);
}

return_type: int


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

v0 = kernel_ring_buffer;
ring_buffer_reset(kernel_ring_buffer);
v1 = 7168;
do
{
ring_buffer_put_char(v0, 99LL);
--v1;
}
while ( v1 );
v2 = 2048;
do
{
ring_buffer_get_char(v0);
--v2;
}
while ( v2 );
ring_buffer_reset(user_ring_buffer);
ring_buffer_copy(user_ring_buffer, v0);
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_D91,
0LL);
CU_assertImplementation(
*(_QWORD *)(v3 + 24) == *(_QWORD *)v3 + 2048LL,
252LL,
"ring->end == (ring->upper + 2*1024)",
"ring_buffer-test.c",
&unk_D91,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v3 + 32) == 0,
253LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D91,
0LL);
}

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

v0 = kernel_ring_buffer;
ring_buffer_reset(kernel_ring_buffer);
v1 = 7168;
do
{
ring_buffer_put_char(v0, 99LL);
--v1;
}
while ( v1 );
v2 = 2048;
do
{
ring_buffer_get_char(v0);
--v2;
}
while ( v2 );
ring_buffer_reset(user_ring_buffer);
ring_buffer_copy(user_ring_buffer, v0);
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_D91,
0LL);
CU_assertImplementation(
*(_QWORD *)(v3 + 24) == *(_QWORD *)v3 + 2048LL,
252LL,
"ring->end == (ring->upper + 2*1024)",
"ring_buffer-test.c",
&unk_D91,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v3 + 32) == 0,
253LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D91,
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()
{
__int64 v0; // rbp
int v1; // ebx
int v2; // ebx

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

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

v0 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
v1 = 5120;
do
{
ring_buffer_put_char(v0, 99LL);
--v1;
}
while ( v1 );
CU_assertImplementation(
*(_QWORD *)(v0 + 16) == *(_QWORD *)v0 + 1024LL,
166LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D91,
0LL);
CU_assertImplementation(
*(_QWORD *)(v0 + 24) == *(_QWORD *)v0 + 1024LL,
167LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D91,
0LL);
CU_assertImplementation(*(_DWORD *)(v0 + 32) == 1, 168LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D91, 0LL);
v2 = 6144;
do
{
ring_buffer_get_char(v0);
--v2;
}
while ( v2 );
CU_assertImplementation(
*(_QWORD *)(v0 + 16) == *(_QWORD *)v0 + 1024LL,
173LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D91,
0LL);
CU_assertImplementation(
*(_QWORD *)(v0 + 24) == *(_QWORD *)v0 + 1024LL,
174LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D91,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v0 + 32) == 0,
175LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D91,
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()
{
__int64 v0; // rbp
int v1; // ebx
int v2; // ebx

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

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

v0 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
v1 = 5120;
do
{
ring_buffer_put_char(v0, 99LL);
--v1;
}
while ( v1 );
CU_assertImplementation(
*(_QWORD *)(v0 + 16) == *(_QWORD *)v0 + 1024LL,
144LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D91,
0LL);
CU_assertImplementation(
*(_QWORD *)(v0 + 24) == *(_QWORD *)v0 + 1024LL,
145LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D91,
0LL);
CU_assertImplementation(*(_DWORD *)(v0 + 32) == 1, 146LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D91, 0LL);
v2 = 4096;
do
{
ring_buffer_get_char(v0);
--v2;
}
while ( v2 );
CU_assertImplementation(
*(_QWORD *)(v0 + 16) == *(_QWORD *)v0 + 1024LL,
151LL,
"ring->start == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D91,
0LL);
CU_assertImplementation(
*(_QWORD *)(v0 + 24) == *(_QWORD *)v0 + 1024LL,
152LL,
"ring->end == (ring->upper + 1024)",
"ring_buffer-test.c",
&unk_D91,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v0 + 32) == 0,
153LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D91,
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()
{
__int64 v0; // rbp
int v1; // ebx
int v2; // ebx

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

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

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

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

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

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

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

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

v0 = user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
v1 = 4096;
do
{
ring_buffer_put_char(v0, 99LL);
--v1;
}
while ( v1 );
CU_assertImplementation(
*(_QWORD *)(v0 + 16) == *(_QWORD *)v0,
74LL,
"ring->start == (ring->upper)",
"ring_buffer-test.c",
&unk_D91,
0LL);
CU_assertImplementation(
*(_QWORD *)(v0 + 24) == *(_QWORD *)v0,
75LL,
"ring->end == (ring->upper)",
"ring_buffer-test.c",
&unk_D91,
0LL);
CU_assertImplementation(*(_DWORD *)(v0 + 32) == 1, 76LL, "ring->circled == 1", "ring_buffer-test.c", &unk_D91, 0LL);
v2 = 4096;
do
{
ring_buffer_get_char(v0);
--v2;
}
while ( v2 );
CU_assertImplementation(
*(_QWORD *)(v0 + 16) == *(_QWORD *)v0,
81LL,
"ring->start == (ring->upper)",
"ring_buffer-test.c",
&unk_D91,
0LL);
CU_assertImplementation(
*(_QWORD *)(v0 + 24) == *(_QWORD *)v0,
82LL,
"ring->end == (ring->upper)",
"ring_buffer-test.c",
&unk_D91,
0LL);
return CU_assertImplementation(
*(_DWORD *)(v0 + 32) == 0,
83LL,
"ring->circled == 0",
"ring_buffer-test.c",
&unk_D91,
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()
{
unsigned __int64 *v0; // rbx
int v1; // ebp
int v2; // ebp

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

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

v0 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
v1 = 20;
do
{
ring_buffer_put_char(v0, 99LL);
func0(v0);
--v1;
}
while ( v1 );
v2 = 30;
do
{
ring_buffer_get_char(v0);
func0(v0);
--v2;
}
while ( v2 );
CU_assertImplementation(
v0[2] == *v0 + 20,
61LL,
"ring->start == (ring->upper + 20)",
"ring_buffer-test.c",
&unk_D91,
0LL);
return CU_assertImplementation(
v0[3] == *v0 + 20,
62LL,
"ring->end == (ring->upper + 20)",
"ring_buffer-test.c",
&unk_D91,
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()
{
unsigned __int64 *v0; // rbx
int v1; // ebp
int v2; // ebp

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

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

v0 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
v1 = 10;
do
{
ring_buffer_put_char(v0, 99LL);
func0(v0);
--v1;
}
while ( v1 );
v2 = 8;
do
{
ring_buffer_get_char(v0);
func0(v0);
--v2;
}
while ( v2 );
CU_assertImplementation(
v0[2] == *v0 + 8,
42LL,
"ring->start == (ring->upper + 8)",
"ring_buffer-test.c",
&unk_D91,
0LL);
return CU_assertImplementation(
v0[3] == *v0 + 10,
43LL,
"ring->end == (ring->upper + 10)",
"ring_buffer-test.c",
&unk_D91,
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()
{
unsigned __int64 *v0; // rbp
int v1; // ebx

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

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

v0 = (unsigned __int64 *)user_ring_buffer;
ring_buffer_reset(user_ring_buffer);
v1 = 10;
do
{
ring_buffer_put_char(v0, 99LL);
func0(v0);
--v1;
}
while ( v1 );
CU_assertImplementation(v0[2] == *v0, 23LL, "ring->start == ring->upper", "ring_buffer-test.c", &unk_D91, 0LL);
return CU_assertImplementation(
v0[3] == *v0 + 10,
24LL,
"ring->end == (ring->upper + 10)",
"ring_buffer-test.c",
&unk_D91,
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; // rbx
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_D91, 0LL);
}

canonical_decompiled_code:
__int64 func14()
{
unsigned __int64 *v0; // rbx
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_D91, 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;
}


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;
a1[2] = *a1;
a1[3] = result;
*((_DWORD *)a1 + 8) = 0;
return result;
}

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

result = *a1;
a1[2] = *a1;
a1[3] = result;
*((_DWORD *)a1 + 8) = 0;
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(unsigned __int64 *a1, char a2)
{
_BYTE *v2; // rax
unsigned __int64 result; // rax
_BYTE *v4; // rax
unsigned __int64 v5; // rdx

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

canonical_decompiled_code:
unsigned __int64 __fastcall func3(unsigned __int64 *a1, char a2)
{
_BYTE *v2; // rax
unsigned __int64 result; // rax
_BYTE *v4; // rax
unsigned __int64 v5; // rdx

if ( !*((_DWORD *)a1 + 8) )
{
v2 = (_BYTE *)a1[3];
a1[3] = (unsigned __int64)(v2 + 1);
*v2 = a2;
result = a1[1];
if ( a1[3] >= result )
{
result = *a1;
a1[3] = *a1;
*((_DWORD *)a1 + 8) = 1;
}
return result;
}
v4 = (_BYTE *)a1[3];
a1[3] = (unsigned __int64)(v4 + 1);
*v4 = a2;
result = a1[3];
if ( result <= a1[2] )
{
v5 = a1[1];
if ( result < v5 )
goto LABEL_9;
}
else
{
a1[2] = result;
v5 = a1[1];
if ( result < v5 )
return result;
}
result = *a1;
a1[3] = *a1;
LABEL_9:
if ( a1[2] >= v5 )
{
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(unsigned __int64 *a1, __int64 *a2)
{
char v2; // al
_BOOL8 result; // rax

while ( 1 )
{
result = ring_buffer_empty((__int64)a2);
if ( result )
break;
v2 = ring_buffer_get_char(a2);
ring_buffer_put_char(a1, v2);
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func6(unsigned __int64 *a1, __int64 *a2)
{
char v2; // al
_BOOL8 result; // rax

while ( 1 )
{
result = func5((__int64)a2);
if ( result )
break;
v2 = func4(a2);
func3(a1, v2);
}
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 func9(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; // rbp
__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 func10(const char *a1)
{
__m128i *v1; // rbp
__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 func11(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 func12(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; // al
char *v2; // rbp
char *v3; // rbx
char *result; // rax
char v5; // dl
void *v6; // rax
char nptr[280]; // [rsp+0h] [rbp-118h] BYREF

*(_QWORD *)nptr = 0LL;
*(_QWORD *)&nptr[8] = 0LL;
*(_QWORD *)&nptr[16] = 0LL;
*(_QWORD *)&nptr[24] = 0LL;
*(_QWORD *)&nptr[32] = 0LL;
*(_QWORD *)&nptr[40] = 0LL;
*(_QWORD *)&nptr[48] = 0LL;
*(_QWORD *)&nptr[56] = 0LL;
*(_QWORD *)&nptr[64] = 0LL;
*(_QWORD *)&nptr[72] = 0LL;
*(_QWORD *)&nptr[80] = 0LL;
*(_QWORD *)&nptr[88] = 0LL;
*(_QWORD *)&nptr[96] = 0LL;
*(_QWORD *)&nptr[104] = 0LL;
*(_QWORD *)&nptr[112] = 0LL;
*(_QWORD *)&nptr[120] = 0LL;
*(_QWORD *)&nptr[128] = 0LL;
*(_QWORD *)&nptr[136] = 0LL;
*(_QWORD *)&nptr[144] = 0LL;
*(_QWORD *)&nptr[152] = 0LL;
*(_QWORD *)&nptr[160] = 0LL;
*(_QWORD *)&nptr[168] = 0LL;
*(_QWORD *)&nptr[176] = 0LL;
*(_QWORD *)&nptr[184] = 0LL;
*(_QWORD *)&nptr[192] = 0LL;
*(_QWORD *)&nptr[200] = 0LL;
*(_QWORD *)&nptr[208] = 0LL;
*(_QWORD *)&nptr[216] = 0LL;
*(_QWORD *)&nptr[224] = 0LL;
*(_QWORD *)&nptr[232] = 0LL;
*(_QWORD *)&nptr[240] = 0LL;
*(_QWORD *)&nptr[248] = 0LL;
v0 = (char *)listfs_parser_buffer;
v1 = *(_BYTE *)listfs_parser_buffer;
if ( *(_BYTE *)listfs_parser_buffer == 10 )
{
v2 = nptr;
}
else
{
v2 = nptr;
do
{
++v0;
*v2++ = v1;
v1 = *v0;
}
while ( *v0 != 10 );
}
v3 = v0 + 1;
printk(3LL, 34LL, "first line captured: %s\n", nptr);
*(v2 - 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 )
{
*result = v5;
++v3;
++result;
v5 = *v3;
if ( *v3 == 10 )
break;
if ( result - nptr > 255 )
return result;
}
}
++v3;
v6 = (void *)strim(nptr);
parse_line(v6);
}
return result;
}

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

*(_QWORD *)nptr = 0LL;
*(_QWORD *)&nptr[8] = 0LL;
*(_QWORD *)&nptr[16] = 0LL;
*(_QWORD *)&nptr[24] = 0LL;
*(_QWORD *)&nptr[32] = 0LL;
*(_QWORD *)&nptr[40] = 0LL;
*(_QWORD *)&nptr[48] = 0LL;
*(_QWORD *)&nptr[56] = 0LL;
*(_QWORD *)&nptr[64] = 0LL;
*(_QWORD *)&nptr[72] = 0LL;
*(_QWORD *)&nptr[80] = 0LL;
*(_QWORD *)&nptr[88] = 0LL;
*(_QWORD *)&nptr[96] = 0LL;
*(_QWORD *)&nptr[104] = 0LL;
*(_QWORD *)&nptr[112] = 0LL;
*(_QWORD *)&nptr[120] = 0LL;
*(_QWORD *)&nptr[128] = 0LL;
*(_QWORD *)&nptr[136] = 0LL;
*(_QWORD *)&nptr[144] = 0LL;
*(_QWORD *)&nptr[152] = 0LL;
*(_QWORD *)&nptr[160] = 0LL;
*(_QWORD *)&nptr[168] = 0LL;
*(_QWORD *)&nptr[176] = 0LL;
*(_QWORD *)&nptr[184] = 0LL;
*(_QWORD *)&nptr[192] = 0LL;
*(_QWORD *)&nptr[200] = 0LL;
*(_QWORD *)&nptr[208] = 0LL;
*(_QWORD *)&nptr[216] = 0LL;
*(_QWORD *)&nptr[224] = 0LL;
*(_QWORD *)&nptr[232] = 0LL;
*(_QWORD *)&nptr[240] = 0LL;
*(_QWORD *)&nptr[248] = 0LL;
v0 = (char *)listfs_parser_buffer;
v1 = *(_BYTE *)listfs_parser_buffer;
if ( *(_BYTE *)listfs_parser_buffer == 10 )
{
v2 = nptr;
}
else
{
v2 = nptr;
do
{
++v0;
*v2++ = v1;
v1 = *v0;
}
while ( *v0 != 10 );
}
v3 = v0 + 1;
printk(3LL, 34LL, "first line captured: %s\n", nptr);
*(v2 - 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 )
{
*result = v5;
++v3;
++result;
v5 = *v3;
if ( *v3 == 10 )
break;
if ( result - nptr > 255 )
return result;
}
}
++v3;
v6 = (void *)strim(nptr);
func8(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, const char **a2)
{
__int64 result; // rax

result = (__int64)a1;
switch ( test_id )
{
case 0:
result = CU_assertImplementation(0LL, 10LL, "0", "shell_handler-test.c", &unk_7A0, 0LL);
break;
case 1:
result = CU_assertImplementation(0LL, 13LL, "0", "shell_handler-test.c", &unk_7A0, 0LL);
break;
case 2:
result = CU_assertImplementation(0LL, 16LL, "0", "shell_handler-test.c", &unk_7A0, 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_7A0,
0LL);
CU_assertImplementation(
strcmp(*a2, "abc") == 0,
20LL,
"0 == strcmp(secondary_parameters[0], \"abc\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
result = CU_assertImplementation(
strcmp(a2[1], "def") == 0,
21LL,
"0 == strcmp(secondary_parameters[1], \"def\")",
"shell_handler-test.c",
&unk_7A0,
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_7A0,
0LL);
CU_assertImplementation(
strcmp(*a2, "abc") == 0,
27LL,
"0 == strcmp(secondary_parameters[0], \"abc\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
strcmp(a2[1], "def") == 0,
28LL,
"0 == strcmp(secondary_parameters[1], \"def\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
strcmp(a2[2], "098") == 0,
29LL,
"0 == strcmp(secondary_parameters[2], \"098\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
result = CU_assertImplementation(
strcmp(a2[3], "&&") == 0,
30LL,
"0 == strcmp(secondary_parameters[3], \"&&\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
break;
case 7:
CU_assertImplementation(
strcmp(a1, "/bin") == 0,
33LL,
"0 == strcmp(primary_parameter, \"/bin\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
*a2 == 0LL,
34LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[1] == 0LL,
35LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[2] == 0LL,
36LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7A0,
0LL);
result = CU_assertImplementation(
a2[3] == 0LL,
37LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7A0,
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_7A0, 0LL);
CU_assertImplementation(
*a2 == 0LL,
46LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[1] == 0LL,
47LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[2] == 0LL,
48LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7A0,
0LL);
result = CU_assertImplementation(
a2[3] == 0LL,
49LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7A0,
0LL);
break;
case 0xE:
CU_assertImplementation(
strcmp(a1, "ls") == 0,
52LL,
"0 == strcmp(primary_parameter, \"ls\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
*a2 == 0LL,
53LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[1] == 0LL,
54LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[2] == 0LL,
55LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7A0,
0LL);
result = CU_assertImplementation(
a2[3] == 0LL,
56LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7A0,
0LL);
break;
default:
return result;
}
return result;
}

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

result = (__int64)a1;
switch ( test_id )
{
case 0:
result = CU_assertImplementation(0LL, 10LL, "0", "shell_handler-test.c", &unk_7A0, 0LL);
break;
case 1:
result = CU_assertImplementation(0LL, 13LL, "0", "shell_handler-test.c", &unk_7A0, 0LL);
break;
case 2:
result = CU_assertImplementation(0LL, 16LL, "0", "shell_handler-test.c", &unk_7A0, 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_7A0,
0LL);
CU_assertImplementation(
strcmp(*a2, "abc") == 0,
20LL,
"0 == strcmp(secondary_parameters[0], \"abc\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
result = CU_assertImplementation(
strcmp(a2[1], "def") == 0,
21LL,
"0 == strcmp(secondary_parameters[1], \"def\")",
"shell_handler-test.c",
&unk_7A0,
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_7A0,
0LL);
CU_assertImplementation(
strcmp(*a2, "abc") == 0,
27LL,
"0 == strcmp(secondary_parameters[0], \"abc\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
strcmp(a2[1], "def") == 0,
28LL,
"0 == strcmp(secondary_parameters[1], \"def\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
strcmp(a2[2], "098") == 0,
29LL,
"0 == strcmp(secondary_parameters[2], \"098\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
result = CU_assertImplementation(
strcmp(a2[3], "&&") == 0,
30LL,
"0 == strcmp(secondary_parameters[3], \"&&\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
break;
case 7:
CU_assertImplementation(
strcmp(a1, "/bin") == 0,
33LL,
"0 == strcmp(primary_parameter, \"/bin\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
*a2 == 0LL,
34LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[1] == 0LL,
35LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[2] == 0LL,
36LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7A0,
0LL);
result = CU_assertImplementation(
a2[3] == 0LL,
37LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7A0,
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_7A0, 0LL);
CU_assertImplementation(
*a2 == 0LL,
46LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[1] == 0LL,
47LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[2] == 0LL,
48LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7A0,
0LL);
result = CU_assertImplementation(
a2[3] == 0LL,
49LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7A0,
0LL);
break;
case 0xE:
CU_assertImplementation(
strcmp(a1, "ls") == 0,
52LL,
"0 == strcmp(primary_parameter, \"ls\")",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
*a2 == 0LL,
53LL,
"NULL == secondary_parameters[0]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[1] == 0LL,
54LL,
"NULL == secondary_parameters[1]",
"shell_handler-test.c",
&unk_7A0,
0LL);
CU_assertImplementation(
a2[2] == 0LL,
55LL,
"NULL == secondary_parameters[2]",
"shell_handler-test.c",
&unk_7A0,
0LL);
result = CU_assertImplementation(
a2[3] == 0LL,
56LL,
"NULL == secondary_parameters[3]",
"shell_handler-test.c",
&unk_7A0,
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, const char **a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 3) <= 1,
63LL,
"(3 == test_id) || (4 == test_id)",
"shell_handler-test.c",
&unk_7A0,
0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func1(const char *a1, const char **a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 3) <= 1,
63LL,
"(3 == test_id) || (4 == test_id)",
"shell_handler-test.c",
&unk_7A0,
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, const char **a2)
{
CU_assertImplementation(test_id == 5, 69LL, "5 == test_id", "shell_handler-test.c", &unk_7A0, 0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func2(const char *a1, const char **a2)
{
CU_assertImplementation(test_id == 5, 69LL, "5 == test_id", "shell_handler-test.c", &unk_7A0, 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, const char **a2)
{
CU_assertImplementation(test_id == 6, 75LL, "6 == test_id", "shell_handler-test.c", &unk_7A0, 0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func3(const char *a1, const char **a2)
{
CU_assertImplementation(test_id == 6, 75LL, "6 == test_id", "shell_handler-test.c", &unk_7A0, 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, const char **a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 7) <= 1,
81LL,
"(7 == test_id) || (8 == test_id)",
"shell_handler-test.c",
&unk_7A0,
0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func4(const char *a1, const char **a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 7) <= 1,
81LL,
"(7 == test_id) || (8 == test_id)",
"shell_handler-test.c",
&unk_7A0,
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 func5()
{
;
}

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


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

canonical_decompiled_code:
__int64 __fastcall func6(const char *a1, const char **a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 9) <= 1,
91LL,
"(9 == test_id) || (10 == test_id)",
"shell_handler-test.c",
&unk_7A0,
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, const char **a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 11) <= 1,
97LL,
"(11 == test_id) || (12 == test_id)",
"shell_handler-test.c",
&unk_7A0,
0LL);
return cmd_parameters_check(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1, const char **a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 11) <= 1,
97LL,
"(11 == test_id) || (12 == test_id)",
"shell_handler-test.c",
&unk_7A0,
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 func8()
{
;
}

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


decompiled_code:
void handle_cmd_ps()
{
;
}

canonical_decompiled_code:
void func9()
{
;
}

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


decompiled_code:
void handle_cmd_kill()
{
;
}

canonical_decompiled_code:
void func10()
{
;
}

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


decompiled_code:
void handle_cmd_log()
{
;
}

canonical_decompiled_code:
void func11()
{
;
}

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


decompiled_code:
void handle_cmd_reset()
{
;
}

canonical_decompiled_code:
void func12()
{
;
}

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


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

canonical_decompiled_code:
__int64 __fastcall func13(const char *a1, const char **a2)
{
CU_assertImplementation(
(unsigned int)(test_id - 13) <= 1,
123LL,
"(13 == test_id) || (14 == test_id)",
"shell_handler-test.c",
&unk_7A0,
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:
__int64 glibc_test_initialize()
{
int v0; // ebx
const __m128i *v1; // rax

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

canonical_decompiled_code:
__int64 func3()
{
int v0; // ebx
const __m128i *v1; // rax

v0 = get_glibc_malloc_test_cases_count();
v1 = (const __m128i *)get_glibc_malloc_test_cases_array();
return func0(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 func1()
{
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 func2()
{
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:
__int64 mm_test_initialize()
{
int v0; // ebx
const __m128i *v1; // rax
int v2; // ebx
const __m128i *v3; // rdi
int v4; // ebx
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(v1, v0);
v2 = get_mm_slab_allocator_test_cases_count();
v3 = (const __m128i *)get_mm_slab_allocator_test_cases_array();
add_test_cases(v3, v2);
v4 = get_mm_allocator_test_cases_count();
v5 = (const __m128i *)get_mm_allocator_test_cases_array();
return add_test_cases(v5, v4);
}

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

v0 = get_mm_page_allocator_test_cases_count();
v1 = (const __m128i *)get_mm_page_allocator_test_cases_array();
func0(v1, v0);
v2 = get_mm_slab_allocator_test_cases_count();
v3 = (const __m128i *)get_mm_slab_allocator_test_cases_array();
func0(v3, v2);
v4 = get_mm_allocator_test_cases_count();
v5 = (const __m128i *)get_mm_allocator_test_cases_array();
return func0(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 func1()
{
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 func2()
{
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; }


decompiled_code:
__int64 __fastcall slabset_contain_slab(__int64 a1, __int64 a2)
{
_QWORD *v2; // rax
_QWORD *v3; // rdi
_QWORD *v4; // rsi

v2 = *(_QWORD **)(a1 + 16);
v3 = (_QWORD *)(a1 + 16);
if ( v2 == v3 )
return 0LL;
v4 = (_QWORD *)(a2 + 16);
if ( v2 == v4 )
return 1LL;
while ( 1 )
{
v2 = (_QWORD *)*v2;
if ( v2 == v3 )
break;
if ( v2 == v4 )
return 1LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
_QWORD *v2; // rax
_QWORD *v3; // rdi
_QWORD *v4; // rsi

v2 = *(_QWORD **)(a1 + 16);
v3 = (_QWORD *)(a1 + 16);
if ( v2 == v3 )
return 0LL;
v4 = (_QWORD *)(a2 + 16);
if ( v2 == v4 )
return 1LL;
while ( 1 )
{
v2 = (_QWORD *)*v2;
if ( v2 == v3 )
break;
if ( v2 == v4 )
return 1LL;
}
return 0LL;
}

original_code:
static bool slabset_contain_slab(struct slabset* set, struct page* slab) {
  struct list_head* current = set->slabs.next;
  while(&set->slabs != current) {
 if (&slab->manage == current) {
   return true;
 }
 current = current->next;
  }
  return false;
}

canonical_original_code:
static int slabset_contain_slab(struct slabset *set, struct page *slab) {
  struct list_head *current = set->slabs.next;
  while(&set->slabs != current) {
 if (&slab->manage == current) {
   return true;
 }
 current = current->next;
  }
  return false;
}

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 { struct list_head *next; } slabs; } *

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

variable_types: struct list_head { struct list_head *next; } *


decompiled_code:
__int64 __fastcall slab_alloc_object(__int64 *a1, int a2, int a3, int a4)
{
__int64 v6; // rbx
__int64 v7; // rax

v6 = *a1;
printk(1LL, 36LL, "slab_alloc_object(): slab = %x, order = %x\n", a1, (unsigned int)*((char *)a1 + 9));
if ( a3 <= 0 )
return 0LL;
v7 = 0LL;
while ( *(_BYTE *)(v6 + v7) )
{
if ( ++v7 == a3 )
return 0LL;
}
*(_BYTE *)(v6 + v7) = -1;
return v6 + a4 + (__int64)(a2 * (int)v7);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 *a1, int a2, int a3, int a4)
{
__int64 v6; // rbx
__int64 v7; // rax

v6 = *a1;
printk(1LL, 36LL, "slab_alloc_object(): slab = %x, order = %x\n", a1, (unsigned int)*((char *)a1 + 9));
if ( a3 <= 0 )
return 0LL;
v7 = 0LL;
while ( *(_BYTE *)(v6 + v7) )
{
if ( ++v7 == a3 )
return 0LL;
}
*(_BYTE *)(v6 + v7) = -1;
return v6 + a4 + (__int64)(a2 * (int)v7);
}

original_code:
static void* slab_alloc_object(struct page* slab, int object_size, int objects_per_slab, int align) {
  unsigned char* map = (unsigned char*)slab->virtual;
  int i;
  void * result = ((void *)0);
  printk(0x01, 0x24, "slab_alloc_object(): slab = %x, order = %x\n", slab, slab->order);
  for (i = 0; i < objects_per_slab; i++) {
 if ((unsigned char)0 == map[i]) {
   map[i] = (unsigned char)0xff;
   result = (void *)((map + align) + object_size * i);
   break;
 }
  }
  return result;
}

canonical_original_code:
static void *slab_alloc_object(struct page *slab, int object_size, int objects_per_slab, int align) {
  unsigned char *map = (unsigned char*)slab->virtual;
  int i;
  void *result = ((void *)0);
  printk(0x01, 0x24, "slab_alloc_object(): slab = %x, order = %x\n", slab, slab->order);
  for (i = 0; i < objects_per_slab; i++) {
 if ((unsigned char)0 == map[i]) {
   map[i] = (unsigned char)0xff;
   result = (void *)((map + align) + object_size * i);
   break;
 }
  }
  return result;
}

variable_types: align int

variable_types:
map
unsigned char *

variable_types:
result
void *

return_type: void *


original_code:
static void slabset_remove_slab(struct page* slab, struct slabset* set) {
  struct list_head* current = &set->slabs;
  while(&slab->manage != current->next) {
 printk(0x01, 0x25, "slab = %x, &slab->manage = %x, current->next = %x\n", slab, &slab->manage, current->next);
 current = current->next;
  }
  current->next = current->next->next;
  if (slab->manage.next == &set->slabs) {
 set->slabs.prev = current;
  }
  set->slab_count --;
}

canonical_original_code:
static void slabset_remove_slab(struct page *slab, struct slabset *set) {
  struct list_head *current = &set->slabs;
  while(&slab->manage != current->next) {
 printk(0x01, 0x25, "slab = %x, &slab->manage = %x, current->next = %x\n", slab, &slab->manage, current->next);
 current = current->next;
  }
  current->next = current->next->next;
  if (slab->manage.next == &set->slabs) {
 set->slabs.prev = current;
  }
  set->slab_count --;
}

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


decompiled_code:
__int64 __fastcall slab_free_object(__int64 *a1, int a2, int a3, int a4, __int64 a5)
{
__int64 v8; // r13
__int64 v9; // rax
unsigned int v10; // ebx
_BYTE *v11; // r13

v8 = *a1;
printk(1LL, 37LL, "slab_free_object(): slab = %x\n", a1);
if ( a3 <= 0 )
{
LABEL_11:
printk(1LL, 16LL, "returned memory %x is not a valid address\n", (unsigned int)a5);
return 0LL;
}
if ( a5 != v8 + a4 )
{
v9 = v8 + a2 + (__int64)a4;
v10 = 0;
while ( a3 != ++v10 )
{
if ( a5 == v9 )
goto LABEL_8;
v9 += a2;
}
goto LABEL_11;
}
v10 = 0;
LABEL_8:
printk(1LL, 37LL, "objects index found: %x\n", v10);
printk(1LL, 37LL, "map = %x\n", v8);
v11 = (_BYTE *)((int)v10 + v8);
if ( !*v11 )
printk(1LL, 16LL, "returned memory %x was not allocated\n", (unsigned int)a5);
*v11 = 0;
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 *a1, int a2, int a3, int a4, __int64 a5)
{
__int64 v8; // r13
__int64 v9; // rax
unsigned int v10; // ebx
_BYTE *v11; // r13

v8 = *a1;
printk(1LL, 37LL, "slab_free_object(): slab = %x\n", a1);
if ( a3 <= 0 )
{
LABEL_11:
printk(1LL, 16LL, "returned memory %x is not a valid address\n", (unsigned int)a5);
return 0LL;
}
if ( a5 != v8 + a4 )
{
v9 = v8 + a2 + (__int64)a4;
v10 = 0;
while ( a3 != ++v10 )
{
if ( a5 == v9 )
goto LABEL_8;
v9 += a2;
}
goto LABEL_11;
}
v10 = 0;
LABEL_8:
printk(1LL, 37LL, "objects index found: %x\n", v10);
printk(1LL, 37LL, "map = %x\n", v8);
v11 = (_BYTE *)((int)v10 + v8);
if ( !*v11 )
printk(1LL, 16LL, "returned memory %x was not allocated\n", (unsigned int)a5);
*v11 = 0;
return 1LL;
}

original_code:
static bool slab_free_object(struct page* slab, int object_size, int objects_per_slab, int align, void* object) {
  unsigned char* map = (unsigned char*)slab->virtual;
  int i;
  printk(0x01, 0x25, "slab_free_object(): slab = %x\n", slab);
  for (i = 0; i < objects_per_slab; i++) {
 if (object == (map + align + object_size * i)) {
   printk(0x01, 0x25, "objects index found: %x\n", i);
   printk(0x01, 0x25, "map = %x\n", map);
   if ((unsigned char)0 == map[i])
  printk(0x01, 0x10, "returned memory %x was not allocated\n", (unsigned int)object);
   map[i] = (unsigned char)0;
   return true;
 }
  }
  printk(0x01, 0x10, "returned memory %x is not a valid address\n", (unsigned int)object);
  return false;
}

canonical_original_code:
static int slab_free_object(struct page *slab, int object_size, int objects_per_slab, int align, void *object) {
  unsigned char *map = (unsigned char*)slab->virtual;
  int i;
  printk(0x01, 0x25, "slab_free_object(): slab = %x\n", slab);
  for (i = 0; i < objects_per_slab; i++) {
 if (object == (map + align + object_size * i)) {
   printk(0x01, 0x25, "objects index found: %x\n", i);
   printk(0x01, 0x25, "map = %x\n", map);
   if ((unsigned char)0 == map[i])
  printk(0x01, 0x10, "returned memory %x was not allocated\n", (unsigned int)object);
   map[i] = (unsigned char)0;
   return true;
 }
  }
  printk(0x01, 0x10, "returned memory %x is not a valid address\n", (unsigned int)object);
  return false;
}

variable_types:
object
void *

variable_types: i int