decompiled_code:
__int64 sbt_alloc_print_remnants()
{
unsigned int v0; // eax
__int64 *v1; // rbp
__int64 v2; // rbx
const void *v3; // r12
__int64 v4; // r13
unsigned int v5; // eax
unsigned int v6; // eax

v0 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_alloc.c",
"sbt_alloc_print_remnants",
77LL,
v0,
"Start printing the remant of allocations");
v1 = g_allocate_adrs;
v2 = 0LL;
do
{
v3 = (const void *)*v1;
if ( *v1 )
{
v4 = *((unsigned int *)v1 + 2);
v5 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_alloc.c",
"sbt_alloc_print_remnants",
80LL,
v5,
"index=%d address=0x%p size=%d",
v2,
v3,
v4);
}
v2 = (unsigned int)(v2 + 1);
v1 += 2;
}
while ( (_DWORD)v2 != 1000 );
v6 = getpid();
return sbt_logln_tofd(
stderr,
"D",
"src/sbt_alloc.c",
"sbt_alloc_print_remnants",
83LL,
v6,
"Terminate printing the remant of allocations");
}

canonical_decompiled_code:
__int64 func3()
{
unsigned int v0; // eax
__int64 *v1; // rbp
__int64 v2; // rbx
const void *v3; // r12
__int64 v4; // r13
unsigned int v5; // eax
unsigned int v6; // eax

v0 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_alloc.c",
"sbt_alloc_print_remnants",
77LL,
v0,
"Start printing the remant of allocations");
v1 = g_allocate_adrs;
v2 = 0LL;
do
{
v3 = (const void *)*v1;
if ( *v1 )
{
v4 = *((unsigned int *)v1 + 2);
v5 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_alloc.c",
"sbt_alloc_print_remnants",
80LL,
v5,
"index=%d address=0x%p size=%d",
v2,
v3,
v4);
}
v2 = (unsigned int)(v2 + 1);
v1 += 2;
}
while ( (_DWORD)v2 != 1000 );
v6 = getpid();
return sbt_logln_tofd(
stderr,
"D",
"src/sbt_alloc.c",
"sbt_alloc_print_remnants",
83LL,
v6,
"Terminate printing the remant of allocations");
}

original_code:
void sbt_alloc_print_remnants(){
 int i=0;
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 77, getpid(), "Start printing the remant of allocations");
 for(i=0; i<1000; i++){
  if(((void *)0) != g_allocate_adrs[i].addr){
   sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 80, getpid(), "index=%d address=0x%p size=%d" , i, g_allocate_adrs[i].addr, g_allocate_adrs[i].size);
  }
 }
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 83, getpid(), "Terminate printing the remant of allocations");
}

canonical_original_code:
void sbt_alloc_print_remnants(){
 int i = 0;
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 77, getpid(), "Start printing the remant of allocations");
 for(i=0; i<1000; i++){
  if(((void *)0) != g_allocate_adrs[i].addr){
   sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 80, getpid(), "index=%d address=0x%p size=%d" , i, g_allocate_adrs[i].addr, g_allocate_adrs[i].size);
  }
 }
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 83, getpid(), "Terminate printing the remant of allocations");
}


repo: seabat/TohriSDK

decompiled_code:
__int64 sbt_alloc_get_allocate_size()
{
return (unsigned int)g_sbt_all_alloc_size;
}

canonical_decompiled_code:
__int64 func4()
{
return (unsigned int)g_sbt_all_alloc_size;
}

original_code:
int sbt_alloc_get_allocate_size(){
 return g_sbt_all_alloc_size;
}

return_type: int


decompiled_code:
__int64 sbt_alloc_test()
{
unsigned int v0; // eax
unsigned int v1; // eax
void *v2; // rdi
unsigned int v3; // eax
void *v4; // rbp
void *v5; // rbx
unsigned int v6; // eax
unsigned int v7; // eax
void *v8; // rbx
unsigned int v9; // eax

v0 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 96LL, v0, "Start sbt_alloc_test");
v1 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 99LL, v1, "test1");
v2 = sbt_malloc(0x32uLL);
sbt_free(v2);
if ( (unsigned int)sbt_alloc_get_allocate_size() )
_assert_fail("0 == sbt_alloc_get_allocate_size()", "src/sbt_alloc.c", 0x67u, "sbt_alloc_test");
v3 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 106LL, v3, "test2");
v4 = sbt_malloc(0x1EuLL);
v5 = sbt_malloc(0x28uLL);
sbt_free(v4);
sbt_free(v5);
if ( (unsigned int)sbt_alloc_get_allocate_size() )
_assert_fail("0 == sbt_alloc_get_allocate_size()", "src/sbt_alloc.c", 0x71u, "sbt_alloc_test");
v6 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 116LL, v6, "test3 result1 index=0 size=30");
v7 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 117LL, v7, "test3 result2 index=2 size=40");
sbt_malloc(0x1EuLL);
v8 = sbt_malloc(0x28uLL);
sbt_malloc(0x32uLL);
sbt_free(v8);
sbt_alloc_print_remnants();
v9 = getpid();
return sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 124LL, v9, "End sbt_alloc_test");
}

canonical_decompiled_code:
__int64 func5()
{
unsigned int v0; // eax
unsigned int v1; // eax
void *v2; // rdi
unsigned int v3; // eax
void *v4; // rbp
void *v5; // rbx
unsigned int v6; // eax
unsigned int v7; // eax
void *v8; // rbx
unsigned int v9; // eax

v0 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 96LL, v0, "Start sbt_alloc_test");
v1 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 99LL, v1, "test1");
v2 = func1(0x32uLL);
func2(v2);
if ( (unsigned int)func4() )
_assert_fail("0 == sbt_alloc_get_allocate_size()", "src/sbt_alloc.c", 0x67u, "sbt_alloc_test");
v3 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 106LL, v3, "test2");
v4 = func1(0x1EuLL);
v5 = func1(0x28uLL);
func2(v4);
func2(v5);
if ( (unsigned int)func4() )
_assert_fail("0 == sbt_alloc_get_allocate_size()", "src/sbt_alloc.c", 0x71u, "sbt_alloc_test");
v6 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 116LL, v6, "test3 result1 index=0 size=30");
v7 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 117LL, v7, "test3 result2 index=2 size=40");
func1(0x1EuLL);
v8 = func1(0x28uLL);
func1(0x32uLL);
func2(v8);
func3();
v9 = getpid();
return sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", "sbt_alloc_test", 124LL, v9, "End sbt_alloc_test");
}

original_code:
void sbt_alloc_test(){
 char* a = ((void *)0);
 char* b = ((void *)0);
 char* c = ((void *)0);
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 96, getpid(), "Start sbt_alloc_test");
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 99, getpid(), "test1");
 a = sbt_malloc(50);
 sbt_free(a);
 a = ((void *)0);
 ((void) sizeof ((0 == sbt_alloc_get_allocate_size()) ? 1 : 0), __extension__ ({ if (0 == sbt_alloc_get_allocate_size()) ; else __assert_fail ("0 == sbt_alloc_get_allocate_size()", "src/sbt_alloc.c", 103, __extension__ __PRETTY_FUNCTION__); }));
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 106, getpid(), "test2");
 a = sbt_malloc(30);
 b = sbt_malloc(40);
 sbt_free(a);
 a = ((void *)0);
 sbt_free(b);
 b = ((void *)0);
 ((void) sizeof ((0 == sbt_alloc_get_allocate_size()) ? 1 : 0), __extension__ ({ if (0 == sbt_alloc_get_allocate_size()) ; else __assert_fail ("0 == sbt_alloc_get_allocate_size()", "src/sbt_alloc.c", 113, __extension__ __PRETTY_FUNCTION__); }));
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 116, getpid(), "test3 result1 index=0  size=30");
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 117, getpid(), "test3 result2 index=2  size=40");
 a = (char*)sbt_malloc(30);
 b = (char*)sbt_malloc(40);
 c = (char*)sbt_malloc(50);
 sbt_free(b);
 sbt_alloc_print_remnants();
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 124, getpid(), "End sbt_alloc_test");
}

canonical_original_code:
void sbt_alloc_test(){
 char *a = ((void *)0);
 char *b = ((void *)0);
 char *c = ((void *)0);
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 96, getpid(), "Start sbt_alloc_test");
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 99, getpid(), "test1");
 a = sbt_malloc(50);
 sbt_free(a);
 a = ((void *)0);
 ((void) sizeof ((0 == sbt_alloc_get_allocate_size()) ? 1 : 0), __extension__ ({ if (0 == sbt_alloc_get_allocate_size()) ; else __assert_fail ("0 == sbt_alloc_get_allocate_size()", "src/sbt_alloc.c", 103, __extension__ __PRETTY_FUNCTION__); }));
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 106, getpid(), "test2");
 a = sbt_malloc(30);
 b = sbt_malloc(40);
 sbt_free(a);
 a = ((void *)0);
 sbt_free(b);
 b = ((void *)0);
 ((void) sizeof ((0 == sbt_alloc_get_allocate_size()) ? 1 : 0), __extension__ ({ if (0 == sbt_alloc_get_allocate_size()) ; else __assert_fail ("0 == sbt_alloc_get_allocate_size()", "src/sbt_alloc.c", 113, __extension__ __PRETTY_FUNCTION__); }));
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 116, getpid(), "test3 result1 index=0  size=30");
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 117, getpid(), "test3 result2 index=2  size=40");
 a = (char *)sbt_malloc(30);
 b = (char *)sbt_malloc(40);
 c = (char *)sbt_malloc(50);
 sbt_free(b);
 sbt_alloc_print_remnants();
 sbt_logln_tofd(stderr, "D", "src/sbt_alloc.c", __func__, 124, getpid(), "End sbt_alloc_test");
}

variable_types:
a
char *

variable_types:
b
char *

variable_types:
c
char *

return_type: void


decompiled_code:
void *__fastcall sub_thread_void(void *a1)
{
const void *v1; // rbx
unsigned int v2; // eax
unsigned int v3; // eax

v1 = (const void *)pthread_self();
v2 = getpid();
printf("%s(0x%x): start thread TID=%p\n", "sub_thread_void", v2, v1);
sleep(1u);
v3 = getpid();
printf("%s(0x%x): end thread TID=%p\n", "sub_thread_void", v3, v1);
return 0LL;
}

canonical_decompiled_code:
void *__fastcall func0(void *a1)
{
const void *v1; // rbx
unsigned int v2; // eax
unsigned int v3; // eax

v1 = (const void *)pthread_self();
v2 = getpid();
printf("%s(0x%x): start thread TID=%p\n", "sub_thread_void", v2, v1);
sleep(1u);
v3 = getpid();
printf("%s(0x%x): end thread TID=%p\n", "sub_thread_void", v3, v1);
return 0LL;
}

original_code:
void* sub_thread_void(){
 char sub_buf[1024]={0x00};
 pthread_t tid = pthread_self();
 printf("%s(0x%x): start thread TID=%p\n", __func__, getpid(), tid);
 sleep(1);
 printf("%s(0x%x): end thread   TID=%p\n", __func__, getpid(), tid);
 return ((void *)0);
}

canonical_original_code:
void *sub_thread_void(){
 char sub_buf[1024] = {0x00};
 unsigned long tid = pthread_self();
 printf("%s(0x%x): start thread TID=%p\n", __func__, getpid(), tid);
 sleep(1);
 printf("%s(0x%x): end thread   TID=%p\n", __func__, getpid(), tid);
 return ((void *)0);
}

variable_types:
tid
unsigned long

return_type: void *


decompiled_code:
void *__fastcall sub_thread_int(void *a1)
{
const void *v1; // rbx
unsigned int v2; // ebp
unsigned int v3; // eax
unsigned int v4; // eax

v1 = (const void *)pthread_self();
v2 = *(_DWORD *)a1;
v3 = getpid();
printf("%s(0x%x): start thread(no=%d) TID=%p\n", "sub_thread_int", v3, v2, v1);
sleep(1u);
v4 = getpid();
printf("%s(0x%x): end thread TID=%p\n", "sub_thread_int", v4, v1);
return 0LL;
}

canonical_decompiled_code:
void *__fastcall func1(void *a1)
{
const void *v1; // rbx
unsigned int v2; // ebp
unsigned int v3; // eax
unsigned int v4; // eax

v1 = (const void *)pthread_self();
v2 = *(_DWORD *)a1;
v3 = getpid();
printf("%s(0x%x): start thread(no=%d) TID=%p\n", "sub_thread_int", v3, v2, v1);
sleep(1u);
v4 = getpid();
printf("%s(0x%x): end thread TID=%p\n", "sub_thread_int", v4, v1);
return 0LL;
}

original_code:
void* sub_thread_int( int* thread_no ){
 char sub_buf[1024]={0x00};
 pthread_t tid = pthread_self();
 printf("%s(0x%x): start thread(no=%d) TID=%p\n", __func__, getpid(), *thread_no, tid);
 sleep(1);
 printf("%s(0x%x): end thread TID=%p\n", __func__, getpid(), tid);
 return ((void *)0);
}

canonical_original_code:
void *sub_thread_int(int *thread_no){
 char sub_buf[1024] = {0x00};
 unsigned long tid = pthread_self();
 printf("%s(0x%x): start thread(no=%d) TID=%p\n", __func__, getpid(), *thread_no, tid);
 sleep(1);
 printf("%s(0x%x): end thread TID=%p\n", __func__, getpid(), tid);
 return ((void *)0);
}


decompiled_code:
int __fastcall create_thread(int a1)
{
unsigned int v1; // eax
unsigned int v2; // eax
int arg; // [rsp+Ch] [rbp-4Ch] BYREF
pthread_attr_t attr; // [rsp+10h] [rbp-48h] BYREF
pthread_t newthread[2]; // [rsp+48h] [rbp-10h] BYREF

arg = a1;
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 0x10000uLL);
if ( a1 % 2 == 1 )
pthread_create(newthread, 0LL, sub_thread_void, 0LL);
else
pthread_create(newthread, 0LL, sub_thread_int, &arg);
v1 = getpid();
printf("%s(0x%x): Wait main thread\n", "create_thread", v1);
pthread_join(newthread[0], 0LL);
v2 = getpid();
printf("%s(0x%x): Resume main thread\n", "create_thread", v2);
return pthread_attr_destroy(&attr);
}

canonical_decompiled_code:
int __fastcall func2(int a1)
{
unsigned int v1; // eax
unsigned int v2; // eax
int arg; // [rsp+Ch] [rbp-4Ch] BYREF
pthread_attr_t attr; // [rsp+10h] [rbp-48h] BYREF
pthread_t newthread[2]; // [rsp+48h] [rbp-10h] BYREF

arg = a1;
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 0x10000uLL);
if ( a1 % 2 == 1 )
pthread_create(newthread, 0LL, sub_thread_void, 0LL);
else
pthread_create(newthread, 0LL, sub_thread_int, &arg);
v1 = getpid();
printf("%s(0x%x): Wait main thread\n", "create_thread", v1);
pthread_join(newthread[0], 0LL);
v2 = getpid();
printf("%s(0x%x): Resume main thread\n", "create_thread", v2);
return pthread_attr_destroy(&attr);
}

original_code:
void create_thread( int thread_no ){
    pthread_t thread;
 pthread_attr_t attr;
 pthread_attr_init(&attr);
 pthread_attr_setstacksize(&attr, 64 * 1024);
 if(1==thread_no%2){
  pthread_create( &thread, ((void *)0), sub_thread_void, (void*)((void *)0) );
 }else{
  pthread_create( &thread, ((void *)0), (void*)sub_thread_int, (void*)&thread_no );
 }
 printf("%s(0x%x): Wait   main thread\n",__func__, getpid());
 pthread_join( thread, ((void *)0) );
 printf("%s(0x%x): Resume main thread\n",__func__, getpid());
 pthread_attr_destroy(&attr);
}

