decompiled_code:
double wall_time()
{
struct timespec v1; // [rsp+0h] [rbp-18h] BYREF

clock_gettime(1, &v1);
return (double)SLODWORD(v1.tv_nsec) * 0.000000001 + (double)SLODWORD(v1.tv_sec);
}

canonical_decompiled_code:
double func1()
{
struct timespec v1; // [rsp+0h] [rbp-18h] BYREF

clock_gettime(1, &v1);
return (double)SLODWORD(v1.tv_nsec) * 0.000000001 + (double)SLODWORD(v1.tv_sec);
}

original_code:
double wall_time ()
{
  struct timespec t;
  clock_gettime (1, &t);
  return 1.*t.tv_sec + 1.e-9*t.tv_nsec;
}

canonical_original_code:
double wall_time()
{
  struct timespec t;
  clock_gettime (1, &t);
  return 1.*t.tv_sec + 1.e-9*t.tv_nsec;
}

variable_types: struct timespec { long tv_sec; long tv_nsec; }

return_type: double


die

decompiled_code:
void __fastcall __noreturn die(const char *a1)
{
perror(a1);
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func2(const char *a1)
{
perror(a1);
exit(1);
}

original_code:
void die (const char* message)
{
  perror (message);
  exit (1);
}

canonical_original_code:
void die(char *message)
{
  perror (message);
  exit (1);
}

variable_types:
message
char *

return_type: void


fill

decompiled_code:
void __fastcall fill(double *a1, int a2)
{
double *v2; // rbx
double v3; // xmm0_8

if ( a2 > 0 )
{
v2 = a1;
do
{
v3 = drand48();
*v2++ = v3 + v3 - 1.0;
}
while ( v2 != &a1[(unsigned int)(a2 - 1) + 1] );
}
}

canonical_decompiled_code:
void __fastcall func3(double *a1, int a2)
{
double *v2; // rbx
double v3; // xmm0_8

if ( a2 > 0 )
{
v2 = a1;
do
{
v3 = drand48();
*v2++ = v3 + v3 - 1.0;
}
while ( v2 != &a1[(unsigned int)(a2 - 1) + 1] );
}
}

original_code:
void fill (double* p, int n)
{
  for (int i = 0; i < n; ++i)
    p[i] = 2 * drand48() - 1;
}

canonical_original_code:
void fill(double *p, int n)
{
  for (int i = 0; i < n; ++i)
    p[i] = 2 * drand48() - 1;
}

variable_types:
p
double *

variable_types: n int

variable_types: i int


decompiled_code:
void __fastcall absolute_value(_QWORD *a1, int a2)
{
_QWORD *v2; // rax

if ( a2 > 0 )
{
v2 = a1;
do
*v2++ &= LC2;
while ( v2 != &a1[(unsigned int)(a2 - 1) + 1] );
}
}

canonical_decompiled_code:
void __fastcall func4(_QWORD *a1, int a2)
{
_QWORD *v2; // rax

if ( a2 > 0 )
{
v2 = a1;
do
*v2++ &= LC2;
while ( v2 != &a1[(unsigned int)(a2 - 1) + 1] );
}
}

original_code:
void absolute_value (double *p, int n)
{
  for (int i = 0; i < n; ++i)
    p[i] = fabs (p[i]);
}

canonical_original_code:
void absolute_value(double *p, int n)
{
  for (int i = 0; i < n; ++i)
    p[i] = fabs (p[i]);
}


original_code:
static void do_block(int M, int K, int N, double* A, double* B, double* C) {
    __m128d c0, c1, a0, a1, b0, b1, b2, b3, d0, d1;
    for (int k=0; k<K; k+=2) {
        for (int j=0; j<N; j+=2) {
            b0 = _mm_load1_pd(B+k+j*K);
            b1 = _mm_load1_pd(B+k+1+j*K);
            b2 = _mm_load1_pd(B+k+(j+1)*K);
            b3 = _mm_load1_pd(B+k+1+(j+1)*K);
            for (int i=0; i<M; i+=2) {
                a0 = _mm_load_pd(A+i+k*M);
                a1 = _mm_load_pd(A+i+(k+1)*M);
                c0 = _mm_load_pd(C+i+j*M);
                c1 = _mm_load_pd(C+i+(j+1)*M);
                d0 = _mm_add_pd(c0, _mm_mul_pd(a0,b0));
                d1 = _mm_add_pd(c1, _mm_mul_pd(a0,b2));
                c0 = _mm_add_pd(d0, _mm_mul_pd(a1,b1));
                c1 = _mm_add_pd(d1, _mm_mul_pd(a1,b3));
                _mm_store_pd(C+i+j*M,c0);
                _mm_store_pd(C+i+(j+1)*M,c1);
            }
        }
    }
}

canonical_original_code:
static void do_block(int M, int K, int N, double *A, double *B, double *C) {
    double c0; double c1; double a0; double a1; double b0; double b1; double b2; double b3; double d0; double d1;
    for (int k = 0; k<K; k+=2) {
        for (int j = 0; j<N; j+=2) {
            b0 = _mm_load1_pd(B+k+j*K);
            b1 = _mm_load1_pd(B+k+1+j*K);
            b2 = _mm_load1_pd(B+k+(j+1)*K);
            b3 = _mm_load1_pd(B+k+1+(j+1)*K);
            for (int i = 0; i<M; i+=2) {
                a0 = _mm_load_pd(A+i+k*M);
                a1 = _mm_load_pd(A+i+(k+1)*M);
                c0 = _mm_load_pd(C+i+j*M);
                c1 = _mm_load_pd(C+i+(j+1)*M);
                d0 = _mm_add_pd(c0, _mm_mul_pd(a0,b0));
                d1 = _mm_add_pd(c1, _mm_mul_pd(a0,b2));
                c0 = _mm_add_pd(d0, _mm_mul_pd(a1,b1));
                c1 = _mm_add_pd(d1, _mm_mul_pd(a1,b3));
                _mm_store_pd(C+i+j*M,c0);
                _mm_store_pd(C+i+(j+1)*M,c1);
            }
        }
    }
}

variable_types: M int

variable_types: K int

variable_types: N int

variable_types:
A
double *

variable_types:
B
double *

variable_types:
C
double *

variable_types: k int

variable_types: j int


original_code:
static void add_block(double* new_A, double* A, int M, int N, int lda, int M_even) {
    __m128d a;
    int i_step;
    for (int j=0; j<N; j++) {
        for (int i=0; i<M; i+=2) {
            i_step = (((2)<(M-i))?(2):(M-i));
            if (i_step == 1) {
                A[i+j*lda] = new_A[i+j*M_even];
            }
            else {
                a = _mm_load_pd(new_A + i + j*M_even);
                _mm_storeu_pd(A+i+j*lda,a);
            }
        }
    }
}

canonical_original_code:
static void add_block(double *new_A, double *A, int M, int N, int lda, int M_even) {
    double a;
    int i_step;
    for (int j = 0; j<N; j++) {
        for (int i = 0; i<M; i+=2) {
            i_step = (((2)<(M-i))?(2):(M-i));
            if (i_step == 1) {
                A[i+j*lda] = new_A[i+j*M_even];
            }
            else {
                a = _mm_load_pd(new_A + i + j*M_even);
                _mm_storeu_pd(A+i+j*lda,a);
            }
        }
    }
}

variable_types: lda int

variable_types: a double


show

repo: yuhongliang/practice

decompiled_code:
int __fastcall show(unsigned int *a1)
{
return printf("%d\n", *a1);
}

canonical_decompiled_code:
int __fastcall func7(unsigned int *a1)
{
return printf("%d\n", *a1);
}

original_code:
void show(void *data)
{
 printf("%d\n",*(int*)data);
}

canonical_original_code:
void show(void *data)
{
 printf("%d\n",*(int *)data);
}

variable_types:
data
void *


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

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

original_code:
void free_d(void *data)
{
 free(data);
}

canonical_original_code:
void free_d(void *data)
{
 free(data);
}


decompiled_code:
__int64 __fastcall stack_destroy(unsigned int *a1)
{
_QWORD *v1; // rbp
__int64 result; // rax

v1 = (_QWORD *)*((_QWORD *)a1 + 1);
for ( result = *a1; (_DWORD)result; result = *a1 )
{
*((_QWORD *)a1 + 1) = v1[1];
*a1 = result - 1;
(*((void (__fastcall **)(_QWORD))a1 + 4))(*v1);
free(v1);
v1 = (_QWORD *)*((_QWORD *)a1 + 1);
}
*((_QWORD *)a1 + 2) = 0LL;
*((_QWORD *)a1 + 1) = 0LL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(unsigned int *a1)
{
_QWORD *v1; // rbp
__int64 result; // rax

v1 = (_QWORD *)*((_QWORD *)a1 + 1);
for ( result = *a1; (_DWORD)result; result = *a1 )
{
*((_QWORD *)a1 + 1) = v1[1];
*a1 = result - 1;
(*((void (__fastcall **)(_QWORD))a1 + 4))(*v1);
free(v1);
v1 = (_QWORD *)*((_QWORD *)a1 + 1);
}
*((_QWORD *)a1 + 2) = 0LL;
*((_QWORD *)a1 + 1) = 0LL;
return result;
}

original_code:
void stack_destroy(stack_t* stack)
{
 stack_elem_t *top=stack->top;
 while(stack->size)
 {
  stack->top=top->next;
  stack->size--;
  stack->free(top->data);
  free(top);
  top=stack->top;
 }
 stack->top = stack->bottom = ((void *)0);
}

canonical_original_code:
void stack_destroy(struct stack *stack)
{
 struct stack_elem *top = stack->top;
 while(stack->size)
 {
  stack->top=top->next;
  stack->size--;
  stack->free(top->data);
  free(top);
  top=stack->top;
 }
 stack->top = stack->bottom = ((void *)0);
}

variable_types: struct stack { int size; struct stack_elem { void *data; struct stack_elem *next; } *top; struct stack_elem *bottom; int (*cmp)(void *key1, void *key2, unsigned long size); void (*free)(void *data); } *

user_defined_types: struct stack { int size; struct stack_elem *top; struct stack_elem *bottom; int (*cmp)(void *key1, void *key2, unsigned long size); void (*free)(void *data); }


original_code:
void *stack_pop(stack_t* stack)
{
 if(stack->size==0)
  return ((void *)0);
 stack_elem_t *del=stack->top;
 void * data = del->data;
 stack->top=stack->top->next;
 stack->size--;
 if(stack->size==0)
  stack->bottom=((void *)0);
 free(del);
 return data;
}

canonical_original_code:
void *stack_pop(struct stack *stack)
{
 if(stack->size==0)
  return ((void *)0);
 struct stack_elem *del = stack->top;
 void *data = del->data;
 stack->top=stack->top->next;
 stack->size--;
 if(stack->size==0)
  stack->bottom=((void *)0);
 free(del);
 return data;
}

variable_types: struct stack_elem { void *data; struct stack_elem *next; } *

return_type: void *


original_code:
int stack_push(stack_t* stack,const void *data)
{
 stack_elem_t *elem;
 elem=(stack_elem_t *)malloc(sizeof(stack_elem_t));
 if(elem==((void *)0))
  return 0;
 elem->data=(void *)data;
 if(stack->size==0)
  stack->bottom=elem;
 elem->next=stack->top;
 stack->top=elem;
 stack->size++;
 return 1;
}

canonical_original_code:
int stack_push(struct stack *stack, void *data)
{
 struct stack_elem *elem;
 elem=(struct stack_elem *)malloc(sizeof(stack_elem_t));
 if(elem==((void *)0))
  return 0;
 elem->data=(void *)data;
 if(stack->size==0)
  stack->bottom=elem;
 elem->next=stack->top;
 stack->top=elem;
 stack->size++;
 return 1;
}

return_type: int

user_defined_types: struct stack_elem { void *data; struct stack_elem *next; }


decompiled_code:
int __fastcall stack_show(__int64 a1, __int64 (__fastcall *a2)(_QWORD))
{
_QWORD *i; // rbx
int result; // eax

if ( !*(_DWORD *)a1 )
return puts("The stack is empty");
for ( i = *(_QWORD **)(a1 + 8); i; i = (_QWORD *)i[1] )
result = a2(*i);
return result;
}

canonical_decompiled_code:
int __fastcall func13(__int64 a1, __int64 (__fastcall *a2)(_QWORD))
{
_QWORD *i; // rbx
int result; // eax

if ( !*(_DWORD *)a1 )
return puts("The stack is empty");
for ( i = *(_QWORD **)(a1 + 8); i; i = (_QWORD *)i[1] )
result = a2(*i);
return result;
}

original_code:
void stack_show(stack_t *stack, show_t *show)
{
 if(stack->size==0)
 {
  printf("The stack is empty\n");
  return ;
 }
 stack_elem_t* elem=stack->top;
 while(elem!=((void *)0))
 {
  show(elem->data);
  elem=elem->next;
 }
}

canonical_original_code:
void stack_show(struct stack *stack, void (*show)(void *data))
{
 if(stack->size==0)
 {
  printf("The stack is empty\n");
  return ;
 }
 struct stack_elem *elem = stack->top;
 while(elem!=((void *)0))
 {
  show(elem->data);
  elem=elem->next;
 }
}

variable_types:
show
void (*)(void *data)


decompiled_code:
_BOOL8 __fastcall stack_read(_DWORD *a1)
{
return *a1 != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func14(_DWORD *a1)
{
return *a1 != 0;
}

original_code:
int stack_read(stack_t* stack,void **data)
{
 if(stack->size==0)
  return 0;
 data=&(stack->top->data);
 return 1;
}

canonical_original_code:
int stack_read(struct stack *stack, void **data)
{
 if(stack->size==0)
  return 0;
 data=&(stack->top->data);
 return 1;
}

variable_types:
data
void **


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
_DWORD *v3; // rbx
_DWORD *v4; // rax
_DWORD *v5; // rax
void *v6; // rax
_BYTE v8[56]; // [rsp+0h] [rbp-38h] BYREF

v3 = malloc(4uLL);
*v3 = 123;
stack_init(v8, 0LL, 0LL);
stack_push(v8, v3);
stack_show(v8, show);
v4 = malloc(4uLL);
*v4 = 456;
stack_push(v8, v4);
v5 = malloc(4uLL);
*v5 = 789;
stack_push(v8, v5);
stack_show(v8, show);
v6 = (void *)stack_pop(v8);
free(v6);
stack_show(v8, show);
stack_destroy(v8);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
_DWORD *v3; // rbx
_DWORD *v4; // rax
_DWORD *v5; // rax
void *v6; // rax
_BYTE v8[56]; // [rsp+0h] [rbp-38h] BYREF

v3 = malloc(4uLL);
*v3 = 123;
stack_init(v8, 0LL, 0LL);
func12(v8, v3);
func13(v8, show);
v4 = malloc(4uLL);
*v4 = 456;
func12(v8, v4);
v5 = malloc(4uLL);
*v5 = 789;
func12(v8, v5);
func13(v8, show);
v6 = (void *)func11(v8);
free(v6);
func13(v8, show);
func10(v8);
return 0;
}

original_code:
int main()
{
 stack_t stack1;
 int *p=(int*)malloc(sizeof(int));
 *p=123;
 int *b;
 stack_init(&stack1,((void *)0),((void *)0));
 stack_push(&stack1,(void*)p);
 stack_show(&stack1,show);
 p=(int*)malloc(sizeof(int));
 *p=456;
 stack_push(&stack1,(void*)p);
 p=(int*)malloc(sizeof(int));
 *p=789;
 stack_push(&stack1,(void*)p);
 stack_show(&stack1,show);
 b = (int *)stack_pop(&stack1);
 free(b);
 stack_show(&stack1,show);
 stack_destroy(&stack1);
 return 0;
}

canonical_original_code:
int main()
{
 struct stack stack1;
 int *p = (int*)malloc(sizeof(int));
 *p=123;
 int *b;
 stack_init(&stack1,((void *)0),((void *)0));
 stack_push(&stack1,(void *)p);
 stack_show(&stack1,show);
 p=(int *)malloc(sizeof(int));
 *p=456;
 stack_push(&stack1,(void *)p);
 p=(int *)malloc(sizeof(int));
 *p=789;
 stack_push(&stack1,(void *)p);
 stack_show(&stack1,show);
 b = (int *)stack_pop(&stack1);
 free(b);
 stack_show(&stack1,show);
 stack_destroy(&stack1);
 return 0;
}

variable_types: struct stack { int size; struct stack_elem { void *data; struct stack_elem *next; } *top; struct stack_elem *bottom; int (*cmp)(void *key1, void *key2, unsigned long size); void (*free)(void *data); }

variable_types:
p
int *

variable_types:
b
int *


destroyHashTable

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

original_code:
void destroyHashTable(HashTable *H)
{
 free(H->elem);
 H->count=0;
 H->sizeindex=0;
 H->elem=((void *)0);
}

canonical_original_code:
void destroyHashTable(struct HashTable *H)
{
 free(H->elem);
 H->count=0;
 H->sizeindex=0;
 H->elem=((void *)0);
}

variable_types: struct HashTable { struct ElemType { int key; int ord; } *elem; int count; int sizeindex; } *

user_defined_types: struct HashTable { struct ElemType *elem; int count; int sizeindex; }


Hash

decompiled_code:
__int64 __fastcall Hash(int a1)
{
return (unsigned int)(a1 % m);
}

canonical_decompiled_code:
__int64 __fastcall func9(int a1)
{
return (unsigned int)(a1 % m);
}

original_code:
unsigned Hash(const KeyType key)
{
 return key%m;
}

canonical_original_code:
unsigned int Hash(int key)
{
 return key%m;
}

variable_types: key int

return_type: unsigned int


searchHash

decompiled_code:
_BOOL8 __fastcall searchHash(_QWORD *a1, int a2, int *a3, _DWORD *a4)
{
int i; // eax

*a3 = Hash(a2);
*a4 = 0;
for ( i = *(_DWORD *)(*a1 + 8LL * *a3); i != a2 && i != -1; i = *(_DWORD *)(*a1 + 8LL * *a3) )
{
++*a4;
collision(a3);
}
return a2 == i;
}

original_code:
Status searchHash(const HashTable *H,KeyType K,int *p,int *c)
{
 *p=Hash(K);
 *c=0;
 while(H->elem[*p].key!=-1&&!((K)==(H->elem[*p].key)))
 {
  (*c)++;
  collision(p);
 }
 if ((K)==(H->elem[*p].key))
  return 1;
 else
   {
  p=((void *)0);
  return 0;
   }
}

canonical_original_code:
int searchHash(struct HashTable *H, int K, int *p, int *c)
{
 *p=Hash(K);
 *c=0;
 while(H->elem[*p].key!=-1&&!((K)==(H->elem[*p].key)))
 {
  (*c)++;
  collision(p);
 }
 if ((K)==(H->elem[*p].key))
  return 1;
 else
   {
  p=((void *)0);
  return 0;
   }
}

variable_types: K int

variable_types:
c
int *


SearchHash

decompiled_code:
_BOOL8 __fastcall SearchHash(_QWORD *a1, int a2, int *a3)
{
int v4; // [rsp+Ch] [rbp-4h] BYREF

return searchHash(a1, a2, a3, &v4);
}

canonical_decompiled_code:
_BOOL8 __fastcall func12(_QWORD *a1, int a2, int *a3)
{
int v4; // [rsp+Ch] [rbp-4h] BYREF

return func11(a1, a2, a3, &v4);
}

original_code:
Status SearchHash(const HashTable *H,KeyType K,int *p)
{
  int c;
  return searchHash(H,K,p,&c);
}

canonical_original_code:
int SearchHash(struct HashTable *H, int K, int *p)
{
  int c;
  return searchHash(H,K,p,&c);
}

variable_types: c int


InsertHash

decompiled_code:
__int64 __fastcall InsertHash(__int64 a1, __int64 a2)
{
unsigned int v2; // ebp
int v4; // [rsp+8h] [rbp-20h] BYREF
int v5[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = -1;
if ( !searchHash((_QWORD *)a1, a2, &v4, v5) )
{
v2 = 0;
if ( hashsize[*(int *)(a1 + 12)] / 2 <= v5[0] )
{
puts(&byte_402090);
}
else
{
*(_QWORD *)(*(_QWORD *)a1 + 8LL * v4) = a2;
++*(_DWORD *)(a1 + 8);
v2 = 1;
}
}
return v2;
}

original_code:
Status InsertHash(HashTable *H,ElemType e)
{
 int c,p;
 if(searchHash(H,e.key,&p,&c))
  return -1;
 else
  if(c<hashsize[H->sizeindex]/2)
  {
   H->elem[p]=e;
   ++H->count;
   return 1;
  }
  else
  {
   printf("冲突过多需要重新建表！\n");
   return 0;
  }
}

canonical_original_code:
int InsertHash(struct HashTable *H, struct ElemType e)
{
 int c; int p;
 if(searchHash(H,e.key,&p,&c))
  return -1;
 else
  if(c<hashsize[H->sizeindex]/2)
  {
   H->elem[p]=e;
   ++H->count;
   return 1;
  }
  else
  {
   printf("冲突过多需要重新建表！\n");
   return 0;
  }
}

variable_types:
e
struct ElemType

variable_types: p int


DeletHash

decompiled_code:
__int64 __fastcall DeletHash(__int64 *a1, int a2)
{
__int64 result; // rax
int v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

SearchHash(a1, a2, v3);
*(_DWORD *)(*a1 + 8LL * v3[0]) = -1;
result = *a1;
*(_DWORD *)(*a1 + 8LL * v3[0] + 4) = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 *a1, int a2)
{
__int64 result; // rax
int v3[3]; // [rsp+Ch] [rbp-Ch] BYREF

func12(a1, a2, v3);
*(_DWORD *)(*a1 + 8LL * v3[0]) = -1;
result = *a1;
*(_DWORD *)(*a1 + 8LL * v3[0] + 4) = 0;
return result;
}

original_code:
Status DeletHash(HashTable *H,KeyType K)
{
     int p;
     SearchHash(H,K,&p);
     H->elem[p].key=-1;
     H->elem[p].ord=0;
}

canonical_original_code:
int DeletHash(struct HashTable *H, int K)
{
     int p;
     SearchHash(H,K,&p);
     H->elem[p].key=-1;
     H->elem[p].ord=0;
}


TraverseHash

decompiled_code:
__int64 __fastcall TraverseHash(__int64 a1, void (__fastcall *a2)(_QWORD, _QWORD))
{
__int64 result; // rax
__int64 v3; // rbx
_QWORD *v4; // rax

result = *(int *)(a1 + 12);
if ( hashsize[result] > 0 )
{
v3 = 0LL;
do
{
v4 = (_QWORD *)(*(_QWORD *)a1 + 8 * v3);
if ( *(_DWORD *)v4 != -1 )
a2((unsigned int)v3, *v4);
++v3;
result = *(int *)(a1 + 12);
}
while ( hashsize[result] > (int)v3 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, void (__fastcall *a2)(_QWORD, _QWORD))
{
__int64 result; // rax
__int64 v3; // rbx
_QWORD *v4; // rax

result = *(int *)(a1 + 12);
if ( hashsize[result] > 0 )
{
v3 = 0LL;
do
{
v4 = (_QWORD *)(*(_QWORD *)a1 + 8 * v3);
if ( *(_DWORD *)v4 != -1 )
a2((unsigned int)v3, *v4);
++v3;
result = *(int *)(a1 + 12);
}
while ( hashsize[result] > (int)v3 );
}
return result;
}

original_code:
void TraverseHash(const HashTable *H,void(*Vi)(int,ElemType))
{
 int i;
 for(i=0;i<hashsize[H->sizeindex];i++)
  if(H->elem[i].key!=-1)
    Vi(i,H->elem[i]);
}

canonical_original_code:
void TraverseHash(struct HashTable *H, void (*Vi)(int, struct ElemType))
{
 int i;
 for(i=0;i<hashsize[H->sizeindex];i++)
  if(H->elem[i].key!=-1)
    Vi(i,H->elem[i]);
}

variable_types:
Vi
void (*)(int, struct ElemType)

variable_types: i int


print

decompiled_code:
int __fastcall print(unsigned int a1, __int64 a2)
{
return printf("address=%d (%d,%d) \n", a1, a2, a2 >> 32);
}

canonical_decompiled_code:
int __fastcall func16(unsigned int a1, __int64 a2)
{
return printf("address=%d (%d,%d) \n", a1, a2, a2 >> 32);
}

original_code:
void print(int p,ElemType r)
{
   printf("address=%d (%d,%d) \n",p,r.key,r.ord);
}

canonical_original_code:
void print(int p, struct ElemType r)
{
   printf("address=%d (%d,%d) \n",p,r.key,r.ord);
}

variable_types:
r
struct ElemType { int key; int ord; }


eq

decompiled_code:
_BOOL8 __fastcall eq(_DWORD *a1, _DWORD *a2)
{
return *a1 == *a2;
}

canonical_decompiled_code:
_BOOL8 __fastcall func7(_DWORD *a1, _DWORD *a2)
{
return *a1 == *a2;
}

original_code:
int eq(const void * key1,const void * key2)
{
 if(*(int*)key1 == *(int*)key2)
  return 1;
 return 0;
}

canonical_original_code:
int eq(void *key1, void *key2)
{
 if(*(int *)key1 == *(int *)key2)
  return 1;
 return 0;
}


destroy

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

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

original_code:
void destroy(void *data)
{
 free(data);
}

variable_types:
data
void *


original_code:
int set_init(set_t *set,int (*eq)(const void *,const void *),void (*destroy)(void *))
{
 set->size=0;
 set->head=((void *)0);
 set->eq=eq;
 set->destroy=destroy;
}

canonical_original_code:
int set_init(struct set *set, int (*eq)(void *, void *), void (*destroy)(void *))
{
 set->size=0;
 set->head=((void *)0);
 set->eq=eq;
 set->destroy=destroy;
}

variable_types: struct set { int size; struct setelem { void *data; struct setelem *next; long updatetime; } *head; struct setelem *tail; int (*eq)(void *key1, void *key2); void (*destroy)(void *data); } *

variable_types:
eq
int (*)(void *, void *)

variable_types:
destroy
void (*)(void *)

user_defined_types: struct set { int size; struct setelem *head; struct setelem *tail; int (*eq)(void *key1, void *key2); void (*destroy)(void *data); }


original_code:
int set_remove(set_t *set,void *data)
{
 if(((set)->size)==0)
  return 1;
 setelem_t *pre;
 setelem_t *del;
 pre=del=set->head;
 while(del != ((void *)0))
 {
  if(!eq(del->data,data))
  {
   pre=del;
   del=del->next;
   continue;
  }
  if(((set)->size)==1)
  {
   set->tail=((void *)0);
   set->head=((void *)0);
  }
  else
   if(del==set->head)
    set->head=del->next;
   else
    pre->next=del->next;
  set->size--;
  set->destroy(del->data);
  free(del);
  return 0;
 }
 return 1;
}

canonical_original_code:
int set_remove(struct set *set, void *data)
{
 if(((set)->size)==0)
  return 1;
 struct setelem *pre;
 struct setelem *del;
 pre=del=set->head;
 while(del != ((void *)0))
 {
  if(!eq(del->data,data))
  {
   pre=del;
   del=del->next;
   continue;
  }
  if(((set)->size)==1)
  {
   set->tail=((void *)0);
   set->head=((void *)0);
  }
  else
   if(del==set->head)
    set->head=del->next;
   else
    pre->next=del->next;
  set->size--;
  set->destroy(del->data);
  free(del);
  return 0;
 }
 return 1;
}

variable_types: struct setelem { void *data; struct setelem *next; long updatetime; } *


original_code:
int set_removeall(set_t *set)
{
 if(((set)->size)==0)
  return 0;
 setelem_t *p=set->head;
 while(p != ((void *)0))
 {
  set->head=p->next;
  set->destroy(p->data);
  free(p);
  p=set->head;
 }
 set->tail=((void *)0);
 return 0;
}

canonical_original_code:
int set_removeall(struct set *set)
{
 if(((set)->size)==0)
  return 0;
 struct setelem *p = set->head;
 while(p != ((void *)0))
 {
  set->head=p->next;
  set->destroy(p->data);
  free(p);
  p=set->head;
 }
 set->tail=((void *)0);
 return 0;
}

user_defined_types: struct setelem { void *data; struct setelem *next; long updatetime; }


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

result = set_removeall((__int64)a1);
*a1 = 0LL;
return result;
}

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

result = func11((__int64)a1);
*a1 = 0LL;
return result;
}

original_code:
void set_destroy(set_t *set)
{
 set_removeall(set);
 memset(set,0,sizeof(set));
}

canonical_original_code:
void set_destroy(struct set *set)
{
 set_removeall(set);
 memset(set,0,sizeof(set));
}


decompiled_code:
time_t __fastcall set_update(__int64 a1)
{
__int64 v1; // rbx
time_t result; // rax
time_t timer; // [rsp+8h] [rbp-20h] BYREF

v1 = *(_QWORD *)(a1 + 8);
for ( result = time(&timer); v1; v1 = *(_QWORD *)(v1 + 8) )
{
result = timer - *(_QWORD *)(v1 + 16);
if ( result > 10 )
result = set_remove(a1, *(_DWORD **)v1);
}
return result;
}

canonical_decompiled_code:
time_t __fastcall func13(__int64 a1)
{
__int64 v1; // rbx
time_t result; // rax
time_t timer; // [rsp+8h] [rbp-20h] BYREF

v1 = *(_QWORD *)(a1 + 8);
for ( result = time(&timer); v1; v1 = *(_QWORD *)(v1 + 8) )
{
result = timer - *(_QWORD *)(v1 + 16);
if ( result > 10 )
result = func10(a1, *(_DWORD **)v1);
}
return result;
}

original_code:
void set_update(set_t *set)
{
 setelem_t *p=set->head;
 time_t nowtime;
 time(&nowtime);
 while(p != ((void *)0))
 {
  if((nowtime - p->updatetime) > 10)
   set_remove(set,p->data);
  p=p->next;
 }
}

canonical_original_code:
void set_update(struct set *set)
{
 struct setelem *p = set->head;
 long nowtime;
 time(&nowtime);
 while(p != ((void *)0))
 {
  if((nowtime - p->updatetime) > 10)
   set_remove(set,p->data);
  p=p->next;
 }
}

variable_types: nowtime long


decompiled_code:
__int64 __fastcall set_is_member(unsigned int *a1, _DWORD *a2)
{
__int64 result; // rax
__int64 v3; // rbx

set_update((__int64)a1);
result = *a1;
if ( (_DWORD)result )
{
v3 = *((_QWORD *)a1 + 1);
if ( v3 )
{
while ( 1 )
{
result = eq(*(_DWORD **)v3, a2);
if ( (_DWORD)result )
break;
v3 = *(_QWORD *)(v3 + 8);
if ( !v3 )
return result;
}
result = 1LL;
}
else
{
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(unsigned int *a1, _DWORD *a2)
{
__int64 result; // rax
__int64 v3; // rbx

func13((__int64)a1);
result = *a1;
if ( (_DWORD)result )
{
v3 = *((_QWORD *)a1 + 1);
if ( v3 )
{
while ( 1 )
{
result = func7(*(_DWORD **)v3, a2);
if ( (_DWORD)result )
break;
v3 = *(_QWORD *)(v3 + 8);
if ( !v3 )
return result;
}
result = 1LL;
}
else
{
result = 0LL;
}
}
return result;
}

original_code:
int set_is_member(set_t* set,const void *key)
{
 set_update(set);
 if(0==((set)->size))
  return 0;
 setelem_t* p=set->head;
 while(p != ((void *)0))
 {
  if(eq(p->data,key))
   return 1;
  p=p->next;
 }
 return 0;
}

canonical_original_code:
int set_is_member(struct set *set, void *key)
{
 set_update(set);
 if(0==((set)->size))
  return 0;
 struct setelem *p = set->head;
 while(p != ((void *)0))
 {
  if(eq(p->data,key))
   return 1;
  p=p->next;
 }
 return 0;
}

variable_types:
key
void *


decompiled_code:
__int64 __fastcall set_insert(__int64 a1, _DWORD *a2)
{
unsigned int v2; // ebp
_QWORD *v4; // rax
_QWORD *v5; // r13
unsigned int v6; // eax

set_update(a1);
v2 = 1;
if ( !(unsigned int)set_is_member((unsigned int *)a1, a2) )
{
v2 = 0;
v4 = malloc(0x18uLL);
v5 = v4;
if ( v4 )
{
*v4 = a2;
time(v4 + 2);
v6 = *(_DWORD *)a1;
if ( !*(_DWORD *)a1 )
*(_QWORD *)(a1 + 16) = v5;
v5[1] = *(_QWORD *)(a1 + 8);
*(_QWORD *)(a1 + 8) = v5;
*(_DWORD *)a1 = v6 + 1;
}
else
{
v2 = 1;
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, _DWORD *a2)
{
unsigned int v2; // ebp
_QWORD *v4; // rax
_QWORD *v5; // r13
unsigned int v6; // eax

func13(a1);
v2 = 1;
if ( !(unsigned int)func14((unsigned int *)a1, a2) )
{
v2 = 0;
v4 = malloc(0x18uLL);
v5 = v4;
if ( v4 )
{
*v4 = a2;
time(v4 + 2);
v6 = *(_DWORD *)a1;
if ( !*(_DWORD *)a1 )
*(_QWORD *)(a1 + 16) = v5;
v5[1] = *(_QWORD *)(a1 + 8);
*(_QWORD *)(a1 + 8) = v5;
*(_DWORD *)a1 = v6 + 1;
}
else
{
v2 = 1;
}
}
return v2;
}

original_code:
int set_insert(set_t *set,const void *data)
{
 set_update(set);
 if(set_is_member(set,data))
  return 1;
 setelem_t *new_elem;
 new_elem=(setelem_t*)malloc(sizeof(setelem_t));
 if(new_elem==((void *)0))
  return 1;
 new_elem->data=(void *)data;
 time(&(new_elem->updatetime));
 if(((set)->size)==0)
  set->tail=new_elem;
 new_elem->next=set->head;
 set->head=new_elem;
 set->size++;
 return 0;
}

canonical_original_code:
int set_insert(struct set *set, void *data)
{
 set_update(set);
 if(set_is_member(set,data))
  return 1;
 struct setelem *new_elem;
 new_elem=(struct setelem *)malloc(sizeof(setelem_t));
 if(new_elem==((void *)0))
  return 1;
 new_elem->data=(void *)data;
 time(&(new_elem->updatetime));
 if(((set)->size)==0)
  set->tail=new_elem;
 new_elem->next=set->head;
 set->head=new_elem;
 set->size++;
 return 0;
}


decompiled_code:
__int64 __fastcall set_is_subset(__int64 a1, unsigned int *a2)
{
__int64 result; // rax
__int64 v3; // rbx

set_update(a1);
set_update((__int64)a2);
result = 1LL;
if ( *(_DWORD *)a1 )
{
result = 0LL;
if ( *(_DWORD *)a1 <= (signed int)*a2 )
{
v3 = *(_QWORD *)(a1 + 8);
if ( v3 )
{
while ( 1 )
{
result = set_is_member(a2, *(_DWORD **)v3);
if ( !(_DWORD)result )
break;
v3 = *(_QWORD *)(v3 + 8);
if ( !v3 )
return 1LL;
}
}
else
{
result = 1LL;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1, unsigned int *a2)
{
__int64 result; // rax
__int64 v3; // rbx

func13(a1);
func13((__int64)a2);
result = 1LL;
if ( *(_DWORD *)a1 )
{
result = 0LL;
if ( *(_DWORD *)a1 <= (signed int)*a2 )
{
v3 = *(_QWORD *)(a1 + 8);
if ( v3 )
{
while ( 1 )
{
result = func14(a2, *(_DWORD **)v3);
if ( !(_DWORD)result )
break;
v3 = *(_QWORD *)(v3 + 8);
if ( !v3 )
return 1LL;
}
}
else
{
result = 1LL;
}
}
}
return result;
}

original_code:
int set_is_subset(set_t* set1,set_t* set2)
{
 set_update(set1);
 set_update(set2);
 if(((set1)->size)==0)
  return 1;
 if(((set1)->size) > ((set2)->size))
  return 0;
 setelem_t *set1elem=set1->head;
 setelem_t *set2elem;
 while(set1elem != ((void *)0))
 {
  if(!set_is_member(set2,set1elem->data))
   return 0;
  set1elem=set1elem->next;
 }
 return 1;
}

canonical_original_code:
int set_is_subset(struct set *set1, struct set *set2)
{
 set_update(set1);
 set_update(set2);
 if(((set1)->size)==0)
  return 1;
 if(((set1)->size) > ((set2)->size))
  return 0;
 struct setelem *set1elem = set1->head;
 struct setelem *set2elem;
 while(set1elem != ((void *)0))
 {
  if(!set_is_member(set2,set1elem->data))
   return 0;
  set1elem=set1elem->next;
 }
 return 1;
}


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

set_update((__int64)a1);
set_update((__int64)a2);
result = 0LL;
if ( *a1 == *a2 )
{
set_is_subset((__int64)a1, a2);
result = 1LL;
}
return result;
}

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

func13((__int64)a1);
func13((__int64)a2);
result = 0LL;
if ( *a1 == *a2 )
{
func16((__int64)a1, a2);
result = 1LL;
}
return result;
}

original_code:
int set_is_equal(set_t *set1,set_t *set2)
{
 set_update(set1);
 set_update(set2);
 if(((set1)->size) != ((set2)->size))
  return 0;
 if(set_is_subset(set1,set2))
  return 1;
}

canonical_original_code:
int set_is_equal(struct set *set1, struct set *set2)
{
 set_update(set1);
 set_update(set2);
 if(((set1)->size) != ((set2)->size))
  return 0;
 if(set_is_subset(set1,set2))
  return 1;
}


decompiled_code:
__int64 __fastcall set_union(_QWORD *a1, __int64 a2, __int64 a3)
{
__int64 v4; // rbx
_DWORD **v5; // rbx

set_update(a2);
set_update(a3);
v4 = *(_QWORD *)(a2 + 8);
if ( v4 )
{
while ( !(unsigned int)set_insert((__int64)a1, *(_DWORD **)v4) )
{
v4 = *(_QWORD *)(v4 + 8);
if ( !v4 )
goto LABEL_4;
}
}
else
{
LABEL_4:
v5 = *(_DWORD ***)(a3 + 8);
if ( !v5 )
return 0LL;
while ( (unsigned int)set_is_member((unsigned int *)a2, *v5) || !(unsigned int)set_insert((__int64)a1, *v5) )
{
v5 = (_DWORD **)v5[1];
if ( !v5 )
return 0LL;
}
}
set_destroy(a1);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func18(_QWORD *a1, __int64 a2, __int64 a3)
{
__int64 v4; // rbx
_DWORD **v5; // rbx

func13(a2);
func13(a3);
v4 = *(_QWORD *)(a2 + 8);
if ( v4 )
{
while ( !(unsigned int)func15((__int64)a1, *(_DWORD **)v4) )
{
v4 = *(_QWORD *)(v4 + 8);
if ( !v4 )
goto LABEL_4;
}
}
else
{
LABEL_4:
v5 = *(_DWORD ***)(a3 + 8);
if ( !v5 )
return 0LL;
while ( (unsigned int)func14((unsigned int *)a2, *v5) || !(unsigned int)func15((__int64)a1, *v5) )
{
v5 = (_DWORD **)v5[1];
if ( !v5 )
return 0LL;
}
}
func12(a1);
return 1LL;
}

original_code:
int set_union(set_t *set,set_t *set1,set_t *set2)
{
 set_update(set1);
 set_update(set2);
 setelem_t *p=set1->head;
 while(p != ((void *)0))
 {
  if(set_insert(set,p->data)==0)
   p=p->next;
  else
  {
   set_destroy(set);
   return 1;
  }
 }
 p=set2->head;
 while(p != ((void *)0))
 {
  if(!set_is_member(set1,p->data))
   if(set_insert(set,p->data)!=0)
   {
    set_destroy(set);
    return 1;
   }
  p=p->next;
 }
 return 0;
}

canonical_original_code:
int set_union(struct set *set, struct set *set1, struct set *set2)
{
 set_update(set1);
 set_update(set2);
 struct setelem *p = set1->head;
 while(p != ((void *)0))
 {
  if(set_insert(set,p->data)==0)
   p=p->next;
  else
  {
   set_destroy(set);
   return 1;
  }
 }
 p=set2->head;
 while(p != ((void *)0))
 {
  if(!set_is_member(set1,p->data))
   if(set_insert(set,p->data)!=0)
   {
    set_destroy(set);
    return 1;
   }
  p=p->next;
 }
 return 0;
}


decompiled_code:
__int64 __fastcall set_intersection(_QWORD *a1, __int64 a2, unsigned int *a3)
{
_DWORD **v4; // rbx

set_update(a2);
set_update((__int64)a3);
v4 = *(_DWORD ***)(a2 + 8);
if ( !v4 )
return 0LL;
do
{
if ( (unsigned int)set_is_member(a3, *v4) && (unsigned int)set_insert((__int64)a1, *v4) )
{
set_destroy(a1);
return 1LL;
}
v4 = (_DWORD **)v4[1];
}
while ( v4 );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func19(_QWORD *a1, __int64 a2, unsigned int *a3)
{
_DWORD **v4; // rbx

func13(a2);
func13((__int64)a3);
v4 = *(_DWORD ***)(a2 + 8);
if ( !v4 )
return 0LL;
do
{
if ( (unsigned int)func14(a3, *v4) && (unsigned int)func15((__int64)a1, *v4) )
{
func12(a1);
return 1LL;
}
v4 = (_DWORD **)v4[1];
}
while ( v4 );
return 0LL;
}

original_code:
int set_intersection(set_t* set,set_t* set1,set_t* set2)
{
 set_update(set1);
 set_update(set2);
 setelem_t * p=set1->head;
 while(p != ((void *)0))
 {
  if(set_is_member(set2,p->data))
   if(set_insert(set,p->data)!=0)
   {
    set_destroy(set);
    return 1;
   }
  p=p->next;
 }
 return 0;
}

canonical_original_code:
int set_intersection(struct set *set, struct set *set1, struct set *set2)
{
 set_update(set1);
 set_update(set2);
 struct setelem *p = set1->head;
 while(p != ((void *)0))
 {
  if(set_is_member(set2,p->data))
   if(set_insert(set,p->data)!=0)
   {
    set_destroy(set);
    return 1;
   }
  p=p->next;
 }
 return 0;
}


decompiled_code:
__int64 __fastcall set_difference(_QWORD *a1, __int64 a2, unsigned int *a3)
{
_DWORD **v4; // rbx

set_update(a2);
set_update((__int64)a3);
v4 = *(_DWORD ***)(a2 + 8);
if ( !v4 )
return 0LL;
do
{
if ( !(unsigned int)set_is_member(a3, *v4) && (unsigned int)set_insert((__int64)a1, *v4) )
{
set_destroy(a1);
return 1LL;
}
v4 = (_DWORD **)v4[1];
}
while ( v4 );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func20(_QWORD *a1, __int64 a2, unsigned int *a3)
{
_DWORD **v4; // rbx

func13(a2);
func13((__int64)a3);
v4 = *(_DWORD ***)(a2 + 8);
if ( !v4 )
return 0LL;
do
{
if ( !(unsigned int)func14(a3, *v4) && (unsigned int)func15((__int64)a1, *v4) )
{
func12(a1);
return 1LL;
}
v4 = (_DWORD **)v4[1];
}
while ( v4 );
return 0LL;
}

original_code:
int set_difference(set_t *set,set_t *set1,set_t * set2)
{
 set_update(set1);
 set_update(set2);
 setelem_t * p=set1->head;
 while(p != ((void *)0))
 {
  if(!set_is_member(set2,p->data))
   if(set_insert(set,p->data)!=0)
   {
    set_destroy(set);
    return 1;
   }
  p=p->next;
 }
 return 0;
}

canonical_original_code:
int set_difference(struct set *set, struct set *set1, struct set *set2)
{
 set_update(set1);
 set_update(set2);
 struct setelem *p = set1->head;
 while(p != ((void *)0))
 {
  if(!set_is_member(set2,p->data))
   if(set_insert(set,p->data)!=0)
   {
    set_destroy(set);
    return 1;
   }
  p=p->next;
 }
 return 0;
}


decompiled_code:
int __fastcall set_show(__int64 a1)
{
unsigned int **v1; // rbx

set_update(a1);
v1 = *(unsigned int ***)(a1 + 8);
if ( !v1 )
return puts("The set is empty");
do
{
printf("%d\t", **v1);
v1 = (unsigned int **)v1[1];
}
while ( v1 );
return puts("\n");
}

canonical_decompiled_code:
int __fastcall func21(__int64 a1)
{
unsigned int **v1; // rbx

func13(a1);
v1 = *(unsigned int ***)(a1 + 8);
if ( !v1 )
return puts("The set is empty");
do
{
printf("%d\t", **v1);
v1 = (unsigned int **)v1[1];
}
while ( v1 );
return puts("\n");
}

original_code:
void set_show(set_t *set)
{
 set_update(set);
 if(set->head==((void *)0))
 {
  printf("The set is empty\n");
  return ;
 }
 setelem_t * p;
 p=set->head;
 while(p!=((void *)0))
 {
  printf("%d\t",*(int *)(p->data));
  p=p->next;
 }
 printf("\n\n");
}

canonical_original_code:
void set_show(struct set *set)
{
 set_update(set);
 if(set->head==((void *)0))
 {
  printf("The set is empty\n");
  return ;
 }
 struct setelem *p;
 p=set->head;
 while(p!=((void *)0))
 {
  printf("%d\t",*(int *)(p->data));
  p=p->next;
 }
 printf("\n\n");
}


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int i; // ebx
unsigned int *v4; // rbp
_DWORD *v5; // rax
int j; // ebx
_DWORD *v7; // rax
_BYTE v9[48]; // [rsp+0h] [rbp-138h] BYREF
char v10[48]; // [rsp+30h] [rbp-108h] BYREF
char v11[48]; // [rsp+60h] [rbp-D8h] BYREF
int v12; // [rsp+90h] [rbp-A8h]
int v13; // [rsp+94h] [rbp-A4h]
int v14; // [rsp+98h] [rbp-A0h]
int v15; // [rsp+9Ch] [rbp-9Ch]
int v16[7]; // [rsp+A0h] [rbp-98h] BYREF
unsigned int k; // [rsp+BCh] [rbp-7Ch] BYREF
char v18[48]; // [rsp+C0h] [rbp-78h] BYREF
char v19[72]; // [rsp+F0h] [rbp-48h] BYREF

set_init(v19, eq, destroy);
set_init(v18, eq, destroy);
v12 = 0;
v13 = 1;
v14 = 2;
v15 = 3;
v16[0] = 4;
v16[1] = 5;
v16[2] = 6;
v16[3] = 7;
v16[4] = 8;
v16[5] = 9;
k = 0;
for ( i = 0; i <= 4; k = i )
{
v4 = (unsigned int *)malloc(4uLL);
*v4 = i;
set_insert(v19, v4);
printf("Insert %d into set1\n", *v4);
puts("wait for 2s...");
sleep(2u);
i = k + 1;
}
printf("set1:");
set_show(v19);
set_remove(v19, v16);
printf("set1:");
set_show(v19);
v5 = malloc(4uLL);
*v5 = 15;
set_insert(v19, v5);
printf("set1:");
set_show(v19);
puts("\n");
k = 0;
for ( j = 0; j <= 9; k = j )
{
v7 = malloc(4uLL);
*v7 = j;
set_insert(v18, v7);
j = k + 1;
}
printf("set2:");
set_show(v18);
for ( k = 0; (int)k <= 6; ++k )
{
if ( (unsigned int)set_is_member(v19, &k) )
printf("%d is in set1\n", k);
else
printf("%d is not in set1\n", k);
}
set_init(v11, eq, destroy);
set_union(v11, v19, v18);
printf("setu:");
set_show(v11);
set_init(v10, eq, destroy);
set_intersection(v10, v19, v18);
printf("seti:");
set_show(v10);
puts("Testing set_is_equal");
printf("set1:");
set_show(v19);
printf("set:");
set_show(v19);
if ( (unsigned int)set_is_equal(v19) )
puts("set1 eq set3");
puts("Testing set_is_subset");
printf("set1:");
set_show(v19);
printf("set3:");
set_show(v19);
if ( (unsigned int)set_is_subset(v19) )
puts("set1 is set3's subset");
puts("Testint difference");
printf("set1:");
set_show(v19);
printf("set2:");
set_show(v18);
set_init(v9, eq, destroy);
set_difference(v9, v18, v19);
printf("setd:");
set_show(v9);
sleep(0xFu);
set_show(v19);
set_destroy(v11);
set_destroy(v19);
set_destroy(v18);
set_destroy(v9);
set_destroy(v10);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int i; // ebx
unsigned int *v4; // rbp
_DWORD *v5; // rax
int j; // ebx
_DWORD *v7; // rax
_BYTE v9[48]; // [rsp+0h] [rbp-138h] BYREF
char v10[48]; // [rsp+30h] [rbp-108h] BYREF
char v11[48]; // [rsp+60h] [rbp-D8h] BYREF
int v12; // [rsp+90h] [rbp-A8h]
int v13; // [rsp+94h] [rbp-A4h]
int v14; // [rsp+98h] [rbp-A0h]
int v15; // [rsp+9Ch] [rbp-9Ch]
int v16[7]; // [rsp+A0h] [rbp-98h] BYREF
unsigned int k; // [rsp+BCh] [rbp-7Ch] BYREF
char v18[48]; // [rsp+C0h] [rbp-78h] BYREF
char v19[72]; // [rsp+F0h] [rbp-48h] BYREF

func9(v19, eq, destroy);
func9(v18, eq, destroy);
v12 = 0;
v13 = 1;
v14 = 2;
v15 = 3;
v16[0] = 4;
v16[1] = 5;
v16[2] = 6;
v16[3] = 7;
v16[4] = 8;
v16[5] = 9;
k = 0;
for ( i = 0; i <= 4; k = i )
{
v4 = (unsigned int *)malloc(4uLL);
*v4 = i;
func15(v19, v4);
printf("Insert %d into set1\n", *v4);
puts("wait for 2s...");
sleep(2u);
i = k + 1;
}
printf("set1:");
func21(v19);
func10(v19, v16);
printf("set1:");
func21(v19);
v5 = malloc(4uLL);
*v5 = 15;
func15(v19, v5);
printf("set1:");
func21(v19);
puts("\n");
k = 0;
for ( j = 0; j <= 9; k = j )
{
v7 = malloc(4uLL);
*v7 = j;
func15(v18, v7);
j = k + 1;
}
printf("set2:");
func21(v18);
for ( k = 0; (int)k <= 6; ++k )
{
if ( (unsigned int)func14(v19, &k) )
printf("%d is in set1\n", k);
else
printf("%d is not in set1\n", k);
}
func9(v11, eq, destroy);
func18(v11, v19, v18);
printf("setu:");
func21(v11);
func9(v10, eq, destroy);
func19(v10, v19, v18);
printf("seti:");
func21(v10);
puts("Testing set_is_equal");
printf("set1:");
func21(v19);
printf("set:");
func21(v19);
if ( (unsigned int)func17(v19) )
puts("set1 eq set3");
puts("Testing set_is_subset");
printf("set1:");
func21(v19);
printf("set3:");
func21(v19);
if ( (unsigned int)func16(v19) )
puts("set1 is set3's subset");
puts("Testint difference");
printf("set1:");
func21(v19);
printf("set2:");
func21(v18);
func9(v9, eq, destroy);
func20(v9, v18, v19);
printf("setd:");
func21(v9);
sleep(0xFu);
func21(v19);
func12(v11);
func12(v19);
func12(v18);
func12(v9);
func12(v10);
return 0;
}

original_code:
int main()
{
 set_t set1,set2;
 set_init(&set1,eq,destroy);
 set_init(&set2,eq,destroy);
 int i;
 int a[10]={0,1,2,3,4,5,6,7,8,9};
 int *data;
 for(i=0;i<5;i++)
 {
  data=(int *)malloc(sizeof(int));
  *data=i;
  set_insert(&set1,(void *)data);
  printf("Insert %d into set1\n",*data);
  printf("wait for 2s...\n");
  sleep(2);
 }
 printf("set1:");
 set_show(&set1);
 data=a;
 set_remove(&set1,(void*)(data+4));
 printf("set1:");
 set_show(&set1);
 data=(int*)malloc(sizeof(int));
 *data=15;
 set_insert(&set1,(void*)data);
 printf("set1:");
 set_show(&set1);
 printf("\n\n");
 for(i=0;i<10;i++)
 {
  data=(int *)malloc(sizeof(int));
  *data=i;
  set_insert(&set2,(void *)data);
 }
 printf("set2:");
 set_show(&set2);
 for(i=0;i<7;i++)
 {
  if(set_is_member(&set1,(void *)&i))
  {
   printf("%d is in set1\n",i);
  }
  else
   printf("%d is not in set1\n",i);
 }
 set_t setu;
 set_init(&setu,eq,destroy);
 set_union(&setu,&set1,&set2);
 printf("setu:");
 set_show(&setu);
 set_t seti;
 set_init(&seti,eq,destroy);
 set_intersection(&seti,&set1,&set2);
 printf("seti:");
 set_show(&seti);
 printf("Testing set_is_equal\n");
 printf("set1:");
 set_show(&set1);
 printf("set:");
 set_show(&set1);
 if(set_is_equal(&set1,&set1))
  printf("set1 eq set3\n");
 printf("Testing set_is_subset\n");
 printf("set1:");
 set_show(&set1);
 printf("set3:");
 set_show(&set1);
 if(set_is_subset(&set1,&set1))
  printf("set1 is set3's subset\n");
 printf("Testint difference\n");
 printf("set1:");
 set_show(&set1);
 printf("set2:");
 set_show(&set2);
 set_t setd;
 set_init(&setd,eq,destroy);
 set_difference(&setd,&set2,&set1);
 printf("setd:");
 set_show(&setd);
 sleep(15);
 set_show(&set1);
 set_destroy(&setu);
 set_destroy(&set1);
 set_destroy(&set2);
 set_destroy(&setd);
 set_destroy(&seti);
 return 0;
}

canonical_original_code:
int main()
{
 struct set set1; struct set set2;
 set_init(&set1,eq,destroy);
 set_init(&set2,eq,destroy);
 int i;
 int a[10] = {0,1,2,3,4,5,6,7,8,9};
 int *data;
 for(i=0;i<5;i++)
 {
  data=(int *)malloc(sizeof(int));
  *data=i;
  set_insert(&set1,(void *)data);
  printf("Insert %d into set1\n",*data);
  printf("wait for 2s...\n");
  sleep(2);
 }
 printf("set1:");
 set_show(&set1);
 data=a;
 set_remove(&set1,(void *)(data+4));
 printf("set1:");
 set_show(&set1);
 data=(int *)malloc(sizeof(int));
 *data=15;
 set_insert(&set1,(void *)data);
 printf("set1:");
 set_show(&set1);
 printf("\n\n");
 for(i=0;i<10;i++)
 {
  data=(int *)malloc(sizeof(int));
  *data=i;
  set_insert(&set2,(void *)data);
 }
 printf("set2:");
 set_show(&set2);
 for(i=0;i<7;i++)
 {
  if(set_is_member(&set1,(void *)&i))
  {
   printf("%d is in set1\n",i);
  }
  else
   printf("%d is not in set1\n",i);
 }
 struct set setu;
 set_init(&setu,eq,destroy);
 set_union(&setu,&set1,&set2);
 printf("setu:");
 set_show(&setu);
 struct set seti;
 set_init(&seti,eq,destroy);
 set_intersection(&seti,&set1,&set2);
 printf("seti:");
 set_show(&seti);
 printf("Testing set_is_equal\n");
 printf("set1:");
 set_show(&set1);
 printf("set:");
 set_show(&set1);
 if(set_is_equal(&set1,&set1))
  printf("set1 eq set3\n");
 printf("Testing set_is_subset\n");
 printf("set1:");
 set_show(&set1);
 printf("set3:");
 set_show(&set1);
 if(set_is_subset(&set1,&set1))
  printf("set1 is set3's subset\n");
 printf("Testint difference\n");
 printf("set1:");
 set_show(&set1);
 printf("set2:");
 set_show(&set2);
 struct set setd;
 set_init(&setd,eq,destroy);
 set_difference(&setd,&set2,&set1);
 printf("setd:");
 set_show(&setd);
 sleep(15);
 set_show(&set1);
 set_destroy(&setu);
 set_destroy(&set1);
 set_destroy(&set2);
 set_destroy(&setd);
 set_destroy(&seti);
 return 0;
}

variable_types: struct set { int size; struct setelem { void *data; struct setelem *next; long updatetime; } *head; struct setelem *tail; int (*eq)(void *key1, void *key2); void (*destroy)(void *data); }

variable_types:
a
int [10]

variable_types:
data
int *


repo: yuikns/callback

decompiled_code:
int __fastcall use_magic_num(unsigned int a1)
{
return printf("bar.c : magic number is %d \n", a1);
}

canonical_decompiled_code:
int __fastcall func7(unsigned int a1)
{
return printf("bar.c : magic number is %d \n", a1);
}

original_code:
void use_magic_num(int magic_num)
{
 printf("bar.c : magic number is %d \n", magic_num);
}


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
get_magic_num(use_magic_num, argv, envp);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
func8(use_magic_num, argv, envp);
return 0;
}

original_code:
int main(int argc,char *argv[])
{
 get_magic_num(use_magic_num);
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
 get_magic_num(use_magic_num);
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]


decompiled_code:
__int64 nv50_graph_reset()
{
__int64 result; // rax
int v1; // edx
int v2; // ecx

result = regs;
v1 = *(_DWORD *)(regs + 512);
v2 = v1;
BYTE1(v2) = BYTE1(v1) & 0xEF;
*(_DWORD *)(regs + 512) = v2;
BYTE1(v1) |= 0x10u;
*(_DWORD *)(result + 512) = v1;
*(int *)((char *)&dword_400040 + result) = -1;
*(int *)((char *)&dword_400040 + result) = 0;
return result;
}

canonical_decompiled_code:
__int64 func15()
{
__int64 result; // rax
int v1; // edx
int v2; // ecx

result = regs;
v1 = *(_DWORD *)(regs + 512);
v2 = v1;
BYTE1(v2) = BYTE1(v1) & 0xEF;
*(_DWORD *)(regs + 512) = v2;
BYTE1(v1) |= 0x10u;
*(_DWORD *)(result + 512) = v1;
*(int *)((char *)&dword_400040 + result) = -1;
*(int *)((char *)&dword_400040 + result) = 0;
return result;
}

variable_types:
enable
unsigned int


repo: yunccll/fat

decompiled_code:
void fat_time_fat2unix()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code:
void fat_time_fat2unix(struct fat_sb *fsb, struct timespec64 *ts,
  __le16 __time, __le16 __date, u8 time_cs)
{
}

canonical_original_code:
void fat_time_fat2unix(struct fat_sb *fsb, struct timespec64 *ts, unsigned short __time, unsigned short __date, unsigned char time_cs)
{
}

variable_types: struct fat_sb { unsigned short sector_size; unsigned char fat_bits; unsigned int fsinfo_sector; unsigned short fat_sector_start; unsigned int fat_length; unsigned char fats; unsigned int root_dir_sector_start; unsigned short root_dir_entries; unsigned int data_sector_start; unsigned int max_sectors; unsigned short sec_per_clus; unsigned int root_cluster; unsigned int max_cluster; unsigned int cluster_size; unsigned short cluster_bits; int dir_per_block; int dir_per_block_bits; } *

variable_types: struct timespec64 { long long tv_sec; long tv_nsec; } *


decompiled_code:
__int64 __fastcall mode_from_fat_attr(char a1, unsigned int a2)
{
unsigned int v2; // eax
char v3; // di
int v4; // esi

v2 = a2;
LOBYTE(v2) = a2 & 0x6D;
if ( (a1 & 1) == 0 )
v2 = a2;
v3 = a1 & 0x10;
v4 = -(v3 == 0);
LOWORD(v4) = v3 == 0 ? 0x8000 : 0x4000;
return v4 | v2;
}

canonical_decompiled_code:
__int64 __fastcall func1(char a1, unsigned int a2)
{
unsigned int v2; // eax
char v3; // di
int v4; // esi

v2 = a2;
LOBYTE(v2) = a2 & 0x6D;
if ( (a1 & 1) == 0 )
v2 = a2;
v3 = a1 & 0x10;
v4 = -(v3 == 0);
LOWORD(v4) = v3 == 0 ? 0x8000 : 0x4000;
return v4 | v2;
}

original_code:
u8 mode_from_fat_attr(const u8 fat_attr, const umode_t mode)
{
    umode_t ret_mode = mode;
    if(fat_attr & 1){
        ret_mode &= ~(00200|00020|00002);
    }
    ret_mode |= ((fat_attr & 16) ? 0040000 : 0100000);
    return ret_mode;
}

canonical_original_code:
unsigned char mode_from_fat_attr(unsigned char fat_attr, unsigned short mode)
{
    unsigned short ret_mode = mode;
    if(fat_attr & 1){
        ret_mode &= ~(00200|00020|00002);
    }
    ret_mode |= ((fat_attr & 16) ? 0040000 : 0100000);
    return ret_mode;
}

variable_types:
mode
unsigned short

return_type: unsigned char


decompiled_code:
__int64 __fastcall fat_attr_make_from_mode(char a1, _BYTE *a2)
{
char v2; // al

if ( (a1 & 0x92) != 0 )
v2 = *a2 & 0xFE;
else
v2 = *a2 | 1;
*a2 = v2;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(char a1, _BYTE *a2)
{
char v2; // al

if ( (a1 & 0x92) != 0 )
v2 = *a2 & 0xFE;
else
v2 = *a2 | 1;
*a2 = v2;
return 0LL;
}

canonical_original_code:
int fat_attr_make_from_mode(unsigned char mode, unsigned char *fat_attr)
{
    if((((mode) & 00170000) == 0040000))
        *fat_attr |= 16;
    if( mode&(00200|00020|00002)){
        *fat_attr &= ~1;
    }
    else{
        *fat_attr |= 1;
    }
    return 0;
}

variable_types:
mode
unsigned char


decompiled_code:
void __fastcall fat_dev_destroy(void *ptr)
{
int *v1; // rax
char *v2; // rax

if ( ptr )
{
if ( close(*((_DWORD *)ptr + 2)) )
{
v1 = _errno_location();
v2 = strerror(*v1);
printf("close file [%s] error, error:%s\n", *(const char **)ptr, v2);
}
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func0(void *ptr)
{
int *v1; // rax
char *v2; // rax

if ( ptr )
{
if ( close(*((_DWORD *)ptr + 2)) )
{
v1 = _errno_location();
v2 = strerror(*v1);
printf("close file [%s] error, error:%s\n", *(const char **)ptr, v2);
}
free(ptr);
}
}

original_code:
void fat_dev_destroy(fat_dev_t * ptr){
    if(ptr){
        if(0 != close(ptr->_fd)){
            printf("close file [%s] error, error:%s\n", ptr->_fname, strerror((*__errno_location ())));
        }
        ptr->_is_connected = 0;
        ptr->_fname = ((void *)0);
        ptr->_fd = (-1);
        free(ptr);
    }
}

canonical_original_code:
void fat_dev_destroy(struct fat_dev_s *ptr){
    if(ptr){
        if(0 != close(ptr->_fd)){
            printf("close file [%s] error, error:%s\n", ptr->_fname, strerror((*__errno_location ())));
        }
        ptr->_is_connected = 0;
        ptr->_fname = ((void *)0);
        ptr->_fd = (-1);
        free(ptr);
    }
}

variable_types: struct fat_dev_s { char *_fname; int _fd; int _is_connected; } *


decompiled_code:
__off_t __fastcall fat_dev_write(__int64 a1, __off_t a2, const void *a3, size_t a4)
{
int v5; // edi
__off_t v8; // rbx
int *v10; // rax
char *v11; // rax
int *v12; // rax
char *v13; // rax

v5 = *(_DWORD *)(a1 + 8);
if ( v5 == -1 )
{
puts("open device first");
v8 = -1LL;
}
else
{
v8 = lseek(v5, a2, 0);
if ( v8 < 0 )
{
v10 = _errno_location();
v11 = strerror(*v10);
printf("lseek file failed! err:%s\n", v11);
}
else
{
v8 = write(*(_DWORD *)(a1 + 8), a3, a4);
if ( v8 < 0 )
{
v12 = _errno_location();
v13 = strerror(*v12);
printf("write file failed! err:%s\n", v13);
}
}
}
return v8;
}

canonical_decompiled_code:
__off_t __fastcall func1(__int64 a1, __off_t a2, const void *a3, size_t a4)
{
int v5; // edi
__off_t v8; // rbx
int *v10; // rax
char *v11; // rax
int *v12; // rax
char *v13; // rax

v5 = *(_DWORD *)(a1 + 8);
if ( v5 == -1 )
{
puts("open device first");
v8 = -1LL;
}
else
{
v8 = lseek(v5, a2, 0);
if ( v8 < 0 )
{
v10 = _errno_location();
v11 = strerror(*v10);
printf("lseek file failed! err:%s\n", v11);
}
else
{
v8 = write(*(_DWORD *)(a1 + 8), a3, a4);
if ( v8 < 0 )
{
v12 = _errno_location();
v13 = strerror(*v12);
printf("write file failed! err:%s\n", v13);
}
}
}
return v8;
}

original_code:
long long fat_dev_write(fat_dev_t * ptr, fat_offset_t offset,const char * block, long long bytes){
    do { if((ptr->_fd == (-1))) { printf("open device first\n"); return -1; } } while (0);
    long long ret = lseek(ptr->_fd, offset, 0);
    do { if((ret < 0)) { printf("lseek file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    ret = write(ptr->_fd, block, bytes);
    do { if((ret < 0)) { printf("write file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    return ret;
}

canonical_original_code:
long long fat_dev_write(struct fat_dev_s *ptr, long long offset, char *block, long long bytes){
    do { if((ptr->_fd == (-1))) { printf("open device first\n"); return -1; } } while (0);
    long long ret = lseek(ptr->_fd, offset, 0);
    do { if((ret < 0)) { printf("lseek file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    ret = write(ptr->_fd, block, bytes);
    do { if((ret < 0)) { printf("write file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    return ret;
}

variable_types:
offset
long long

variable_types:
block
char *

variable_types:
bytes
long long

variable_types:
ret
long long

return_type: long long

user_defined_types: struct fat_dev_s { char *_fname; int _fd; int _is_connected; }


decompiled_code:
__off_t __fastcall fat_dev_read(__int64 a1, __off_t a2, void *a3, size_t a4)
{
int v5; // edi
__off_t v8; // rbx
int *v10; // rax
char *v11; // rax
int *v12; // rax
char *v13; // rax

v5 = *(_DWORD *)(a1 + 8);
if ( v5 == -1 )
{
puts("open device first");
v8 = -1LL;
}
else
{
v8 = lseek(v5, a2, 0);
if ( v8 < 0 )
{
v10 = _errno_location();
v11 = strerror(*v10);
printf("lseek file failed! err:%s\n", v11);
}
else
{
v8 = read(*(_DWORD *)(a1 + 8), a3, a4);
if ( v8 < 0 )
{
v12 = _errno_location();
v13 = strerror(*v12);
printf("read file failed! err:%s\n", v13);
}
}
}
return v8;
}

canonical_decompiled_code:
__off_t __fastcall func2(__int64 a1, __off_t a2, void *a3, size_t a4)
{
int v5; // edi
__off_t v8; // rbx
int *v10; // rax
char *v11; // rax
int *v12; // rax
char *v13; // rax

v5 = *(_DWORD *)(a1 + 8);
if ( v5 == -1 )
{
puts("open device first");
v8 = -1LL;
}
else
{
v8 = lseek(v5, a2, 0);
if ( v8 < 0 )
{
v10 = _errno_location();
v11 = strerror(*v10);
printf("lseek file failed! err:%s\n", v11);
}
else
{
v8 = read(*(_DWORD *)(a1 + 8), a3, a4);
if ( v8 < 0 )
{
v12 = _errno_location();
v13 = strerror(*v12);
printf("read file failed! err:%s\n", v13);
}
}
}
return v8;
}

original_code:
long long fat_dev_read(fat_dev_t * ptr, fat_offset_t offset, char * block, long long bytes){
    do { if((ptr->_fd == (-1))) { printf("open device first\n"); return -1; } } while (0);
    long long ret = lseek(ptr->_fd, offset, 0);
    do { if((ret < 0)) { printf("lseek file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    ret = read(ptr->_fd, block, bytes);
    do { if((ret < 0)) { printf("read file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    return ret;
}

canonical_original_code:
long long fat_dev_read(struct fat_dev_s *ptr, long long offset, char *block, long long bytes){
    do { if((ptr->_fd == (-1))) { printf("open device first\n"); return -1; } } while (0);
    long long ret = lseek(ptr->_fd, offset, 0);
    do { if((ret < 0)) { printf("lseek file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    ret = read(ptr->_fd, block, bytes);
    do { if((ret < 0)) { printf("read file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    return ret;
}


decompiled_code:
_BOOL8 __fastcall fat_dev_is_open(__int64 a1)
{
return *(_DWORD *)(a1 + 12) == 1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(__int64 a1)
{
return *(_DWORD *)(a1 + 12) == 1;
}

original_code:
int fat_dev_is_open(fat_dev_t * ptr){
    return ptr->_is_connected == 1;
}

canonical_original_code:
int fat_dev_is_open(struct fat_dev_s *ptr){
    return ptr->_is_connected == 1;
}


decompiled_code:
__int64 __fastcall fat_dev_fname(__int64 a1)
{
return *(_QWORD *)a1;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
return *(_QWORD *)a1;
}

original_code:
const char * fat_dev_fname(fat_dev_t * ptr){
    return ptr->_fname;
}

canonical_original_code:
char *fat_dev_fname(struct fat_dev_s *ptr){
    return ptr->_fname;
}

return_type: char *


decompiled_code:
int __fastcall fat_dev_print(__int64 a1)
{
return printf(
"fd:%d, is_connected:%d, name:%s\n",
*(unsigned int *)(a1 + 8),
*(unsigned int *)(a1 + 12),
*(const char **)a1);
}

canonical_decompiled_code:
int __fastcall func5(__int64 a1)
{
return printf(
"fd:%d, is_connected:%d, name:%s\n",
*(unsigned int *)(a1 + 8),
*(unsigned int *)(a1 + 12),
*(const char **)a1);
}

original_code:
void fat_dev_print(fat_dev_t * ptr){
    printf("fd:%d, is_connected:%d, name:%s\n", ptr->_fd, ptr->_is_connected, ptr->_fname);
}

canonical_original_code:
void fat_dev_print(struct fat_dev_s *ptr){
    printf("fd:%d, is_connected:%d, name:%s\n", ptr->_fd, ptr->_is_connected, ptr->_fname);
}


decompiled_code:
__int64 current_uid()
{
return 100LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 100LL;
}

original_code:
static inline kuid_t current_uid()
{
    return (kuid_t){ 100 };
}

canonical_original_code:
static inline struct kuid_t current_uid()
{
    return (struct kuid_t){ 100 };
}

return_type: struct kuid_t { unsigned int val; }


decompiled_code:
__int64 current_gid()
{
return 100LL;
}

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

original_code:
static inline kgid_t current_gid()
{
    return (kgid_t){ 100 };
}

canonical_original_code:
static inline struct kgid_t current_gid()
{
    return (struct kgid_t){ 100 };
}

return_type: struct kgid_t { unsigned int val; }


decompiled_code:
__int64 __fastcall atomic64_cmpxchg(_DWORD *a1, __int64 a2, __int64 a3)
{
return arch_atomic64_cmpxchg(a1, a2, a3);
}

canonical_decompiled_code:
__int64 __fastcall func17(_DWORD *a1, __int64 a2, __int64 a3)
{
return func16(a1, a2, a3);
}

original_code:
static inline s64
atomic64_cmpxchg(atomic64_t *v, s64 old, s64 new)
{
    return arch_atomic64_cmpxchg(v, old, new);
}

canonical_original_code:
static inline long long atomic64_cmpxchg(struct atomic64_t *v, long long old, long long new)
{
    return arch_atomic64_cmpxchg(v, old, new);
}

variable_types: struct atomic64_t { long long counter; } *

variable_types:
old
long long

variable_types:
new
long long


decompiled_code:
__int64 fat_exit()
{
return unregister_filesystem(&fat_fs_type);
}

canonical_decompiled_code:
__int64 func24()
{
return unregister_filesystem(&fat_fs_type);
}

original_code:
static void fat_exit(){
 unregister_filesystem(&fat_fs_type);
}


decompiled_code:
void ListTest_use()
{
;
}

canonical_decompiled_code:
void func27()
{
;
}

original_code:
void ListTest_use(void){
    struct list_head head = { &(head), &(head) };
}

canonical_original_code:
void ListTest_use(){
    struct list_head head = { &(head), &(head) };
}

variable_types: struct list_head { struct list_head *next; }


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
FileSystemTypeTest_use(argc, argv, envp);
ListTest_use();
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
func26(argc, argv, envp);
func27();
return 0;
}

original_code:
int main(int argc, char * argv[]){
    FileSystemTypeTest_use();
    ListTest_use();
}

canonical_original_code:
int main(int argc, char *argv[]){
    FileSystemTypeTest_use();
    ListTest_use();
}


decompiled_code:
void __fastcall mcfs_dev_destroy(void *ptr)
{
int *v1; // rax
char *v2; // rax

if ( ptr )
{
if ( close(*((_DWORD *)ptr + 2)) )
{
v1 = _errno_location();
v2 = strerror(*v1);
printf("close file [%s] error, error:%s\n", *(const char **)ptr, v2);
}
free(ptr);
}
}

original_code:
void mcfs_dev_destroy(mcfs_dev_t * ptr){
    if(ptr){
        if(0 != close(ptr->_fd)){
            printf("close file [%s] error, error:%s\n", ptr->_fname, strerror((*__errno_location ())));
        }
        ptr->_is_connected = 0;
        ptr->_fname = ((void *)0);
        ptr->_fd = (-1);
        free(ptr);
    }
}

canonical_original_code:
void mcfs_dev_destroy(struct mcfs_dev *ptr){
    if(ptr){
        if(0 != close(ptr->_fd)){
            printf("close file [%s] error, error:%s\n", ptr->_fname, strerror((*__errno_location ())));
        }
        ptr->_is_connected = 0;
        ptr->_fname = ((void *)0);
        ptr->_fd = (-1);
        free(ptr);
    }
}

variable_types: struct mcfs_dev { char *_fname; int _fd; int _is_connected; } *


decompiled_code:
__off_t __fastcall mcfs_dev_write(__int64 a1, __off_t a2, const void *a3, size_t a4)
{
int v5; // edi
__off_t v8; // rbx
int *v10; // rax
char *v11; // rax
int *v12; // rax
char *v13; // rax

v5 = *(_DWORD *)(a1 + 8);
if ( v5 == -1 )
{
puts("open device first");
v8 = -1LL;
}
else
{
v8 = lseek(v5, a2, 0);
if ( v8 < 0 )
{
v10 = _errno_location();
v11 = strerror(*v10);
printf("lseek file failed! err:%s\n", v11);
}
else
{
v8 = write(*(_DWORD *)(a1 + 8), a3, a4);
if ( v8 < 0 )
{
v12 = _errno_location();
v13 = strerror(*v12);
printf("write file failed! err:%s\n", v13);
}
}
}
return v8;
}

original_code:
long long mcfs_dev_write(mcfs_dev_t * ptr, loff_t offset,const char * block, long long bytes){
    loff_t ret;
    do { if((ptr->_fd == (-1))) { printf("open device first\n"); return -1; } } while (0);
    ret = lseek(ptr->_fd, offset, 0);
    do { if((ret < 0)) { printf("lseek file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    ret = write(ptr->_fd, block, bytes);
    do { if((ret < 0)) { printf("write file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    return ret;
}

canonical_original_code:
long long mcfs_dev_write(struct mcfs_dev *ptr, long offset, char *block, long long bytes){
    long ret;
    do { if((ptr->_fd == (-1))) { printf("open device first\n"); return -1; } } while (0);
    ret = lseek(ptr->_fd, offset, 0);
    do { if((ret < 0)) { printf("lseek file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    ret = write(ptr->_fd, block, bytes);
    do { if((ret < 0)) { printf("write file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    return ret;
}

variable_types: offset long

variable_types: ret long

user_defined_types: struct mcfs_dev { char *_fname; int _fd; int _is_connected; }


decompiled_code:
__off_t __fastcall mcfs_dev_read(__int64 a1, __off_t a2, void *a3, size_t a4)
{
int v5; // edi
__off_t v8; // rbx
int *v10; // rax
char *v11; // rax
int *v12; // rax
char *v13; // rax

v5 = *(_DWORD *)(a1 + 8);
if ( v5 == -1 )
{
puts("open device first");
v8 = -1LL;
}
else
{
v8 = lseek(v5, a2, 0);
if ( v8 < 0 )
{
v10 = _errno_location();
v11 = strerror(*v10);
printf("lseek file failed! err:%s\n", v11);
}
else
{
v8 = read(*(_DWORD *)(a1 + 8), a3, a4);
if ( v8 < 0 )
{
v12 = _errno_location();
v13 = strerror(*v12);
printf("read file failed! err:%s\n", v13);
}
}
}
return v8;
}

original_code:
long long mcfs_dev_read(mcfs_dev_t * ptr, loff_t offset, char * block, long long bytes){
    loff_t ret;
    do { if((ptr->_fd == (-1))) { printf("open device first\n"); return -1; } } while (0);
    ret = lseek(ptr->_fd, offset, 0);
    do { if((ret < 0)) { printf("lseek file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    ret = read(ptr->_fd, block, bytes);
    do { if((ret < 0)) { printf("read file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    return ret;
}

canonical_original_code:
long long mcfs_dev_read(struct mcfs_dev *ptr, long offset, char *block, long long bytes){
    long ret;
    do { if((ptr->_fd == (-1))) { printf("open device first\n"); return -1; } } while (0);
    ret = lseek(ptr->_fd, offset, 0);
    do { if((ret < 0)) { printf("lseek file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    ret = read(ptr->_fd, block, bytes);
    do { if((ret < 0)) { printf("read file failed! err:%s\n", strerror((*__errno_location ()))); return ret; } } while (0);
    return ret;
}


decompiled_code:
_BOOL8 __fastcall mcfs_dev_is_open(__int64 a1)
{
return *(_DWORD *)(a1 + 12) == 1;
}

original_code:
int mcfs_dev_is_open(mcfs_dev_t * ptr){
    return ptr->_is_connected == 1;
}

canonical_original_code:
int mcfs_dev_is_open(struct mcfs_dev *ptr){
    return ptr->_is_connected == 1;
}


decompiled_code:
__int64 __fastcall mcfs_dev_fname(__int64 a1)
{
return *(_QWORD *)a1;
}

original_code:
const char * mcfs_dev_fname(mcfs_dev_t * ptr){
    return ptr->_fname;
}

canonical_original_code:
char *mcfs_dev_fname(struct mcfs_dev *ptr){
    return ptr->_fname;
}


decompiled_code:
int __fastcall mcfs_dev_print(__int64 a1)
{
return printf(
"fd:%d, is_connected:%d, name:%s\n",
*(unsigned int *)(a1 + 8),
*(unsigned int *)(a1 + 12),
*(const char **)a1);
}

original_code:
void mcfs_dev_print(mcfs_dev_t * ptr){
    printf("fd:%d, is_connected:%d, name:%s\n", ptr->_fd, ptr->_is_connected, ptr->_fname);
}

canonical_original_code:
void mcfs_dev_print(struct mcfs_dev *ptr){
    printf("fd:%d, is_connected:%d, name:%s\n", ptr->_fd, ptr->_is_connected, ptr->_fname);
}


decompiled_code:
int __fastcall spin_lock(unsigned int *a1)
{
int result; // eax

if ( *a1 )
return printf("DEBUG: spin lock failed, count:[%d]\n", *a1);
result = *a1 + 1;
*a1 = result;
return result;
}

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

if ( *a1 )
return printf("DEBUG: spin lock failed, count:[%d]\n", *a1);
result = *a1 + 1;
*a1 = result;
return result;
}

original_code:
void spin_lock(spinlock_t * lock)
{
    if(lock->count == 0){
        ++(lock->count);
    }
    else{
        printf("DEBUG: spin lock failed, count:[%d]\n", lock->count);
    }
}

canonical_original_code:
void spin_lock(struct spinlock_t *lock)
{
    if(lock->count == 0){
        ++(lock->count);
    }
    else{
        printf("DEBUG: spin lock failed, count:[%d]\n", lock->count);
    }
}

variable_types:
lock
struct spinlock_t { int count; } *


decompiled_code:
int __fastcall spin_unlock(unsigned int *a1)
{
int result; // eax

if ( (int)*a1 <= 0 )
return printf("DEBUG: spinlock unlock failed, count:[%d]\n", *a1);
result = *a1 - 1;
*a1 = result;
return result;
}

canonical_decompiled_code:
int __fastcall func2(unsigned int *a1)
{
int result; // eax

if ( (int)*a1 <= 0 )
return printf("DEBUG: spinlock unlock failed, count:[%d]\n", *a1);
result = *a1 - 1;
*a1 = result;
return result;
}

original_code:
void spin_unlock(spinlock_t * lock)
{
    if(lock->count > 0){
        --(lock->count);
    }
    else{
        printf("DEBUG: spinlock unlock failed, count:[%d]\n", lock->count);
    }
}

canonical_original_code:
void spin_unlock(struct spinlock_t *lock)
{
    if(lock->count > 0){
        --(lock->count);
    }
    else{
        printf("DEBUG: spinlock unlock failed, count:[%d]\n", lock->count);
    }
}


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

result = 0LL;
if ( !*a1 )
{
++*a1;
result = 1LL;
}
return result;
}

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

result = 0LL;
if ( !*a1 )
{
++*a1;
result = 1LL;
}
return result;
}

original_code:
int spin_trylock(spinlock_t *lock)
{
    if(lock->count == 0){
        ++(lock->count);
        return 1;
    }
    else{
        return 0;
    }
}

canonical_original_code:
int spin_trylock(struct spinlock_t *lock)
{
    if(lock->count == 0){
        ++(lock->count);
        return 1;
    }
    else{
        return 0;
    }
}


decompiled_code:
_BOOL8 __fastcall spin_is_locked(_DWORD *a1)
{
return *a1 > 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func4(_DWORD *a1)
{
return *a1 > 0;
}

original_code:
int spin_is_locked(spinlock_t *lock)
{
    return lock->count > 0;
}

canonical_original_code:
int spin_is_locked(struct spinlock_t *lock)
{
    return lock->count > 0;
}


down

decompiled_code:
int __fastcall down(_DWORD *a1)
{
__int64 v1; // rsi
int result; // eax

v1 = (unsigned int)*a1;
if ( (int)v1 <= 0 )
return printf("DEBUG: down wait, count:[%d]\n", v1);
*a1 = v1 - 1;
return result;
}

canonical_decompiled_code:
int __fastcall func5(_DWORD *a1)
{
__int64 v1; // rsi
int result; // eax

v1 = (unsigned int)*a1;
if ( (int)v1 <= 0 )
return printf("DEBUG: down wait, count:[%d]\n", v1);
*a1 = v1 - 1;
return result;
}

original_code:
void down(struct semaphore *sem)
{
 if(sem->count > 0){
  sem->count --;
 }
 else{
  printf("DEBUG: down wait, count:[%d]\n", sem->count);
 }
}

variable_types:
sem
struct semaphore { int count; } *


up

decompiled_code:
int __fastcall up(_DWORD *a1)
{
__int64 v1; // rsi
int result; // eax

v1 = (unsigned int)*a1;
if ( (_DWORD)v1 )
return printf("DEBUG: up wait, count:[%d]\n", v1);
*a1 = 1;
return result;
}

canonical_decompiled_code:
int __fastcall func6(_DWORD *a1)
{
__int64 v1; // rsi
int result; // eax

v1 = (unsigned int)*a1;
if ( (_DWORD)v1 )
return printf("DEBUG: up wait, count:[%d]\n", v1);
*a1 = 1;
return result;
}

original_code:
void up(struct semaphore *sem)
{
 if(sem->count == 0){
  sem->count ++;
 }
 else{
  printf("DEBUG: up wait, count:[%d]\n", sem->count);
 }
}


decompiled_code:
__int64 __fastcall down_trylock(int *a1)
{
int v1; // eax

v1 = *a1 - 1;
if ( v1 >= 0 )
*a1 = v1;
return (unsigned int)v1 >> 31;
}

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

v1 = *a1 - 1;
if ( v1 >= 0 )
*a1 = v1;
return (unsigned int)v1 >> 31;
}

original_code:
int down_trylock(struct semaphore *sem)
{
 int count = sem->count - 1;
 if(count >= 0){
  sem->count = count;
 }
    return count < 0;
}

variable_types: count int


decompiled_code:
int __fastcall down_read(unsigned int *a1)
{
int result; // eax

if ( (int)*a1 <= 0 )
return printf("DEBUG: down_read wait, count:[%d]\n", *a1);
result = *a1 - 1;
*a1 = result;
return result;
}

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

if ( (int)*a1 <= 0 )
return printf("DEBUG: down_read wait, count:[%d]\n", *a1);
result = *a1 - 1;
*a1 = result;
return result;
}

original_code:
void down_read(struct rw_semaphore *sem)
{
    if(sem->count >0){
        sem->count --;
    }
    else{
        printf("DEBUG: down_read wait, count:[%d]\n", sem->count);
    }
}

variable_types: struct rw_semaphore { int count; int write_count; } *


decompiled_code:
__int64 __fastcall down_read_trylock(int *a1)
{
int v1; // eax

v1 = *a1 - 1;
if ( v1 >= 0 )
*a1 = v1;
return (unsigned int)v1 >> 31;
}

canonical_decompiled_code:
__int64 __fastcall func10(int *a1)
{
int v1; // eax

v1 = *a1 - 1;
if ( v1 >= 0 )
*a1 = v1;
return (unsigned int)v1 >> 31;
}

original_code:
int down_read_trylock(struct rw_semaphore *sem)
{
 int count = sem->count - 1;
 if(count >= 0){
  sem->count = count;
 }
    return count < 0;
}

user_defined_types: struct rw_semaphore { int count; int write_count; }


decompiled_code:
int __fastcall up_read(unsigned int *a1)
{
int result; // eax

if ( *a1 )
return printf("DEBUG: up wait, count:[%d]\n", *a1);
result = *a1 + 1;
*a1 = result;
return result;
}

canonical_decompiled_code:
int __fastcall func11(unsigned int *a1)
{
int result; // eax

if ( *a1 )
return printf("DEBUG: up wait, count:[%d]\n", *a1);
result = *a1 + 1;
*a1 = result;
return result;
}

original_code:
void up_read(struct rw_semaphore *sem)
{
 if(sem->count == 0){
  sem->count ++;
 }
 else{
  printf("DEBUG: up wait, count:[%d]\n", sem->count);
 }
}


decompiled_code:
int __fastcall down_write(__int64 a1)
{
int result; // eax

if ( *(int *)(a1 + 4) <= 0 )
return printf("DEBUG: down_write wait, write_count:[%d]\n", *(unsigned int *)(a1 + 4));
result = *(_DWORD *)(a1 + 4) - 1;
*(_DWORD *)(a1 + 4) = result;
return result;
}

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

if ( *(int *)(a1 + 4) <= 0 )
return printf("DEBUG: down_write wait, write_count:[%d]\n", *(unsigned int *)(a1 + 4));
result = *(_DWORD *)(a1 + 4) - 1;
*(_DWORD *)(a1 + 4) = result;
return result;
}

original_code:
void down_write(struct rw_semaphore *sem)
{
    if(sem->write_count >0){
        sem->write_count --;
    }
    else{
        printf("DEBUG: down_write wait, write_count:[%d]\n", sem->write_count);
    }
}


decompiled_code:
__int64 __fastcall down_write_trylock(__int64 a1)
{
int v1; // eax

v1 = *(_DWORD *)(a1 + 4) - 1;
if ( v1 >= 0 )
*(_DWORD *)(a1 + 4) = v1;
return (unsigned int)v1 >> 31;
}

original_code:
int down_write_trylock(struct rw_semaphore *sem)
{
 int count = sem->write_count - 1;
 if(count >= 0){
  sem->write_count = count;
 }
    return count < 0;
}


decompiled_code:
int __fastcall up_write(__int64 a1)
{
int result; // eax

if ( *(_DWORD *)(a1 + 4) )
return printf("DEBUG: up_write wait, write count:[%d]\n", *(unsigned int *)(a1 + 4));
result = *(_DWORD *)(a1 + 4) + 1;
*(_DWORD *)(a1 + 4) = result;
return result;
}

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

if ( *(_DWORD *)(a1 + 4) )
return printf("DEBUG: up_write wait, write count:[%d]\n", *(unsigned int *)(a1 + 4));
result = *(_DWORD *)(a1 + 4) + 1;
*(_DWORD *)(a1 + 4) = result;
return result;
}

original_code:
void up_write(struct rw_semaphore *sem)
{
 if(sem->write_count == 0){
  sem->write_count ++;
 }
 else{
  printf("DEBUG: up_write wait, write count:[%d]\n", sem->write_count);
 }
}


decompiled_code:
int __fastcall downgrade_write(unsigned int *a1)
{
up_write((__int64)a1);
return down_read(a1);
}

canonical_decompiled_code:
int __fastcall func15(unsigned int *a1)
{
func14((__int64)a1);
return func9(a1);
}

original_code:
void downgrade_write(struct rw_semaphore *sem)
{
    up_write(sem);
    down_read(sem);
}


decompiled_code:
int __fastcall mutex_lock(unsigned int *a1)
{
int result; // eax

if ( *a1 )
return printf("mutex lock wait....., count:[%d]\n", *a1);
result = *a1 + 1;
*a1 = result;
return result;
}

canonical_decompiled_code:
int __fastcall func17(unsigned int *a1)
{
int result; // eax

if ( *a1 )
return printf("mutex lock wait....., count:[%d]\n", *a1);
result = *a1 + 1;
*a1 = result;
return result;
}

original_code:
void mutex_lock(struct mutex * lock)
{
    if(lock->count == 0){
        lock->count ++;
    }
    else{
        printf("mutex lock wait....., count:[%d]\n", lock->count);
    }
}

canonical_original_code:
void mutex_lock(struct mutex *lock)
{
    if(lock->count == 0){
        lock->count ++;
    }
    else{
        printf("mutex lock wait....., count:[%d]\n", lock->count);
    }
}

variable_types:
lock
struct mutex { int count; } *


decompiled_code:
int __fastcall mutex_unlock(unsigned int *a1)
{
int result; // eax

if ( (int)*a1 <= 0 )
return printf("mutex unlock failed, count:[%d]\n", *a1);
result = *a1 - 1;
*a1 = result;
return result;
}

canonical_decompiled_code:
int __fastcall func18(unsigned int *a1)
{
int result; // eax

if ( (int)*a1 <= 0 )
return printf("mutex unlock failed, count:[%d]\n", *a1);
result = *a1 - 1;
*a1 = result;
return result;
}

original_code:
void mutex_unlock(struct mutex * lock)
{
    if(lock->count > 0){
        lock->count --;
    }
    else{
        printf("mutex unlock failed, count:[%d]\n", lock->count);
    }
}

canonical_original_code:
void mutex_unlock(struct mutex *lock)
{
    if(lock->count > 0){
        lock->count --;
    }
    else{
        printf("mutex unlock failed, count:[%d]\n", lock->count);
    }
}


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

result = 0LL;
if ( !*a1 )
{
--*a1;
result = 1LL;
}
return result;
}

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

result = 0LL;
if ( !*a1 )
{
--*a1;
result = 1LL;
}
return result;
}

original_code:
int mutex_trylock(struct mutex * lock)
{
    if(lock->count == 0){
        lock->count --;
        return 1;
    }
    return 0;
}

canonical_original_code:
int mutex_trylock(struct mutex *lock)
{
    if(lock->count == 0){
        lock->count --;
        return 1;
    }
    return 0;
}


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

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

original_code:
void fat_block_view_free(fat_block_view_t * ptr){
    if(ptr){
        free(ptr);
    }
}

canonical_original_code:
void fat_block_view_free(struct fat_block_view_s *ptr){
    if(ptr){
        free(ptr);
    }
}

variable_types: struct fat_block_view_s { int _index; char *_offset; int _size; } *


decompiled_code:
int __fastcall fat_block_view_print(const void **a1)
{
printf("block index: %d ", *(unsigned int *)a1);
printf("block offset: %p ", a1[1]);
printf("block_size: %d ", *((unsigned int *)a1 + 4));
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func10(const void **a1)
{
printf("block index: %d ", *(unsigned int *)a1);
printf("block offset: %p ", a1[1]);
printf("block_size: %d ", *((unsigned int *)a1 + 4));
return putchar(10);
}

original_code:
void fat_block_view_print(fat_block_view_t * ptr){
    printf("block index: %d ", ptr->_index);
    printf("block offset: %p ", ptr->_offset);
    printf("block_size: %d ", ptr->_size);
    printf("\n");
}

canonical_original_code:
void fat_block_view_print(struct fat_block_view_s *ptr){
    printf("block index: %d ", ptr->_index);
    printf("block offset: %p ", ptr->_offset);
    printf("block_size: %d ", ptr->_size);
    printf("\n");
}

user_defined_types: struct fat_block_view_s { int _index; char *_offset; int _size; }


original_code:
int fat_boot_parser(fat_boot_t * ptr, char * block_offset, int bytes){
    if(bytes >= 512){
        struct boot_sector_s * boot = (struct boot_sector_s*)block_offset;
        ptr->_total_sector = boot->bpb.total_sector16;
        ptr->_bytes_per_sector = boot->bpb.bytes_per_sector;
        ptr->_reserved_sector_count = boot->bpb.reserved_sector_count;
        ptr->_number_of_fats = boot->bpb.number_of_fats;
        ptr->_sector_per_fat = boot->bpb.sector_per_fat;
        ptr->_sector_per_cluster = boot->bpb.sector_per_cluster;
        ptr->_root_entry_count = boot->bpb.root_entry_count;
        ptr->_bytes_per_entry = 32;
        ptr->_media = boot->bpb.media;
        ptr->_first_sector_of_data = (1 + 9 + 9 + 14);
        memcpy(ptr-> _file_system_type, &(boot->bpb.special.fat_boot_sector.file_system_type), 8);
        return 0;
    }
    printf("Error: boot block size < 512bytes \n");
    return -1;
}

canonical_original_code:
int fat_boot_parser(struct fat_boot_s *ptr, char *block_offset, int bytes){
    if(bytes >= 512){
        struct boot_sector_s *boot = (struct boot_sector_s*)block_offset;
        ptr->_total_sector = boot->bpb.total_sector16;
        ptr->_bytes_per_sector = boot->bpb.bytes_per_sector;
        ptr->_reserved_sector_count = boot->bpb.reserved_sector_count;
        ptr->_number_of_fats = boot->bpb.number_of_fats;
        ptr->_sector_per_fat = boot->bpb.sector_per_fat;
        ptr->_sector_per_cluster = boot->bpb.sector_per_cluster;
        ptr->_root_entry_count = boot->bpb.root_entry_count;
        ptr->_bytes_per_entry = 32;
        ptr->_media = boot->bpb.media;
        ptr->_first_sector_of_data = (1 + 9 + 9 + 14);
        memcpy(ptr-> _file_system_type, &(boot->bpb.special.fat_boot_sector.file_system_type), 8);
        return 0;
    }
    printf("Error: boot block size < 512bytes \n");
    return -1;
}

variable_types: struct fat_boot_s { long long _total_sector; int _bytes_per_sector; int _reserved_sector_count; int _number_of_fats; int _sector_per_fat; int _sector_per_cluster; int _root_entry_count; int _bytes_per_entry; int _media; int _first_sector_of_data; char _file_system_type[9]; } *

variable_types: bytes int

variable_types: struct boot_sector_s { char jump_to_boot[3]; char oem_name[8]; struct bios_parameter_block_s { unsigned short bytes_per_sector; unsigned char sector_per_cluster; unsigned short reserved_sector_count; unsigned char number_of_fats; unsigned short root_entry_count; unsigned short total_sector16; unsigned char media; unsigned short sector_per_fat; unsigned short sector_per_track; unsigned short number_of_headers; unsigned int hidden_sectors; unsigned int total_sector32; union fatSpecial { struct fat_s { unsigned char number_of_driver; unsigned char reserved1; unsigned char boot_signature; unsigned int volumeId; char volume_label[11]; char file_system_type[8]; } fat_boot_sector; struct fat32_s { unsigned int sector_per_fat32; unsigned short extend_flag; unsigned short file_system_version; unsigned int cluster_number_of_root_directory; unsigned short fs_info; unsigned short backup_boot_sector; char reserved[12]; unsigned char driver_number; unsigned char reserved1; } fat32_boot_sector; } special; } bpb; } *

user_defined_types: struct boot_sector_s { char jump_to_boot[3]; char oem_name[8]; struct bios_parameter_block_s bpb; }

user_defined_types: struct bios_parameter_block_s { unsigned short bytes_per_sector; unsigned char sector_per_cluster; unsigned short reserved_sector_count; unsigned char number_of_fats; unsigned short root_entry_count; unsigned short total_sector16; unsigned char media; unsigned short sector_per_fat; unsigned short sector_per_track; unsigned short number_of_headers; unsigned int hidden_sectors; unsigned int total_sector32; union fatSpecial special; }

user_defined_types: union fatSpecial { struct fat_s fat_boot_sector; struct fat32_s fat32_boot_sector; }


decompiled_code:
void *fat_boot_create()
{
void *v0; // rbx

v0 = calloc(0x38uLL, 1uLL);
if ( !v0 )
puts("no enough memory");
return v0;
}

canonical_decompiled_code:
void *func1()
{
void *v0; // rbx

v0 = calloc(0x38uLL, 1uLL);
if ( !v0 )
puts("no enough memory");
return v0;
}

original_code:
fat_boot_t * fat_boot_create(){
    fat_boot_t * ptr = (fat_boot_t *)calloc(sizeof(fat_boot_t), 1);
    do { if((ptr == ((void *)0))) { printf("no enough memory\n"); return ((void *)0); } } while (0);
    return ptr;
}

canonical_original_code:
struct fat_boot_s *fat_boot_create(){
    struct fat_boot_s *ptr = (fat_boot_t *)calloc(sizeof(fat_boot_t), 1);
    do { if((ptr == ((void *)0))) { printf("no enough memory\n"); return ((void *)0); } } while (0);
    return ptr;
}

return_type: struct fat_boot_s { long long _total_sector; int _bytes_per_sector; int _reserved_sector_count; int _number_of_fats; int _sector_per_fat; int _sector_per_cluster; int _root_entry_count; int _bytes_per_entry; int _media; int _first_sector_of_data; char _file_system_type[9]; } *


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

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

original_code:
void fat_boot_destroy(fat_boot_t * ptr){
    if(ptr){
        free(ptr);
    }
}

canonical_original_code:
void fat_boot_destroy(struct fat_boot_s *ptr){
    if(ptr){
        free(ptr);
    }
}

user_defined_types: struct fat_boot_s { long long _total_sector; int _bytes_per_sector; int _reserved_sector_count; int _number_of_fats; int _sector_per_fat; int _sector_per_cluster; int _root_entry_count; int _bytes_per_entry; int _media; int _first_sector_of_data; char _file_system_type[9]; }


decompiled_code:
int __fastcall fat_boot_print(__int64 a1)
{
printf("total_sector:%lld ", *(_QWORD *)a1);
printf(",bytes_per_sector:%d ", *(unsigned int *)(a1 + 8));
printf(",reserved_sector_count:%d ", *(unsigned int *)(a1 + 12));
printf(",number_of_fats:%d ", *(unsigned int *)(a1 + 16));
printf(",sector_per_fat:%d ", *(unsigned int *)(a1 + 20));
putchar(10);
printf(",sector_per_cluster:%d ", *(unsigned int *)(a1 + 24));
printf(",root_entry_count:%d ", *(unsigned int *)(a1 + 28));
printf(",bytes_per_sector:%d ", *(unsigned int *)(a1 + 32));
putchar(10);
printf(",media:%d ", *(unsigned int *)(a1 + 36));
printf(",firstSectorOfData: %d ", *(unsigned int *)(a1 + 40));
printf(",file_system_type:%s", (const char *)(a1 + 44));
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func3(__int64 a1)
{
printf("total_sector:%lld ", *(_QWORD *)a1);
printf(",bytes_per_sector:%d ", *(unsigned int *)(a1 + 8));
printf(",reserved_sector_count:%d ", *(unsigned int *)(a1 + 12));
printf(",number_of_fats:%d ", *(unsigned int *)(a1 + 16));
printf(",sector_per_fat:%d ", *(unsigned int *)(a1 + 20));
putchar(10);
printf(",sector_per_cluster:%d ", *(unsigned int *)(a1 + 24));
printf(",root_entry_count:%d ", *(unsigned int *)(a1 + 28));
printf(",bytes_per_sector:%d ", *(unsigned int *)(a1 + 32));
putchar(10);
printf(",media:%d ", *(unsigned int *)(a1 + 36));
printf(",firstSectorOfData: %d ", *(unsigned int *)(a1 + 40));
printf(",file_system_type:%s", (const char *)(a1 + 44));
return putchar(10);
}

original_code:
void fat_boot_print(fat_boot_t * ptr){
    printf("total_sector:%lld ", ptr->_total_sector);
    printf(",bytes_per_sector:%d ", ptr->_bytes_per_sector);
    printf(",reserved_sector_count:%d ", ptr->_reserved_sector_count);
    printf(",number_of_fats:%d ", ptr->_number_of_fats);
    printf(",sector_per_fat:%d ", ptr->_sector_per_fat);
    printf("\n");
    printf(",sector_per_cluster:%d ", ptr->_sector_per_cluster);
    printf(",root_entry_count:%d ", ptr->_root_entry_count);
    printf(",bytes_per_sector:%d ", ptr->_bytes_per_entry);
    printf("\n");
    printf(",media:%d ", ptr->_media);
    printf(",firstSectorOfData: %d ", ptr->_first_sector_of_data);
    printf(",file_system_type:%s", ptr->_file_system_type);
    printf("\n");
}

canonical_original_code:
void fat_boot_print(struct fat_boot_s *ptr){
    printf("total_sector:%lld ", ptr->_total_sector);
    printf(",bytes_per_sector:%d ", ptr->_bytes_per_sector);
    printf(",reserved_sector_count:%d ", ptr->_reserved_sector_count);
    printf(",number_of_fats:%d ", ptr->_number_of_fats);
    printf(",sector_per_fat:%d ", ptr->_sector_per_fat);
    printf("\n");
    printf(",sector_per_cluster:%d ", ptr->_sector_per_cluster);
    printf(",root_entry_count:%d ", ptr->_root_entry_count);
    printf(",bytes_per_sector:%d ", ptr->_bytes_per_entry);
    printf("\n");
    printf(",media:%d ", ptr->_media);
    printf(",firstSectorOfData: %d ", ptr->_first_sector_of_data);
    printf(",file_system_type:%s", ptr->_file_system_type);
    printf("\n");
}


decompiled_code:
void *fat_fat_create()
{
void *v0; // rbx

v0 = calloc(4uLL, 1uLL);
if ( !v0 )
puts("no enough memory");
return v0;
}

canonical_decompiled_code:
void *func0()
{
void *v0; // rbx

v0 = calloc(4uLL, 1uLL);
if ( !v0 )
puts("no enough memory");
return v0;
}

original_code:
fat_fat_t * fat_fat_create(){
    fat_fat_t * ptr = (fat_fat_t*)calloc(sizeof(fat_fat_t), 1);
    do { if((ptr == ((void *)0))) { printf("no enough memory\n"); return ((void *)0); } } while (0);
    return ptr;
}

canonical_original_code:
struct fat_fat_s *fat_fat_create(){
    struct fat_fat_s *ptr = (fat_fat_t*)calloc(sizeof(fat_fat_t), 1);
    do { if((ptr == ((void *)0))) { printf("no enough memory\n"); return ((void *)0); } } while (0);
    return ptr;
}

variable_types:
ptr
struct fat_fat_s { int loop; } *

return_type: struct fat_fat_s { int loop; } *


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

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

original_code:
void fat_fat_destroy(fat_fat_t * ptr){
    if(ptr){
        free(ptr);
    }
}

canonical_original_code:
void fat_fat_destroy(struct fat_fat_s *ptr){
    if(ptr){
        free(ptr);
    }
}


decompiled_code:
void fat_fat_print()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

original_code:
void fat_fat_print(fat_fat_t * ptr){
}

canonical_original_code:
void fat_fat_print(struct fat_fat_s *ptr){
}


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

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

original_code:
int fat_fat_parser(fat_fat_t * ptr, const char * block_offset, int bytes){
    return 0;
}

canonical_original_code:
int fat_fat_parser(struct fat_fat_s *ptr, char *block_offset, int bytes){
    return 0;
}


decompiled_code:
// attributes: thunk
__int64 __fastcall get_unaligned_le16(unsigned __int16 *a1)
{
return _le16_to_cpup(a1);
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned __int16 *a1)
{
return func0(a1);
}

original_code:
static inline u16 get_unaligned_le16(const void *p)
{
 return __le16_to_cpup((__le16 *)p);
}

canonical_original_code:
static inline unsigned short get_unaligned_le16(void *p)
{
 return __le16_to_cpup((unsigned short *)p);
}

variable_types:
p
void *

return_type: unsigned short


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

result = (unsigned __int16)get_unaligned_le16((unsigned __int16 *)(a1 + 19));
if ( !(_WORD)result )
result = *(unsigned int *)(a1 + 32);
return result;
}

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

result = (unsigned __int16)func1((unsigned __int16 *)(a1 + 19));
if ( !(_WORD)result )
result = *(unsigned int *)(a1 + 32);
return result;
}

original_code:
static u32 calc_max_sectors(const struct fat_boot_sector * fbs)
{
 u32 max_sectors = get_unaligned_le16(&fbs->sectors);
 if(max_sectors == 0)
  max_sectors = ((__u32)(__le32)(fbs->total_sect));
 return max_sectors;
}

canonical_original_code:
static unsigned int calc_max_sectors(struct fat_boot_sector *fbs)
{
 unsigned int max_sectors = get_unaligned_le16(&fbs->sectors);
 if(max_sectors == 0)
  max_sectors = ((__u32)(__le32)(fbs->total_sect));
 return max_sectors;
}

variable_types: struct fat_boot_sector { unsigned char ignored[3]; unsigned char system_id[8]; unsigned char sector_size[2]; unsigned char sec_per_clus; unsigned short reserved; unsigned char fats; unsigned char dir_entries[2]; unsigned char sectors[2]; unsigned char media; unsigned short fat_length; unsigned short secs_track; unsigned short heads; unsigned int hidden; unsigned int total_sect; union { struct { unsigned char drive_number; unsigned char state; unsigned char signature; unsigned char vol_id[4]; unsigned char vol_label[11]; unsigned char fs_type[8]; } fat16; struct { unsigned int length; unsigned short flags; unsigned char version[2]; unsigned int root_cluster; unsigned short info_sector; unsigned short backup_boot; unsigned short reserved2[6]; unsigned char drive_number; unsigned char state; unsigned char signature; unsigned char vol_id[4]; unsigned char vol_label[11]; unsigned char fs_type[8]; } fat32; }; } *


original_code:
static int fat_sb_read(struct fat_sb *fsb, const struct fat_boot_sector * fbs)
{
 fsb->sector_size = get_unaligned_le16(fbs->sector_size);
 fsb->fat_bits = 12;
 fsb->fsinfo_sector = 0;
 fsb->fat_sector_start = ((__u16)(__le16)(fbs->reserved));
 fsb->fat_length = ((__u16)(__le16)(fbs->fat_length));
 fsb->fats = fbs->fats;
 fsb->root_dir_sector_start = fsb->fat_sector_start + fbs->fats * fsb->fat_length;
 fsb->root_dir_entries = get_unaligned_le16(&fbs->dir_entries);
 fsb->data_sector_start = fsb->root_dir_sector_start + fsb->root_dir_entries * sizeof(struct msdos_dir_entry)/fsb->sector_size;
 fsb->max_sectors = calc_max_sectors(fbs);
 fsb->sec_per_clus = fbs->sec_per_clus;
 fsb->root_cluster = 0;
 fsb->max_cluster = calc_max_cluster(fsb);
 fsb->cluster_size = (fsb->sec_per_clus) * (fsb->sector_size);
 fsb->cluster_bits = ffs(fsb->cluster_size) - 1;
    return 0;
}

canonical_original_code:
static int fat_sb_read(struct fat_sb *fsb, struct fat_boot_sector *fbs)
{
 fsb->sector_size = get_unaligned_le16(fbs->sector_size);
 fsb->fat_bits = 12;
 fsb->fsinfo_sector = 0;
 fsb->fat_sector_start = ((__u16)(__le16)(fbs->reserved));
 fsb->fat_length = ((__u16)(__le16)(fbs->fat_length));
 fsb->fats = fbs->fats;
 fsb->root_dir_sector_start = fsb->fat_sector_start + fbs->fats * fsb->fat_length;
 fsb->root_dir_entries = get_unaligned_le16(&fbs->dir_entries);
 fsb->data_sector_start = fsb->root_dir_sector_start + fsb->root_dir_entries * sizeof(struct msdos_dir_entry)/fsb->sector_size;
 fsb->max_sectors = calc_max_sectors(fbs);
 fsb->sec_per_clus = fbs->sec_per_clus;
 fsb->root_cluster = 0;
 fsb->max_cluster = calc_max_cluster(fsb);
 fsb->cluster_size = (fsb->sec_per_clus) * (fsb->sector_size);
 fsb->cluster_bits = ffs(fsb->cluster_size) - 1;
    return 0;
}

variable_types: struct fat_sb { unsigned short sector_size; unsigned char fat_bits; unsigned int fsinfo_sector; unsigned short fat_sector_start; unsigned int fat_length; unsigned char fats; unsigned int root_dir_sector_start; unsigned short root_dir_entries; unsigned int data_sector_start; unsigned int max_sectors; unsigned short sec_per_clus; unsigned int root_cluster; unsigned int max_cluster; unsigned int cluster_size; unsigned short cluster_bits; int dir_per_block; int dir_per_block_bits; } *

user_defined_types: struct msdos_dir_entry { unsigned char name[11]; unsigned char attr; unsigned char lcase; unsigned char ctime_cs; unsigned short ctime; unsigned short cdate; unsigned short adate; unsigned short starthi; unsigned short time; unsigned int size; }

user_defined_types: struct fat_boot_sector { unsigned char ignored[3]; unsigned char system_id[8]; unsigned char sector_size[2]; unsigned char sec_per_clus; unsigned short reserved; unsigned char fats; unsigned char dir_entries[2]; unsigned char sectors[2]; unsigned char media; unsigned short fat_length; unsigned short secs_track; unsigned short heads; unsigned int hidden; unsigned int total_sect; union { struct { unsigned char drive_number; unsigned char state; unsigned char signature; unsigned char vol_id[4]; unsigned char vol_label[11]; unsigned char fs_type[8]; } fat16; struct { unsigned int length; unsigned short flags; unsigned char version[2]; unsigned int root_cluster; unsigned short info_sector; unsigned short backup_boot; unsigned short reserved2[6]; unsigned char drive_number; unsigned char state; unsigned char signature; unsigned char vol_id[4]; unsigned char vol_label[11]; unsigned char fs_type[8]; } fat32; }; }


decompiled_code:
int __fastcall fat_sb_print(unsigned __int16 *a1)
{
printf("DEBUG: sector_size in disk - [%d]\n", *a1);
printf("DEBUG: fat bits (12, 16 32) - [%d]\n", *((unsigned __int8 *)a1 + 2));
printf("DEBUG: sector number of fsinfo - [%d]\n", *((unsigned int *)a1 + 1));
printf("DEBUG: fat sector start - [%d]\n", a1[4]);
printf("DEBUG: fat length - [%d]\n", *((unsigned int *)a1 + 3));
printf("DEBUG: number of fats - [%d]\n", *((unsigned __int8 *)a1 + 16));
printf("DEBUG: root dir sector start - [%d]\n", *((unsigned int *)a1 + 5));
printf("DEBUG: number of entry in root_directory - [%d]\n", a1[12]);
printf("DEBUG: first data sector - [%d]\n", *((unsigned int *)a1 + 7));
printf("DEBUG: max sectors in disk - [%d]\n", *((unsigned int *)a1 + 8));
printf("DEBUG: number of sectors per cluster - [%d]\n", a1[18]);
printf("DEBUG: first cluster of root cluster - [%d]\n", *((unsigned int *)a1 + 10));
printf("DEBUG: maximum cluster number - [%d]\n", *((unsigned int *)a1 + 11));
printf("DEBUG: cluster_size - [%d]\n", *((unsigned int *)a1 + 12));
return printf("DEBUG: log2(cluster_size) - [%d]\n", a1[26]);
}

canonical_decompiled_code:
int __fastcall func6(unsigned __int16 *a1)
{
printf("DEBUG: sector_size in disk - [%d]\n", *a1);
printf("DEBUG: fat bits (12, 16 32) - [%d]\n", *((unsigned __int8 *)a1 + 2));
printf("DEBUG: sector number of fsinfo - [%d]\n", *((unsigned int *)a1 + 1));
printf("DEBUG: fat sector start - [%d]\n", a1[4]);
printf("DEBUG: fat length - [%d]\n", *((unsigned int *)a1 + 3));
printf("DEBUG: number of fats - [%d]\n", *((unsigned __int8 *)a1 + 16));
printf("DEBUG: root dir sector start - [%d]\n", *((unsigned int *)a1 + 5));
printf("DEBUG: number of entry in root_directory - [%d]\n", a1[12]);
printf("DEBUG: first data sector - [%d]\n", *((unsigned int *)a1 + 7));
printf("DEBUG: max sectors in disk - [%d]\n", *((unsigned int *)a1 + 8));
printf("DEBUG: number of sectors per cluster - [%d]\n", a1[18]);
printf("DEBUG: first cluster of root cluster - [%d]\n", *((unsigned int *)a1 + 10));
printf("DEBUG: maximum cluster number - [%d]\n", *((unsigned int *)a1 + 11));
printf("DEBUG: cluster_size - [%d]\n", *((unsigned int *)a1 + 12));
return printf("DEBUG: log2(cluster_size) - [%d]\n", a1[26]);
}

original_code:
static void fat_sb_print(struct fat_sb * fsb)
{
 printf("DEBUG: sector_size in disk - [%d]\n", fsb->sector_size);
 printf("DEBUG: fat bits (12, 16 32) - [%d]\n",fsb->fat_bits);
 printf("DEBUG: sector number of fsinfo - [%d]\n", fsb->fsinfo_sector);
 printf("DEBUG: fat sector start - [%d]\n", fsb->fat_sector_start);
 printf("DEBUG: fat length - [%d]\n", fsb->fat_length);
 printf("DEBUG: number of fats - [%d]\n", fsb->fats);
 printf("DEBUG: root dir sector start - [%d]\n", fsb->root_dir_sector_start);
 printf("DEBUG: number of entry in root_directory - [%d]\n", fsb->root_dir_entries);
 printf("DEBUG: first data sector - [%d]\n", fsb->data_sector_start);
 printf("DEBUG: max sectors in disk - [%d]\n", fsb->max_sectors);
 printf("DEBUG: number of sectors per cluster - [%d]\n", fsb->sec_per_clus);
 printf("DEBUG: first cluster of root cluster - [%d]\n", fsb->root_cluster);
 printf("DEBUG: maximum cluster number - [%d]\n", fsb->max_cluster);
 printf("DEBUG: cluster_size - [%d]\n", fsb->cluster_size);
 printf("DEBUG: log2(cluster_size) - [%d]\n", fsb->cluster_bits);
}

canonical_original_code:
static void fat_sb_print(struct fat_sb *fsb)
{
 printf("DEBUG: sector_size in disk - [%d]\n", fsb->sector_size);
 printf("DEBUG: fat bits (12, 16 32) - [%d]\n",fsb->fat_bits);
 printf("DEBUG: sector number of fsinfo - [%d]\n", fsb->fsinfo_sector);
 printf("DEBUG: fat sector start - [%d]\n", fsb->fat_sector_start);
 printf("DEBUG: fat length - [%d]\n", fsb->fat_length);
 printf("DEBUG: number of fats - [%d]\n", fsb->fats);
 printf("DEBUG: root dir sector start - [%d]\n", fsb->root_dir_sector_start);
 printf("DEBUG: number of entry in root_directory - [%d]\n", fsb->root_dir_entries);
 printf("DEBUG: first data sector - [%d]\n", fsb->data_sector_start);
 printf("DEBUG: max sectors in disk - [%d]\n", fsb->max_sectors);
 printf("DEBUG: number of sectors per cluster - [%d]\n", fsb->sec_per_clus);
 printf("DEBUG: first cluster of root cluster - [%d]\n", fsb->root_cluster);
 printf("DEBUG: maximum cluster number - [%d]\n", fsb->max_cluster);
 printf("DEBUG: cluster_size - [%d]\n", fsb->cluster_size);
 printf("DEBUG: log2(cluster_size) - [%d]\n", fsb->cluster_bits);
}

user_defined_types: struct fat_sb { unsigned short sector_size; unsigned char fat_bits; unsigned int fsinfo_sector; unsigned short fat_sector_start; unsigned int fat_length; unsigned char fats; unsigned int root_dir_sector_start; unsigned short root_dir_entries; unsigned int data_sector_start; unsigned int max_sectors; unsigned short sec_per_clus; unsigned int root_cluster; unsigned int max_cluster; unsigned int cluster_size; unsigned short cluster_bits; int dir_per_block; int dir_per_block_bits; }


decompiled_code:
__int64 fat_sb_free()
{
return kfree();
}

canonical_decompiled_code:
__int64 func7()
{
return kfree();
}

original_code:
void fat_sb_free(struct fat_sb * fsb)
{
    kfree(fsb);
}

canonical_original_code:
void fat_sb_free(struct fat_sb *fsb)
{
    kfree(fsb);
}