decompiled_code:
int socket_invalid_protocol()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx

v0 = 0;
if ( socket(2, 2, -1) < 0 )
v0 = *_errno_location() == 22;
printf("%s", "socket_invalid_protocol");
fflush(stdout);
v1 = 37LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func4()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx

v0 = 0;
if ( socket(2, 2, -1) < 0 )
v0 = *_errno_location() == 22;
printf("%s", "socket_invalid_protocol");
fflush(stdout);
v1 = 37LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

original_code:
static void socket_invalid_protocol(void)
{
 int rc;
 rc = socket(2, SOCK_DGRAM, -1);
 do { size_t i; int t = (rc < 0 && (*__errno_location ()) == 22); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void socket_invalid_protocol()
{
 int rc;
 rc = socket(2, SOCK_DGRAM, -1);
 do { unsigned long i; int t = (rc < 0 && (*__errno_location ()) == 22); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


repo: IxLabs/mptp

decompiled_code:
int socket_ok()
{
int v0; // ebp
int *v1; // rax
__int64 v2; // rbx

v0 = socket(2, 2, 137);
v1 = _errno_location();
dprintf((int)"rc = %d, errno = %d\n", (const char *)v0, (unsigned int)*v1);
printf("%s", "socket_ok");
fflush(stdout);
v2 = 51LL;
do
{
putchar(46);
--v2;
}
while ( v2 );
if ( v0 <= 0 )
puts("failed");
else
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func5()
{
int v0; // ebp
int *v1; // rax
__int64 v2; // rbx

v0 = socket(2, 2, 137);
v1 = _errno_location();
dprintf((int)"rc = %d, errno = %d\n", (const char *)v0, (unsigned int)*v1);
printf("%s", "socket_ok");
fflush(stdout);
v2 = 51LL;
do
{
putchar(46);
--v2;
}
while ( v2 );
if ( v0 <= 0 )
puts("failed");
else
puts("passed");
return fflush(stdout);
}

original_code:
static void socket_ok(void)
{
 int rc;
 rc = socket(2, SOCK_DGRAM, 137);
 dprintf("rc = %d, errno = %d\n", rc, (*__errno_location ()));
 do { size_t i; int t = (rc > 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void socket_ok()
{
 int rc;
 rc = socket(2, SOCK_DGRAM, 137);
 dprintf("rc = %d, errno = %d\n", rc, (*__errno_location ()));
 do { unsigned long i; int t = (rc > 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

variable_types: rc int

variable_types:
i
unsigned long

variable_types: t int

return_type: void


decompiled_code:
int socket_test_suite()
{
printf("\n==== Starting %s ====\n", "socket_test_suite");
socket_dummy();
socket_invalid_domain();
socket_invalid_type();
socket_invalid_protocol();
run_as_child_process(socket_insufficient_file_descriptors);
return socket_ok();
}

canonical_decompiled_code:
int func6()
{
printf("\n==== Starting %s ====\n", "socket_test_suite");
func1();
func2();
func3();
func4();
run_as_child_process(socket_insufficient_file_descriptors);
return func5();
}

original_code:
void socket_test_suite(void)
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 socket_dummy();
 socket_invalid_domain();
 socket_invalid_type();
 socket_invalid_protocol();
 run_as_child_process(socket_insufficient_file_descriptors);
 socket_ok();
}

canonical_original_code:
void socket_test_suite()
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 socket_dummy();
 socket_invalid_domain();
 socket_invalid_type();
 socket_invalid_protocol();
 run_as_child_process(socket_insufficient_file_descriptors);
 socket_ok();
}


decompiled_code:
int dummy_1_eq_1()
{
__int64 v0; // rbx

printf("%s", "dummy_1_eq_1");
fflush(stdout);
v0 = 48LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func0()
{
__int64 v0; // rbx

printf("%s", "dummy_1_eq_1");
fflush(stdout);
v0 = 48LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

original_code:
static void dummy_1_eq_1(void)
{
 do { size_t i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void dummy_1_eq_1()
{
 do { unsigned long i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int dummy_1_neq_0()
{
__int64 v0; // rbx

printf("%s", "dummy_1_neq_0");
fflush(stdout);
v0 = 47LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func1()
{
__int64 v0; // rbx

printf("%s", "dummy_1_neq_0");
fflush(stdout);
v0 = 47LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

original_code:
static void dummy_1_neq_0(void)
{
 do { size_t i; int t = (1 != 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void dummy_1_neq_0()
{
 do { unsigned long i; int t = (1 != 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int test_dummy()
{
printf("\n==== Starting %s ====\n", "test_dummy");
dummy_1_eq_1();
return dummy_1_neq_0();
}

canonical_decompiled_code:
int func2()
{
printf("\n==== Starting %s ====\n", "test_dummy");
func0();
return func1();
}

original_code:
void test_dummy(void)
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 dummy_1_eq_1();
 dummy_1_neq_0();
}

canonical_original_code:
void test_dummy()
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 dummy_1_eq_1();
 dummy_1_neq_0();
}


decompiled_code:
int recvmsg_dummy()
{
__int64 v0; // rbx

printf("%s", "recvmsg_dummy");
fflush(stdout);
v0 = 47LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func0()
{
__int64 v0; // rbx

printf("%s", "recvmsg_dummy");
fflush(stdout);
v0 = 47LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

original_code:
static void recvmsg_dummy(void)
{
 do { size_t i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvmsg_dummy()
{
 do { unsigned long i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvmsg_invalid_descriptor()
{
__int64 v0; // rbx

printf("%s", "recvmsg_invalid_descriptor");
fflush(stdout);
v0 = 34LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func1()
{
__int64 v0; // rbx

printf("%s", "recvmsg_invalid_descriptor");
fflush(stdout);
v0 = 34LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void recvmsg_invalid_descriptor(void)
{
 do { size_t i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvmsg_invalid_descriptor()
{
 do { unsigned long i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvmsg_descriptor_is_not_a_socket()
{
__int64 v0; // rbx

printf("%s", "recvmsg_descriptor_is_not_a_socket");
fflush(stdout);
v0 = 26LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func2()
{
__int64 v0; // rbx

printf("%s", "recvmsg_descriptor_is_not_a_socket");
fflush(stdout);
v0 = 26LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void recvmsg_descriptor_is_not_a_socket(void)
{
 do { size_t i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvmsg_descriptor_is_not_a_socket()
{
 do { unsigned long i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvmsg_socket_is_not_bound()
{
__int64 v0; // rbx

printf("%s", "recvmsg_socket_is_not_bound");
fflush(stdout);
v0 = 33LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func3()
{
__int64 v0; // rbx

printf("%s", "recvmsg_socket_is_not_bound");
fflush(stdout);
v0 = 33LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void recvmsg_socket_is_not_bound(void)
{
 do { size_t i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvmsg_socket_is_not_bound()
{
 do { unsigned long i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvmsg_after_sendto_ok()
{
__int64 v0; // rbx

printf("%s", "recvmsg_after_sendto_ok");
fflush(stdout);
v0 = 37LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func4()
{
__int64 v0; // rbx

printf("%s", "recvmsg_after_sendto_ok");
fflush(stdout);
v0 = 37LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void recvmsg_after_sendto_ok(void)
{
 do { size_t i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvmsg_after_sendto_ok()
{
 do { unsigned long i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvmsg_after_sendmsg_ok()
{
__int64 v0; // rbx

printf("%s", "recvmsg_after_sendmsg_ok");
fflush(stdout);
v0 = 36LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func5()
{
__int64 v0; // rbx

printf("%s", "recvmsg_after_sendmsg_ok");
fflush(stdout);
v0 = 36LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void recvmsg_after_sendmsg_ok(void)
{
 do { size_t i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvmsg_after_sendmsg_ok()
{
 do { unsigned long i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvmsg_test_suite()
{
printf("\n==== Starting %s ====\n", "recvmsg_test_suite");
recvmsg_dummy();
recvmsg_invalid_descriptor();
recvmsg_descriptor_is_not_a_socket();
recvmsg_socket_is_not_bound();
recvmsg_after_sendto_ok();
return recvmsg_after_sendmsg_ok();
}

canonical_decompiled_code:
int func6()
{
printf("\n==== Starting %s ====\n", "recvmsg_test_suite");
func0();
func1();
func2();
func3();
func4();
return func5();
}

original_code:
void recvmsg_test_suite(void)
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 recvmsg_dummy();
 recvmsg_invalid_descriptor();
 recvmsg_descriptor_is_not_a_socket();
 recvmsg_socket_is_not_bound();
 recvmsg_after_sendto_ok();
 recvmsg_after_sendmsg_ok();
}

canonical_original_code:
void recvmsg_test_suite()
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 recvmsg_dummy();
 recvmsg_invalid_descriptor();
 recvmsg_descriptor_is_not_a_socket();
 recvmsg_socket_is_not_bound();
 recvmsg_after_sendto_ok();
 recvmsg_after_sendmsg_ok();
}


decompiled_code:
int close_dummy()
{
__int64 v0; // rbx

printf("%s", "close_dummy");
fflush(stdout);
v0 = 49LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func0()
{
__int64 v0; // rbx

printf("%s", "close_dummy");
fflush(stdout);
v0 = 49LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

original_code:
static void close_dummy(void)
{
 do { size_t i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void close_dummy()
{
 do { unsigned long i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int close_invalid_descriptor()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx

v0 = 0;
if ( close(-1) < 0 )
v0 = *_errno_location() == 9;
printf("%s", "close_invalid_descriptor");
fflush(stdout);
v1 = 36LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func1()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx

v0 = 0;
if ( close(-1) < 0 )
v0 = *_errno_location() == 9;
printf("%s", "close_invalid_descriptor");
fflush(stdout);
v1 = 36LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

original_code:
static void close_invalid_descriptor(void)
{
 int rc;
 rc = close(-1);
 do { size_t i; int t = (rc < 0 && (*__errno_location ()) == 9); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void close_invalid_descriptor()
{
 int rc;
 rc = close(-1);
 do { unsigned long i; int t = (rc < 0 && (*__errno_location ()) == 9); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int close_descriptor_is_not_a_socket()
{
int v0; // eax
int v1; // ebp
_BOOL4 v2; // er12
__int64 v3; // rbx

v0 = dup(1);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_close.c", 60LL);
perror("dup");
exit(1);
}
v1 = v0;
v2 = 0;
if ( close(v0) < 0 )
v2 = *_errno_location() == 9;
printf("%s", "close_descriptor_is_not_a_socket");
fflush(stdout);
v3 = 28LL;
do
{
putchar(46);
--v3;
}
while ( v3 );
if ( v2 )
puts("passed");
else
puts("failed");
fflush(stdout);
return close(v1);
}

canonical_decompiled_code:
int func2()
{
int v0; // eax
int v1; // ebp
_BOOL4 v2; // er12
__int64 v3; // rbx

v0 = dup(1);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_close.c", 60LL);
perror("dup");
exit(1);
}
v1 = v0;
v2 = 0;
if ( close(v0) < 0 )
v2 = *_errno_location() == 9;
printf("%s", "close_descriptor_is_not_a_socket");
fflush(stdout);
v3 = 28LL;
do
{
putchar(46);
--v3;
}
while ( v3 );
if ( v2 )
puts("passed");
else
puts("failed");
fflush(stdout);
return close(v1);
}

original_code:
static void close_descriptor_is_not_a_socket(void)
{
 int fd;
 int rc;
 fd = dup(1);
 do { if (fd < 0) { do { fprintf(stderr, "(%s, %d): ", "test_close.c", 60); perror("dup"); } while (0); exit(1); } } while(0);
 rc = close(fd);
 do { size_t i; int t = (rc < 0 && (*__errno_location ()) == 9); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
 close(fd);
}

canonical_original_code:
static void close_descriptor_is_not_a_socket()
{
 int fd;
 int rc;
 fd = dup(1);
 do { if (fd < 0) { do { fprintf(stderr, "(%s, %d): ", "test_close.c", 60); perror("dup"); } while (0); exit(1); } } while(0);
 rc = close(fd);
 do { unsigned long i; int t = (rc < 0 && (*__errno_location ()) == 9); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
 close(fd);
}

variable_types: fd int


decompiled_code:
int close_ok_descriptor_is_not_bound()
{
int v0; // eax
int v1; // ebp
__int64 v2; // rbx

v0 = socket(2, 2, 137);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_close.c", 76LL);
perror("socket");
exit(1);
}
v1 = close(v0);
printf("%s", "close_ok_descriptor_is_not_bound");
fflush(stdout);
v2 = 28LL;
do
{
putchar(46);
--v2;
}
while ( v2 );
if ( v1 )
puts("failed");
else
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func3()
{
int v0; // eax
int v1; // ebp
__int64 v2; // rbx

v0 = socket(2, 2, 137);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_close.c", 76LL);
perror("socket");
exit(1);
}
v1 = close(v0);
printf("%s", "close_ok_descriptor_is_not_bound");
fflush(stdout);
v2 = 28LL;
do
{
putchar(46);
--v2;
}
while ( v2 );
if ( v1 )
puts("failed");
else
puts("passed");
return fflush(stdout);
}

original_code:
static void close_ok_descriptor_is_not_bound(void)
{
 int s;
 int rc;
 s = socket(2, SOCK_DGRAM, 137);
 do { if (s < 0) { do { fprintf(stderr, "(%s, %d): ", "test_close.c", 76); perror("socket"); } while (0); exit(1); } } while(0);
 rc = close(s);
 do { size_t i; int t = (rc == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void close_ok_descriptor_is_not_bound()
{
 int s;
 int rc;
 s = socket(2, SOCK_DGRAM, 137);
 do { if (s < 0) { do { fprintf(stderr, "(%s, %d): ", "test_close.c", 76); perror("socket"); } while (0); exit(1); } } while(0);
 rc = close(s);
 do { unsigned long i; int t = (rc == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

variable_types: s int


decompiled_code:
int close_ok_descriptor_is_bound()
{
int v0; // eax
int v1; // ebx
int v2; // ebp
__int64 v3; // rbx
struct sockaddr v5; // [rsp+0h] [rbp-38h] BYREF
int v6; // [rsp+10h] [rbp-28h]

v0 = socket(2, 2, 137);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_close.c", 91LL);
perror("socket");
exit(1);
}
v1 = v0;
*(_QWORD *)&v5.sa_family = 2LL;
*(_QWORD *)&v5.sa_data[6] = 0LL;
v6 = 0;
if ( bind(v0, &v5, 0x14u) < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_close.c", 97LL);
perror("bind");
exit(1);
}
v2 = close(v1);
printf("%s", "close_ok_descriptor_is_bound");
fflush(stdout);
v3 = 32LL;
do
{
putchar(46);
--v3;
}
while ( v3 );
if ( v2 )
puts("failed");
else
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func4()
{
int v0; // eax
int v1; // ebx
int v2; // ebp
__int64 v3; // rbx
struct sockaddr v5; // [rsp+0h] [rbp-38h] BYREF
int v6; // [rsp+10h] [rbp-28h]

v0 = socket(2, 2, 137);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_close.c", 91LL);
perror("socket");
exit(1);
}
v1 = v0;
*(_QWORD *)&v5.sa_family = 2LL;
*(_QWORD *)&v5.sa_data[6] = 0LL;
v6 = 0;
if ( bind(v0, &v5, 0x14u) < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_close.c", 97LL);
perror("bind");
exit(1);
}
v2 = close(v1);
printf("%s", "close_ok_descriptor_is_bound");
fflush(stdout);
v3 = 32LL;
do
{
putchar(46);
--v3;
}
while ( v3 );
if ( v2 )
puts("failed");
else
puts("passed");
return fflush(stdout);
}

original_code:
static void close_ok_descriptor_is_bound(void)
{
 int s;
 int rc;
 struct sockaddr_sw addr;
 s = socket(2, SOCK_DGRAM, 137);
 do { if (s < 0) { do { fprintf(stderr, "(%s, %d): ", "test_close.c", 91); perror("socket"); } while (0); exit(1); } } while(0);
 memset(&addr, 0, sizeof(addr));
 addr.sin_family = 2;
 addr.sin_addr.s_addr = ((in_addr_t) 0x00000000);
 rc = bind(s, (struct sockaddr *) &addr, sizeof(addr));
 do { if (rc < 0) { do { fprintf(stderr, "(%s, %d): ", "test_close.c", 97); perror("bind"); } while (0); exit(1); } } while(0);
 rc = close(s);
 do { size_t i; int t = (rc == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void close_ok_descriptor_is_bound()
{
 int s;
 int rc;
 struct sockaddr_sw addr;
 s = socket(2, SOCK_DGRAM, 137);
 do { if (s < 0) { do { fprintf(stderr, "(%s, %d): ", "test_close.c", 91); perror("socket"); } while (0); exit(1); } } while(0);
 memset(&addr, 0, sizeof(addr));
 addr.sin_family = 2;
 addr.sin_addr.s_addr = ((unsigned int) 0x00000000);
 rc = bind(s, (struct sockaddr *) &addr, sizeof(addr));
 do { if (rc < 0) { do { fprintf(stderr, "(%s, %d): ", "test_close.c", 97); perror("bind"); } while (0); exit(1); } } while(0);
 rc = close(s);
 do { unsigned long i; int t = (rc == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

variable_types: struct sockaddr_sw { unsigned short sin_family; struct in_addr { unsigned int s_addr; } sin_addr; struct sw_hash { unsigned int h_array[8]; } sw_hash; unsigned char sw_zero[-1]; }

user_defined_types: struct sockaddr_sw { unsigned short sin_family; struct in_addr sin_addr; struct sw_hash sw_hash; unsigned char sw_zero[-1]; }

user_defined_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; }


decompiled_code:
int close_test_suite()
{
printf("\n==== Starting %s ====\n", "close_test_suite");
close_dummy();
close_invalid_descriptor();
close_descriptor_is_not_a_socket();
close_ok_descriptor_is_not_bound();
return close_ok_descriptor_is_bound();
}

canonical_decompiled_code:
int func5()
{
printf("\n==== Starting %s ====\n", "close_test_suite");
func0();
func1();
func2();
func3();
return func4();
}

original_code:
void close_test_suite(void)
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 close_dummy();
 close_invalid_descriptor();
 close_descriptor_is_not_a_socket();
 close_ok_descriptor_is_not_bound();
 close_ok_descriptor_is_bound();
}

canonical_original_code:
void close_test_suite()
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 close_dummy();
 close_invalid_descriptor();
 close_descriptor_is_not_a_socket();
 close_ok_descriptor_is_not_bound();
 close_ok_descriptor_is_bound();
}


decompiled_code:
int sendto_dummy()
{
__int64 v0; // rbx

printf("%s", "sendto_dummy");
fflush(stdout);
v0 = 48LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func0()
{
__int64 v0; // rbx

printf("%s", "sendto_dummy");
fflush(stdout);
v0 = 48LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

original_code:
static void sendto_dummy(void)
{
 do { size_t i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void sendto_dummy()
{
 do { unsigned long i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int sendto_invalid_descriptor()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx
__int64 v3; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v5[56]; // [rsp+2020h] [rbp-38h] BYREF

fill_sockaddr_sw((__int64)v5, (__int64)&addr, "127.0.0.1", "myHash", "127.0.0.1");
v0 = 0;
if ( sendto(-1, &v3, 0x2000uLL, 0, &addr, 0x14u) < 0 )
v0 = *_errno_location() == 9;
printf("%s", "sendto_invalid_descriptor");
fflush(stdout);
v1 = 35LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func2()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx
__int64 v3; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v5[56]; // [rsp+2020h] [rbp-38h] BYREF

func1((__int64)v5, (__int64)&addr, "127.0.0.1", "myHash", "127.0.0.1");
v0 = 0;
if ( sendto(-1, &v3, 0x2000uLL, 0, &addr, 0x14u) < 0 )
v0 = *_errno_location() == 9;
printf("%s", "sendto_invalid_descriptor");
fflush(stdout);
v1 = 35LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

original_code:
static void sendto_invalid_descriptor()
{
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 ssize_t bytes_sent;
 char buffer[8192];
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_sent = sendto(-1, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { size_t i; int t = (bytes_sent < 0 && (*__errno_location ()) == 9); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void sendto_invalid_descriptor()
{
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 long bytes_sent;
 char buffer[8192];
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_sent = sendto(-1, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { unsigned long i; int t = (bytes_sent < 0 && (*__errno_location ()) == 9); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

variable_types:
buffer
char [8192]

user_defined_types: struct sw_hash { unsigned int h_array[8]; }


decompiled_code:
int sendto_descriptor_is_not_socket()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx
__int64 v3; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v5[56]; // [rsp+2020h] [rbp-38h] BYREF

fill_sockaddr_sw((__int64)v5, (__int64)&addr, "127.0.0.1", "myHash", "127.0.0.1");
v0 = 0;
if ( sendto(1, &v3, 0x2000uLL, 0, &addr, 0x14u) < 0 )
v0 = *_errno_location() == 88;
printf("%s", "sendto_descriptor_is_not_socket");
fflush(stdout);
v1 = 29LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func3()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx
__int64 v3; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v5[56]; // [rsp+2020h] [rbp-38h] BYREF

func1((__int64)v5, (__int64)&addr, "127.0.0.1", "myHash", "127.0.0.1");
v0 = 0;
if ( sendto(1, &v3, 0x2000uLL, 0, &addr, 0x14u) < 0 )
v0 = *_errno_location() == 88;
printf("%s", "sendto_descriptor_is_not_socket");
fflush(stdout);
v1 = 29LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

original_code:
static void sendto_descriptor_is_not_socket(void)
{
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 ssize_t bytes_sent;
 char buffer[8192];
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_sent = sendto(1, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { size_t i; int t = (bytes_sent < 0 && (*__errno_location ()) == 88); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void sendto_descriptor_is_not_socket()
{
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 long bytes_sent;
 char buffer[8192];
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_sent = sendto(1, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { unsigned long i; int t = (bytes_sent < 0 && (*__errno_location ()) == 88); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int sendto_socket_is_not_bound()
{
int v0; // eax
int v1; // ebx
_BOOL4 v2; // ebp
__int64 v3; // rbx
__int64 v5; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v7[56]; // [rsp+2020h] [rbp-38h] BYREF

v0 = socket(2, 2, 137);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_sendto.c", 82LL);
perror("socket");
exit(1);
}
v1 = v0;
fill_sockaddr_sw((__int64)v7, (__int64)&addr, "127.0.0.1", "myHash", "127.0.0.1");
v2 = 0;
if ( sendto(v1, &v5, 0x2000uLL, 0, &addr, 0x14u) < 0 )
v2 = *_errno_location() == 97;
printf("%s", "sendto_socket_is_not_bound");
fflush(stdout);
v3 = 34LL;
do
{
putchar(46);
--v3;
}
while ( v3 );
if ( v2 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func4()
{
int v0; // eax
int v1; // ebx
_BOOL4 v2; // ebp
__int64 v3; // rbx
__int64 v5; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v7[56]; // [rsp+2020h] [rbp-38h] BYREF

v0 = socket(2, 2, 137);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_sendto.c", 82LL);
perror("socket");
exit(1);
}
v1 = v0;
func1((__int64)v7, (__int64)&addr, "127.0.0.1", "myHash", "127.0.0.1");
v2 = 0;
if ( sendto(v1, &v5, 0x2000uLL, 0, &addr, 0x14u) < 0 )
v2 = *_errno_location() == 97;
printf("%s", "sendto_socket_is_not_bound");
fflush(stdout);
v3 = 34LL;
do
{
putchar(46);
--v3;
}
while ( v3 );
if ( v2 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

original_code:
static void sendto_socket_is_not_bound(void)
{
 int sockfd;
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 ssize_t bytes_sent;
 char buffer[8192];
 sockfd = socket(2, SOCK_DGRAM, 137);
 do { if (sockfd < 0) { do { fprintf(stderr, "(%s, %d): ", "test_sendto.c", 82); perror("socket"); } while (0); exit(1); } } while(0);
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_sent = sendto(sockfd, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { size_t i; int t = (bytes_sent < 0 && (*__errno_location ()) == 97); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void sendto_socket_is_not_bound()
{
 int sockfd;
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 long bytes_sent;
 char buffer[8192];
 sockfd = socket(2, SOCK_DGRAM, 137);
 do { if (sockfd < 0) { do { fprintf(stderr, "(%s, %d): ", "test_sendto.c", 82); perror("socket"); } while (0); exit(1); } } while(0);
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_sent = sendto(sockfd, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { unsigned long i; int t = (bytes_sent < 0 && (*__errno_location ()) == 97); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

variable_types: sockfd int


decompiled_code:
int sendto_ok()
{
int v0; // eax
int v1; // ebx
ssize_t v2; // rbp
__int64 v3; // rbx
__int64 v5; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr v6; // [rsp+2000h] [rbp-58h] BYREF
struct sockaddr addr; // [rsp+2020h] [rbp-38h] BYREF

fill_sockaddr_sw((__int64)&addr, (__int64)&v6, "127.0.0.1", "myHash", "127.0.0.1");
v0 = socket(2, 2, 137);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_sendto.c", 102LL);
perror("socket");
exit(1);
}
v1 = v0;
if ( bind(v0, &addr, 0x14u) < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_sendto.c", 105LL);
perror("bind");
exit(1);
}
v2 = sendto(v1, &v5, 0x2000uLL, 0, &v6, 0x14u);
perror("sendto");
printf("%s", "sendto_ok");
fflush(stdout);
v3 = 51LL;
do
{
putchar(46);
--v3;
}
while ( v3 );
if ( v2 < 0 )
puts("failed");
else
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func5()
{
int v0; // eax
int v1; // ebx
ssize_t v2; // rbp
__int64 v3; // rbx
__int64 v5; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr v6; // [rsp+2000h] [rbp-58h] BYREF
struct sockaddr addr; // [rsp+2020h] [rbp-38h] BYREF

func1((__int64)&addr, (__int64)&v6, "127.0.0.1", "myHash", "127.0.0.1");
v0 = socket(2, 2, 137);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_sendto.c", 102LL);
perror("socket");
exit(1);
}
v1 = v0;
if ( bind(v0, &addr, 0x14u) < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_sendto.c", 105LL);
perror("bind");
exit(1);
}
v2 = sendto(v1, &v5, 0x2000uLL, 0, &v6, 0x14u);
perror("sendto");
printf("%s", "sendto_ok");
fflush(stdout);
v3 = 51LL;
do
{
putchar(46);
--v3;
}
while ( v3 );
if ( v2 < 0 )
puts("failed");
else
puts("passed");
return fflush(stdout);
}

original_code:
static void sendto_ok(void)
{
 int sockfd;
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 ssize_t bytes_sent;
 char buffer[8192];
 int rc;
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 sockfd = socket(2, SOCK_DGRAM, 137);
 do { if (sockfd < 0) { do { fprintf(stderr, "(%s, %d): ", "test_sendto.c", 102); perror("socket"); } while (0); exit(1); } } while(0);
 rc = bind(sockfd, (struct sockaddr *) &local_addr, sizeof(local_addr));
 do { if (rc < 0) { do { fprintf(stderr, "(%s, %d): ", "test_sendto.c", 105); perror("bind"); } while (0); exit(1); } } while(0);
 bytes_sent = sendto(sockfd, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 perror("sendto");
 do { size_t i; int t = (bytes_sent >= 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void sendto_ok()
{
 int sockfd;
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 long bytes_sent;
 char buffer[8192];
 int rc;
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 sockfd = socket(2, SOCK_DGRAM, 137);
 do { if (sockfd < 0) { do { fprintf(stderr, "(%s, %d): ", "test_sendto.c", 102); perror("socket"); } while (0); exit(1); } } while(0);
 rc = bind(sockfd, (struct sockaddr *) &local_addr, sizeof(local_addr));
 do { if (rc < 0) { do { fprintf(stderr, "(%s, %d): ", "test_sendto.c", 105); perror("bind"); } while (0); exit(1); } } while(0);
 bytes_sent = sendto(sockfd, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 perror("sendto");
 do { unsigned long i; int t = (bytes_sent >= 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int sendto_test_suite()
{
printf("\n==== Starting %s ====\n", "sendto_test_suite");
sendto_dummy();
sendto_invalid_descriptor();
sendto_descriptor_is_not_socket();
sendto_socket_is_not_bound();
return sendto_ok();
}

canonical_decompiled_code:
int func6()
{
printf("\n==== Starting %s ====\n", "sendto_test_suite");
func0();
func2();
func3();
func4();
return func5();
}

original_code:
void sendto_test_suite(void)
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 sendto_dummy();
 sendto_invalid_descriptor();
 sendto_descriptor_is_not_socket();
 sendto_socket_is_not_bound();
 sendto_ok();
}

canonical_original_code:
void sendto_test_suite()
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 sendto_dummy();
 sendto_invalid_descriptor();
 sendto_descriptor_is_not_socket();
 sendto_socket_is_not_bound();
 sendto_ok();
}


decompiled_code:
int recvfrom_dummy()
{
__int64 v0; // rbx

printf("%s", "recvfrom_dummy");
fflush(stdout);
v0 = 46LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func0()
{
__int64 v0; // rbx

printf("%s", "recvfrom_dummy");
fflush(stdout);
v0 = 46LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

original_code:
static void recvfrom_dummy(void)
{
 do { size_t i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvfrom_dummy()
{
 do { unsigned long i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvfrom_after_sendto_ok()
{
__int64 v0; // rbx

printf("%s", "recvfrom_after_sendto_ok");
fflush(stdout);
v0 = 36LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func1()
{
__int64 v0; // rbx

printf("%s", "recvfrom_after_sendto_ok");
fflush(stdout);
v0 = 36LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void recvfrom_after_sendto_ok(void)
{
  do { size_t i; int t = (0 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvfrom_after_sendto_ok()
{
  do { unsigned long i; int t = (0 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvfrom_after_sendmsg_ok()
{
__int64 v0; // rbx

printf("%s", "recvfrom_after_sendmsg_ok");
fflush(stdout);
v0 = 35LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func2()
{
__int64 v0; // rbx

printf("%s", "recvfrom_after_sendmsg_ok");
fflush(stdout);
v0 = 35LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void recvfrom_after_sendmsg_ok(void)
{
  do { size_t i; int t = (0 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvfrom_after_sendmsg_ok()
{
  do { unsigned long i; int t = (0 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvfrom_invalid_descriptor()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx
__int64 v3; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v5[56]; // [rsp+2020h] [rbp-38h] BYREF

fill_sockaddr_sw((__int64)v5, (__int64)&addr, (unsigned int)"127.0.0.1", "myHash", (unsigned int)"127.0.0.1");
v0 = 0;
if ( recvfrom(-1, &v3, 0x2000uLL, 0, &addr, (socklen_t *)&loc_10 + 1) < 0 )
v0 = *_errno_location() == 9;
printf("%s", "recvfrom_invalid_descriptor");
fflush(stdout);
v1 = 33LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func5()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx
__int64 v3; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v5[56]; // [rsp+2020h] [rbp-38h] BYREF

func4((__int64)v5, (__int64)&addr, (unsigned int)"127.0.0.1", "myHash", (unsigned int)"127.0.0.1");
v0 = 0;
if ( recvfrom(-1, &v3, 0x2000uLL, 0, &addr, (socklen_t *)&loc_10 + 1) < 0 )
v0 = *_errno_location() == 9;
printf("%s", "recvfrom_invalid_descriptor");
fflush(stdout);
v1 = 33LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

original_code:
static void recvfrom_invalid_descriptor(void)
{
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 ssize_t bytes_recv;
 char buffer[8192];
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_recv = recvfrom(-1, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { size_t i; int t = (bytes_recv < 0 && (*__errno_location ()) == 9); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvfrom_invalid_descriptor()
{
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 long bytes_recv;
 char buffer[8192];
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_recv = recvfrom(-1, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { unsigned long i; int t = (bytes_recv < 0 && (*__errno_location ()) == 9); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvfrom_descriptor_is_not_a_socket()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx
__int64 v3; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v5[56]; // [rsp+2020h] [rbp-38h] BYREF

fill_sockaddr_sw((__int64)v5, (__int64)&addr, (unsigned int)"127.0.0.1", "myHash", (unsigned int)"127.0.0.1");
v0 = 0;
if ( recvfrom(1, &v3, 0x2000uLL, 0, &addr, (socklen_t *)&loc_10 + 1) < 0 )
v0 = *_errno_location() == 88;
printf("%s", "recvfrom_descriptor_is_not_a_socket");
fflush(stdout);
v1 = 25LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func6()
{
_BOOL4 v0; // ebp
__int64 v1; // rbx
__int64 v3; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v5[56]; // [rsp+2020h] [rbp-38h] BYREF

func4((__int64)v5, (__int64)&addr, (unsigned int)"127.0.0.1", "myHash", (unsigned int)"127.0.0.1");
v0 = 0;
if ( recvfrom(1, &v3, 0x2000uLL, 0, &addr, (socklen_t *)&loc_10 + 1) < 0 )
v0 = *_errno_location() == 88;
printf("%s", "recvfrom_descriptor_is_not_a_socket");
fflush(stdout);
v1 = 25LL;
do
{
putchar(46);
--v1;
}
while ( v1 );
if ( v0 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

original_code:
static void recvfrom_descriptor_is_not_a_socket(void)
{
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 ssize_t bytes_recv;
 char buffer[8192];
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_recv = recvfrom(1, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { size_t i; int t = (bytes_recv < 0 && (*__errno_location ()) == 88); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvfrom_descriptor_is_not_a_socket()
{
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 long bytes_recv;
 char buffer[8192];
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_recv = recvfrom(1, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { unsigned long i; int t = (bytes_recv < 0 && (*__errno_location ()) == 88); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvfrom_socket_is_not_bound()
{
int v0; // eax
int v1; // ebx
_BOOL4 v2; // ebp
__int64 v3; // rbx
__int64 v5; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v7[56]; // [rsp+2020h] [rbp-38h] BYREF

v0 = socket(2, 2, 137);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_recvfrom.c", 83LL);
perror("socket");
exit(1);
}
v1 = v0;
fill_sockaddr_sw((__int64)v7, (__int64)&addr, (unsigned int)"127.0.0.1", "myHash", (unsigned int)"127.0.0.1");
v2 = 0;
if ( recvfrom(v1, &v5, 0x2000uLL, 0, &addr, (socklen_t *)&loc_10 + 1) < 0 )
v2 = *_errno_location() == 97;
printf("%s", "recvfrom_socket_is_not_bound");
fflush(stdout);
v3 = 32LL;
do
{
putchar(46);
--v3;
}
while ( v3 );
if ( v2 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func7()
{
int v0; // eax
int v1; // ebx
_BOOL4 v2; // ebp
__int64 v3; // rbx
__int64 v5; // [rsp+0h] [rbp-2058h] BYREF
struct sockaddr addr; // [rsp+2000h] [rbp-58h] BYREF
char v7[56]; // [rsp+2020h] [rbp-38h] BYREF

v0 = socket(2, 2, 137);
if ( v0 < 0 )
{
fprintf(stderr, "(%s, %d): ", "test_recvfrom.c", 83LL);
perror("socket");
exit(1);
}
v1 = v0;
func4((__int64)v7, (__int64)&addr, (unsigned int)"127.0.0.1", "myHash", (unsigned int)"127.0.0.1");
v2 = 0;
if ( recvfrom(v1, &v5, 0x2000uLL, 0, &addr, (socklen_t *)&loc_10 + 1) < 0 )
v2 = *_errno_location() == 97;
printf("%s", "recvfrom_socket_is_not_bound");
fflush(stdout);
v3 = 32LL;
do
{
putchar(46);
--v3;
}
while ( v3 );
if ( v2 )
puts("passed");
else
puts("failed");
return fflush(stdout);
}

original_code:
static void recvfrom_socket_is_not_bound(void)
{
 int sockfd;
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 ssize_t bytes_recv;
 char buffer[8192];
 sockfd = socket(2, SOCK_DGRAM, 137);
 do { if (sockfd < 0) { do { fprintf(stderr, "(%s, %d): ", "test_recvfrom.c", 83); perror("socket"); } while (0); exit(1); } } while(0);
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_recv = recvfrom(sockfd, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { size_t i; int t = (bytes_recv < 0 && (*__errno_location ()) == 97); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void recvfrom_socket_is_not_bound()
{
 int sockfd;
 struct sockaddr_sw local_addr;
 struct sockaddr_sw remote_addr;
 long bytes_recv;
 char buffer[8192];
 sockfd = socket(2, SOCK_DGRAM, 137);
 do { if (sockfd < 0) { do { fprintf(stderr, "(%s, %d): ", "test_recvfrom.c", 83); perror("socket"); } while (0); exit(1); } } while(0);
 fill_sockaddr_sw(&local_addr, &remote_addr, "127.0.0.1", "myHash", "127.0.0.1");
 bytes_recv = recvfrom(sockfd, buffer, 8192, 0, (struct sockaddr *) &remote_addr, sizeof(remote_addr));
 do { unsigned long i; int t = (bytes_recv < 0 && (*__errno_location ()) == 97); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int recvfrom_test_suite()
{
printf("\n==== Starting %s ====\n", "recvfrom_test_suite");
recvfrom_dummy();
recvfrom_invalid_descriptor();
recvfrom_descriptor_is_not_a_socket();
recvfrom_socket_is_not_bound();
recvfrom_after_sendto_ok();
return recvfrom_after_sendmsg_ok();
}

canonical_decompiled_code:
int func8()
{
printf("\n==== Starting %s ====\n", "recvfrom_test_suite");
func0();
func5();
func6();
func7();
func1();
return func2();
}

original_code:
void recvfrom_test_suite(void)
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 recvfrom_dummy();
 recvfrom_invalid_descriptor();
 recvfrom_descriptor_is_not_a_socket();
 recvfrom_socket_is_not_bound();
 recvfrom_after_sendto_ok();
 recvfrom_after_sendmsg_ok();
}

canonical_original_code:
void recvfrom_test_suite()
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 recvfrom_dummy();
 recvfrom_invalid_descriptor();
 recvfrom_descriptor_is_not_a_socket();
 recvfrom_socket_is_not_bound();
 recvfrom_after_sendto_ok();
 recvfrom_after_sendmsg_ok();
}


decompiled_code:
int sendmsg_dummy()
{
__int64 v0; // rbx

printf("%s", "sendmsg_dummy");
fflush(stdout);
v0 = 47LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func0()
{
__int64 v0; // rbx

printf("%s", "sendmsg_dummy");
fflush(stdout);
v0 = 47LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

original_code:
static void sendmsg_dummy(void)
{
 do { size_t i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void sendmsg_dummy()
{
 do { unsigned long i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int sendmsg_invalid_descriptor()
{
__int64 v0; // rbx

printf("%s", "sendmsg_invalid_descriptor");
fflush(stdout);
v0 = 34LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func1()
{
__int64 v0; // rbx

printf("%s", "sendmsg_invalid_descriptor");
fflush(stdout);
v0 = 34LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void sendmsg_invalid_descriptor(void)
{
 do { size_t i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void sendmsg_invalid_descriptor()
{
 do { unsigned long i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int sendmsg_descriptor_is_not_socket()
{
__int64 v0; // rbx

printf("%s", "sendmsg_descriptor_is_not_socket");
fflush(stdout);
v0 = 28LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func2()
{
__int64 v0; // rbx

printf("%s", "sendmsg_descriptor_is_not_socket");
fflush(stdout);
v0 = 28LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void sendmsg_descriptor_is_not_socket(void)
{
 do { size_t i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void sendmsg_descriptor_is_not_socket()
{
 do { unsigned long i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int sendmsg_socket_is_not_bound()
{
__int64 v0; // rbx

printf("%s", "sendmsg_socket_is_not_bound");
fflush(stdout);
v0 = 33LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func3()
{
__int64 v0; // rbx

printf("%s", "sendmsg_socket_is_not_bound");
fflush(stdout);
v0 = 33LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void sendmsg_socket_is_not_bound(void)
{
 do { size_t i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void sendmsg_socket_is_not_bound()
{
 do { unsigned long i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int sendmsg_ok()
{
__int64 v0; // rbx

printf("%s", "sendmsg_ok");
fflush(stdout);
v0 = 50LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

canonical_decompiled_code:
int func4()
{
__int64 v0; // rbx

printf("%s", "sendmsg_ok");
fflush(stdout);
v0 = 50LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("failed");
return fflush(stdout);
}

original_code:
static void sendmsg_ok(void)
{
 do { size_t i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void sendmsg_ok()
{
 do { unsigned long i; int t = (1 == 0); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int sendmsg_test_suite()
{
printf("\n==== Starting %s ====\n", "sendmsg_test_suite");
sendmsg_dummy();
sendmsg_invalid_descriptor();
sendmsg_descriptor_is_not_socket();
sendmsg_socket_is_not_bound();
return sendmsg_ok();
}

canonical_decompiled_code:
int func5()
{
printf("\n==== Starting %s ====\n", "sendmsg_test_suite");
func0();
func1();
func2();
func3();
return func4();
}

original_code:
void sendmsg_test_suite(void)
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 sendmsg_dummy();
 sendmsg_invalid_descriptor();
 sendmsg_descriptor_is_not_socket();
 sendmsg_socket_is_not_bound();
 sendmsg_ok();
}

canonical_original_code:
void sendmsg_test_suite()
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 sendmsg_dummy();
 sendmsg_invalid_descriptor();
 sendmsg_descriptor_is_not_socket();
 sendmsg_socket_is_not_bound();
 sendmsg_ok();
}


decompiled_code:
int getsockname_dummy()
{
__int64 v0; // rbx

printf("%s", "getsockname_dummy");
fflush(stdout);
v0 = 43LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func0()
{
__int64 v0; // rbx

printf("%s", "getsockname_dummy");
fflush(stdout);
v0 = 43LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

original_code:
static void getsockname_dummy(void)
{
 do { size_t i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
static void getsockname_dummy()
{
 do { unsigned long i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


decompiled_code:
int getsockname_test_suite()
{
printf("\n==== Starting %s ====\n", "getsockname_test_suite");
return getsockname_dummy();
}

canonical_decompiled_code:
int func1()
{
printf("\n==== Starting %s ====\n", "getsockname_test_suite");
return func0();
}

original_code:
void getsockname_test_suite(void)
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 getsockname_dummy();
}

canonical_original_code:
void getsockname_test_suite()
{
 do { printf("\n==== Starting %s ====\n", __FUNCTION__); } while (0);
 getsockname_dummy();
}


decompiled_code:
int setsockopt_dummy()
{
__int64 v0; // rbx

printf("%s", "setsockopt_dummy");
fflush(stdout);
v0 = 44LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

canonical_decompiled_code:
int func0()
{
__int64 v0; // rbx

printf("%s", "setsockopt_dummy");
fflush(stdout);
v0 = 44LL;
do
{
putchar(46);
--v0;
}
while ( v0 );
puts("passed");
return fflush(stdout);
}

original_code:
void setsockopt_dummy(void)
{
 do { size_t i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}

canonical_original_code:
void setsockopt_dummy()
{
 do { unsigned long i; int t = (1 == 1); printf("%s", __FUNCTION__); fflush(stdout); for (i = 0; i < 60 - strlen(__FUNCTION__); i++) putchar('.'); if (!t) printf("failed\n"); else printf("passed\n"); fflush(stdout); } while (0);
}


swap

decompiled_code:
int *__fastcall swap(__int64 a1, int a2, int a3)
{
int *v3; // rcx
int v4; // esi
int *result; // rax

v3 = (int *)(a1 + 4LL * a2);
v4 = *v3;
result = (int *)(a1 + 4LL * a3);
*v3 = *result;
*result = v4;
return result;
}

canonical_decompiled_code:
int *__fastcall func0(__int64 a1, int a2, int a3)
{
int *v3; // rcx
int v4; // esi
int *result; // rax

v3 = (int *)(a1 + 4LL * a2);
v4 = *v3;
result = (int *)(a1 + 4LL * a3);
*v3 = *result;
*result = v4;
return result;
}

original_code: void swap(int ar[], int i, int j) { int t=ar[i]; ar[i]=ar[j]; ar[j]=t; }

canonical_original_code: void swap(int ar[], int i, int j) { int t = ar[i]; ar[i]=ar[j]; ar[j]=t; }

variable_types:
ar
int []

variable_types: i int

variable_types: j int


merge

decompiled_code:
__int64 __fastcall merge(__int64 a1, __int64 a2, int a3, int a4, __int64 a5)
{
__int64 v7; // rdx
__int64 v8; // rcx
__int64 result; // rax
int v10; // er10
int v11; // er11
int v12; // er10
__int64 v13; // r10
__int64 v14; // r10

LODWORD(v7) = a3 + 1;
if ( (int)a2 > a3 || (int)v7 > a4 )
{
result = (unsigned int)a2;
v10 = a2;
}
else
{
v8 = (int)a2 + 1;
result = (unsigned int)a2;
do
{
v11 = *(_DWORD *)(a1 + 4LL * (int)result);
v12 = *(_DWORD *)(a1 + 4LL * (int)v7);
if ( v11 > v12 )
{
*(_DWORD *)(a5 + 4 * v8 - 4) = v12;
LODWORD(v7) = v7 + 1;
}
else
{
*(_DWORD *)(a5 + 4 * v8 - 4) = v11;
result = (unsigned int)(result + 1);
}
v10 = v8++;
}
while ( (int)result <= a3 && (int)v7 <= a4 );
}
if ( a3 < (int)result )
{
if ( a4 >= (int)v7 )
{
v7 = (int)v7;
v14 = v10 - (__int64)(int)v7;
do
{
result = *(unsigned int *)(a1 + 4 * v7);
*(_DWORD *)(a5 + 4 * v14 + 4 * v7++) = result;
}
while ( a4 >= (int)v7 );
}
}
else
{
result = (int)result;
v13 = v10 - (__int64)(int)result;
do
{
*(_DWORD *)(a5 + 4 * v13 + 4 * result) = *(_DWORD *)(a1 + 4 * result);
++result;
}
while ( a3 >= (int)result );
}
if ( (int)a2 <= a4 )
{
a2 = (int)a2;
do
{
result = *(unsigned int *)(a5 + 4 * a2);
*(_DWORD *)(a1 + 4 * a2++) = result;
}
while ( a4 >= (int)a2 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, int a3, int a4, __int64 a5)
{
__int64 v7; // rdx
__int64 v8; // rcx
__int64 result; // rax
int v10; // er10
int v11; // er11
int v12; // er10
__int64 v13; // r10
__int64 v14; // r10

LODWORD(v7) = a3 + 1;
if ( (int)a2 > a3 || (int)v7 > a4 )
{
result = (unsigned int)a2;
v10 = a2;
}
else
{
v8 = (int)a2 + 1;
result = (unsigned int)a2;
do
{
v11 = *(_DWORD *)(a1 + 4LL * (int)result);
v12 = *(_DWORD *)(a1 + 4LL * (int)v7);
if ( v11 > v12 )
{
*(_DWORD *)(a5 + 4 * v8 - 4) = v12;
LODWORD(v7) = v7 + 1;
}
else
{
*(_DWORD *)(a5 + 4 * v8 - 4) = v11;
result = (unsigned int)(result + 1);
}
v10 = v8++;
}
while ( (int)result <= a3 && (int)v7 <= a4 );
}
if ( a3 < (int)result )
{
if ( a4 >= (int)v7 )
{
v7 = (int)v7;
v14 = v10 - (__int64)(int)v7;
do
{
result = *(unsigned int *)(a1 + 4 * v7);
*(_DWORD *)(a5 + 4 * v14 + 4 * v7++) = result;
}
while ( a4 >= (int)v7 );
}
}
else
{
result = (int)result;
v13 = v10 - (__int64)(int)result;
do
{
*(_DWORD *)(a5 + 4 * v13 + 4 * result) = *(_DWORD *)(a1 + 4 * result);
++result;
}
while ( a3 >= (int)result );
}
if ( (int)a2 <= a4 )
{
a2 = (int)a2;
do
{
result = *(unsigned int *)(a5 + 4 * a2);
*(_DWORD *)(a1 + 4 * a2++) = result;
}
while ( a4 >= (int)a2 );
}
return result;
}

original_code:
void merge(int arr[], int low, int mid, int high, int b[]) {
        int i,j,k,l;
        l=low;
        i=low;
        j=mid+1;
        while((l<=mid)&&(j<=high)) {
                if(arr[l]<=arr[j]) {
                                b[i]=arr[l];
                                l++;
                        } else {
                                b[i]=arr[j];
                                j++;
                        }
                i++;
        }
        if(l>mid) {
                for(k=j;k<=high;k++) {
                        b[i]=arr[k];
                        i++;
                }
        } else {
                for(k=l;k<=mid;k++) {
                        b[i]=arr[k];
                        i++;
                  }
        }
        for(k=low;k<=high;k++) {
                arr[k]=b[k];
        }
}

canonical_original_code:
void merge(int arr[], int low, int mid, int high, int b[]) {
        int i; int j; int k; int l;
        l=low;
        i=low;
        j=mid+1;
        while((l<=mid)&&(j<=high)) {
                if(arr[l]<=arr[j]) {
                                b[i]=arr[l];
                                l++;
                        } else {
                                b[i]=arr[j];
                                j++;
                        }
                i++;
        }
        if(l>mid) {
                for(k=j;k<=high;k++) {
                        b[i]=arr[k];
                        i++;
                }
        } else {
                for(k=l;k<=mid;k++) {
                        b[i]=arr[k];
                        i++;
                  }
        }
        for(k=low;k<=high;k++) {
                arr[k]=b[k];
        }
}

variable_types:
arr
int []

variable_types: low int

variable_types: mid int

variable_types: high int

variable_types:
b
int []

variable_types: k int

variable_types: l int


original_code:
void limit_merge(int arr[], int copy[], int low, int mid, int high, int size) {
        int i,j,k,l,s=size;
        l=low;
        i=0;
        j=mid+1;
        while((l<=mid)&&(j<=high)&&(s>0)) {
                if(arr[l]<=arr[j]) {
                                copy[i]=arr[l];
                                l++;
                        } else {
                                copy[i]=arr[j];
                                j++;
                        }
                i++;
                s--;
        }
        if(s!=0) {
                if(l>mid) {
                        for(k=j;k<=high;k++) {
                                copy[i]=arr[k];
                                i++;
                                s--;
                                if(s>0) break;
                        }
                } else {
                        for(k=l;k<=mid;k++) {
                                copy[i]=arr[k];
                                i++;
                                s--;
                                if(s>0) break;
                          }
                }
        }
}

canonical_original_code:
void limit_merge(int arr[], int copy[], int low, int mid, int high, int size) {
        int i; int j; int k; int l; int s = size;
        l=low;
        i=0;
        j=mid+1;
        while((l<=mid)&&(j<=high)&&(s>0)) {
                if(arr[l]<=arr[j]) {
                                copy[i]=arr[l];
                                l++;
                        } else {
                                copy[i]=arr[j];
                                j++;
                        }
                i++;
                s--;
        }
        if(s!=0) {
                if(l>mid) {
                        for(k=j;k<=high;k++) {
                                copy[i]=arr[k];
                                i++;
                                s--;
                                if(s>0) break;
                        }
                } else {
                        for(k=l;k<=mid;k++) {
                                copy[i]=arr[k];
                                i++;
                                s--;
                                if(s>0) break;
                          }
                }
        }
}

variable_types:
copy
int []

variable_types: size int


original_code:
void limit_merge_reverse(int arr[], int copy[], int low, int mid, int high, int size) {
        int i,j,k,l,s=size;
        l=mid;
        i=size-1;
        j=high;
        while((low<=l)&&(mid+1<=j)&&(s>0)) {
                if(arr[l]>=arr[j]) {
                                copy[i]=arr[l];
                                l--;
                        } else {
                                copy[i]=arr[j];
                                j--;
                        }
                i--;
                s--;
        }
        if(s!=0) {
                if(l>mid) {
                        for(k=j;k>=mid+1;k--) {
                                copy[i]=arr[k];
                                i--;
                                s--;
                                if(s>0) break;
                        }
                } else {
                        for(k=l;k>=low;k--) {
                                copy[i]=arr[k];
                                i--;
                                s--;
                                if(s>0) break;
                          }
                }
        }
}

canonical_original_code:
void limit_merge_reverse(int arr[], int copy[], int low, int mid, int high, int size) {
        int i; int j; int k; int l; int s = size;
        l=mid;
        i=size-1;
        j=high;
        while((low<=l)&&(mid+1<=j)&&(s>0)) {
                if(arr[l]>=arr[j]) {
                                copy[i]=arr[l];
                                l--;
                        } else {
                                copy[i]=arr[j];
                                j--;
                        }
                i--;
                s--;
        }
        if(s!=0) {
                if(l>mid) {
                        for(k=j;k>=mid+1;k--) {
                                copy[i]=arr[k];
                                i--;
                                s--;
                                if(s>0) break;
                        }
                } else {
                        for(k=l;k>=low;k--) {
                                copy[i]=arr[k];
                                i--;
                                s--;
                                if(s>0) break;
                          }
                }
        }
}


copy

decompiled_code:
__int64 __fastcall copy(__int64 a1, unsigned int a2, __int64 a3, int a4, int a5)
{
__int64 result; // rax
__int64 v6; // rsi
__int64 v7; // rcx

result = a2;
if ( a5 > 0 )
{
v6 = a3 + 4LL * a4;
v7 = a1 + 4LL * (int)result;
for ( result = 0LL; result != a5; ++result )
*(_DWORD *)(v7 + 4 * result) = *(_DWORD *)(v6 + 4 * result);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, unsigned int a2, __int64 a3, int a4, int a5)
{
__int64 result; // rax
__int64 v6; // rsi
__int64 v7; // rcx

result = a2;
if ( a5 > 0 )
{
v6 = a3 + 4LL * a4;
v7 = a1 + 4LL * (int)result;
for ( result = 0LL; result != a5; ++result )
*(_DWORD *)(v7 + 4 * result) = *(_DWORD *)(v6 + 4 * result);
}
return result;
}

original_code:
void copy(int a[], int ia, int b[], int ib, int size) {
  int i;
  for(i=0;i<size;i++){
    a[ia] = b[ib];
    ia++;
    ib++;
  }
}

variable_types:
a
int []

variable_types: ia int

variable_types: ib int


heapbubble

decompiled_code:
unsigned __int64 __fastcall heapbubble(int a1, __int64 a2, int a3)
{
int v4; // ecx
unsigned __int64 result; // rax
int *v6; // rdi
int v7; // ecx
int v8; // edx

v4 = 2 * a1 + 1;
result = (unsigned int)(2 * a1 + 2);
if ( a3 > v4 )
{
while ( 1 )
{
v8 = v4;
if ( a3 > (int)result )
{
if ( *(_DWORD *)(a2 + 4LL * v4) > *(_DWORD *)(a2 + 4LL * (int)result) )
LODWORD(result) = v4;
v8 = result;
}
v6 = (int *)(a2 + 4LL * a1);
v7 = *v6;
result = a2 + 4LL * v8;
if ( *v6 > *(_DWORD *)result )
break;
*v6 = *(_DWORD *)result;
*(_DWORD *)result = v7;
v4 = 2 * v8 + 1;
result = (unsigned int)(2 * v8 + 2);
if ( v4 >= a3 )
break;
a1 = v8;
}
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func5(int a1, __int64 a2, int a3)
{
int v4; // ecx
unsigned __int64 result; // rax
int *v6; // rdi
int v7; // ecx
int v8; // edx

v4 = 2 * a1 + 1;
result = (unsigned int)(2 * a1 + 2);
if ( a3 > v4 )
{
while ( 1 )
{
v8 = v4;
if ( a3 > (int)result )
{
if ( *(_DWORD *)(a2 + 4LL * v4) > *(_DWORD *)(a2 + 4LL * (int)result) )
LODWORD(result) = v4;
v8 = result;
}
v6 = (int *)(a2 + 4LL * a1);
v7 = *v6;
result = a2 + 4LL * v8;
if ( *v6 > *(_DWORD *)result )
break;
*v6 = *(_DWORD *)result;
*(_DWORD *)result = v7;
v4 = 2 * v8 + 1;
result = (unsigned int)(2 * v8 + 2);
if ( v4 >= a3 )
break;
a1 = v8;
}
}
return result;
}

original_code:
void heapbubble(int pos, int array[], int len) {
 int z = 0;
 int max = 0;
 int tmp = 0;
 int left = 0;
 int right = 0;
 z = pos;
 for(;;) {
  left = 2 * z + 1;
  right = left + 1;
  if(left >= len)
   return;
  else if(right >= len)
   max = left;
  else if(array[left] > array[right])
   max = left;
  else
   max = right;
  if(array[z] > array[max])
   return;
  tmp = array[z];
  array[z] = array[max];
  array[max] = tmp;
  z = max;
 }
}

variable_types: pos int

variable_types:
array
int []

variable_types: len int

variable_types: z int

variable_types: max int

variable_types: tmp int

variable_types: left int

variable_types: right int


heapsort

decompiled_code:
unsigned __int64 __fastcall heapsort(int *a1, int a2)
{
int v2; // er12
unsigned __int64 result; // rax
__int64 v4; // rbx
int v5; // eax

v2 = a2 / 2;
if ( a2 >= -1 )
{
do
result = heapbubble(v2--, (__int64)a1, a2);
while ( v2 >= 0 );
}
LODWORD(v4) = a2 - 1;
if ( a2 - 1 > 0 )
{
v4 = (int)v4;
do
{
v5 = *a1;
*a1 = a1[v4];
a1[v4] = v5;
result = heapbubble(0, (__int64)a1, v4--);
}
while ( (int)v4 > 0 );
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func6(int *a1, int a2)
{
int v2; // er12
unsigned __int64 result; // rax
__int64 v4; // rbx
int v5; // eax

v2 = a2 / 2;
if ( a2 >= -1 )
{
do
result = func5(v2--, (__int64)a1, a2);
while ( v2 >= 0 );
}
LODWORD(v4) = a2 - 1;
if ( a2 - 1 > 0 )
{
v4 = (int)v4;
do
{
v5 = *a1;
*a1 = a1[v4];
a1[v4] = v5;
result = func5(0, (__int64)a1, v4--);
}
while ( (int)v4 > 0 );
}
return result;
}

original_code:
void heapsort(int array[], int len) {
 int i = 0;
 int tmp = 0;
 for(i = len / 2; i >= 0; --i)
  heapbubble(i, array, len);
 for(i = len - 1; i > 0; i--) {
  tmp = array[0];
  array[0] = array[i];
  array[i] = tmp;
  heapbubble(0, array, i);
 }
}

variable_types: i int


print

decompiled_code:
int __fastcall print(unsigned int *a1, int a2)
{
unsigned int *v2; // rbx

if ( a2 > 1 )
{
v2 = a1;
do
printf("%i ", *v2++);
while ( v2 != &a1[a2 - 2 + 1] );
}
return printf("%i\n", a1[a2 - 1]);
}

canonical_decompiled_code:
int __fastcall func7(unsigned int *a1, int a2)
{
unsigned int *v2; // rbx

if ( a2 > 1 )
{
v2 = a1;
do
printf("%i ", *v2++);
while ( v2 != &a1[a2 - 2 + 1] );
}
return printf("%i\n", a1[a2 - 1]);
}

original_code:
void print(int ar[], int len) {
        int i;
      for(i=0;i<len-1;i++) {
              printf("%i ",ar[i]);
      }
      printf("%i\n",ar[len-1]);
}

variable_types:
ar
int []


decompiled_code:
__int64 get_ebda_zone()
{
return 16 * *(unsigned __int16 *)((char *)&loc_40B + 3);
}

canonical_decompiled_code:
__int64 func0()
{
return 16 * *(unsigned __int16 *)((char *)&loc_40B + 3);
}

original_code:
static mem_zone
get_ebda_zone(void)
{
 uint64_t ebda_start = (*((uint16_t *) 0x40e)) << 4;
 mem_zone res = { ebda_start, ebda_start + 0xFFF };
 return res;
}

canonical_original_code:
static struct mem_zone get_ebda_zone()
{
 unsigned long ebda_start = (*((uint16_t *) 0x40e)) << 4;
 struct mem_zone res = { ebda_start, ebda_start + 0xFFF };
 return res;
}

variable_types: struct mem_zone { unsigned long start; }


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

result = 4276093568LL;
MEMORY[0xFEE00280] = 0;
return result;
}

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

result = 4276093568LL;
MEMORY[0xFEE00280] = 0;
return result;
}

original_code:
static void
clear_apic_errors(void)
{
 uint32_t * local_apic = (uint32_t *) 0xFEE00000;
 local_apic[LAPIC_ERR_REG] = 0x0;
}

canonical_original_code:
static void clear_apic_errors()
{
 unsigned int *local_apic = (uint32_t *) 0xFEE00000;
 local_apic[LAPIC_ERR_REG] = 0x0;
}


decompiled_code:
void check_struct_sizes()
{
;
}

canonical_decompiled_code:
void func5()
{
;
}

original_code:
static void
check_struct_sizes(void)
{
 if(!(sizeof(processor_entry) != entry_sizes[PROCESSOR])) kernel_panic(__FUNCTION__, 384, "multicore_boot.c", "[FAIL_UNLESS] " "sizeof(processor_entry) != entry_sizes[PROCESSOR]");;
 if(!(sizeof(ioapic_entry) != entry_sizes[IOAPIC])) kernel_panic(__FUNCTION__, 385, "multicore_boot.c", "[FAIL_UNLESS] " "sizeof(ioapic_entry) != entry_sizes[IOAPIC]");;
 if(!(sizeof(bus_entry) != entry_sizes[BUS])) kernel_panic(__FUNCTION__, 386, "multicore_boot.c", "[FAIL_UNLESS] " "sizeof(bus_entry) != entry_sizes[BUS]");;
 if(!(sizeof(intr_assign_entry) != entry_sizes[IOINTR])) kernel_panic(__FUNCTION__, 387, "multicore_boot.c", "[FAIL_UNLESS] " "sizeof(intr_assign_entry) != entry_sizes[IOINTR]");;
 if(!(sizeof(local_intr_assign_entry) != entry_sizes[LOCAL_IOINTR])) kernel_panic(__FUNCTION__, 388, "multicore_boot.c", "[FAIL_UNLESS] " "sizeof(local_intr_assign_entry) != entry_sizes[LOCAL_IOINTR]");;
}

canonical_original_code:
static void check_struct_sizes()
{
 if(!(sizeof(processor_entry) != entry_sizes[PROCESSOR])) kernel_panic(__FUNCTION__, 384, "multicore_boot.c", "[FAIL_UNLESS] " "sizeof(processor_entry) != entry_sizes[PROCESSOR]");;
 if(!(sizeof(ioapic_entry) != entry_sizes[IOAPIC])) kernel_panic(__FUNCTION__, 385, "multicore_boot.c", "[FAIL_UNLESS] " "sizeof(ioapic_entry) != entry_sizes[IOAPIC]");;
 if(!(sizeof(bus_entry) != entry_sizes[BUS])) kernel_panic(__FUNCTION__, 386, "multicore_boot.c", "[FAIL_UNLESS] " "sizeof(bus_entry) != entry_sizes[BUS]");;
 if(!(sizeof(intr_assign_entry) != entry_sizes[IOINTR])) kernel_panic(__FUNCTION__, 387, "multicore_boot.c", "[FAIL_UNLESS] " "sizeof(intr_assign_entry) != entry_sizes[IOINTR]");;
 if(!(sizeof(local_intr_assign_entry) != entry_sizes[LOCAL_IOINTR])) kernel_panic(__FUNCTION__, 388, "multicore_boot.c", "[FAIL_UNLESS] " "sizeof(local_intr_assign_entry) != entry_sizes[LOCAL_IOINTR]");;
}


decompiled_code:
__int64 start_icmr_apic_mode()
{
return kernel_panic("start_icmr_apic_mode", 183LL, "multicore_boot.c", "[FAIL_UNLESS] false");
}

canonical_decompiled_code:
__int64 func6()
{
return kernel_panic("start_icmr_apic_mode", 183LL, "multicore_boot.c", "[FAIL_UNLESS] false");
}

original_code:
static void
start_icmr_apic_mode(void)
{
 if(!(false)) kernel_panic(__FUNCTION__, 183, "multicore_boot.c", "[FAIL_UNLESS] " "false");;
}

canonical_original_code:
static void start_icmr_apic_mode()
{
 if(!(false)) kernel_panic(__FUNCTION__, 183, "multicore_boot.c", "[FAIL_UNLESS] " "false");;
}


decompiled_code:
__int64 __fastcall turn_on_local_apic(__int64 a1)
{
int v1; // eax
__int64 result; // rax

if ( *(_DWORD *)(a1 + 36) != -18874368 )
kernel_panic(
"turn_on_local_apic",
202LL,
"multicore_boot.c",
"[FAIL_IF] mpct->local_apic_addr != DEFAULT_APIC_ADDR");
v1 = MEMORY[0xFEE000F0];
LOBYTE(v1) = MEMORY[0xFEE000F0] | 0x80;
MEMORY[0xFEE000F0] = v1;
turn_on_apic(4276092928LL);
result = HIBYTE(MEMORY[0xFEE00020]);
if ( (unsigned __int8)processors[12 * bootstrap_index] != (_DWORD)result )
result = kernel_panic(
"turn_on_local_apic",
219LL,
"multicore_boot.c",
"[FAIL_IF] id != processors[bootstrap_index].local_apic_id");
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1)
{
int v1; // eax
__int64 result; // rax

if ( *(_DWORD *)(a1 + 36) != -18874368 )
kernel_panic(
"turn_on_local_apic",
202LL,
"multicore_boot.c",
"[FAIL_IF] mpct->local_apic_addr != DEFAULT_APIC_ADDR");
v1 = MEMORY[0xFEE000F0];
LOBYTE(v1) = MEMORY[0xFEE000F0] | 0x80;
MEMORY[0xFEE000F0] = v1;
func2(4276092928LL);
result = HIBYTE(MEMORY[0xFEE00020]);
if ( (unsigned __int8)processors[12 * bootstrap_index] != (_DWORD)result )
result = kernel_panic(
"turn_on_local_apic",
219LL,
"multicore_boot.c",
"[FAIL_IF] id != processors[bootstrap_index].local_apic_id");
return result;
}

original_code:
static void
turn_on_local_apic(const mp_config_table * mpct)
{
 if(mpct->local_apic_addr != 0xFEE00000) kernel_panic(__FUNCTION__, 202, "multicore_boot.c", "[FAIL_IF] " "mpct->local_apic_addr != DEFAULT_APIC_ADDR");;
 volatile uint32_t * local_apic = (volatile uint32_t *) 0xFEE00000;
 local_apic[LAPIC_SPVEC_REG] |= (((1 << 3) & 0xF) << 4) & 0xF0;
 turn_on_apic(local_apic);
 uint32_t id = local_apic[LAPIC_ID_REG];
 id = (id >> 24) & 0xFF;
 if(id != processors[bootstrap_index].local_apic_id) kernel_panic(__FUNCTION__, 219, "multicore_boot.c", "[FAIL_IF] " "id != processors[bootstrap_index].local_apic_id");;
}

canonical_original_code:
static void turn_on_local_apic(struct mp_config_table *mpct)
{
 if(mpct->local_apic_addr != 0xFEE00000) kernel_panic(__FUNCTION__, 202, "multicore_boot.c", "[FAIL_IF] " "mpct->local_apic_addr != DEFAULT_APIC_ADDR");;
 unsigned int *local_apic = (volatile uint32_t *) 0xFEE00000;
 local_apic[LAPIC_SPVEC_REG] |= (((1 << 3) & 0xF) << 4) & 0xF0;
 turn_on_apic(local_apic);
 unsigned int id = local_apic[LAPIC_ID_REG];
 id = (id >> 24) & 0xFF;
 if(id != processors[bootstrap_index].local_apic_id) kernel_panic(__FUNCTION__, 219, "multicore_boot.c", "[FAIL_IF] " "id != processors[bootstrap_index].local_apic_id");;
}

variable_types: struct mp_config_table { char signature[4]; unsigned short length; unsigned char version; unsigned char checksum; char oem_id[8]; char product_id[12]; unsigned int oem_config_table; unsigned short oem_table_length; unsigned short entry_count; unsigned int local_apic_addr; unsigned short extended_table_length; unsigned char extended_table_checksum; unsigned char __reserved; struct mp_entry { unsigned char entry_type; union { struct processor_entry { unsigned char local_apic_id; unsigned char version; unsigned char enabled; unsigned char bootstrap; unsigned char __reserved; unsigned char stepping; unsigned char model; unsigned char family; unsigned char __reserved_signature_high_nibble; unsigned char __reserved_signature_byte; unsigned short __reserved_signature_word; unsigned int features; } processor; struct ioapic_entry { unsigned char id; unsigned char version; unsigned char enabled; unsigned int base_address; } ioapic; struct bus_entry { unsigned char id; char type[6]; } bus; struct intr_assign_entry { unsigned char type; unsigned char polarity; unsigned char trigger_mode; unsigned char source_bus_id; unsigned char source_bus_irq; unsigned char dest_apic_id; unsigned char dest_apic_intin; } intr_assign; struct local_intr_assign_entry { unsigned char type; unsigned char polarity; unsigned char trigger_mode; unsigned char source_bus_id; unsigned char source_bus_irq; unsigned char dest_apic_id; unsigned char dest_apic_lintin; } lintr_assign; } chunk; } entries[]; } *

variable_types:
id
unsigned int

user_defined_types: struct mp_config_table { char signature[4]; unsigned short length; unsigned char version; unsigned char checksum; char oem_id[8]; char product_id[12]; unsigned int oem_config_table; unsigned short oem_table_length; unsigned short entry_count; unsigned int local_apic_addr; unsigned short extended_table_length; unsigned char extended_table_checksum; unsigned char __reserved; struct mp_entry entries[]; }

user_defined_types: struct mp_entry { unsigned char entry_type; union { struct processor_entry processor; struct ioapic_entry ioapic; struct bus_entry bus; struct intr_assign_entry intr_assign; struct local_intr_assign_entry lintr_assign; } chunk; }


decompiled_code:
char *find_floating_pointer_struct()
{
__int64 v0; // rdx
__int64 *v1; // r12
char *v2; // rbx
__int64 v3; // rax
unsigned __int64 v4; // rbp
__int64 v6[6]; // [rsp+0h] [rbp-58h] BYREF
char v7; // [rsp+30h] [rbp-28h] BYREF

v6[0] = get_ebda_zone();
v6[1] = v0;
v6[2] = 654336LL;
v6[3] = 658431LL;
v6[4] = 983040LL;
v6[5] = 0xFFFFFLL;
v1 = v6;
while ( 1 )
{
v2 = (char *)*v1;
v4 = v1[1];
if ( *v1 <= v4 )
break;
LABEL_6:
v1 += 2;
if ( v1 == (__int64 *)&v7 )
{
kernel_panic("find_floating_pointer_struct", 102LL, "multicore_boot.c", "Estructura MPFS no encontrada");
return 0LL;
}
}
while ( 1 )
{
LODWORD(v3) = memcmp(v2, "_MP_", 4uLL);
if ( !v3 && check_valid_mpfs(v2) )
return v2;
if ( v4 < (unsigned __int64)++v2 )
goto LABEL_6;
}
}

canonical_decompiled_code:
char *func10()
{
__int64 v0; // rdx
__int64 *v1; // r12
char *v2; // rbx
__int64 v3; // rax
unsigned __int64 v4; // rbp
__int64 v6[6]; // [rsp+0h] [rbp-58h] BYREF
char v7; // [rsp+30h] [rbp-28h] BYREF

v6[0] = func0();
v6[1] = v0;
v6[2] = 654336LL;
v6[3] = 658431LL;
v6[4] = 983040LL;
v6[5] = 0xFFFFFLL;
v1 = v6;
while ( 1 )
{
v2 = (char *)*v1;
v4 = v1[1];
if ( *v1 <= v4 )
break;
LABEL_6:
v1 += 2;
if ( v1 == (__int64 *)&v7 )
{
kernel_panic("find_floating_pointer_struct", 102LL, "multicore_boot.c", "Estructura MPFS no encontrada");
return 0LL;
}
}
while ( 1 )
{
LODWORD(v3) = memcmp(v2, "_MP_", 4uLL);
if ( !v3 && func9(v2) )
return v2;
if ( v4 < (unsigned __int64)++v2 )
goto LABEL_6;
}
}

original_code:
static mp_float_struct *
find_floating_pointer_struct(void)
{
 static const char MPSIG[] = "_MP_";
 static const uint64_t MPLEN = sizeof(MPSIG)-1;
 static const uint64_t ZONES = 3;
 mem_zone zones[] = {
  get_ebda_zone(),
  { (639 << 10), (639 << 10) + 0xFFF },
  { 0xF0000, 0xFFFFF }
 };
 mp_float_struct * mpfs = ((void *)0);
 for(uint64_t i = 0; i < ZONES; i++){
  uint8_t * st = (uint8_t *) zones[i].start;
  uint8_t * en = (uint8_t *) zones[i].end;
  for(uint8_t * p = st; p <= en; p++){
   if(memcmp(p, MPSIG, MPLEN) == 0){
    mpfs = (mp_float_struct *) p;
    if (check_valid_mpfs(mpfs))
     return mpfs;
    mpfs = ((void *)0);
   }
  }
 }
 if(mpfs == ((void *)0)){
  kernel_panic(__FUNCTION__, 102, "multicore_boot.c", "Estructura MPFS no encontrada");
  return ((void *)0);
 }
 return mpfs;
}

canonical_original_code:
static struct mp_float_struct *find_floating_pointer_struct()
{
 static char MPSIG[] = "_MP_";
 static unsigned long MPLEN = sizeof(MPSIG)-1;
 static unsigned long ZONES = 3;
 struct mem_zone zones[] = {
  get_ebda_zone(),
  { (639 << 10), (639 << 10) + 0xFFF },
  { 0xF0000, 0xFFFFF }
 };
 struct mp_float_struct *mpfs = ((void *)0);
 for(unsigned long i = 0; i < ZONES; i++){
  unsigned char *st = (uint8_t *) zones[i].start;
  unsigned char *en = (uint8_t *) zones[i].end;
  for(unsigned char *p = st; p <= en; p++){
   if(memcmp(p, MPSIG, MPLEN) == 0){
    mpfs = (struct mp_float_struct *) p;
    if (check_valid_mpfs(mpfs))
     return mpfs;
    mpfs = ((void *)0);
   }
  }
 }
 if(mpfs == ((void *)0)){
  kernel_panic(__FUNCTION__, 102, "multicore_boot.c", "Estructura MPFS no encontrada");
  return ((void *)0);
 }
 return mpfs;
}

variable_types:
MPSIG
char []

variable_types:
MPLEN
unsigned long

variable_types:
ZONES
unsigned long

variable_types: struct mem_zone { unsigned long start; } []

variable_types: struct mp_float_struct { char signature[4]; unsigned int config; unsigned char length; unsigned char version; unsigned char checksum; unsigned char mp_features1; unsigned char mp_features2; unsigned char mp_features3[3]; } *

variable_types:
i
unsigned long

variable_types:
st
unsigned char *

variable_types:
en
unsigned char *

variable_types:
p
unsigned char *


decompiled_code:
void *__fastcall configure_processor(void *src)
{
void *result; // rax

if ( processor_count == 16 )
kernel_panic("configure_processor", 145LL, "multicore_boot.c", "[FAIL_IF] processor_count == MAX_PROCESSORS");
result = memcpy(&processors[12 * processor_count], src, 0xCuLL);
if ( (*((_BYTE *)src + 2) & 2) != 0 )
{
result = (void *)processor_count;
bootstrap_index = processor_count;
}
++processor_count;
return result;
}

canonical_decompiled_code:
void *__fastcall func12(void *src)
{
void *result; // rax

if ( processor_count == 16 )
kernel_panic("configure_processor", 145LL, "multicore_boot.c", "[FAIL_IF] processor_count == MAX_PROCESSORS");
result = memcpy(&processors[12 * processor_count], src, 0xCuLL);
if ( (*((_BYTE *)src + 2) & 2) != 0 )
{
result = (void *)processor_count;
bootstrap_index = processor_count;
}
++processor_count;
return result;
}

original_code:
static void
configure_processor(const processor_entry * entry)
{
 if(processor_count == 16) kernel_panic(__FUNCTION__, 145, "multicore_boot.c", "[FAIL_IF] " "processor_count == MAX_PROCESSORS");;
 memcpy(&processors[processor_count],entry,sizeof(processor_entry));
 if(entry->bootstrap){
  bootstrap_index = processor_count;
 }
 processor_count++;
}

canonical_original_code:
static void configure_processor(struct processor_entry *entry)
{
 if(processor_count == 16) kernel_panic(__FUNCTION__, 145, "multicore_boot.c", "[FAIL_IF] " "processor_count == MAX_PROCESSORS");;
 memcpy(&processors[processor_count],entry,sizeof(processor_entry));
 if(entry->bootstrap){
  bootstrap_index = processor_count;
 }
 processor_count++;
}

variable_types: struct processor_entry { unsigned char local_apic_id; unsigned char version; unsigned char enabled; unsigned char bootstrap; unsigned char __reserved; unsigned char stepping; unsigned char model; unsigned char family; unsigned char __reserved_signature_high_nibble; unsigned char __reserved_signature_byte; unsigned short __reserved_signature_word; unsigned int features; } *


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

if ( *(char *)(a1 + 1) < 0 )
result = init_ioapic(*(unsigned int *)(a1 + 2));
return result;
}

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

if ( *(char *)(a1 + 1) < 0 )
result = init_ioapic(*(unsigned int *)(a1 + 2));
return result;
}

original_code:
static void
configure_ioapic(const ioapic_entry* ioapic){
 if (ioapic->enabled){
  init_ioapic(ioapic->base_address);
 }
}

canonical_original_code:
static void configure_ioapic(struct ioapic_entry *ioapic){
 if (ioapic->enabled){
  init_ioapic(ioapic->base_address);
 }
}

variable_types: struct ioapic_entry { unsigned char id; unsigned char version; unsigned char enabled; unsigned int base_address; } *


decompiled_code:
// write access to const memory has been detected, the output may be wrong!
__int64 __fastcall set_warm_reset_vector(int a1)
{
__int64 result; // rax

result = cmos_writeb(15LL, 10LL);
*(_DWORD *)((char *)&loc_465 + 2) = a1;
return result;
}

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

result = cmos_writeb(15LL, 10LL);
*(_DWORD *)((char *)&loc_465 + 2) = a1;
return result;
}

original_code:
static void
set_warm_reset_vector(uint32_t address)
{
 cmos_writeb(0xF,0xA);
 *((uint32_t *) (0x40*16 +0x67)) = address;
}

canonical_original_code:
static void set_warm_reset_vector(unsigned int address)
{
 cmos_writeb(0xF,0xA);
 *((unsigned int *) (0x40*16 +0x67)) = address;
}

variable_types:
address
unsigned int


decompiled_code:
unsigned int __fastcall determine_cpu_configuration(__int64 a1)
{
unsigned __int16 *v1; // r12
_BYTE *v2; // rbx
unsigned __int64 v3; // rbp

v1 = (unsigned __int16 *)*(unsigned int *)(a1 + 4);
if ( !check_valid_mpct(v1) )
kernel_panic("determine_cpu_configuration", 330LL, "multicore_boot.c", "[FAIL_IF] !check_valid_mpct(mpct)");
v2 = v1 + 22;
if ( v1[17]
|| (kernel_panic("determine_cpu_configuration", 334LL, "multicore_boot.c", "[FAIL_UNLESS] mpct->entry_count > 0"),
v1[17]) )
{
v3 = 0LL;
do
{
if ( !*v2 )
configure_processor(v2 + 1);
if ( *v2 == 2 )
configure_ioapic((__int64)(v2 + 1));
v2 = next_mp_entry((__int64)v1, v2);
++v3;
}
while ( v1[17] > v3 );
}
if ( bootstrap_index < 0 )
kernel_panic("determine_cpu_configuration", 352LL, "multicore_boot.c", "[FAIL_IF] bootstrap_index < 0");
if ( *(char *)(a1 + 12) < 0 )
start_icmr_apic_mode();
turn_on_local_apic((__int64)v1);
if ( ((unsigned int)&ap_startup_code_page & 0xFFF) != 0 )
kernel_panic("determine_cpu_configuration", 368LL, "multicore_boot.c", "[FAIL_UNLESS] (ap_symb & 0xFFF) == 0");
return turn_on_aps((unsigned int)&ap_startup_code_page);
}

canonical_decompiled_code:
unsigned int __fastcall func16(__int64 a1)
{
unsigned __int16 *v1; // r12
_BYTE *v2; // rbx
unsigned __int64 v3; // rbp

v1 = (unsigned __int16 *)*(unsigned int *)(a1 + 4);
if ( !func11(v1) )
kernel_panic("determine_cpu_configuration", 330LL, "multicore_boot.c", "[FAIL_IF] !check_valid_mpct(mpct)");
v2 = v1 + 22;
if ( v1[17]
|| (kernel_panic("determine_cpu_configuration", 334LL, "multicore_boot.c", "[FAIL_UNLESS] mpct->entry_count > 0"),
v1[17]) )
{
v3 = 0LL;
do
{
if ( !*v2 )
func12(v2 + 1);
if ( *v2 == 2 )
func13((__int64)(v2 + 1));
v2 = next_mp_entry((__int64)v1, v2);
++v3;
}
while ( v1[17] > v3 );
}
if ( bootstrap_index < 0 )
kernel_panic("determine_cpu_configuration", 352LL, "multicore_boot.c", "[FAIL_IF] bootstrap_index < 0");
if ( *(char *)(a1 + 12) < 0 )
func6();
func7((__int64)v1);
if ( ((unsigned int)&ap_startup_code_page & 0xFFF) != 0 )
kernel_panic("determine_cpu_configuration", 368LL, "multicore_boot.c", "[FAIL_UNLESS] (ap_symb & 0xFFF) == 0");
return func15((unsigned int)&ap_startup_code_page);
}

original_code:
static void
determine_cpu_configuration(const mp_float_struct * mpfs)
{
 intptr_t ptr = mpfs->config;
 mp_config_table * mpct = (mp_config_table *) ptr;
 if(!check_valid_mpct(mpct)) kernel_panic(__FUNCTION__, 330, "multicore_boot.c", "[FAIL_IF] " "!check_valid_mpct(mpct)");;
 if(!(mpct->entry_count > 0)) kernel_panic(__FUNCTION__, 334, "multicore_boot.c", "[FAIL_UNLESS] " "mpct->entry_count > 0");;
 const mp_entry * entry = mpct->entries;
 for(uint64_t entryi = 0; entryi < mpct->entry_count; entryi++){
  if(entry->entry_type == PROCESSOR){
   configure_processor(&entry->chunk.processor);
  }
  if (entry->entry_type == IOAPIC){
   configure_ioapic(&entry->chunk.ioapic);
  }
  entry = next_mp_entry(mpct,entry);
 }
 if(bootstrap_index < 0) kernel_panic(__FUNCTION__, 352, "multicore_boot.c", "[FAIL_IF] " "bootstrap_index < 0");;
 if(mpfs->mp_features2 & (1 << 7)){
  start_icmr_apic_mode();
 }
 turn_on_local_apic(mpct);
 intptr_t ap_startup_address = (intptr_t) &ap_startup_code_page;
 uint32_t ap_symb = (uint32_t) (ap_startup_address & 0xFFFFFFFF);
 if(!((ap_symb & 0xFFF) == 0)) kernel_panic(__FUNCTION__, 368, "multicore_boot.c", "[FAIL_UNLESS] " "(ap_symb & 0xFFF) == 0");;
 turn_on_aps(ap_symb);
}

canonical_original_code:
static void determine_cpu_configuration(struct mp_float_struct *mpfs)
{
 long ptr = mpfs->config;
 struct mp_config_table *mpct = (mp_config_table *) ptr;
 if(!check_valid_mpct(mpct)) kernel_panic(__FUNCTION__, 330, "multicore_boot.c", "[FAIL_IF] " "!check_valid_mpct(mpct)");;
 if(!(mpct->entry_count > 0)) kernel_panic(__FUNCTION__, 334, "multicore_boot.c", "[FAIL_UNLESS] " "mpct->entry_count > 0");;
 struct mp_entry *entry = mpct->entries;
 for(unsigned long entryi = 0; entryi < mpct->entry_count; entryi++){
  if(entry->entry_type == PROCESSOR){
   configure_processor(&entry->chunk.processor);
  }
  if (entry->entry_type == IOAPIC){
   configure_ioapic(&entry->chunk.ioapic);
  }
  entry = next_mp_entry(mpct,entry);
 }
 if(bootstrap_index < 0) kernel_panic(__FUNCTION__, 352, "multicore_boot.c", "[FAIL_IF] " "bootstrap_index < 0");;
 if(mpfs->mp_features2 & (1 << 7)){
  start_icmr_apic_mode();
 }
 turn_on_local_apic(mpct);
 long ap_startup_address = (intptr_t) &ap_startup_code_page;
 unsigned int ap_symb = (uint32_t) (ap_startup_address & 0xFFFFFFFF);
 if(!((ap_symb & 0xFFF) == 0)) kernel_panic(__FUNCTION__, 368, "multicore_boot.c", "[FAIL_UNLESS] " "(ap_symb & 0xFFF) == 0");;
 turn_on_aps(ap_symb);
}

variable_types: ptr long

variable_types: struct mp_entry { unsigned char entry_type; union { struct processor_entry { unsigned char local_apic_id; unsigned char version; unsigned char enabled; unsigned char bootstrap; unsigned char __reserved; unsigned char stepping; unsigned char model; unsigned char family; unsigned char __reserved_signature_high_nibble; unsigned char __reserved_signature_byte; unsigned short __reserved_signature_word; unsigned int features; } processor; struct ioapic_entry { unsigned char id; unsigned char version; unsigned char enabled; unsigned int base_address; } ioapic; struct bus_entry { unsigned char id; char type[6]; } bus; struct intr_assign_entry { unsigned char type; unsigned char polarity; unsigned char trigger_mode; unsigned char source_bus_id; unsigned char source_bus_irq; unsigned char dest_apic_id; unsigned char dest_apic_intin; } intr_assign; struct local_intr_assign_entry { unsigned char type; unsigned char polarity; unsigned char trigger_mode; unsigned char source_bus_id; unsigned char source_bus_irq; unsigned char dest_apic_id; unsigned char dest_apic_lintin; } lintr_assign; } chunk; } *

variable_types:
entryi
unsigned long

user_defined_types: struct mp_float_struct { char signature[4]; unsigned int config; unsigned char length; unsigned char version; unsigned char checksum; unsigned char mp_features1; unsigned char mp_features2; unsigned char mp_features3[3]; }


decompiled_code:
int multiprocessor_init()
{
char *v0; // rax

v0 = find_floating_pointer_struct();
if ( v0 )
{
if ( *((_DWORD *)v0 + 1) )
{
LODWORD(v0) = determine_cpu_configuration((__int64)v0);
}
else if ( v0[11] )
{
LODWORD(v0) = determine_default_configuration(v0);
}
else
{
LODWORD(v0) = kernel_panic("multiprocessor_init", 419LL, "multicore_boot.c", "Configuracion MPFS invalida");
}
}
return (int)v0;
}

canonical_decompiled_code:
int func17()
{
char *v0; // rax

v0 = func10();
if ( v0 )
{
if ( *((_DWORD *)v0 + 1) )
{
LODWORD(v0) = func16((__int64)v0);
}
else if ( v0[11] )
{
LODWORD(v0) = func8(v0);
}
else
{
LODWORD(v0) = kernel_panic("multiprocessor_init", 419LL, "multicore_boot.c", "Configuracion MPFS invalida");
}
}
return (int)v0;
}

original_code:
void multiprocessor_init()
{
 check_struct_sizes();
 mp_float_struct * mpfs = find_floating_pointer_struct();
 if(mpfs == ((void *)0)){
  return;
 }
 if(mpfs->config != 0){
  determine_cpu_configuration(mpfs);
 }else if(mpfs->mp_features1 != 0){
  determine_default_configuration(mpfs);
 }else{
  kernel_panic(__FUNCTION__, 419, "multicore_boot.c", "Configuracion MPFS invalida");
 }
}

canonical_original_code:
void multiprocessor_init()
{
 check_struct_sizes();
 struct mp_float_struct *mpfs = find_floating_pointer_struct();
 if(mpfs == ((void *)0)){
  return;
 }
 if(mpfs->config != 0){
  determine_cpu_configuration(mpfs);
 }else if(mpfs->mp_features1 != 0){
  determine_default_configuration(mpfs);
 }else{
  kernel_panic(__FUNCTION__, 419, "multicore_boot.c", "Configuracion MPFS invalida");
 }
}


memcpy

original_code:
void memcpy(const void* dst, const void* src, uint32_t byteCount){
 char* dst8 = (char*)dst;
 char* src8 = (char*)src;
 while(byteCount--){
  *(dst8++)=*(src8++);
 }
}

canonical_original_code:
void memcpy(void *dst, void *src, unsigned int byteCount){
 char *dst8 = (char*)dst;
 char *src8 = (char*)src;
 while(byteCount--){
  *(dst8++)=*(src8++);
 }
}

variable_types:
dst
void *

variable_types:
src
void *

variable_types:
byteCount
unsigned int


memset

decompiled_code:
void __fastcall memset(_BYTE *a1, char a2, int a3)
{
_BYTE *v3; // rax
_BYTE *v4; // rdi

if ( a3 )
{
v3 = a1;
v4 = &a1[a3];
do
*v3++ = a2;
while ( v3 != v4 );
}
}

canonical_decompiled_code:
void __fastcall func1(_BYTE *a1, char a2, int a3)
{
_BYTE *v3; // rax
_BYTE *v4; // rdi

if ( a3 )
{
v3 = a1;
v4 = &a1[a3];
do
*v3++ = a2;
while ( v3 != v4 );
}
}

original_code:
void memset(void* dst, uint8_t value, uint32_t length){
 uint8_t* ptr = (uint8_t*) dst;
 for(uint32_t idx = 0; idx < length; idx++){
  ptr[idx] = value;
 }
}

canonical_original_code:
void memset(void *dst, unsigned char value, unsigned int length){
 unsigned char *ptr = (uint8_t*) dst;
 for(unsigned int idx = 0; idx < length; idx++){
  ptr[idx] = value;
 }
}

variable_types:
value
unsigned char

variable_types:
length
unsigned int

variable_types:
ptr
unsigned char *

variable_types:
idx
unsigned int


strlen

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

if ( !*a1 )
return 0LL;
LODWORD(result) = 0;
do
result = (unsigned int)(result + 1);
while ( a1[(unsigned int)result] );
return result;
}

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

if ( !*a1 )
return 0LL;
LODWORD(result) = 0;
do
result = (unsigned int)(result + 1);
while ( a1[(unsigned int)result] );
return result;
}

original_code:
uint32_t strlen(const char* str)
{
 uint32_t i = 0;
 while(str[i]) {
  i++;
 }
 return i;
}

canonical_original_code:
unsigned int strlen(char *str)
{
 unsigned int i = 0;
 while(str[i]) {
  i++;
 }
 return i;
}

variable_types:
str
char *

variable_types:
i
unsigned int

return_type: unsigned int