canonical_original_code:
void create_thread(int thread_no){
    unsigned long thread;
 union pthread_attr_t attr;
 pthread_attr_init(&attr);
 pthread_attr_setstacksize(&attr, 64 * 1024);
 if(1==thread_no%2){
  pthread_create( &thread, ((void *)0), sub_thread_void, (void *)((void *)0) );
 }else{
  pthread_create( &thread, ((void *)0), (void *)sub_thread_int, (void *)&thread_no );
 }
 printf("%s(0x%x): Wait   main thread\n",__func__, getpid());
 pthread_join( thread, ((void *)0) );
 printf("%s(0x%x): Resume main thread\n",__func__, getpid());
 pthread_attr_destroy(&attr);
}

variable_types:
thread
unsigned long

variable_types: union pthread_attr_t { char __size[56]; long __align; }


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // eax
unsigned int v4; // eax
unsigned int v5; // eax
unsigned int v6; // eax
__int64 v8[6]; // [rsp+0h] [rbp-48h] BYREF
__int16 v9; // [rsp+30h] [rbp-18h]

v8[0] = 0LL;
v8[1] = 0LL;
v8[2] = 0LL;
v8[3] = 0LL;
v8[4] = 0LL;
v8[5] = 0LL;
v9 = 0;
v3 = getpid();
printf("%s(0x%x): start\n", "main", v3);
v4 = getpid();
printf((const char *)v8, "grep VmSize /proc/%d/status", v4);
v5 = getpid();
printf("%s(0x%x): Dump virtual memory\n", "main", v5);
system((const char *)v8);
create_thread(1);
system((const char *)v8);
create_thread(2);
system((const char *)v8);
create_thread(3);
system((const char *)v8);
v6 = getpid();
printf("%s(0x%x): end\n", "main", v6);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
unsigned int v3; // eax
unsigned int v4; // eax
unsigned int v5; // eax
unsigned int v6; // eax
__int64 v8[6]; // [rsp+0h] [rbp-48h] BYREF
__int16 v9; // [rsp+30h] [rbp-18h]

v8[0] = 0LL;
v8[1] = 0LL;
v8[2] = 0LL;
v8[3] = 0LL;
v8[4] = 0LL;
v8[5] = 0LL;
v9 = 0;
v3 = getpid();
printf("%s(0x%x): start\n", "main", v3);
v4 = getpid();
printf((const char *)v8, "grep VmSize /proc/%d/status", v4);
v5 = getpid();
printf("%s(0x%x): Dump virtual memory\n", "main", v5);
system((const char *)v8);
func2(1);
system((const char *)v8);
func2(2);
system((const char *)v8);
func2(3);
system((const char *)v8);
v6 = getpid();
printf("%s(0x%x): end\n", "main", v6);
return 0;
}

original_code:
int main(int argc, char **argv)
{
 int ret = 0;
 char cmd_buf[50] = {0x00};
 int i;
 printf("%s(0x%x): start\n", __func__, getpid());
 printf(cmd_buf, "grep VmSize /proc/%d/status", getpid());
 printf("%s(0x%x): Dump virtual memory\n", __func__, getpid());
 system( cmd_buf );
 for(i=0; i<3; ++i){
  create_thread(i+1);
  system( cmd_buf );
 }
exit:
 printf("%s(0x%x): end\n", __func__, getpid());
 return ret;
}

variable_types: argc int

variable_types:
argv
char **

variable_types: ret int

variable_types: i int


decompiled_code:
int printf_ex(const char *a1, const char *a2, const char *a3, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a3);
printf("[%s][%s]:", a1, a2);
return vprintf(a3, arg);
}

canonical_decompiled_code:
int func7(const char *a1, const char *a2, const char *a3, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, a3);
printf("[%s][%s]:", a1, a2);
return vprintf(a3, arg);
}

original_code:
void printf_ex( const char* file, const char* func, const char* format, ...){
 va_list arg;
 printf("[%s][%s]:", file, func);
 __builtin_va_start(arg,format);
 vprintf( format, arg );
 __builtin_va_end(arg);
}

canonical_original_code:
void printf_ex(char *file, char *func, char *format, ...){
 __builtin_va_list arg;
 printf("[%s][%s]:", file, func);
 __builtin_va_start(arg,format);
 vprintf( format, arg );
 __builtin_va_end(arg);
}

variable_types:
file
char *

variable_types:
func
char *

variable_types:
format
char *


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
printf_ex("hello_command.c", "main", "start\n");
if ( argc <= 3 )
{
printf_ex("hello_command.c", "main", "invalid parameter\n");
}
else
{
printf_ex("hello_command.c", "main", "%s %s %s\n", argv[1], argv[2], argv[3]);
printf_ex("hello_command.c", "main", "result=%d\n", 3LL);
}
printf_ex("hello_command.c", "main", "end\n");
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
func7("hello_command.c", "main", "start\n");
if ( argc <= 3 )
{
func7("hello_command.c", "main", "invalid parameter\n");
}
else
{
func7("hello_command.c", "main", "%s %s %s\n", argv[1], argv[2], argv[3]);
func7("hello_command.c", "main", "result=%d\n", 3LL);
}
func7("hello_command.c", "main", "end\n");
return 0;
}

original_code:
int main(int argc, char **argv)
{
 int ret = 0;
 printf_ex( "hello_command.c", __func__, "start\n");;
 if(3>=argc){
  printf_ex( "hello_command.c", __func__, "invalid parameter\n");;
  goto exit;
 }
 printf_ex( "hello_command.c", __func__, "%s %s %s\n", argv[1], argv[2], argv[3]);;
 printf_ex( "hello_command.c", __func__, "result=%d\n",3);;
exit:
 printf_ex( "hello_command.c", __func__, "end\n");;
 return ret;
}


decompiled_code:
__int64 __fastcall sbt_androidxml_get_array_length(char *a1, char *a2)
{
search_res_name(a1, a2);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(char *a1, char *a2)
{
func0(a1, a2);
return 0LL;
}

original_code:
int sbt_androidxml_get_array_length(const char* file_name, const char* res_name){
    search_res_name(file_name, res_name);
    return 0;
}

canonical_original_code:
int sbt_androidxml_get_array_length(char *file_name, char *res_name){
    search_res_name(file_name, res_name);
    return 0;
}


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

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

original_code:
char* sbt_androidxml_get_string_array(const char* file_name, const char* res_name){
    return ((void *)0);
}

canonical_original_code:
char *sbt_androidxml_get_string_array(char *file_name, char *res_name){
    return ((void *)0);
}

return_type: char *


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

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

original_code:
int* sbt_androidxml_get_int_array(const char* file_name, const char* res_name){
    return ((void *)0);
}

canonical_original_code:
int *sbt_androidxml_get_int_array(char *file_name, char *res_name){
    return ((void *)0);
}

return_type: int *


decompiled_code:
__int64 func_c()
{
puts("func_c");
return 2LL;
}

canonical_decompiled_code:
__int64 func7()
{
puts("func_c");
return 2LL;
}

original_code:
static int func_c(char arg){
 printf("func_c\n");
 return 2;
}

variable_types: arg char


decompiled_code:
__int64 func_b()
{
puts("func_b");
return 1LL;
}

canonical_decompiled_code:
__int64 func8()
{
puts("func_b");
return 1LL;
}

original_code:
static int func_b(char arg){
 printf("func_b\n");
 return 1;
}


decompiled_code:
__int64 func_a()
{
puts("func_a");
return 0LL;
}

canonical_decompiled_code:
__int64 func9()
{
puts("func_a");
return 0LL;
}

original_code:
static int func_a(char arg){
 printf("func_a\n");
 return 0;
}


decompiled_code:
__int64 server_main()
{
const char *v0; // rbx
void (__fastcall **v1)(__int64); // rbx

puts("Enter server_main");
printf("size of the data table = %d\n", 416LL);
printf("count entries in the data table = %d\n", 4LL);
v0 = aTokyo;
do
{
printf("id=%d name=%s\n", *((unsigned int *)v0 - 1), v0);
v0 += 104;
}
while ( v0 != (const char *)&unk_404244 );
printf("size of the function table = %d\n", 48LL);
printf("count entries in the function table = %d\n", 3LL);
v1 = (void (__fastcall **)(__int64))&funcTable;
do
{
printf("id=%d\n", *(unsigned int *)v1);
v1[1](97LL);
v1 += 2;
}
while ( v1 != (void (__fastcall **)(__int64))&unk_404090 );
puts("Exit server_main");
return 0LL;
}

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

puts("Enter server_main");
printf("size of the data table = %d\n", 416LL);
printf("count entries in the data table = %d\n", 4LL);
v0 = aTokyo;
do
{
printf("id=%d name=%s\n", *((unsigned int *)v0 - 1), v0);
v0 += 104;
}
while ( v0 != (const char *)&unk_404244 );
printf("size of the function table = %d\n", 48LL);
printf("count entries in the function table = %d\n", 3LL);
v1 = (void (__fastcall **)(__int64))&funcTable;
do
{
printf("id=%d\n", *(unsigned int *)v1);
v1[1](97LL);
v1 += 2;
}
while ( v1 != (void (__fastcall **)(__int64))&unk_404090 );
puts("Exit server_main");
return 0LL;
}

original_code:
int server_main()
{
 int i;
 printf("Enter server_main\n");
 printf( "size of the data table = %d\n", (int)sizeof(dataTable) );
 printf( "count entries in the data table = %d\n", (int)(sizeof(dataTable)/sizeof(stDataTable)) );
 for( i=0; i < sizeof(dataTable)/sizeof(stDataTable); i++ ){
  printf( "id=%d name=%s\n", dataTable[i].id, dataTable[i].name );
 }
 printf( "size of the function table = %d\n", (int)sizeof(funcTable) );
 printf( "count entries in the function table = %d\n", (int)(sizeof(funcTable)/sizeof(stFuncTable)) );
 for( i=0; i < sizeof(funcTable)/sizeof(stFuncTable); i++ ){
  printf( "id=%d\n", funcTable[i].id );
  funcTable[i].func('a');
 }
 printf("Exit server_main\n");
 return 0;
}


decompiled_code:
__int64 client_main()
{
__int64 v0; // rdx
__int64 v1; // rbp
int i; // ebx
__int64 v3; // rbx
int v5; // [rsp+78h] [rbp-30h] BYREF
int v6; // [rsp+7Ch] [rbp-2Ch] BYREF
unsigned int *v7; // [rsp+80h] [rbp-28h] BYREF
const char *v8; // [rsp+88h] [rbp-20h] BYREF

v8 = 0LL;
v7 = 0LL;
v6 = 0;
v5 = 0;
puts("Enter client_main");
getDataTable(&v6, &v8);
printf("pDataTable : value=%p size=%d\n", v8, 8LL);
printf("*pDataTable: value=%d size=%d\n", 104LL, v0);
if ( v6 > 0 )
{
v1 = 0LL;
for ( i = 0; i < v6; ++i )
{
printf("id=%d name=%s\n", *(unsigned int *)&v8[v1], &v8[v1 + 4]);
v1 += 104LL;
}
}
getFuncTable(&v5, &v7);
printf("pFuncTable : value=%p size=%d\n", v7, 8LL);
printf("*pFuncTable: value=%d size=%d\n", *v7, *((_QWORD *)v7 + 1));
if ( v5 > 0 )
{
v3 = 0LL;
do
{
printf("id=%d\n", v7[4 * v3]);
(*(void (__fastcall **)(__int64))&v7[4 * v3++ + 2])(97LL);
}
while ( v5 > (int)v3 );
}
puts("Exit client_main");
return 0LL;
}

canonical_decompiled_code:
__int64 func13()
{
__int64 v0; // rdx
__int64 v1; // rbp
int i; // ebx
__int64 v3; // rbx
int v5; // [rsp+78h] [rbp-30h] BYREF
int v6; // [rsp+7Ch] [rbp-2Ch] BYREF
unsigned int *v7; // [rsp+80h] [rbp-28h] BYREF
const char *v8; // [rsp+88h] [rbp-20h] BYREF

v8 = 0LL;
v7 = 0LL;
v6 = 0;
v5 = 0;
puts("Enter client_main");
func11(&v6, &v8);
printf("pDataTable : value=%p size=%d\n", v8, 8LL);
printf("*pDataTable: value=%d size=%d\n", 104LL, v0);
if ( v6 > 0 )
{
v1 = 0LL;
for ( i = 0; i < v6; ++i )
{
printf("id=%d name=%s\n", *(unsigned int *)&v8[v1], &v8[v1 + 4]);
v1 += 104LL;
}
}
func12(&v5, &v7);
printf("pFuncTable : value=%p size=%d\n", v7, 8LL);
printf("*pFuncTable: value=%d size=%d\n", *v7, *((_QWORD *)v7 + 1));
if ( v5 > 0 )
{
v3 = 0LL;
do
{
printf("id=%d\n", v7[4 * v3]);
(*(void (__fastcall **)(__int64))&v7[4 * v3++ + 2])(97LL);
}
while ( v5 > (int)v3 );
}
puts("Exit client_main");
return 0LL;
}

original_code:
int client_main(){
 stDataTable* pDataTable = ((void *)0);
 stFuncTable* pFuncTable = ((void *)0);
 int dataTableSize = 0;
 int funcTableSize = 0;
    int i =0;
 printf( "Enter client_main\n" );
 getDataTable( &dataTableSize, &pDataTable );
 printf( "pDataTable : value=%p size=%d\n", pDataTable, (int)sizeof(pDataTable) );
 printf( "*pDataTable: value=%d size=%d\n", *pDataTable, (int)sizeof(*pDataTable) );
 for( i=0; i < dataTableSize; i++ ){
  printf( "id=%d name=%s\n", pDataTable[i].id, pDataTable[i].name );
 }
 getFuncTable( &funcTableSize, &pFuncTable );
 printf( "pFuncTable : value=%p size=%d\n", pFuncTable, (int)sizeof(pFuncTable) );
 printf( "*pFuncTable: value=%d size=%d\n", *pFuncTable, (int)sizeof(*pFuncTable) );
 for( i=0; i < funcTableSize; i++ ){
  printf( "id=%d\n", pFuncTable[i].id );
  pFuncTable[i].func('a');
 }
 printf( "Exit client_main\n" );
 return 0;
}

canonical_original_code:
int client_main(){
 struct st_dataTable *pDataTable = ((void *)0);
 struct st_funcTable *pFuncTable = ((void *)0);
 int dataTableSize = 0;
 int funcTableSize = 0;
    int i = 0;
 printf( "Enter client_main\n" );
 getDataTable( &dataTableSize, &pDataTable );
 printf( "pDataTable : value=%p size=%d\n", pDataTable, (int)sizeof(pDataTable) );
 printf( "*pDataTable: value=%d size=%d\n", *pDataTable, (int)sizeof(*pDataTable) );
 for( i=0; i < dataTableSize; i++ ){
  printf( "id=%d name=%s\n", pDataTable[i].id, pDataTable[i].name );
 }
 getFuncTable( &funcTableSize, &pFuncTable );
 printf( "pFuncTable : value=%p size=%d\n", pFuncTable, (int)sizeof(pFuncTable) );
 printf( "*pFuncTable: value=%d size=%d\n", *pFuncTable, (int)sizeof(*pFuncTable) );
 for( i=0; i < funcTableSize; i++ ){
  printf( "id=%d\n", pFuncTable[i].id );
  pFuncTable[i].func('a');
 }
 printf( "Exit client_main\n" );
 return 0;
}

variable_types: struct st_dataTable { int id; char name[100]; } *

variable_types: struct st_funcTable { int id; int (*func)(char arg); } *

variable_types: dataTableSize int

variable_types: funcTableSize int


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

g_plugin = *a1;
result = a1[1];
qword_4040B8 = result;
return result;
}

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

g_plugin = *a1;
result = a1[1];
qword_4040B8 = result;
return result;
}

original_code:
void register_func(plugin_info_st* info){
 g_plugin.name = info->name;
 g_plugin.fp = info->fp;
}

canonical_original_code:
void register_func(struct plugin_info *info){
 g_plugin.name = info->name;
 g_plugin.fp = info->fp;
}

variable_types: struct plugin_info { char *name; struct func_pointer { void (*func_a)(int); int (*func_b)(char); int (*func_c)(int, char); int (*func_d)(struct arg_set { int aa; char bb; } *); } *fp; } *

user_defined_types: struct plugin_info { char *name; struct func_pointer *fp; }

user_defined_types: struct func_pointer { void (*func_a)(int); int (*func_b)(char); int (*func_c)(int, char); int (*func_d)(struct arg_set *); }


decompiled_code:
__int64 matsu_d()
{
printf("%s -- start\n", "matsu_d");
printf("%s -- exit\n", "matsu_d");
return 0LL;
}

canonical_decompiled_code:
__int64 func9()
{
printf("%s -- start\n", "matsu_d");
printf("%s -- exit\n", "matsu_d");
return 0LL;
}

original_code:
static int matsu_d(arg_set_st* st){
 printf("%s -- start\n",__func__);
 printf("%s -- exit\n",__func__);
 return 0;
}

canonical_original_code:
static int matsu_d(struct arg_set *st){
 printf("%s -- start\n",__func__);
 printf("%s -- exit\n",__func__);
 return 0;
}

variable_types:
st
struct arg_set { int aa; char bb; } *


decompiled_code:
__int64 matsu_c()
{
printf("%s -- start\n", "matsu_c");
printf("%s -- exit\n", "matsu_c");
return 0LL;
}

canonical_decompiled_code:
__int64 func10()
{
printf("%s -- start\n", "matsu_c");
printf("%s -- exit\n", "matsu_c");
return 0LL;
}

original_code:
static int matsu_c(int ii, char cc){
 printf("%s -- start\n",__func__);
 printf("%s -- exit\n",__func__);
 return 0;
}

variable_types: ii int

variable_types: cc char


decompiled_code:
__int64 matsu_b()
{
printf("%s -- start\n", "matsu_b");
printf("%s -- exit\n", "matsu_b");
return 0LL;
}

canonical_decompiled_code:
__int64 func11()
{
printf("%s -- start\n", "matsu_b");
printf("%s -- exit\n", "matsu_b");
return 0LL;
}

original_code:
static int matsu_b(char cc){
 printf("%s -- start\n",__func__);
 printf("%s -- exit\n",__func__);
 return 0;
}


decompiled_code:
int matsu_a()
{
printf("%s -- start\n", "matsu_a");
return printf("%s -- exit\n", "matsu_a");
}

canonical_decompiled_code:
int func12()
{
printf("%s -- start\n", "matsu_a");
return printf("%s -- exit\n", "matsu_a");
}

original_code:
static void matsu_a(int ii){
 printf("%s -- start\n",__func__);
 printf("%s -- exit\n",__func__);
 return;
}


decompiled_code:
__int64 plugin_matsu_init()
{
__int64 v1[3]; // [rsp+0h] [rbp-18h] BYREF

v1[0] = (__int64)"plugin-matsu";
v1[1] = (__int64)&fp;
return register_func(v1);
}

original_code:
void plugin_matsu_init(){
 plugin_info_st info;
 info.name = "plugin-matsu";
 info.fp = &fp;
 register_func(&info);
}

canonical_original_code:
void plugin_matsu_init(){
 struct plugin_info info;
 info.name = "plugin-matsu";
 info.fp = &fp;
 register_func(&info);
}

variable_types: struct plugin_info { char *name; struct func_pointer { void (*func_a)(int); int (*func_b)(char); int (*func_c)(int, char); int (*func_d)(struct arg_set { int aa; char bb; } *); } *fp; }


decompiled_code:
__int64 plugin_take_init()
{
__int64 v1[3]; // [rsp+0h] [rbp-18h] BYREF

v1[0] = (__int64)"plugin-take";
v1[1] = (__int64)&fp_0;
return register_func(v1);
}

original_code:
void plugin_take_init(){
 plugin_info_st info;
 info.name = "plugin-take";
 info.fp = &fp;
 register_func(&info);
}

canonical_original_code:
void plugin_take_init(){
 struct plugin_info info;
 info.name = "plugin-take";
 info.fp = &fp;
 register_func(&info);
}


decompiled_code:
__int64 __fastcall plugin_manager_main(int a1)
{
int v2; // [rsp+8h] [rbp-50h] BYREF
char v3; // [rsp+Ch] [rbp-4Ch]
char v4; // [rsp+Fh] [rbp-49h]
char s[8]; // [rsp+10h] [rbp-48h] BYREF
__int64 v6; // [rsp+18h] [rbp-40h]
__int64 v7; // [rsp+20h] [rbp-38h]
__int64 v8; // [rsp+28h] [rbp-30h]
__int64 v9; // [rsp+30h] [rbp-28h]
__int64 v10; // [rsp+38h] [rbp-20h]
__int16 v11; // [rsp+40h] [rbp-18h]

*(_QWORD *)s = 0LL;
v6 = 0LL;
v7 = 0LL;
v8 = 0LL;
v9 = 0LL;
v10 = 0LL;
v11 = 0;
v2 = 1;
v3 = 97;
printf("%s -- start\n", "plugin_manager_main");
if ( a1 == 1 )
{
plugin_matsu_init();
}
else if ( a1 == 2 )
{
plugin_take_init();
}
printf("[%s]", (const char *)g_plugin);
if ( fgets(s, 50, _bss_start) )
{
*(&v4 + strlen(s)) = 0;
(*(void (__fastcall **)(__int64))qword_4040B8)(1LL);
(*(void (__fastcall **)(__int64))(qword_4040B8 + 8))(97LL);
(*(void (__fastcall **)(__int64, __int64))(qword_4040B8 + 16))(1LL, 97LL);
(*(void (__fastcall **)(int *))(qword_4040B8 + 24))(&v2);
}
else
{
puts("input err!");
}
printf("%s -- end\n", "plugin_manager_main");
return 0LL;
}

original_code:
int plugin_manager_main(int type)
{
 int ret = 0;
 char cmd_buf[50] = {0};
 arg_set_st arg_set = {1, 'a'};
 printf("%s -- start\n",__func__);
 if ( 1 == type ) {
  plugin_matsu_init();
 } else if ( 2 == type ) {
  plugin_take_init();
 }
 printf("[%s]", g_plugin.name);
 if ( (fgets(cmd_buf, sizeof(cmd_buf), stdin)) == ((void *)0) ) {
  printf("input err!\n");
  goto exit;
 }
 cmd_buf[strlen(cmd_buf) - 1] = '\0';
 g_plugin.fp->func_a(1);
 g_plugin.fp->func_b('a');
 g_plugin.fp->func_c(1,'a');
 g_plugin.fp->func_d(&arg_set);
exit:
 printf("%s -- end\n",__func__);
 return ret;
}

canonical_original_code:
int plugin_manager_main(int type)
{
 int ret = 0;
 char cmd_buf[50] = {0};
 struct arg_set arg_set = {1, 'a'};
 printf("%s -- start\n",__func__);
 if ( 1 == type ) {
  plugin_matsu_init();
 } else if ( 2 == type ) {
  plugin_take_init();
 }
 printf("[%s]", g_plugin.name);
 if ( (fgets(cmd_buf, sizeof(cmd_buf), stdin)) == ((void *)0) ) {
  printf("input err!\n");
  goto exit;
 }
 cmd_buf[strlen(cmd_buf) - 1] = '\0';
 g_plugin.fp->func_a(1);
 g_plugin.fp->func_b('a');
 g_plugin.fp->func_c(1,'a');
 g_plugin.fp->func_d(&arg_set);
exit:
 printf("%s -- end\n",__func__);
 return ret;
}

variable_types: type int


decompiled_code:
__int64 take_d()
{
printf("%s -- start\n", "take_d");
printf("%s -- end\n", "take_d");
return 0LL;
}

canonical_decompiled_code:
__int64 func14()
{
printf("%s -- start\n", "take_d");
printf("%s -- end\n", "take_d");
return 0LL;
}

original_code:
static int take_d(arg_set_st* st){
 printf("%s -- start\n",__func__);
 printf("%s -- end\n",__func__);
 return 0;
}

canonical_original_code:
static int take_d(struct arg_set *st){
 printf("%s -- start\n",__func__);
 printf("%s -- end\n",__func__);
 return 0;
}


decompiled_code:
__int64 take_c()
{
printf("%s -- start\n", "take_c");
printf("%s -- end\n", "take_c");
return 0LL;
}

canonical_decompiled_code:
__int64 func15()
{
printf("%s -- start\n", "take_c");
printf("%s -- end\n", "take_c");
return 0LL;
}

original_code:
static int take_c(int ii, char cc){
 printf("%s -- start\n",__func__);
 printf("%s -- end\n",__func__);
 return 0;
}


decompiled_code:
__int64 take_b()
{
printf("%s -- start\n", "take_b");
printf("%s -- end\n", "take_b");
return 0LL;
}

canonical_decompiled_code:
__int64 func16()
{
printf("%s -- start\n", "take_b");
printf("%s -- end\n", "take_b");
return 0LL;
}

original_code:
static int take_b(char cc){
 printf("%s -- start\n",__func__);
 printf("%s -- end\n",__func__);
 return 0;
}


decompiled_code:
int take_a()
{
printf("%s -- start\n", "take_a");
return printf("%s -- end\n", "take_a");
}

canonical_decompiled_code:
int func17()
{
printf("%s -- start\n", "take_a");
return printf("%s -- end\n", "take_a");
}

original_code:
static void take_a(int ii){
 printf("%s -- start\n",__func__);
 printf("%s -- end\n",__func__);
 return;
}


decompiled_code:
char *__fastcall sbt_flog_init(char *src)
{
char *result; // rax

if ( src )
result = strcpy(&g_logfile_path, src);
return result;
}

canonical_decompiled_code:
char *__fastcall func2(char *src)
{
char *result; // rax

if ( src )
result = strcpy(&g_logfile_path, src);
return result;
}

original_code:
void sbt_flog_init(const char* path){
 if(((void *)0)!=path){
  strcpy((char*)g_logfile_path, path);
 }
}

canonical_original_code:
void sbt_flog_init(char *path){
 if(((void *)0)!=path){
  strcpy((char *)g_logfile_path, path);
 }
}

variable_types:
path
char *


original_code:
void sbt_dumpln( const unsigned char* buf, int start_index, int end_index ){
 int i = 0;
    int dump_size = 0;
 unsigned char* dump_buf = ((void *)0);
 dump_size = end_index - start_index + 1;
 if( 0!=dump_size%16 ){
  dump_size+= 16 - dump_size%16;
 }
 dump_buf = (unsigned char*)malloc( dump_size );
 memset( dump_buf, 0x00, dump_size );
 memcpy( dump_buf, buf+start_index, end_index - start_index + 1 );
 fprintf(stderr, "        |+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F\n");
 for(i=0; i+16<=dump_size; i+=16){
  fprintf(stderr, "%08x|%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
    i,
    dump_buf[i+ 0],
    dump_buf[i+ 1],
    dump_buf[i+ 2],
    dump_buf[i+ 3],
    dump_buf[i+ 4],
    dump_buf[i+ 5],
    dump_buf[i+ 6],
    dump_buf[i+ 7],
    dump_buf[i+ 8],
    dump_buf[i+ 9],
    dump_buf[i+10],
    dump_buf[i+11],
    dump_buf[i+12],
    dump_buf[i+13],
    dump_buf[i+14],
    dump_buf[i+15]
  );
 }
 free(dump_buf);
}

canonical_original_code:
void sbt_dumpln(unsigned char *buf, int start_index, int end_index){
 int i = 0;
    int dump_size = 0;
 unsigned char *dump_buf = ((void *)0);
 dump_size = end_index - start_index + 1;
 if( 0!=dump_size%16 ){
  dump_size+= 16 - dump_size%16;
 }
 dump_buf = (unsigned char *)malloc( dump_size );
 memset( dump_buf, 0x00, dump_size );
 memcpy( dump_buf, buf+start_index, end_index - start_index + 1 );
 fprintf(stderr, "        |+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F\n");
 for(i=0; i+16<=dump_size; i+=16){
  fprintf(stderr, "%08x|%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
    i,
    dump_buf[i+ 0],
    dump_buf[i+ 1],
    dump_buf[i+ 2],
    dump_buf[i+ 3],
    dump_buf[i+ 4],
    dump_buf[i+ 5],
    dump_buf[i+ 6],
    dump_buf[i+ 7],
    dump_buf[i+ 8],
    dump_buf[i+ 9],
    dump_buf[i+10],
    dump_buf[i+11],
    dump_buf[i+12],
    dump_buf[i+13],
    dump_buf[i+14],
    dump_buf[i+15]
  );
 }
 free(dump_buf);
}

variable_types:
buf
unsigned char *


decompiled_code:
int __fastcall sbt_dump(__int64 a1, unsigned int a2, int a3)
{
unsigned int v3; // er15
int v4; // ebx
int v5; // ebx
unsigned int v6; // ebp
int result; // eax
int v8; // er12
int v10; // [rsp+Ch] [rbp-3Ch]

v3 = a2;
v4 = a3;
fwrite(" |+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F\n", 1uLL, 0x39uLL, stderr);
v10 = v4 + 1 - a2;
do
{
v6 = v3;
if ( a3 > (int)(v3 + 15) )
{
fprintf(stderr, "%08x|", v3);
v8 = 16;
}
else
{
v8 = v10;
fprintf(stderr, "%08x|", v3);
if ( v10 <= 0 )
goto LABEL_6;
}
v5 = 0;
do
{
if ( v8 - 1 == v5 )
fprintf(stderr, "%02x", *(unsigned __int8 *)(a1 + (int)v6));
else
fprintf(stderr, "%02x ", *(unsigned __int8 *)(a1 + (int)v6));
++v5;
++v6;
}
while ( v5 < v8 );
LABEL_6:
result = fputc(10, stderr);
v3 += 16;
v10 -= 16;
}
while ( a3 >= (int)v3 );
return result;
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1, unsigned int a2, int a3)
{
unsigned int v3; // er15
int v4; // ebx
int v5; // ebx
unsigned int v6; // ebp
int result; // eax
int v8; // er12
int v10; // [rsp+Ch] [rbp-3Ch]

v3 = a2;
v4 = a3;
fwrite(" |+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F\n", 1uLL, 0x39uLL, stderr);
v10 = v4 + 1 - a2;
do
{
v6 = v3;
if ( a3 > (int)(v3 + 15) )
{
fprintf(stderr, "%08x|", v3);
v8 = 16;
}
else
{
v8 = v10;
fprintf(stderr, "%08x|", v3);
if ( v10 <= 0 )
goto LABEL_6;
}
v5 = 0;
do
{
if ( v8 - 1 == v5 )
fprintf(stderr, "%02x", *(unsigned __int8 *)(a1 + (int)v6));
else
fprintf(stderr, "%02x ", *(unsigned __int8 *)(a1 + (int)v6));
++v5;
++v6;
}
while ( v5 < v8 );
LABEL_6:
result = fputc(10, stderr);
v3 += 16;
v10 -= 16;
}
while ( a3 >= (int)v3 );
return result;
}

original_code:
void sbt_dump( const unsigned char* buf, int start_index, int end_index ){
 int cur_index = start_index;
 int dump_num = 0;
 int i = 0;
 fprintf(stderr, "        |+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F\n");
 do{
  if( (end_index+1)<=cur_index+16 ){
   dump_num = end_index-cur_index+1;
  }else{
   dump_num = 16;
  }
  fprintf(stderr,"%08x|", cur_index);
  for(i=0; i<dump_num; i++){
   if(i==dump_num-1){
    fprintf(stderr, "%02x", buf[cur_index+i]);
   }else{
    fprintf(stderr, "%02x ", buf[cur_index+i]);
   }
  }
  fprintf(stderr, "\n");
  cur_index += 16;
 }while( cur_index<=end_index );
}

canonical_original_code:
void sbt_dump(unsigned char *buf, int start_index, int end_index){
 int cur_index = start_index;
 int dump_num = 0;
 int i = 0;
 fprintf(stderr, "        |+0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F\n");
 do{
  if( (end_index+1)<=cur_index+16 ){
   dump_num = end_index-cur_index+1;
  }else{
   dump_num = 16;
  }
  fprintf(stderr,"%08x|", cur_index);
  for(i=0; i<dump_num; i++){
   if(i==dump_num-1){
    fprintf(stderr, "%02x", buf[cur_index+i]);
   }else{
    fprintf(stderr, "%02x ", buf[cur_index+i]);
   }
  }
  fprintf(stderr, "\n");
  cur_index += 16;
 }while( cur_index<=end_index );
}

variable_types: i int


decompiled_code:
void sbt_test_log()
{
unsigned int v0; // eax
unsigned int v1; // eax
unsigned int v2; // eax
unsigned int v3; // eax
unsigned int v4; // eax
unsigned int v5; // eax
unsigned int v6; // eax
unsigned int v7; // eax
unsigned int v8; // eax
unsigned int v9; // eax
__int64 v10; // [rsp+0h] [rbp-48h]
__int64 v11; // [rsp+0h] [rbp-48h]
__int64 v12; // [rsp+0h] [rbp-48h]
__int64 v13[4]; // [rsp+10h] [rbp-38h] BYREF
int v14[2]; // [rsp+30h] [rbp-18h] BYREF
char v15[13]; // [rsp+3Bh] [rbp-Dh] BYREF

strcpy(v15, "test");
v13[0] = 0x706050403020100LL;
v13[1] = 0xF0E0D0C0B0A0908LL;
v13[2] = 0x1716151413121110LL;
v13[3] = 0x1F1E1D1C1B1A1918LL;
qmemcpy(v14, " !\"#$%", 6);
v0 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_log.c", "sbt_test_log", 0xABu, v0, "DEBUG %d", 3LL);
v1 = getpid();
sbt_logln_tofd(stderr, "I", "src/sbt_log.c", "sbt_test_log", 0xAEu, v1, "INFO %d", 3LL);
v2 = getpid();
sbt_logln_tofd(stderr, "W", "src/sbt_log.c", "sbt_test_log", 0xB1u, v2, "WARNING %d", 3LL);
v3 = getpid();
sbt_logln_tofd(stderr, "E", "src/sbt_log.c", "sbt_test_log", 0xB4u, v3, "ERROR %d", 3LL);
v4 = getpid();
sbt_flogln("D", (__int64)"src/sbt_log.c", "sbt_test_log", 0xB7u, v4, "DEBUG %d", 3LL);
v5 = getpid();
LODWORD(v10) = 3;
sbt_flogln("I", (__int64)"src/sbt_log.c", "sbt_test_log", 0xBAu, v5, "INFO %d", v10);
v6 = getpid();
LODWORD(v11) = 3;
sbt_flogln("W", (__int64)"src/sbt_log.c", "sbt_test_log", 0xBDu, v6, "WARNING %d", v11);
v7 = getpid();
LODWORD(v12) = 3;
sbt_flogln("E", (__int64)"src/sbt_log.c", "sbt_test_log", 0xC0u, v7, "ERROR %d", v12);
sbt_flog_init(0LL);
v8 = getpid();
sbt_flogln("I", (__int64)"src/sbt_log.c", "sbt_test_log", 0xC4u, v8, "%d", v15);
sbt_flog_init("./log2.txt");
v9 = getpid();
sbt_flogln("W", (__int64)"src/sbt_log.c", "sbt_test_log", 0xC8u, v9, "%d", v15);
sbt_dump((__int64)v13, 0, 37);
sbt_dump((__int64)v13, 0x10u, 37);
sbt_dumpln((__int64)v13, 0, 37);
sbt_dumpln((__int64)v13, 16, 37);
}

canonical_decompiled_code:
void func5()
{
unsigned int v0; // eax
unsigned int v1; // eax
unsigned int v2; // eax
unsigned int v3; // eax
unsigned int v4; // eax
unsigned int v5; // eax
unsigned int v6; // eax
unsigned int v7; // eax
unsigned int v8; // eax
unsigned int v9; // eax
__int64 v10; // [rsp+0h] [rbp-48h]
__int64 v11; // [rsp+0h] [rbp-48h]
__int64 v12; // [rsp+0h] [rbp-48h]
__int64 v13[4]; // [rsp+10h] [rbp-38h] BYREF
int v14[2]; // [rsp+30h] [rbp-18h] BYREF
char v15[13]; // [rsp+3Bh] [rbp-Dh] BYREF

strcpy(v15, "test");
v13[0] = 0x706050403020100LL;
v13[1] = 0xF0E0D0C0B0A0908LL;
v13[2] = 0x1716151413121110LL;
v13[3] = 0x1F1E1D1C1B1A1918LL;
qmemcpy(v14, " !\"#$%", 6);
v0 = getpid();
func0(stderr, "D", "src/sbt_log.c", "sbt_test_log", 0xABu, v0, "DEBUG %d", 3LL);
v1 = getpid();
func0(stderr, "I", "src/sbt_log.c", "sbt_test_log", 0xAEu, v1, "INFO %d", 3LL);
v2 = getpid();
func0(stderr, "W", "src/sbt_log.c", "sbt_test_log", 0xB1u, v2, "WARNING %d", 3LL);
v3 = getpid();
func0(stderr, "E", "src/sbt_log.c", "sbt_test_log", 0xB4u, v3, "ERROR %d", 3LL);
v4 = getpid();
func1("D", (__int64)"src/sbt_log.c", "sbt_test_log", 0xB7u, v4, "DEBUG %d", 3LL);
v5 = getpid();
LODWORD(v10) = 3;
func1("I", (__int64)"src/sbt_log.c", "sbt_test_log", 0xBAu, v5, "INFO %d", v10);
v6 = getpid();
LODWORD(v11) = 3;
func1("W", (__int64)"src/sbt_log.c", "sbt_test_log", 0xBDu, v6, "WARNING %d", v11);
v7 = getpid();
LODWORD(v12) = 3;
func1("E", (__int64)"src/sbt_log.c", "sbt_test_log", 0xC0u, v7, "ERROR %d", v12);
func2(0LL);
v8 = getpid();
func1("I", (__int64)"src/sbt_log.c", "sbt_test_log", 0xC4u, v8, "%d", v15);
func2("./log2.txt");
v9 = getpid();
func1("W", (__int64)"src/sbt_log.c", "sbt_test_log", 0xC8u, v9, "%d", v15);
func4((__int64)v13, 0, 37);
func4((__int64)v13, 0x10u, 37);
func3((__int64)v13, 0, 37);
func3((__int64)v13, 16, 37);
}

original_code:
void sbt_test_log(){
 int int_arg = 3;
 unsigned char char_arg[5]={"test"};
 unsigned char dump_arg[38]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f
        ,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f
        ,0x20,0x21,0x22,0x23,0x24,0x25};
 sbt_logln_tofd(stderr, "D", "src/sbt_log.c", __func__, 171, getpid(), "DEBUG %d", int_arg);
 sbt_logln_tofd(stderr, "I", "src/sbt_log.c", __func__, 174, getpid(), "INFO %d", int_arg);
 sbt_logln_tofd(stderr, "W", "src/sbt_log.c", __func__, 177, getpid(), "WARNING %d", int_arg);
 sbt_logln_tofd(stderr, "E", "src/sbt_log.c", __func__, 180, getpid(), "ERROR %d", int_arg);
 sbt_flogln("D", "src/sbt_log.c", __func__, 183, getpid(), "DEBUG %d",int_arg);
 sbt_flogln("I", "src/sbt_log.c", __func__, 186, getpid(), "INFO %d",int_arg);
 sbt_flogln("W", "src/sbt_log.c", __func__, 189, getpid(), "WARNING %d",int_arg);
 sbt_flogln("E", "src/sbt_log.c", __func__, 192, getpid(), "ERROR %d",int_arg);
 sbt_flog_init(((void *)0));
 sbt_flogln("I", "src/sbt_log.c", __func__, 196, getpid(), "%d",char_arg);
 sbt_flog_init("./log2.txt");
 sbt_flogln("W", "src/sbt_log.c", __func__, 200, getpid(), "%d",char_arg);
 sbt_dump( (const unsigned char*)dump_arg, 0, 38-1 );
 sbt_dump( (const unsigned char*)dump_arg, 16, 38-1 );
 sbt_dumpln( (const unsigned char*)dump_arg, 0, 38-1 );
 sbt_dumpln( (const unsigned char*)dump_arg, 16, 38-1 );
}

canonical_original_code:
void sbt_test_log(){
 int int_arg = 3;
 unsigned char char_arg[5] = {"test"};
 unsigned char dump_arg[38] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f
        ,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f
        ,0x20,0x21,0x22,0x23,0x24,0x25};
 sbt_logln_tofd(stderr, "D", "src/sbt_log.c", __func__, 171, getpid(), "DEBUG %d", int_arg);
 sbt_logln_tofd(stderr, "I", "src/sbt_log.c", __func__, 174, getpid(), "INFO %d", int_arg);
 sbt_logln_tofd(stderr, "W", "src/sbt_log.c", __func__, 177, getpid(), "WARNING %d", int_arg);
 sbt_logln_tofd(stderr, "E", "src/sbt_log.c", __func__, 180, getpid(), "ERROR %d", int_arg);
 sbt_flogln("D", "src/sbt_log.c", __func__, 183, getpid(), "DEBUG %d",int_arg);
 sbt_flogln("I", "src/sbt_log.c", __func__, 186, getpid(), "INFO %d",int_arg);
 sbt_flogln("W", "src/sbt_log.c", __func__, 189, getpid(), "WARNING %d",int_arg);
 sbt_flogln("E", "src/sbt_log.c", __func__, 192, getpid(), "ERROR %d",int_arg);
 sbt_flog_init(((void *)0));
 sbt_flogln("I", "src/sbt_log.c", __func__, 196, getpid(), "%d",char_arg);
 sbt_flog_init("./log2.txt");
 sbt_flogln("W", "src/sbt_log.c", __func__, 200, getpid(), "%d",char_arg);
 sbt_dump( (unsigned char *)dump_arg, 0, 38-1 );
 sbt_dump( (unsigned char *)dump_arg, 16, 38-1 );
 sbt_dumpln( (unsigned char *)dump_arg, 0, 38-1 );
 sbt_dumpln( (unsigned char *)dump_arg, 16, 38-1 );
}


decompiled_code:
int __fastcall sbt_mem_dump(unsigned __int8 *a1, __int64 a2)
{
int result; // eax
unsigned __int8 *v3; // rbx

result = fwrite("ADDRESS |VALUE\n", 1uLL, 0x19uLL, stderr);
if ( a2 )
{
v3 = a1;
do
{
result = fprintf(stderr, "%p|%02x\n", v3, *v3);
++v3;
}
while ( v3 != &a1[a2] );
}
return result;
}

canonical_decompiled_code:
int __fastcall func6(unsigned __int8 *a1, __int64 a2)
{
int result; // eax
unsigned __int8 *v3; // rbx

result = fwrite("ADDRESS |VALUE\n", 1uLL, 0x19uLL, stderr);
if ( a2 )
{
v3 = a1;
do
{
result = fprintf(stderr, "%p|%02x\n", v3, *v3);
++v3;
}
while ( v3 != &a1[a2] );
}
return result;
}

original_code:
void sbt_mem_dump( void* buf, unsigned long long num){
 int i = 0;
 unsigned char* c_buf = buf;
 if(4==sizeof(buf)){
  fprintf(stderr, "ADDRESS   |VALUE\n");
 }else if(8==sizeof(buf)){
  fprintf(stderr, "ADDRESS           |VALUE\n");
 }else{
 }
 for(i=0; i<num; i++){
   fprintf(stderr, "%p|%02x\n",
     (unsigned char*)&c_buf[i],
     (unsigned char)c_buf[i]);
 }
}

canonical_original_code:
void sbt_mem_dump(void *buf, unsigned long long num){
 int i = 0;
 unsigned char *c_buf = buf;
 if(4==sizeof(buf)){
  fprintf(stderr, "ADDRESS   |VALUE\n");
 }else if(8==sizeof(buf)){
  fprintf(stderr, "ADDRESS           |VALUE\n");
 }else{
 }
 for(i=0; i<num; i++){
   fprintf(stderr, "%p|%02x\n",
     (unsigned char *)&c_buf[i],
     (unsigned char)c_buf[i]);
 }
}

variable_types:
buf
void *

variable_types:
num
unsigned long long


decompiled_code:
int sbt_test_mem_dump()
{
__int64 *v1; // [rsp+0h] [rbp-28h] BYREF
__int64 v2; // [rsp+8h] [rbp-20h] BYREF
__int64 v3[3]; // [rsp+10h] [rbp-18h] BYREF

v3[0] = 0x1817161514131211LL;
v3[1] = 0x2827262524232221LL;
v2 = 287454020LL;
v1 = &v2;
fwrite("Dump array memory =>\n", 1uLL, 0x15uLL, stderr);
fprintf(stderr, "Start address is %p\n", v3);
sbt_mem_dump((unsigned __int8 *)v3, 16LL);
fwrite("Dump int memory =>\n", 1uLL, 0x13uLL, stderr);
fprintf(stderr, "Start address is %p\n", &v2);
sbt_mem_dump((unsigned __int8 *)&v2, 8LL);
fwrite("Dump int pointer memory =>\n", 1uLL, 0x1BuLL, stderr);
fprintf(stderr, "Start address is %p\n", &v1);
sbt_mem_dump((unsigned __int8 *)&v1, 8LL);
fwrite("Dump all local memory =>\n", 1uLL, 0x19uLL, stderr);
sbt_mem_dump((unsigned __int8 *)&v1, 32LL);
fwrite("Dump stack memory(with \"ebp\" and \"return address\") =>\n", 1uLL, 0x36uLL, stderr);
return sbt_mem_dump((unsigned __int8 *)&v1, 48LL);
}

canonical_decompiled_code:
int func7()
{
__int64 *v1; // [rsp+0h] [rbp-28h] BYREF
__int64 v2; // [rsp+8h] [rbp-20h] BYREF
__int64 v3[3]; // [rsp+10h] [rbp-18h] BYREF

v3[0] = 0x1817161514131211LL;
v3[1] = 0x2827262524232221LL;
v2 = 287454020LL;
v1 = &v2;
fwrite("Dump array memory =>\n", 1uLL, 0x15uLL, stderr);
fprintf(stderr, "Start address is %p\n", v3);
func6((unsigned __int8 *)v3, 16LL);
fwrite("Dump int memory =>\n", 1uLL, 0x13uLL, stderr);
fprintf(stderr, "Start address is %p\n", &v2);
func6((unsigned __int8 *)&v2, 8LL);
fwrite("Dump int pointer memory =>\n", 1uLL, 0x1BuLL, stderr);
fprintf(stderr, "Start address is %p\n", &v1);
func6((unsigned __int8 *)&v1, 8LL);
fwrite("Dump all local memory =>\n", 1uLL, 0x19uLL, stderr);
func6((unsigned __int8 *)&v1, 32LL);
fwrite("Dump stack memory(with \"ebp\" and \"return address\") =>\n", 1uLL, 0x36uLL, stderr);
return func6((unsigned __int8 *)&v1, 48LL);
}

original_code:
void sbt_test_mem_dump(){
 unsigned char test_ar[]={ 0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18
           ,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28 };
 long long test_int = 0x11223344;
 long long* p_test_int = &test_int;
 fprintf(stderr, "Dump array memory =>\n");
 fprintf(stderr, "Start address is %p\n",&test_ar[0]);
 sbt_mem_dump( (void*)test_ar ,sizeof(test_ar));
 fprintf(stderr, "Dump int memory =>\n");
 fprintf(stderr, "Start address is %p\n",&test_int);
 sbt_mem_dump( (void*)&test_int ,sizeof(long long));
 fprintf(stderr, "Dump int pointer memory =>\n");
 fprintf(stderr, "Start address is %p\n",&p_test_int);
 sbt_mem_dump( (void*)&p_test_int ,sizeof(long long*));
 fprintf(stderr, "Dump all local memory =>\n");
 sbt_mem_dump( (void*)&p_test_int, sizeof(long long*) + sizeof(long long) + sizeof(test_ar));
 fprintf(stderr, "Dump stack memory(with \"ebp\" and \"return address\") =>\n");
 sbt_mem_dump( (void*)&p_test_int, sizeof(long long*) + sizeof(long long) + sizeof(test_ar) + sizeof(void*) + sizeof(void*) );
}

canonical_original_code:
void sbt_test_mem_dump(){
 unsigned char test_ar[] = { 0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18
           ,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28 };
 long long test_int = 0x11223344;
 long long *p_test_int = &test_int;
 fprintf(stderr, "Dump array memory =>\n");
 fprintf(stderr, "Start address is %p\n",&test_ar[0]);
 sbt_mem_dump( (void *)test_ar ,sizeof(test_ar));
 fprintf(stderr, "Dump int memory =>\n");
 fprintf(stderr, "Start address is %p\n",&test_int);
 sbt_mem_dump( (void *)&test_int ,sizeof(long long));
 fprintf(stderr, "Dump int pointer memory =>\n");
 fprintf(stderr, "Start address is %p\n",&p_test_int);
 sbt_mem_dump( (void *)&p_test_int ,sizeof(long long *));
 fprintf(stderr, "Dump all local memory =>\n");
 sbt_mem_dump( (void *)&p_test_int, sizeof(long long *) + sizeof(long long) + sizeof(test_ar));
 fprintf(stderr, "Dump stack memory(with \"ebp\" and \"return address\") =>\n");
 sbt_mem_dump( (void *)&p_test_int, sizeof(long long *) + sizeof(long long) + sizeof(test_ar) + sizeof(void *) + sizeof(void *) );
}


canonical_decompiled_code:
__int64 func0()
{
printf("%s -- start\n", "matsu_d");
printf("%s -- exit\n", "matsu_d");
return 0LL;
}

original_code:
static int matsu_d(arg_set_st* st){
 printf("%s -- start\n",__func__);
 printf("%s -- exit\n",__func__);
 return 0;
}


canonical_decompiled_code:
__int64 func1()
{
printf("%s -- start\n", "matsu_c");
printf("%s -- exit\n", "matsu_c");
return 0LL;
}

original_code:
static int matsu_c(int ii, char cc){
 printf("%s -- start\n",__func__);
 printf("%s -- exit\n",__func__);
 return 0;
}


canonical_decompiled_code:
__int64 func2()
{
printf("%s -- start\n", "matsu_b");
printf("%s -- exit\n", "matsu_b");
return 0LL;
}

original_code:
static int matsu_b(char cc){
 printf("%s -- start\n",__func__);
 printf("%s -- exit\n",__func__);
 return 0;
}


canonical_decompiled_code:
int func3()
{
printf("%s -- start\n", "matsu_a");
return printf("%s -- exit\n", "matsu_a");
}

original_code:
static void matsu_a(int ii){
 printf("%s -- start\n",__func__);
 printf("%s -- exit\n",__func__);
 return;
}


decompiled_code:
__int64 *plugin_init()
{
printf("%s %s -- start\n", "plugin_matsu.c", "plugin_init");
printf("%s %s -- exit\n", "plugin_matsu.c", "plugin_init");
info = (__int64)"plugin-matsu";
xmmword_188 = (__int128)_mm_load_si128((const __m128i *)fp);
xmmword_198 = (__int128)_mm_load_si128((const __m128i *)off_250);
return &info;
}

canonical_decompiled_code:
__int64 *func4()
{
printf("%s %s -- start\n", "plugin_matsu.c", "plugin_init");
printf("%s %s -- exit\n", "plugin_matsu.c", "plugin_init");
info = (__int64)"plugin-matsu";
xmmword_188 = (__int128)_mm_load_si128((const __m128i *)fp);
xmmword_198 = (__int128)_mm_load_si128((const __m128i *)off_250);
return &info;
}

original_code:
plugin_info_st* plugin_init(){
 printf("%s %s -- start\n","plugin_matsu.c",__func__);
 printf("%s %s -- exit\n","plugin_matsu.c",__func__);
 info.name = "plugin-matsu";
 info.fp = fp;
 return &info;
}

canonical_original_code:
struct plugin_info *plugin_init(){
 printf("%s %s -- start\n","plugin_matsu.c",__func__);
 printf("%s %s -- exit\n","plugin_matsu.c",__func__);
 info.name = "plugin-matsu";
 info.fp = fp;
 return &info;
}

return_type: struct plugin_info { char *name; struct func_pointer { void (*func_a)(int); int (*func_b)(char); int (*func_c)(int, char); int (*func_d)(struct arg_set { int aa; char bb; } *); } fp; } *

user_defined_types: struct plugin_info { char *name; struct func_pointer fp; }


decompiled_code:
int plugin_desc()
{
printf("%s %s -- start\n", "plugin_matsu.c", "plugin_desc");
return printf("%s %s -- exit\n", "plugin_matsu.c", "plugin_desc");
}

canonical_decompiled_code:
int func5()
{
printf("%s %s -- start\n", "plugin_matsu.c", "plugin_desc");
return printf("%s %s -- exit\n", "plugin_matsu.c", "plugin_desc");
}

original_code:
void plugin_desc(){
 printf("%s %s -- start\n","plugin_matsu.c",__func__);
 printf("%s %s -- exit\n","plugin_matsu.c",__func__);
}


decompiled_code:
char *__fastcall sbt_web_html_parse(_QWORD *a1, const char *a2)
{
char *result; // rax
int v4; // edx
__int64 v5; // rcx
int v6; // esi
int v7; // edx
char v8; // di
void *v9; // r12
__int64 v10[2]; // [rsp+0h] [rbp-418h] BYREF
char v11[1008]; // [rsp+10h] [rbp-408h] BYREF

v10[0] = 0LL;
v10[1] = 0LL;
memset(v11, 0, sizeof(v11));
result = (char *)strlen(a2);
if ( (int)result <= 0 )
goto LABEL_16;
v4 = (int)result;
result = (char *)a2;
v5 = (__int64)&a2[v4 - 1 + 1];
v6 = 0;
v7 = 0;
do
{
if ( v7 )
{
if ( v7 == 1 )
{
v8 = *result;
if ( *result == 60 )
{
v7 = 0;
}
else if ( v8 != 32 )
{
*((_BYTE *)v10 + v6++) = v8;
v7 = 2;
}
}
else if ( v7 == 2 )
{
if ( *result == 60 )
v7 = 0;
else
*((_BYTE *)v10 + v6++) = *result;
}
}
else
{
v7 = *result == 62;
}
++result;
}
while ( result != (char *)v5 );
if ( v6 )
{
v9 = malloc(v6);
*a1 = v9;
memset(v9, 0, v6);
result = strcpy((char *)v9, (const char *)v10);
}
else
{
LABEL_16:
*a1 = 0LL;
}
return result;
}

canonical_decompiled_code:
char *__fastcall func0(_QWORD *a1, const char *a2)
{
char *result; // rax
int v4; // edx
__int64 v5; // rcx
int v6; // esi
int v7; // edx
char v8; // di
void *v9; // r12
__int64 v10[2]; // [rsp+0h] [rbp-418h] BYREF
char v11[1008]; // [rsp+10h] [rbp-408h] BYREF

v10[0] = 0LL;
v10[1] = 0LL;
memset(v11, 0, sizeof(v11));
result = (char *)strlen(a2);
if ( (int)result <= 0 )
goto LABEL_16;
v4 = (int)result;
result = (char *)a2;
v5 = (__int64)&a2[v4 - 1 + 1];
v6 = 0;
v7 = 0;
do
{
if ( v7 )
{
if ( v7 == 1 )
{
v8 = *result;
if ( *result == 60 )
{
v7 = 0;
}
else if ( v8 != 32 )
{
*((_BYTE *)v10 + v6++) = v8;
v7 = 2;
}
}
else if ( v7 == 2 )
{
if ( *result == 60 )
v7 = 0;
else
*((_BYTE *)v10 + v6++) = *result;
}
}
else
{
v7 = *result == 62;
}
++result;
}
while ( result != (char *)v5 );
if ( v6 )
{
v9 = malloc(v6);
*a1 = v9;
memset(v9, 0, v6);
result = strcpy((char *)v9, (const char *)v10);
}
else
{
LABEL_16:
*a1 = 0LL;
}
return result;
}

original_code:
void sbt_web_html_parse(char** outBuf,const char* inBuf){
 char textBuf[1024] = {'\0'};
 int in_len;
 int i;
 int tagStatus = 0;
 int outLen = 0;
 in_len = strlen( inBuf );
 for(i=0; i<in_len; i++){
  if( 0 == tagStatus ){
   if('>' == inBuf[i]){
    tagStatus = 1;
   }
  }else if(1 == tagStatus){
   if('<' == inBuf[i]){
    tagStatus = 0;
   }else if(' ' == inBuf[i]){
   }else{
    tagStatus = 2;
    textBuf[outLen] = inBuf[i];
    outLen++;
   }
  }else if(2 == tagStatus){
   if('<' == inBuf[i]){
    tagStatus = 0;
    continue;
   }else{
    textBuf[outLen] = inBuf[i];
    outLen++;
   }
  }
 }
 if(0==outLen){
  *outBuf = ((void *)0);
 }else{
  *outBuf = malloc(outLen);
  memset( *outBuf, '\0', outLen );
  strcpy( *outBuf, textBuf );
 }
 return;
}

canonical_original_code:
void sbt_web_html_parse(char **outBuf, char *inBuf){
 char textBuf[1024] = {'\0'};
 int in_len;
 int i;
 int tagStatus = 0;
 int outLen = 0;
 in_len = strlen( inBuf );
 for(i=0; i<in_len; i++){
  if( 0 == tagStatus ){
   if('>' == inBuf[i]){
    tagStatus = 1;
   }
  }else if(1 == tagStatus){
   if('<' == inBuf[i]){
    tagStatus = 0;
   }else if(' ' == inBuf[i]){
   }else{
    tagStatus = 2;
    textBuf[outLen] = inBuf[i];
    outLen++;
   }
  }else if(2 == tagStatus){
   if('<' == inBuf[i]){
    tagStatus = 0;
    continue;
   }else{
    textBuf[outLen] = inBuf[i];
    outLen++;
   }
  }
 }
 if(0==outLen){
  *outBuf = ((void *)0);
 }else{
  *outBuf = malloc(outLen);
  memset( *outBuf, '\0', outLen );
  strcpy( *outBuf, textBuf );
 }
 return;
}

variable_types:
outBuf
char **

variable_types:
inBuf
char *

variable_types:
textBuf
char [1024]

variable_types: tagStatus int

variable_types: outLen int


decompiled_code:
__int64 sbt_web_html_parse_test()
{
bool v0; // cf
bool v1; // zf
_BYTE *v2; // rdi
__int64 v3; // rcx
_BYTE *v4; // rsi
bool v5; // cf
bool v6; // zf
const char *v7; // rdi
__int64 v8; // rcx
const char *v9; // rsi
char v11[48]; // [rsp+0h] [rbp-68h] BYREF
char v12[40]; // [rsp+30h] [rbp-38h] BYREF
__int64 v13[2]; // [rsp+58h] [rbp-10h] BYREF

v13[0] = 0LL;
strcpy(v12, "aaa");
strcpy(v11, "  bbb  ");
sbt_web_html_parse(v13, v12);
v2 = &unk_23F;
v3 = 4LL;
v4 = (_BYTE *)v13[0];
do
{
if ( !v3 )
break;
v0 = *v4 < *v2;
v1 = *v4++ == *v2++;
--v3;
}
while ( v1 );
if ( (!v0 && !v1) != v0 )
_assert_fail("0 == strcmp(p_buf,\"aaa\")", "src/sbt_web.c", 0x46u, "sbt_web_html_parse_test");
sbt_free(v13[0], v4);
sbt_web_html_parse(v13, v11);
v7 = "bbb ";
v8 = 6LL;
v9 = (const char *)v13[0];
do
{
if ( !v8 )
break;
v5 = *v9 < (unsigned int)*v7;
v6 = *v9++ == *v7++;
--v8;
}
while ( v6 );
if ( (!v5 && !v6) != v5 )
_assert_fail("0 == strcmp(p_buf,\"bbb \")", "src/sbt_web.c", 0x4Au, "sbt_web_html_parse_test");
return sbt_free(v13[0], v9);
}

canonical_decompiled_code:
__int64 func1()
{
bool v0; // cf
bool v1; // zf
_BYTE *v2; // rdi
__int64 v3; // rcx
_BYTE *v4; // rsi
bool v5; // cf
bool v6; // zf
const char *v7; // rdi
__int64 v8; // rcx
const char *v9; // rsi
char v11[48]; // [rsp+0h] [rbp-68h] BYREF
char v12[40]; // [rsp+30h] [rbp-38h] BYREF
__int64 v13[2]; // [rsp+58h] [rbp-10h] BYREF

v13[0] = 0LL;
strcpy(v12, "aaa");
strcpy(v11, "  bbb  ");
func0(v13, v12);
v2 = &unk_23F;
v3 = 4LL;
v4 = (_BYTE *)v13[0];
do
{
if ( !v3 )
break;
v0 = *v4 < *v2;
v1 = *v4++ == *v2++;
--v3;
}
while ( v1 );
if ( (!v0 && !v1) != v0 )
_assert_fail("0 == strcmp(p_buf,\"aaa\")", "src/sbt_web.c", 0x46u, "sbt_web_html_parse_test");
sbt_free(v13[0], v4);
func0(v13, v11);
v7 = "bbb ";
v8 = 6LL;
v9 = (const char *)v13[0];
do
{
if ( !v8 )
break;
v5 = *v9 < (unsigned int)*v7;
v6 = *v9++ == *v7++;
--v8;
}
while ( v6 );
if ( (!v5 && !v6) != v5 )
_assert_fail("0 == strcmp(p_buf,\"bbb \")", "src/sbt_web.c", 0x4Au, "sbt_web_html_parse_test");
return sbt_free(v13[0], v9);
}

original_code:
void sbt_web_html_parse_test(){
 char *p_buf = ((void *)0);
 char html_test1[]={"aaa"};
 char html_test2[]={"  bbb   "};
 sbt_web_html_parse( (char**)&p_buf,(const char*)html_test1 );
 ((void) sizeof ((0 == strcmp(p_buf,"aaa")) ? 1 : 0), __extension__ ({ if (0 == strcmp(p_buf,"aaa")) ; else __assert_fail ("0 == strcmp(p_buf,\"aaa\")", "src/sbt_web.c", 70, __extension__ __PRETTY_FUNCTION__); }));
 if(((void *)0)!=p_buf) sbt_free(p_buf);
 sbt_web_html_parse( (char**)&p_buf,(const char*)html_test2 );
 ((void) sizeof ((0 == strcmp(p_buf,"bbb  ")) ? 1 : 0), __extension__ ({ if (0 == strcmp(p_buf,"bbb  ")) ; else __assert_fail ("0 == strcmp(p_buf,\"bbb  \")", "src/sbt_web.c", 74, __extension__ __PRETTY_FUNCTION__); }));
 if(((void *)0)!=p_buf) sbt_free(p_buf);
}

canonical_original_code:
void sbt_web_html_parse_test(){
 char *p_buf = ((void *)0);
 char html_test1[] = {"aaa"};
 char html_test2[] = {"  bbb   "};
 sbt_web_html_parse( (char **)&p_buf,(char *)html_test1 );
 ((void) sizeof ((0 == strcmp(p_buf,"aaa")) ? 1 : 0), __extension__ ({ if (0 == strcmp(p_buf,"aaa")) ; else __assert_fail ("0 == strcmp(p_buf,\"aaa\")", "src/sbt_web.c", 70, __extension__ __PRETTY_FUNCTION__); }));
 if(((void *)0)!=p_buf) sbt_free(p_buf);
 sbt_web_html_parse( (char **)&p_buf,(char *)html_test2 );
 ((void) sizeof ((0 == strcmp(p_buf,"bbb  ")) ? 1 : 0), __extension__ ({ if (0 == strcmp(p_buf,"bbb  ")) ; else __assert_fail ("0 == strcmp(p_buf,\"bbb  \")", "src/sbt_web.c", 74, __extension__ __PRETTY_FUNCTION__); }));
 if(((void *)0)!=p_buf) sbt_free(p_buf);
}


decompiled_code:
void __fastcall progress_print(_DWORD *a1, unsigned __int64 a2, unsigned __int64 a3)
{
unsigned __int64 v4; // r14
_QWORD *v5; // rbx

if ( a1 )
{
v4 = a2 / (a3 / 0x28);
v5 = malloc(0x29uLL);
*v5 = 0LL;
v5[1] = 0LL;
v5[2] = 0LL;
v5[3] = 0LL;
v5[4] = 0LL;
*((_BYTE *)v5 + 40) = 0;
memset(v5, 42, (unsigned int)v4);
memset((char *)v5 + (unsigned int)v4, 45, (unsigned int)(40 - v4));
fputs((const char *)v5, stderr);
fprintf(stderr, "(%lld/%lld)", a2, a3);
fputc(13, stderr);
fflush(stderr);
if ( (_DWORD)v4 == 40 )
fputc(10, stderr);
*a1 = v4;
}
}

canonical_decompiled_code:
void __fastcall func1(_DWORD *a1, unsigned __int64 a2, unsigned __int64 a3)
{
unsigned __int64 v4; // r14
_QWORD *v5; // rbx

if ( a1 )
{
v4 = a2 / (a3 / 0x28);
v5 = malloc(0x29uLL);
*v5 = 0LL;
v5[1] = 0LL;
v5[2] = 0LL;
v5[3] = 0LL;
v5[4] = 0LL;
*((_BYTE *)v5 + 40) = 0;
memset(v5, 42, (unsigned int)v4);
memset((char *)v5 + (unsigned int)v4, 45, (unsigned int)(40 - v4));
fputs((const char *)v5, stderr);
fprintf(stderr, "(%lld/%lld)", a2, a3);
fputc(13, stderr);
fflush(stderr);
if ( (_DWORD)v4 == 40 )
fputc(10, stderr);
*a1 = v4;
}
}

original_code:
void progress_print(unsigned int* prog_num, unsigned long long progress, unsigned long long max){
 unsigned int MAX_WIDTH = 40;
 unsigned long long rate = 0;
 unsigned int new_prog_num = 0;
 unsigned char* prog_bar = ((void *)0);
 if( ((void *)0)==prog_num ){
  return;
 }
 rate = max / (unsigned long long)MAX_WIDTH;
 new_prog_num = (unsigned int)(progress / rate);
 ;
 prog_bar = (unsigned char*)malloc(MAX_WIDTH+1);
 memset( prog_bar, 0x00, MAX_WIDTH+1 );
 memset( prog_bar, '*', new_prog_num );
 memset( prog_bar+new_prog_num, '-', MAX_WIDTH-new_prog_num );
 fprintf( stderr, "%s",prog_bar );
 fprintf( stderr, "(%lld/%lld)", progress, max );
    fprintf( stderr,"\r");
 fflush( stderr );
 if( MAX_WIDTH==new_prog_num ){
       fprintf( stderr, "\n" );
 }
 *prog_num = new_prog_num;
 if( ((void *)0)==prog_bar ){
  free(prog_bar);
 }
 return;
}

canonical_original_code:
void progress_print(unsigned int *prog_num, unsigned long long progress, unsigned long long max){
 unsigned int MAX_WIDTH = 40;
 unsigned long long rate = 0;
 unsigned int new_prog_num = 0;
 unsigned char *prog_bar = ((void *)0);
 if( ((void *)0)==prog_num ){
  return;
 }
 rate = max / (unsigned long long)MAX_WIDTH;
 new_prog_num = (unsigned int)(progress / rate);
 ;
 prog_bar = (unsigned char *)malloc(MAX_WIDTH+1);
 memset( prog_bar, 0x00, MAX_WIDTH+1 );
 memset( prog_bar, '*', new_prog_num );
 memset( prog_bar+new_prog_num, '-', MAX_WIDTH-new_prog_num );
 fprintf( stderr, "%s",prog_bar );
 fprintf( stderr, "(%lld/%lld)", progress, max );
    fprintf( stderr,"\r");
 fflush( stderr );
 if( MAX_WIDTH==new_prog_num ){
       fprintf( stderr, "\n" );
 }
 *prog_num = new_prog_num;
 if( ((void *)0)==prog_bar ){
  free(prog_bar);
 }
 return;
}

variable_types:
progress
unsigned long long

variable_types:
max
unsigned long long

variable_types:
rate
unsigned long long


decompiled_code:
void __fastcall append_file_thread(void *src, int a2)
{
_DWORD *v2; // rbx
void *v3; // rax
pthread_attr_t v4; // [rsp+0h] [rbp-68h] BYREF
pthread_t newthread[6]; // [rsp+38h] [rbp-30h] BYREF

v2 = malloc(0x10uLL);
v2[3] = 0;
v3 = malloc(a2);
*(_QWORD *)v2 = v3;
memcpy(v3, src, a2);
v2[2] = a2;
pthread_attr_init(&v4);
pthread_attr_setstacksize(&v4, 0x10000uLL);
pthread_create(newthread, 0LL, (void *(*)(void *))append_file, v2);
pthread_join(newthread[0], 0LL);
pthread_attr_destroy(&v4);
if ( *(_QWORD *)v2 )
free(*(void **)v2);
free(v2);
}

canonical_decompiled_code:
void __fastcall func2(void *src, int a2)
{
_DWORD *v2; // rbx
void *v3; // rax
pthread_attr_t v4; // [rsp+0h] [rbp-68h] BYREF
pthread_t newthread[6]; // [rsp+38h] [rbp-30h] BYREF

v2 = malloc(0x10uLL);
v2[3] = 0;
v3 = malloc(a2);
*(_QWORD *)v2 = v3;
memcpy(v3, src, a2);
v2[2] = a2;
pthread_attr_init(&v4);
pthread_attr_setstacksize(&v4, 0x10000uLL);
pthread_create(newthread, 0LL, (void *(*)(void *))append_file, v2);
pthread_join(newthread[0], 0LL);
pthread_attr_destroy(&v4);
if ( *(_QWORD *)v2 )
free(*(void **)v2);
free(v2);
}

original_code:
void append_file_thread( char* buf, int size ){
    pthread_t thread;
 pthread_attr_t attr;
 append_file_st* apd;
 apd = (append_file_st*)malloc( sizeof(append_file_st) );
 memset( apd, 0x00, sizeof(append_file_st) );
 apd->buf = (char*)malloc(size);
 memcpy(apd->buf, buf, size);
 apd->size = size;
 pthread_attr_init(&attr);
 pthread_attr_setstacksize(&attr, 64 * 1024);
 pthread_create( &thread, ((void *)0), (void*)append_file, (append_file_st*)apd );
 ;
 pthread_join( thread, ((void *)0) );
 ;
 pthread_attr_destroy(&attr);
 if(((void *)0)!=apd->buf){
  free(apd->buf);
 }
 if(((void *)0)!=apd){
  free(apd);
 }
}

canonical_original_code:
void append_file_thread(char *buf, int size){
    unsigned long thread;
 union pthread_attr_t attr;
 struct _append_file_st *apd;
 apd = (struct _append_file_st *)malloc( sizeof(append_file_st) );
 memset( apd, 0x00, sizeof(append_file_st) );
 apd->buf = (char *)malloc(size);
 memcpy(apd->buf, buf, size);
 apd->size = size;
 pthread_attr_init(&attr);
 pthread_attr_setstacksize(&attr, 64 * 1024);
 pthread_create( &thread, ((void *)0), (void *)append_file, (struct _append_file_st *)apd );
 ;
 pthread_join( thread, ((void *)0) );
 ;
 pthread_attr_destroy(&attr);
 if(((void *)0)!=apd->buf){
  free(apd->buf);
 }
 if(((void *)0)!=apd){
  free(apd);
 }
}

variable_types:
buf
char *

variable_types: size int

variable_types:
thread
unsigned long

variable_types: union pthread_attr_t { char __size[56]; long __align; }

variable_types: struct _append_file_st { char *buf; int size; } *


decompiled_code:
void *__fastcall sub_thread_join(void *a1)
{
pthread_t v1; // r12
unsigned int v2; // eax
__int64 v3; // rbx
unsigned int v4; // eax
unsigned int v5; // eax

v1 = pthread_self();
v2 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_join", 50LL, v2, "Start(threadID=0x%x)", v1);
if ( *(int *)a1 > 0 )
{
v3 = 0LL;
do
{
sleep(1u);
v4 = getpid();
sbt_logln_tofd(stderr, "I", "src/sbt_thread.c", "sub_thread_join", 54LL, v4, "count = %d", v3);
v3 = (unsigned int)(v3 + 1);
}
while ( *(_DWORD *)a1 > (int)v3 );
}
v5 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_join", 57LL, v5, "End(threadID=0x%x)", v1);
return 0LL;
}

canonical_decompiled_code:
void *__fastcall func0(void *a1)
{
pthread_t v1; // r12
unsigned int v2; // eax
__int64 v3; // rbx
unsigned int v4; // eax
unsigned int v5; // eax

v1 = pthread_self();
v2 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_join", 50LL, v2, "Start(threadID=0x%x)", v1);
if ( *(int *)a1 > 0 )
{
v3 = 0LL;
do
{
sleep(1u);
v4 = getpid();
sbt_logln_tofd(stderr, "I", "src/sbt_thread.c", "sub_thread_join", 54LL, v4, "count = %d", v3);
v3 = (unsigned int)(v3 + 1);
}
while ( *(_DWORD *)a1 > (int)v3 );
}
v5 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_join", 57LL, v5, "End(threadID=0x%x)", v1);
return 0LL;
}

original_code:
static void *sub_thread_join(int* param){
 int i;
 pthread_t tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 50, getpid(), "Start(threadID=0x%x)", tid);
 for( i=0; i<*param; i++ ){
        sleep(1);
        sbt_logln_tofd(stderr, "I", "src/sbt_thread.c", __func__, 54, getpid(), "count = %d" , i);
 }
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 57, getpid(), "End(threadID=0x%x)", tid);
 return ((void *)0);
}

canonical_original_code:
static void *sub_thread_join(int *param){
 int i;
 unsigned long tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 50, getpid(), "Start(threadID=0x%x)", tid);
 for( i=0; i<*param; i++ ){
        sleep(1);
        sbt_logln_tofd(stderr, "I", "src/sbt_thread.c", __func__, 54, getpid(), "count = %d" , i);
 }
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 57, getpid(), "End(threadID=0x%x)", tid);
 return ((void *)0);
}

variable_types:
param
int *

variable_types:
tid
unsigned long


decompiled_code:
void *__fastcall sub_thread_exclusive(void *a1)
{
pthread_t v1; // rbx
__int64 v2; // rbp
unsigned int v3; // eax
unsigned int v4; // eax

v1 = pthread_self();
v2 = *(unsigned int *)a1;
v3 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_thread.c",
"sub_thread_exclusive",
77LL,
v3,
"Start(param=0x%x threadID=0x%x)",
v2,
v1);
pthread_mutex_lock(&test_mutex);
test_sleep_func();
pthread_mutex_unlock(&test_mutex);
v4 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_exclusive", 83LL, v4, "End(threadID=0x%x)", v1);
return 0LL;
}

canonical_decompiled_code:
void *__fastcall func2(void *a1)
{
pthread_t v1; // rbx
__int64 v2; // rbp
unsigned int v3; // eax
unsigned int v4; // eax

v1 = pthread_self();
v2 = *(unsigned int *)a1;
v3 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_thread.c",
"sub_thread_exclusive",
77LL,
v3,
"Start(param=0x%x threadID=0x%x)",
v2,
v1);
pthread_mutex_lock(&test_mutex);
func1();
pthread_mutex_unlock(&test_mutex);
v4 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_exclusive", 83LL, v4, "End(threadID=0x%x)", v1);
return 0LL;
}

original_code:
static void *sub_thread_exclusive(int* param){
 pthread_t tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 77, getpid(), "Start(param=0x%x threadID=0x%x)", *param, tid);
    pthread_mutex_lock(&test_mutex);
    test_sleep_func();
    pthread_mutex_unlock(&test_mutex);
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 83, getpid(), "End(threadID=0x%x)", tid);
 return ((void *)0);
}

canonical_original_code:
static void *sub_thread_exclusive(int *param){
 unsigned long tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 77, getpid(), "Start(param=0x%x threadID=0x%x)", *param, tid);
    pthread_mutex_lock(&test_mutex);
    test_sleep_func();
    pthread_mutex_unlock(&test_mutex);
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 83, getpid(), "End(threadID=0x%x)", tid);
 return ((void *)0);
}


decompiled_code:
int sbt_thread_detatch()
{
pthread_t v0; // rax

v0 = pthread_self();
return pthread_detach(v0);
}

canonical_decompiled_code:
int func3()
{
pthread_t v0; // rax

v0 = pthread_self();
return pthread_detach(v0);
}

original_code:
void sbt_thread_detatch( ){
 pthread_detach(pthread_self());
}

canonical_original_code:
void sbt_thread_detatch(){
 pthread_detach(pthread_self());
}


decompiled_code:
void *__fastcall sub_thread_detach(void *a1)
{
pthread_t v1; // r13
unsigned int v2; // eax
__int64 v3; // rbx
unsigned int v4; // eax
__int64 v5; // rbx
__int64 v6; // r12
unsigned int v7; // eax
unsigned int v8; // eax

v1 = pthread_self();
v2 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_detach", 34LL, v2, "Start(threadID=0x%x)", v1);
v3 = *(unsigned int *)a1;
v4 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_detach", 35LL, v4, "param->size=%d", v3);
if ( *(int *)a1 > 0 )
{
v5 = 0LL;
do
{
sleep(1u);
v6 = (unsigned int)*((char *)a1 + v5 + 4);
v7 = getpid();
sbt_logln_tofd(stderr, "I", "src/sbt_thread.c", "sub_thread_detach", 38LL, v7, "param->buf[%d]=%d", v5++, v6);
}
while ( *(_DWORD *)a1 > (int)v5 );
}
v8 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_detach", 41LL, v8, "End(threadID=0x%x)", v1);
sbt_thread_detatch();
return 0LL;
}

canonical_decompiled_code:
void *__fastcall func4(void *a1)
{
pthread_t v1; // r13
unsigned int v2; // eax
__int64 v3; // rbx
unsigned int v4; // eax
__int64 v5; // rbx
__int64 v6; // r12
unsigned int v7; // eax
unsigned int v8; // eax

v1 = pthread_self();
v2 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_detach", 34LL, v2, "Start(threadID=0x%x)", v1);
v3 = *(unsigned int *)a1;
v4 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_detach", 35LL, v4, "param->size=%d", v3);
if ( *(int *)a1 > 0 )
{
v5 = 0LL;
do
{
sleep(1u);
v6 = (unsigned int)*((char *)a1 + v5 + 4);
v7 = getpid();
sbt_logln_tofd(stderr, "I", "src/sbt_thread.c", "sub_thread_detach", 38LL, v7, "param->buf[%d]=%d", v5++, v6);
}
while ( *(_DWORD *)a1 > (int)v5 );
}
v8 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sub_thread_detach", 41LL, v8, "End(threadID=0x%x)", v1);
func3();
return 0LL;
}

original_code:
static void *sub_thread_detach(test_thread_func_st* param){
 int i;
 pthread_t tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 34, getpid(), "Start(threadID=0x%x)", tid);
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 35, getpid(), "param->size=%d", param->size);
 for( i=0; i<param->size; i++ ){
        sleep(1);
        sbt_logln_tofd(stderr, "I", "src/sbt_thread.c", __func__, 38, getpid(), "param->buf[%d]=%d", i, param->buf[i]);
 }
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 41, getpid(), "End(threadID=0x%x)", tid);
 sbt_thread_detatch();
 return ((void *)0);
}

canonical_original_code:
static void *sub_thread_detach(struct _test_thread_func_st *param){
 int i;
 unsigned long tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 34, getpid(), "Start(threadID=0x%x)", tid);
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 35, getpid(), "param->size=%d", param->size);
 for( i=0; i<param->size; i++ ){
        sleep(1);
        sbt_logln_tofd(stderr, "I", "src/sbt_thread.c", __func__, 38, getpid(), "param->buf[%d]=%d", i, param->buf[i]);
 }
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 41, getpid(), "End(threadID=0x%x)", tid);
 sbt_thread_detatch();
 return ((void *)0);
}

variable_types: struct _test_thread_func_st { int size; char buf[4]; } *

variable_types: i int


decompiled_code:
void __noreturn sbt_thread_exit()
{
pthread_exit(0LL);
}

canonical_decompiled_code:
void __noreturn func5()
{
pthread_exit(0LL);
}

original_code:
void sbt_thread_exit( ){
 pthread_exit(((void *)0));
}

canonical_original_code:
void sbt_thread_exit(){
 pthread_exit(((void *)0));
}


decompiled_code:
int __fastcall sbt_thread_run(void *(*start_routine)(void *), void *arg, __int16 a3, size_t a4)
{
pthread_attr_t v7; // [rsp+0h] [rbp-68h] BYREF
pthread_t newthread[6]; // [rsp+38h] [rbp-30h] BYREF

pthread_attr_init(&v7);
if ( a4 )
pthread_attr_setstacksize(&v7, a4);
else
pthread_attr_setstacksize(&v7, 0x10000uLL);
if ( a3 == 1 )
{
pthread_attr_setdetachstate(&v7, 0);
pthread_create(newthread, &v7, start_routine, arg);
pthread_join(newthread[0], 0LL);
}
else
{
pthread_attr_setdetachstate(&v7, 1);
pthread_create(newthread, &v7, start_routine, arg);
}
return pthread_attr_destroy(&v7);
}

canonical_decompiled_code:
int __fastcall func6(void *(*start_routine)(void *), void *arg, __int16 a3, size_t a4)
{
pthread_attr_t v7; // [rsp+0h] [rbp-68h] BYREF
pthread_t newthread[6]; // [rsp+38h] [rbp-30h] BYREF

pthread_attr_init(&v7);
if ( a4 )
pthread_attr_setstacksize(&v7, a4);
else
pthread_attr_setstacksize(&v7, 0x10000uLL);
if ( a3 == 1 )
{
pthread_attr_setdetachstate(&v7, 0);
pthread_create(newthread, &v7, start_routine, arg);
pthread_join(newthread[0], 0LL);
}
else
{
pthread_attr_setdetachstate(&v7, 1);
pthread_create(newthread, &v7, start_routine, arg);
}
return pthread_attr_destroy(&v7);
}

original_code:
void sbt_thread_run( const void* func, const void* f_arg, short int join_flg, long int stk_size){
    pthread_t thread;
 pthread_attr_t attr;
 pthread_attr_init(&attr);
 if(0==stk_size){
  pthread_attr_setstacksize( &attr, 64 * 1024 );
 }else{
  pthread_attr_setstacksize( &attr, stk_size );
 }
 if(1==join_flg){
  pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE );
 }else{
  pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
 }
 pthread_create( &thread, &attr, (void*)func, (void*)f_arg );
 if(1==join_flg){
  pthread_join( thread, ((void *)0) );
 }
 pthread_attr_destroy(&attr);
 return;
}

canonical_original_code:
void sbt_thread_run(void *func, void *f_arg, short join_flg, long stk_size){
    unsigned long thread;
 union pthread_attr_t attr;
 pthread_attr_init(&attr);
 if(0==stk_size){
  pthread_attr_setstacksize( &attr, 64 * 1024 );
 }else{
  pthread_attr_setstacksize( &attr, stk_size );
 }
 if(1==join_flg){
  pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE );
 }else{
  pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
 }
 pthread_create( &thread, &attr, (void *)func, (void *)f_arg );
 if(1==join_flg){
  pthread_join( thread, ((void *)0) );
 }
 pthread_attr_destroy(&attr);
 return;
}

variable_types:
func
void *

user_defined_types: union pthread_attr_t { char __size[56]; long __align; }


decompiled_code:
__int64 sbt_thread_test_join()
{
pthread_t v0; // rbx
unsigned int v1; // eax
unsigned int v2; // eax
int arg[3]; // [rsp+Ch] [rbp-Ch] BYREF

arg[0] = 6;
v0 = pthread_self();
v1 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sbt_thread_test_join", 136LL, v1, "Start (main threadID=0x%x)", v0);
sbt_thread_run(sub_thread_join, arg, 1, 0LL);
v2 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sbt_thread_test_join", 142LL, v2, "End (main threadID=0x%x)", v0);
return 0LL;
}

canonical_decompiled_code:
__int64 func7()
{
pthread_t v0; // rbx
unsigned int v1; // eax
unsigned int v2; // eax
int arg[3]; // [rsp+Ch] [rbp-Ch] BYREF

arg[0] = 6;
v0 = pthread_self();
v1 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sbt_thread_test_join", 136LL, v1, "Start (main threadID=0x%x)", v0);
func6(sub_thread_join, arg, 1, 0LL);
v2 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sbt_thread_test_join", 142LL, v2, "End (main threadID=0x%x)", v0);
return 0LL;
}

original_code:
int sbt_thread_test_join(){
 int loop_cnt = 6;
 pthread_t tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 136, getpid(), "Start (main threadID=0x%x)", tid);
 sbt_thread_run( (const void*)sub_thread_join,
     (const void*)&loop_cnt ,
     1,
     0);
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 142, getpid(), "End (main threadID=0x%x)", tid);
 return 0;
}

canonical_original_code:
int sbt_thread_test_join(){
 int loop_cnt = 6;
 unsigned long tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 136, getpid(), "Start (main threadID=0x%x)", tid);
 sbt_thread_run( (void *)sub_thread_join,
     (void *)&loop_cnt ,
     1,
     0);
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 142, getpid(), "End (main threadID=0x%x)", tid);
 return 0;
}


decompiled_code:
void __noreturn sbt_thread_test_detatch()
{
pthread_t v0; // rbp
unsigned int v1; // eax
_BYTE *v2; // rbx
unsigned int v3; // eax

v0 = pthread_self();
v1 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_thread.c",
"sbt_thread_test_detatch",
152LL,
v1,
"Start (main threadID=0x%x)",
v0);
v2 = malloc(8uLL);
*(_DWORD *)v2 = 4;
v2[4] = 1;
v2[5] = 2;
v2[6] = 3;
v2[7] = 4;
sbt_thread_run(sub_thread_detach, v2, 0, 0LL);
free(v2);
v3 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sbt_thread_test_detatch", 165LL, v3, "End (main threadID=0x%x)", v0);
sbt_thread_exit();
}

canonical_decompiled_code:
void __noreturn func8()
{
pthread_t v0; // rbp
unsigned int v1; // eax
_BYTE *v2; // rbx
unsigned int v3; // eax

v0 = pthread_self();
v1 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_thread.c",
"sbt_thread_test_detatch",
152LL,
v1,
"Start (main threadID=0x%x)",
v0);
v2 = malloc(8uLL);
*(_DWORD *)v2 = 4;
v2[4] = 1;
v2[5] = 2;
v2[6] = 3;
v2[7] = 4;
func6(sub_thread_detach, v2, 0, 0LL);
free(v2);
v3 = getpid();
sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", "sbt_thread_test_detatch", 165LL, v3, "End (main threadID=0x%x)", v0);
func5();
}

original_code:
int sbt_thread_test_detatch(){
 test_thread_func_st* st_thread_func = ((void *)0);
 pthread_t tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 152, getpid(), "Start (main threadID=0x%x)", tid);
    st_thread_func = (test_thread_func_st*)malloc( sizeof(test_thread_func_st) );
 st_thread_func->size = 4;
 st_thread_func->buf[0] = 1;
 st_thread_func->buf[1] = 2;
 st_thread_func->buf[2] = 3;
 st_thread_func->buf[3] = 4;
 sbt_thread_run( (const void*)sub_thread_detach,
     (const void*)st_thread_func,
     0,
     0);
 free(st_thread_func);
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 165, getpid(), "End (main threadID=0x%x)", tid);
 sbt_thread_exit();
 return 0;
}

canonical_original_code:
int sbt_thread_test_detatch(){
 struct _test_thread_func_st *st_thread_func = ((void *)0);
 unsigned long tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 152, getpid(), "Start (main threadID=0x%x)", tid);
    st_thread_func = (struct _test_thread_func_st *)malloc( sizeof(test_thread_func_st) );
 st_thread_func->size = 4;
 st_thread_func->buf[0] = 1;
 st_thread_func->buf[1] = 2;
 st_thread_func->buf[2] = 3;
 st_thread_func->buf[3] = 4;
 sbt_thread_run( (void *)sub_thread_detach,
     (void *)st_thread_func,
     0,
     0);
 free(st_thread_func);
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 165, getpid(), "End (main threadID=0x%x)", tid);
 sbt_thread_exit();
 return 0;
}

user_defined_types: struct _test_thread_func_st { int size; char buf[4]; }


decompiled_code:
__int64 sbt_thread_test_exclusive()
{
pthread_t v0; // rbx
unsigned int v1; // eax
unsigned int v2; // eax
int arg[3]; // [rsp+Ch] [rbp-Ch] BYREF

v0 = pthread_self();
v1 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_thread.c",
"sbt_thread_test_exclusive",
177LL,
v1,
"Start (main threadID=0x%x)",
v0);
arg[0] = 0;
do
{
sbt_thread_run(sub_thread_exclusive, arg, 1, 0LL);
++arg[0];
}
while ( arg[0] <= 2 );
v2 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_thread.c",
"sbt_thread_test_exclusive",
185LL,
v2,
"End (main threadID=0x%x)",
v0);
return 0LL;
}

canonical_decompiled_code:
__int64 func9()
{
pthread_t v0; // rbx
unsigned int v1; // eax
unsigned int v2; // eax
int arg[3]; // [rsp+Ch] [rbp-Ch] BYREF

v0 = pthread_self();
v1 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_thread.c",
"sbt_thread_test_exclusive",
177LL,
v1,
"Start (main threadID=0x%x)",
v0);
arg[0] = 0;
do
{
func6(sub_thread_exclusive, arg, 1, 0LL);
++arg[0];
}
while ( arg[0] <= 2 );
v2 = getpid();
sbt_logln_tofd(
stderr,
"D",
"src/sbt_thread.c",
"sbt_thread_test_exclusive",
185LL,
v2,
"End (main threadID=0x%x)",
v0);
return 0LL;
}

original_code:
int sbt_thread_test_exclusive(){
 int i = 0;
 pthread_t tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 177, getpid(), "Start (main threadID=0x%x)", tid);
    for(i=0; i<3; i++){
     sbt_thread_run( (const void*)sub_thread_exclusive,
         (const void*)&i ,
         1,
         0);
    }
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 185, getpid(), "End (main threadID=0x%x)", tid);
 return 0;
}

canonical_original_code:
int sbt_thread_test_exclusive(){
 int i = 0;
 unsigned long tid = pthread_self();
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 177, getpid(), "Start (main threadID=0x%x)", tid);
    for(i=0; i<3; i++){
     sbt_thread_run( (void *)sub_thread_exclusive,
         (void *)&i ,
         1,
         0);
    }
 sbt_logln_tofd(stderr, "D", "src/sbt_thread.c", __func__, 185, getpid(), "End (main threadID=0x%x)", tid);
 return 0;
}


decompiled_code:
__int64 __fastcall load_plugin(char *file, int mode)
{
void *v2; // rax
__int64 (__fastcall *v3)(_QWORD); // rax
__int64 v4; // rbp
__int64 result; // rax
char *v6; // rax

printf("%s %s -- start\n", "plugin_manager.c", "load_plugin");
v2 = dlopen(file, mode);
if ( v2 && (v3 = (__int64 (__fastcall *)(_QWORD))dlsym(v2, "plugin_init")) != 0LL )
{
v4 = v3(0LL);
printf("%s %s -- end\n", "plugin_manager.c", "load_plugin");
result = v4;
}
else
{
v6 = dlerror();
fprintf(stderr, "%s\n", v6);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *file, int mode)
{
void *v2; // rax
__int64 (__fastcall *v3)(_QWORD); // rax
__int64 v4; // rbp
__int64 result; // rax
char *v6; // rax

printf("%s %s -- start\n", "plugin_manager.c", "load_plugin");
v2 = dlopen(file, mode);
if ( v2 && (v3 = (__int64 (__fastcall *)(_QWORD))dlsym(v2, "plugin_init")) != 0LL )
{
v4 = v3(0LL);
printf("%s %s -- end\n", "plugin_manager.c", "load_plugin");
result = v4;
}
else
{
v6 = dlerror();
fprintf(stderr, "%s\n", v6);
result = 0LL;
}
return result;
}

original_code:
plugin_manage_st load_plugin(char* name, int mode){
 void* handle = ((void *)0);
 plugin_info_st* (*function)(char*);
 plugin_manage_st plugin = {0x00};
 printf("%s %s -- start\n","plugin_manager.c",__func__);
 handle = (void*)dlopen( name, mode );
 if(!handle){
  fprintf(stderr, "%s\n",dlerror());
  return plugin;
 }
 function = dlsym(handle, "plugin_init");
 if( ((void *)0)==function ){
  fprintf(stderr, "%s\n", dlerror());
  return plugin;
 }
 plugin.p_plugin_info = (*function)(((void *)0));
 plugin.p_plugin_handle = handle;
 printf("%s %s -- end\n","plugin_manager.c",__func__);
 return plugin;
}

canonical_original_code:
struct plugin_manage load_plugin(char *name, int mode){
 void *handle = ((void *)0);
 struct plugin_info *(*function)(char *);
 struct plugin_manage plugin = {0x00};
 printf("%s %s -- start\n","plugin_manager.c",__func__);
 handle = (void *)dlopen( name, mode );
 if(!handle){
  fprintf(stderr, "%s\n",dlerror());
  return plugin;
 }
 function = dlsym(handle, "plugin_init");
 if( ((void *)0)==function ){
  fprintf(stderr, "%s\n", dlerror());
  return plugin;
 }
 plugin.p_plugin_info = (*function)(((void *)0));
 plugin.p_plugin_handle = handle;
 printf("%s %s -- end\n","plugin_manager.c",__func__);
 return plugin;
}

variable_types:
name
char *

variable_types: mode int

variable_types:
handle
void *

variable_types: struct plugin_info { char *name; struct func_pointer { void (*func_a)(int); int (*func_b)(char); int (*func_c)(int, char); int (*func_d)(struct arg_set { int aa; char bb; } *); } fp; } *(*)(char *)

variable_types: struct plugin_manage { struct plugin_info { char *name; struct func_pointer { void (*func_a)(int); int (*func_b)(char); int (*func_c)(int, char); int (*func_d)(struct arg_set { int aa; char bb; } *); } fp; } *p_plugin_info; void *p_plugin_handle; }

user_defined_types: struct plugin_manage { struct plugin_info *p_plugin_info; void *p_plugin_handle; }


decompiled_code:
__int64 __fastcall unload_plugin(void *handle)
{
void (__fastcall *v1)(_QWORD); // rax
__int64 result; // rax
char *v3; // rax

printf("%s %s -- start\n", "plugin_manager.c", "unload_plugin");
v1 = (void (__fastcall *)(_QWORD))dlsym(handle, "plugin_desc");
if ( v1 )
{
v1(0LL);
dlclose(handle);
printf("%s %s -- end\n", "plugin_manager.c", "unload_plugin");
result = 0LL;
}
else
{
v3 = dlerror();
fprintf(stderr, "%s\n", v3);
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(void *handle)
{
void (__fastcall *v1)(_QWORD); // rax
__int64 result; // rax
char *v3; // rax

printf("%s %s -- start\n", "plugin_manager.c", "unload_plugin");
v1 = (void (__fastcall *)(_QWORD))dlsym(handle, "plugin_desc");
if ( v1 )
{
v1(0LL);
dlclose(handle);
printf("%s %s -- end\n", "plugin_manager.c", "unload_plugin");
result = 0LL;
}
else
{
v3 = dlerror();
fprintf(stderr, "%s\n", v3);
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int unload_plugin(void* handle){
 int (*function)(char*);
 printf("%s %s -- start\n","plugin_manager.c",__func__);
 function = dlsym(handle, "plugin_desc");
 if( ((void *)0)==function ){
  fprintf(stderr, "%s\n", dlerror());
  return -1;
 }
 (*function)(((void *)0));
 dlclose(handle);
 printf("%s %s -- end\n","plugin_manager.c",__func__);
 return 0;
}

canonical_original_code:
int unload_plugin(void *handle){
 int (*function)(char *);
 printf("%s %s -- start\n","plugin_manager.c",__func__);
 function = dlsym(handle, "plugin_desc");
 if( ((void *)0)==function ){
  fprintf(stderr, "%s\n", dlerror());
  return -1;
 }
 (*function)(((void *)0));
 dlclose(handle);
 printf("%s %s -- end\n","plugin_manager.c",__func__);
 return 0;
}

variable_types:
function
int (*)(char *)


decompiled_code:
__int64 plugin_manager_main()
{
__int64 v0; // rdx
__int64 v1; // rdx

printf("%s %s -- start\n", "plugin_manager.c", "plugin_manager_main");
g_plugin_manage = load_plugin("./plugin_dynamic_matsu.so", 1);
*(&g_plugin_manage + 1) = v0;
*(&g_plugin_manage + 2) = load_plugin("./plugin_dynamic_take.so", 1);
*(&g_plugin_manage + 3) = v1;
(*(void (__fastcall **)(__int64))(g_plugin_manage + 8))(1LL);
(*(void (__fastcall **)(__int64))(*(&g_plugin_manage + 2) + 8))(1LL);
unload_plugin((void *)*(&g_plugin_manage + 1));
unload_plugin((void *)*(&g_plugin_manage + 3));
printf("%s %s -- end\n", "plugin_manager.c", "plugin_manager_main");
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
__int64 v0; // rdx
__int64 v1; // rdx

printf("%s %s -- start\n", "plugin_manager.c", "plugin_manager_main");
g_plugin_manage = func0("./plugin_dynamic_matsu.so", 1);
*(&g_plugin_manage + 1) = v0;
*(&g_plugin_manage + 2) = func0("./plugin_dynamic_take.so", 1);
*(&g_plugin_manage + 3) = v1;
(*(void (__fastcall **)(__int64))(g_plugin_manage + 8))(1LL);
(*(void (__fastcall **)(__int64))(*(&g_plugin_manage + 2) + 8))(1LL);
func1((void *)*(&g_plugin_manage + 1));
func1((void *)*(&g_plugin_manage + 3));
printf("%s %s -- end\n", "plugin_manager.c", "plugin_manager_main");
return 0LL;
}

original_code:
int plugin_manager_main(){
 printf("%s %s -- start\n","plugin_manager.c",__func__);
 g_plugin_manage[0] = load_plugin("./plugin_dynamic_matsu.so", 0x00001);
 g_plugin_manage[1] = load_plugin("./plugin_dynamic_take.so", 0x00001);
 g_plugin_manage[0].p_plugin_info->fp.func_a(1);
 g_plugin_manage[1].p_plugin_info->fp.func_a(1);
 unload_plugin(g_plugin_manage[0].p_plugin_handle);
 unload_plugin(g_plugin_manage[1].p_plugin_handle);
 printf("%s %s -- end\n","plugin_manager.c",__func__);
 return 0;
}


decompiled_code:
__int64 sbt_file_test()
{
int v0; // ebp
const char *v1; // r12
__int64 result; // rax
const char *v3; // rbx
__int64 v4; // rbp
unsigned int v5; // eax

v0 = get_file_num("src/");
v1 = (const char *)malloc(100LL * v0);
result = get_file_name_list("src/", (__int64)v1);
if ( v0 > 0 )
{
v3 = v1;
v4 = (__int64)&v1[100 * (v0 - 1) + 100];
do
{
v5 = getpid();
result = sbt_logln_tofd(stderr, "D", "src/sbt_file.c", "sbt_file_test", 77LL, v5, "file name=%s", v3);
v3 += 100;
}
while ( v3 != (const char *)v4 );
}
return result;
}

canonical_decompiled_code:
__int64 func2()
{
int v0; // ebp
const char *v1; // r12
__int64 result; // rax
const char *v3; // rbx
__int64 v4; // rbp
unsigned int v5; // eax

v0 = func0("src/");
v1 = (const char *)malloc(100LL * v0);
result = func1("src/", (__int64)v1);
if ( v0 > 0 )
{
v3 = v1;
v4 = (__int64)&v1[100 * (v0 - 1) + 100];
do
{
v5 = getpid();
result = sbt_logln_tofd(stderr, "D", "src/sbt_file.c", "sbt_file_test", 77LL, v5, "file name=%s", v3);
v3 += 100;
}
while ( v3 != (const char *)v4 );
}
return result;
}

original_code:
void sbt_file_test(){
 int file_num = 0;
 files_st* p_file_list;
 int i;
 file_num = get_file_num("src/");
 p_file_list = (files_st*)malloc( sizeof(files_st)*file_num );
 get_file_name_list( "src/", p_file_list );
 for( i=0;i<file_num;i++ ){
  sbt_logln_tofd(stderr, "D", "src/sbt_file.c", __func__, 77, getpid(), "file name=%s", p_file_list[i].name);
 }
}

canonical_original_code:
void sbt_file_test(){
 int file_num = 0;
 struct files *p_file_list;
 int i;
 file_num = get_file_num("src/");
 p_file_list = (struct files *)malloc( sizeof(files_st)*file_num );
 get_file_name_list( "src/", p_file_list );
 for( i=0;i<file_num;i++ ){
  sbt_logln_tofd(stderr, "D", "src/sbt_file.c", __func__, 77, getpid(), "file name=%s", p_file_list[i].name);
 }
}


decompiled_code:
int log_debug(const char *a1, __int64 a2, const char *a3, unsigned int a4, unsigned int a5, const char *a6, ...)
{
__int64 v7; // r13
__int64 v8; // r14
struct tm *v10; // rax
time_t v12; // [rsp+0h] [rbp-F8h] BYREF
gcc_va_list arg; // [rsp+8h] [rbp-F0h] BYREF

va_start(arg, a6);
v7 = a4;
v8 = a5;
time(&v12);
v10 = localtime(&v12);
fprintf(
stderr,
"%02d-%02d %02d:%02d:%02d %s/%s(%d)[%d]: ",
(unsigned int)(v10->tm_mon + 1),
(unsigned int)v10->tm_mday,
(unsigned int)v10->tm_hour,
(unsigned int)v10->tm_min,
(unsigned int)v10->tm_sec,
a1,
a3,
v7,
v8);
vfprintf(stderr, a6, arg);
return fputc(10, stderr);
}

canonical_decompiled_code:
int func8(const char *a1, __int64 a2, const char *a3, unsigned int a4, unsigned int a5, const char *a6, ...)
{
__int64 v7; // r13
__int64 v8; // r14
struct tm *v10; // rax
time_t v12; // [rsp+0h] [rbp-F8h] BYREF
gcc_va_list arg; // [rsp+8h] [rbp-F0h] BYREF

va_start(arg, a6);
v7 = a4;
v8 = a5;
time(&v12);
v10 = localtime(&v12);
fprintf(
stderr,
"%02d-%02d %02d:%02d:%02d %s/%s(%d)[%d]: ",
(unsigned int)(v10->tm_mon + 1),
(unsigned int)v10->tm_mday,
(unsigned int)v10->tm_hour,
(unsigned int)v10->tm_min,
(unsigned int)v10->tm_sec,
a1,
a3,
v7,
v8);
vfprintf(stderr, a6, arg);
return fputc(10, stderr);
}

original_code:
void log_debug(const char* level, const char* file_name, const char* func_name, int line_no, int pid, const char* format, ...){
 va_list va_args;
 time_t timer;
 struct tm *t_st;
 time(&timer);
 t_st = localtime(&timer);
 fprintf( stderr, "%02d-%02d %02d:%02d:%02d %s/%s(%d)[%d]: ",
    t_st->tm_mon+1,
    t_st->tm_mday,
    t_st->tm_hour,
    t_st->tm_min,
    t_st->tm_sec,
    level,
    func_name,
    line_no,
    pid );
 __builtin_va_start(va_args,format);
 vfprintf(stderr, format, va_args);
 __builtin_va_end(va_args);
 fprintf( stderr, "\n");
}

canonical_original_code:
void log_debug(char *level, char *file_name, char *func_name, int line_no, int pid, char *format, ...){
 __builtin_va_list va_args;
 long timer;
 struct tm *t_st;
 time(&timer);
 t_st = localtime(&timer);
 fprintf( stderr, "%02d-%02d %02d:%02d:%02d %s/%s(%d)[%d]: ",
    t_st->tm_mon+1,
    t_st->tm_mday,
    t_st->tm_hour,
    t_st->tm_min,
    t_st->tm_sec,
    level,
    func_name,
    line_no,
    pid );
 __builtin_va_start(va_args,format);
 vfprintf(stderr, format, va_args);
 __builtin_va_end(va_args);
 fprintf( stderr, "\n");
}

variable_types:
level
char *

variable_types: pid int

variable_types:
format
char *

variable_types: timer long

variable_types: struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long tm_gmtoff; char *tm_zone; } *


decompiled_code:
int __fastcall log_dump(__int64 a1, int a2, __int64 a3)
{
int v3; // er13
int v4; // er15
__int64 v5; // rbp
int v6; // er14
int v7; // er12
__int64 v8; // rbx
int result; // eax

v3 = a2;
v4 = a3;
fprintf(stderr, "end_index=%d\n", a3);
v5 = a2 + a1;
v6 = v4 + 1 - a2;
do
{
if ( v4 > v3 + 15 )
{
v7 = 16;
}
else
{
v7 = v6;
if ( v6 <= 0 )
goto LABEL_5;
}
v8 = 0LL;
do
fprintf(stderr, "%02x", (unsigned int)*(char *)(v5 + v8++));
while ( v7 > (int)v8 );
LABEL_5:
result = fputc(10, stderr);
v3 += 16;
v5 += 16LL;
v6 -= 16;
}
while ( v4 >= v3 );
return result;
}

canonical_decompiled_code:
int __fastcall func9(__int64 a1, int a2, __int64 a3)
{
int v3; // er13
int v4; // er15
__int64 v5; // rbp
int v6; // er14
int v7; // er12
__int64 v8; // rbx
int result; // eax

v3 = a2;
v4 = a3;
fprintf(stderr, "end_index=%d\n", a3);
v5 = a2 + a1;
v6 = v4 + 1 - a2;
do
{
if ( v4 > v3 + 15 )
{
v7 = 16;
}
else
{
v7 = v6;
if ( v6 <= 0 )
goto LABEL_5;
}
v8 = 0LL;
do
fprintf(stderr, "%02x", (unsigned int)*(char *)(v5 + v8++));
while ( v7 > (int)v8 );
LABEL_5:
result = fputc(10, stderr);
v3 += 16;
v5 += 16LL;
v6 -= 16;
}
while ( v4 >= v3 );
return result;
}

original_code:
void log_dump( char* buf, int start_index, int end_index ){
 int dump_index = start_index;
 int dump_num = 0;
 int i = 0;
 fprintf(stderr, "end_index=%d\n", end_index);
 do{
  if( (end_index+1)<=dump_index+16 ){
   dump_num = end_index-dump_index+1;
  }else{
   dump_num = 16;
  }
  for(i=0; i<dump_num; i++){
   fprintf(stderr, "%02x", buf[dump_index+i]);
  }
  fprintf(stderr, "\n");
  dump_index += 16;
 }while( dump_index<=end_index );
}

canonical_original_code:
void log_dump(char *buf, int start_index, int end_index){
 int dump_index = start_index;
 int dump_num = 0;
 int i = 0;
 fprintf(stderr, "end_index=%d\n", end_index);
 do{
  if( (end_index+1)<=dump_index+16 ){
   dump_num = end_index-dump_index+1;
  }else{
   dump_num = 16;
  }
  for(i=0; i<dump_num; i++){
   fprintf(stderr, "%02x", buf[dump_index+i]);
  }
  fprintf(stderr, "\n");
  dump_index += 16;
 }while( dump_index<=end_index );
}

variable_types:
buf
char *