decompiled_code:
void __fastcall tem_destroy(_QWORD *a1)
{
_QWORD *v1; // rbx
volatile __int32 *v2; // r12
__int64 v3; // rax
__int64 v4; // rdx

if ( !a1 )
return;
v1 = (_QWORD *)tem_info;
v2 = (volatile __int32 *)(tem_info + 16);
futex_get((volatile signed __int32 *)(tem_info + 16));
v3 = a1[6];
v4 = a1[5];
if ( !v3 )
{
*v1 = v4;
if ( v4 )
goto LABEL_4;
LABEL_11:
v1[1] = v3;
goto LABEL_5;
}
*(_QWORD *)(v3 + 40) = v4;
if ( !v4 )
goto LABEL_11;
LABEL_4:
*(_QWORD *)(v4 + 48) = v3;
LABEL_5:
futex_release(v2);
if ( *a1 )
{
futex_get(mem_lock);
qm_free(shm_block, *a1);
futex_release(mem_lock);
}
futex_get(mem_lock);
qm_free(shm_block, a1);
futex_release(mem_lock);
}

canonical_decompiled_code:
void __fastcall func11(_QWORD *a1)
{
_QWORD *v1; // rbx
volatile __int32 *v2; // r12
__int64 v3; // rax
__int64 v4; // rdx

if ( !a1 )
return;
v1 = (_QWORD *)tem_info;
v2 = (volatile __int32 *)(tem_info + 16);
func3((volatile signed __int32 *)(tem_info + 16));
v3 = a1[6];
v4 = a1[5];
if ( !v3 )
{
*v1 = v4;
if ( v4 )
goto LABEL_4;
LABEL_11:
v1[1] = v3;
goto LABEL_5;
}
*(_QWORD *)(v3 + 40) = v4;
if ( !v4 )
goto LABEL_11;
LABEL_4:
*(_QWORD *)(v4 + 48) = v3;
LABEL_5:
func1(v2);
if ( *a1 )
{
func3(mem_lock);
qm_free(shm_block, *a1);
func1(mem_lock);
}
func3(mem_lock);
qm_free(shm_block, a1);
func1(mem_lock);
}

original_code:
void tem_destroy(time_event_manager_t *tem)
{
 if (tem) {
  futex_get(&tem_info->structure_mutex);
  if (tem->prev) tem->prev->next = tem->next;
  else tem_info->first = tem->next;
  if (tem->next) tem->next->prev = tem->prev;
  else tem_info->last = tem->prev;
  futex_release(&tem_info->structure_mutex);
  if (tem->time_slots) do { futex_get(mem_lock); qm_free(shm_block, (tem->time_slots)); futex_release(mem_lock); }while(0);
  do { futex_get(mem_lock); qm_free(shm_block, (tem)); futex_release(mem_lock); }while(0);
 }
}

canonical_original_code:
void tem_destroy(struct _time_event_manager_t *tem)
{
 if (tem) {
  futex_get(&tem_info->structure_mutex);
  if (tem->prev) tem->prev->next = tem->next;
  else tem_info->first = tem->next;
  if (tem->next) tem->next->prev = tem->prev;
  else tem_info->last = tem->prev;
  futex_release(&tem_info->structure_mutex);
  if (tem->time_slots) do { futex_get(mem_lock); qm_free(shm_block, (tem->time_slots)); futex_release(mem_lock); }while(0);
  do { futex_get(mem_lock); qm_free(shm_block, (tem)); futex_release(mem_lock); }while(0);
 }
}


repo: virtualolson/who

decompiled_code:
__int64 time_event_management_destroy()
{
_QWORD **v0; // rbp
_QWORD *i; // rbx
__int64 result; // rax

v0 = (_QWORD **)tem_info;
tem_info = 0LL;
if ( v0 )
{
for ( i = *v0; i; tem_destroy(i) )
i = (_QWORD *)i[5];
futex_get(mem_lock);
qm_free(shm_block, v0);
result = futex_release(mem_lock);
}
return result;
}

canonical_decompiled_code:
__int64 func12()
{
_QWORD **v0; // rbp
_QWORD *i; // rbx
__int64 result; // rax

v0 = (_QWORD **)tem_info;
tem_info = 0LL;
if ( v0 )
{
for ( i = *v0; i; func11(i) )
i = (_QWORD *)i[5];
func3(mem_lock);
qm_free(shm_block, v0);
result = func1(mem_lock);
}
return result;
}

original_code:
void time_event_management_destroy()
{
 time_event_manager_t *e, *n;
 tem_info_t *ti = tem_info;
 tem_info = ((void *)0);
 if (!ti) return;
 e = ti->first;
 while (e) {
  n = e->next;
  tem_destroy(n);
  e = n;
 }
 do { futex_get(mem_lock); qm_free(shm_block, (ti)); futex_release(mem_lock); }while(0);
}

canonical_original_code:
void time_event_management_destroy()
{
 struct _time_event_manager_t *e; struct _time_event_manager_t *n;
 struct tem_info_t *ti = tem_info;
 tem_info = ((void *)0);
 if (!ti) return;
 e = ti->first;
 while (e) {
  n = e->next;
  tem_destroy(n);
  e = n;
 }
 do { futex_get(mem_lock); qm_free(shm_block, (ti)); futex_release(mem_lock); }while(0);
}

variable_types: struct tem_info_t { struct _time_event_manager_t { struct _time_event_slot_t { struct _time_event_data_t { unsigned int tick_time; void (*cb)(struct _time_event_data_t *s); void *cb_param; void *cb_param1; struct _time_event_data_t *next; struct _time_event_data_t *prev; } *first; } *time_slots; unsigned int slot_cnt; unsigned int atomic_time; int enable_delay; unsigned int tick_counter; struct atomic_t { int val; } *mutex; unsigned int process_timer_counter; struct _time_event_manager_t *next; struct _time_event_manager_t *prev; } *first; struct _time_event_manager_t *last; struct atomic_t structure_mutex; } *

return_type: void

user_defined_types: struct _time_event_manager_t { struct _time_event_slot_t *time_slots; unsigned int slot_cnt; unsigned int atomic_time; int enable_delay; unsigned int tick_counter; struct atomic_t *mutex; unsigned int process_timer_counter; struct _time_event_manager_t *next; struct _time_event_manager_t *prev; }

user_defined_types: struct tem_info_t { struct _time_event_manager_t *first; struct _time_event_manager_t *last; struct atomic_t structure_mutex; }

user_defined_types: struct _time_event_slot_t { struct _time_event_data_t *first; }


original_code:
void tem_add_event_nolock(time_event_manager_t *tem, unsigned int action_time, time_event_data_t *te)
{
 unsigned int tick, s;

 if (!te) return;
 tick = action_time / tem->atomic_time;
 if ((tem->enable_delay) && (action_time % tem->atomic_time > 0)) {
  tick++;
 }
 if (tick <= 0) tick = 1;
 tick += tem->tick_counter;
 s = tick % tem->slot_cnt;
 te->next = ((void *)0);
 te->prev = tem->time_slots[s].last;
 if (tem->time_slots[s].last)
  tem->time_slots[s].last->next = te;
 else
  tem->time_slots[s].first = te;
 tem->time_slots[s].last = te;
 te->tick_time = tick;

}

canonical_original_code:
void tem_add_event_nolock(struct _time_event_manager_t *tem, unsigned int action_time, struct _time_event_data_t *te)
{
 unsigned int tick; unsigned int s;

 if (!te) return;
 tick = action_time / tem->atomic_time;
 if ((tem->enable_delay) && (action_time % tem->atomic_time > 0)) {
  tick++;
 }
 if (tick <= 0) tick = 1;
 tick += tem->tick_counter;
 s = tick % tem->slot_cnt;
 te->next = ((void *)0);
 te->prev = tem->time_slots[s].last;
 if (tem->time_slots[s].last)
  tem->time_slots[s].last->next = te;
 else
  tem->time_slots[s].first = te;
 tem->time_slots[s].last = te;
 te->tick_time = tick;

}

variable_types: struct _time_event_manager_t { struct _time_event_slot_t { struct _time_event_data_t { unsigned int tick_time; void (*cb)(struct _time_event_data_t *s); void *cb_param; void *cb_param1; struct _time_event_data_t *next; struct _time_event_data_t *prev; } *first; } *time_slots; unsigned int slot_cnt; unsigned int atomic_time; int enable_delay; unsigned int tick_counter; struct atomic_t { int val; } *mutex; unsigned int process_timer_counter; struct _time_event_manager_t *next; struct _time_event_manager_t *prev; } *

variable_types:
te
struct _time_event_data_t *

variable_types:
tick
unsigned int

variable_types:
s
unsigned int


decompiled_code:
__int64 __fastcall tem_add_event(__int64 a1, unsigned int a2, __int64 a3)
{
volatile signed __int32 *v5; // rdi
__int64 result; // rax
volatile __int32 *v7; // rdi

v5 = *(volatile signed __int32 **)(a1 + 24);
if ( v5 )
futex_get(v5);
result = tem_add_event_nolock(a1, a2, a3);
v7 = *(volatile __int32 **)(a1 + 24);
if ( v7 )
result = futex_release(v7);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, unsigned int a2, __int64 a3)
{
volatile signed __int32 *v5; // rdi
__int64 result; // rax
volatile __int32 *v7; // rdi

v5 = *(volatile signed __int32 **)(a1 + 24);
if ( v5 )
func3(v5);
result = func13(a1, a2, a3);
v7 = *(volatile __int32 **)(a1 + 24);
if ( v7 )
result = func1(v7);
return result;
}

original_code:
void tem_add_event(time_event_manager_t *tem, unsigned int action_time, time_event_data_t *te)
{
 if (tem->mutex) futex_get(tem->mutex);
 tem_add_event_nolock(tem, action_time, te);
 if (tem->mutex) futex_release(tem->mutex);
}

canonical_original_code:
void tem_add_event(struct _time_event_manager_t *tem, unsigned int action_time, struct _time_event_data_t *te)
{
 if (tem->mutex) futex_get(tem->mutex);
 tem_add_event_nolock(tem, action_time, te);
 if (tem->mutex) futex_release(tem->mutex);
}

user_defined_types: struct _time_event_data_t { unsigned int tick_time; void (*cb)(struct _time_event_data_t *s); void *cb_param; void *cb_param1; struct _time_event_data_t *next; struct _time_event_data_t *prev; }


decompiled_code:
__int64 __fastcall tem_remove_event_nolock(__int64 a1, __int64 a2)
{
__int64 v2; // rcx
__int64 result; // rax
_QWORD *v4; // rdx
__int64 v5; // rdi

if ( a2 )
{
v2 = *(_QWORD *)(a2 + 32);
result = (unsigned int)(*(_DWORD *)a2 / *(_DWORD *)(a1 + 8));
v4 = (_QWORD *)(*(_QWORD *)a1 + 16LL * (unsigned int)(*(_DWORD *)a2 % *(_DWORD *)(a1 + 8)));
v5 = *(_QWORD *)(a2 + 40);
if ( v5 )
{
*(_QWORD *)(v5 + 32) = v2;
if ( v2 )
{
LABEL_4:
*(_QWORD *)(v2 + 40) = v5;
LABEL_5:
*(_QWORD *)(a2 + 32) = 0LL;
*(_QWORD *)(a2 + 40) = 0LL;
return result;
}
}
else
{
*v4 = v2;
if ( v2 )
goto LABEL_4;
}
v4[1] = v5;
goto LABEL_5;
}
return result;
}

original_code:
void tem_remove_event_nolock(time_event_manager_t *tem, time_event_data_t *te)
{
 time_event_slot_t *slot;

 if (!te) return;
 slot = &tem->time_slots[te->tick_time % tem->slot_cnt];
 if (te->prev) te->prev->next = te->next;
 else slot->first = te->next;
 if (te->next) te->next->prev = te->prev;
 else slot->last = te->prev;
 te->next = ((void *)0);
 te->prev = ((void *)0);

}

canonical_original_code:
void tem_remove_event_nolock(struct _time_event_manager_t *tem, struct _time_event_data_t *te)
{
 struct _time_event_slot_t *slot;

 if (!te) return;
 slot = &tem->time_slots[te->tick_time % tem->slot_cnt];
 if (te->prev) te->prev->next = te->next;
 else slot->first = te->next;
 if (te->next) te->next->prev = te->prev;
 else slot->last = te->prev;
 te->next = ((void *)0);
 te->prev = ((void *)0);

}

variable_types: struct _time_event_slot_t { struct _time_event_data_t { unsigned int tick_time; void (*cb)(struct _time_event_data_t *s); void *cb_param; void *cb_param1; struct _time_event_data_t *next; struct _time_event_data_t *prev; } *first; } *


decompiled_code:
__int64 __fastcall tem_remove_event(__int64 a1, __int64 a2)
{
volatile signed __int32 *v3; // rdi
__int64 result; // rax
volatile __int32 *v5; // rdi

v3 = *(volatile signed __int32 **)(a1 + 24);
if ( v3 )
futex_get(v3);
result = tem_remove_event_nolock(a1, a2);
v5 = *(volatile __int32 **)(a1 + 24);
if ( v5 )
result = futex_release(v5);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1, __int64 a2)
{
volatile signed __int32 *v3; // rdi
__int64 result; // rax
volatile __int32 *v5; // rdi

v3 = *(volatile signed __int32 **)(a1 + 24);
if ( v3 )
func3(v3);
result = func15(a1, a2);
v5 = *(volatile __int32 **)(a1 + 24);
if ( v5 )
result = func1(v5);
return result;
}

original_code:
void tem_remove_event(time_event_manager_t *tem, time_event_data_t *te)
{
 if (tem->mutex) futex_get(tem->mutex);
 tem_remove_event_nolock(tem, te);
 if (tem->mutex) futex_release(tem->mutex);
}

canonical_original_code:
void tem_remove_event(struct _time_event_manager_t *tem, struct _time_event_data_t *te)
{
 if (tem->mutex) futex_get(tem->mutex);
 tem_remove_event_nolock(tem, te);
 if (tem->mutex) futex_release(tem->mutex);
}


original_code:
void base64decode(char* src_buf, int src_len, char* tgt_buf, int* tgt_len) {
 int pos, i, n;
 unsigned char c[4];
 for (pos=0, i=0, *tgt_len=0; pos < src_len; pos++) {
  if (src_buf[pos] >= 'A' && src_buf[pos] <= 'Z')
   c[i] = src_buf[pos] - 65;
  else if (src_buf[pos] >= 'a' && src_buf[pos] <= 'z')
   c[i] = src_buf[pos] - 71;
  else if (src_buf[pos] >= '0' && src_buf[pos] <= '9')
   c[i] = src_buf[pos] + 4;
  else if (src_buf[pos] == '+')
   c[i] = 62;
  else if (src_buf[pos] == '/')
   c[i] = 63;
  else
   c[i] = 64;
  i++;
  if (pos == src_len-1) {
   while (i < 4) {
    c[i] = 64;
    i++;
   }
  }
  if (i==4) {
   if (c[0] == 64)
    n = 0;
   else if (c[2] == 64)
    n = 1;
   else if (c[3] == 64)
    n = 2;
   else
    n = 3;
   switch (n) {
    case 3:
     tgt_buf[*tgt_len+2] = (char) (((c[2] & 0x03) << 6) | c[3]);
    case 2:
     tgt_buf[*tgt_len+1] = (char) (((c[1] & 0x0F) << 4) | (c[2] >> 2));
    case 1:
     tgt_buf[*tgt_len+0] = (char) ((c[0] << 2) | (c[1] >> 4));
     break;
   }
   i=0;
   *tgt_len+= n;
  }
 }
}

canonical_original_code:
void base64decode(char *src_buf, int src_len, char *tgt_buf, int *tgt_len) {
 int pos; int i; int n;
 unsigned char c[4];
 for (pos=0, i=0, *tgt_len=0; pos < src_len; pos++) {
  if (src_buf[pos] >= 'A' && src_buf[pos] <= 'Z')
   c[i] = src_buf[pos] - 65;
  else if (src_buf[pos] >= 'a' && src_buf[pos] <= 'z')
   c[i] = src_buf[pos] - 71;
  else if (src_buf[pos] >= '0' && src_buf[pos] <= '9')
   c[i] = src_buf[pos] + 4;
  else if (src_buf[pos] == '+')
   c[i] = 62;
  else if (src_buf[pos] == '/')
   c[i] = 63;
  else
   c[i] = 64;
  i++;
  if (pos == src_len-1) {
   while (i < 4) {
    c[i] = 64;
    i++;
   }
  }
  if (i==4) {
   if (c[0] == 64)
    n = 0;
   else if (c[2] == 64)
    n = 1;
   else if (c[3] == 64)
    n = 2;
   else
    n = 3;
   switch (n) {
    case 3:
     tgt_buf[*tgt_len+2] = (char) (((c[2] & 0x03) << 6) | c[3]);
    case 2:
     tgt_buf[*tgt_len+1] = (char) (((c[1] & 0x0F) << 4) | (c[2] >> 2));
    case 1:
     tgt_buf[*tgt_len+0] = (char) ((c[0] << 2) | (c[1] >> 4));
     break;
   }
   i=0;
   *tgt_len+= n;
  }
 }
}

variable_types: pos int

variable_types: i int

variable_types: n int

variable_types:
c
unsigned char [4]


original_code:
void base64encode(char* src_buf, int src_len, char* tgt_buf, int* tgt_len) {
 static char code64[64+1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 int pos;
 for (pos=0, *tgt_len=0; pos < src_len; pos+=3,*tgt_len+=4) {
  tgt_buf[*tgt_len+0] = code64[(unsigned char)src_buf[pos+0] >> 2];
  tgt_buf[*tgt_len+1] = code64[(((unsigned char)src_buf[pos+0] & 0x03) << 4) | ((pos+1 < src_len)?((unsigned char)src_buf[pos+1] >> 4):0)];
  if (pos+1 < src_len)
   tgt_buf[*tgt_len+2] = code64[(((unsigned char)src_buf[pos+1] & 0x0F) << 2) | ((pos+2 < src_len)?((unsigned char)src_buf[pos+2] >> 6):0)];
  else
   tgt_buf[*tgt_len+2] = '=';
  if (pos+2 < src_len)
   tgt_buf[*tgt_len+3] = code64[(unsigned char)src_buf[pos+2] & 0x3F];
  else
   tgt_buf[*tgt_len+3] = '=';
 }
}

canonical_original_code:
void base64encode(char *src_buf, int src_len, char *tgt_buf, int *tgt_len) {
 static char code64[-1] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
 int pos;
 for (pos=0, *tgt_len=0; pos < src_len; pos+=3,*tgt_len+=4) {
  tgt_buf[*tgt_len+0] = code64[(unsigned char)src_buf[pos+0] >> 2];
  tgt_buf[*tgt_len+1] = code64[(((unsigned char)src_buf[pos+0] & 0x03) << 4) | ((pos+1 < src_len)?((unsigned char)src_buf[pos+1] >> 4):0)];
  if (pos+1 < src_len)
   tgt_buf[*tgt_len+2] = code64[(((unsigned char)src_buf[pos+1] & 0x0F) << 2) | ((pos+2 < src_len)?((unsigned char)src_buf[pos+2] >> 6):0)];
  else
   tgt_buf[*tgt_len+2] = '=';
  if (pos+2 < src_len)
   tgt_buf[*tgt_len+3] = code64[(unsigned char)src_buf[pos+2] & 0x3F];
  else
   tgt_buf[*tgt_len+3] = '=';
 }
}


decompiled_code:
void __fastcall set_default_rule(int a1)
{
default_rule = a1;
}

canonical_decompiled_code:
void __fastcall func0(int a1)
{
default_rule = a1;
}

original_code:
void set_default_rule( int type )
{
 default_rule = type;
}

canonical_original_code:
void set_default_rule(int type)
{
 default_rule = type;
}

variable_types: type int


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

result = 0x100000001LL;
start_filters = 0LL;
nr_filters = 0x100000001LL;
return result;
}

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

result = 0x100000001LL;
start_filters = 0LL;
nr_filters = 0x100000001LL;
return result;
}

original_code:
void reset_filters(void)
{
 nr_filters[0] = 1;
 nr_filters[1] = 1;
 start_filters[0] = 0;
 start_filters[1] = 0;
}

canonical_original_code:
void reset_filters()
{
 nr_filters[0] = 1;
 nr_filters[1] = 1;
 start_filters[0] = 0;
 start_filters[1] = 0;
}


decompiled_code:
__int64 __fastcall run_filters(char *string)
{
__int64 v2; // rbx
const regex_t *v3; // rdi
int v4; // eax
__int64 v5; // rbx
const regex_t *v6; // rdi
regmatch_t v8[6]; // [rsp+8h] [rbp-30h] BYREF

v2 = (int)start_filters;
if ( (int)start_filters < (int)nr_filters )
{
do
{
v3 = (const regex_t *)rd_filters[v2];
if ( v3 )
{
if ( !regexec(v3, string, 1uLL, v8, 0) )
return 1LL;
}
}
while ( (int)nr_filters > (int)++v2 );
}
v4 = default_rule;
if ( default_rule != 12 )
{
v5 = SHIDWORD(start_filters);
if ( SHIDWORD(start_filters) >= SHIDWORD(nr_filters) )
{
LABEL_11:
if ( v4 == 11 )
return 1LL;
}
else
{
while ( 1 )
{
v6 = (const regex_t *)qword_330[v5];
if ( v6 )
{
if ( !regexec(v6, string, 1uLL, v8, 0) )
break;
}
if ( SHIDWORD(nr_filters) <= (int)++v5 )
{
v4 = default_rule;
goto LABEL_11;
}
}
}
}
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func5(char *string)
{
__int64 v2; // rbx
const regex_t *v3; // rdi
int v4; // eax
__int64 v5; // rbx
const regex_t *v6; // rdi
regmatch_t v8[6]; // [rsp+8h] [rbp-30h] BYREF

v2 = (int)start_filters;
if ( (int)start_filters < (int)nr_filters )
{
do
{
v3 = (const regex_t *)rd_filters[v2];
if ( v3 )
{
if ( !regexec(v3, string, 1uLL, v8, 0) )
return 1LL;
}
}
while ( (int)nr_filters > (int)++v2 );
}
v4 = default_rule;
if ( default_rule != 12 )
{
v5 = SHIDWORD(start_filters);
if ( SHIDWORD(start_filters) >= SHIDWORD(nr_filters) )
{
LABEL_11:
if ( v4 == 11 )
return 1LL;
}
else
{
while ( 1 )
{
v6 = (const regex_t *)qword_330[v5];
if ( v6 )
{
if ( !regexec(v6, string, 1uLL, v8, 0) )
break;
}
if ( SHIDWORD(nr_filters) <= (int)++v5 )
{
v4 = default_rule;
goto LABEL_11;
}
}
}
}
return 0xFFFFFFFFLL;
}

original_code:
int run_filters(char *s)
{
 regmatch_t pmatch;
 int i;
 for( i=start_filters[0] ; i<nr_filters[0] ; i++ ) {
  if (rd_filters[0][i]==0)
   continue;
  if (regexec(rd_filters[0][i], s, 1, &pmatch, 0)==0)
   return 1;
 }
 if (default_rule!=12) {
  for( i=start_filters[1] ; i<nr_filters[1] ; i++ ) {
   if (rd_filters[1][i]==0)
    continue;
   if (regexec(rd_filters[1][i], s, 1, &pmatch, 0)==0)
    return -1;
  }
 }
 return (default_rule==11)?1:-1;
}

canonical_original_code:
int run_filters(char *s)
{
 struct regmatch_t pmatch;
 int i;
 for( i=start_filters[0] ; i<nr_filters[0] ; i++ ) {
  if (rd_filters[0][i]==0)
   continue;
  if (regexec(rd_filters[0][i], s, 1, &pmatch, 0)==0)
   return 1;
 }
 if (default_rule!=12) {
  for( i=start_filters[1] ; i<nr_filters[1] ; i++ ) {
   if (rd_filters[1][i]==0)
    continue;
   if (regexec(rd_filters[1][i], s, 1, &pmatch, 0)==0)
    return -1;
  }
 }
 return (default_rule==11)?1:-1;
}

variable_types:
s
char *

variable_types: struct regmatch_t { int rm_so; int rm_eo; }

return_type: int


decompiled_code:
__int64 __fastcall ptr_vector_add(__int64 a1, __int64 a2)
{
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

v3 = a2;
return vector_add(a1, &v3);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

v3 = a2;
return vector_add(a1, &v3);
}

original_code:
int ptr_vector_add(ptr_vector_t *vector, void *ptr)
{
 return vector_add(vector, &ptr);
}

canonical_original_code:
int ptr_vector_add(struct vector_t *vector, void *ptr)
{
 return vector_add(vector, &ptr);
}

variable_types: struct vector_t { int element_size; int element_count; int allocated_count; int allocation_count; void *data; } *

variable_types:
ptr
void *


decompiled_code:
__int64 __fastcall ptr_vector_get(__int64 a1, __int64 a2)
{
bool v2; // zf
__int64 result; // rax
__int64 v4; // [rsp+8h] [rbp-10h] BYREF

v4 = 0LL;
v2 = (unsigned int)vector_get(a1, a2, &v4) == 0;
result = 0LL;
if ( v2 )
result = v4;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
bool v2; // zf
__int64 result; // rax
__int64 v4; // [rsp+8h] [rbp-10h] BYREF

v4 = 0LL;
v2 = (unsigned int)vector_get(a1, a2, &v4) == 0;
result = 0LL;
if ( v2 )
result = v4;
return result;
}

original_code:
void *ptr_vector_get(ptr_vector_t *vector, int index)
{
 void *ptr = ((void *)0);
 if (vector_get(vector, index, &ptr) != 0) return ((void *)0);
 return ptr;
}

canonical_original_code:
void *ptr_vector_get(struct vector_t *vector, int index)
{
 void *ptr = ((void *)0);
 if (vector_get(vector, index, &ptr) != 0) return ((void *)0);
 return ptr;
}

variable_types: index int

return_type: void *

user_defined_types: struct vector_t { int element_size; int element_count; int allocated_count; int allocation_count; void *data; }


decompiled_code:
// attributes: thunk
__int64 ptr_vector_remove()
{
return vector_remove();
}

canonical_decompiled_code:
__int64 func2()
{
return vector_remove();
}

original_code:
int ptr_vector_remove(ptr_vector_t *vector, int index)
{
 return vector_remove(vector, index);
}

canonical_original_code:
int ptr_vector_remove(struct vector_t *vector, int index)
{
 return vector_remove(vector, index);
}


decompiled_code:
// attributes: thunk
__int64 ptr_vector_destroy()
{
return vector_destroy();
}

canonical_decompiled_code:
__int64 func3()
{
return vector_destroy();
}

original_code:
void ptr_vector_destroy(ptr_vector_t *vector)
{
 return vector_destroy(vector);
}

canonical_original_code:
void ptr_vector_destroy(struct vector_t *vector)
{
 return vector_destroy(vector);
}


decompiled_code:
__int64 __fastcall ptr_vector_init(__int64 a1, unsigned int a2)
{
return vector_init(a1, 8LL, a2);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, unsigned int a2)
{
return vector_init(a1, 8LL, a2);
}

original_code:
int ptr_vector_init(vector_t *vector, int allocation_count)
{
 return vector_init(vector, sizeof(void *), allocation_count);
}

canonical_original_code:
int ptr_vector_init(struct vector_t *vector, int allocation_count)
{
 return vector_init(vector, sizeof(void *), allocation_count);
}


decompiled_code:
__int64 __fastcall parse_allow_header(__int64 a1)
{
__int64 result; // rax
_QWORD *v2; // rax
_QWORD *v3; // rbp
__int64 v4; // rbx
unsigned int v5; // eax
const char *v6; // rbx
__int64 v7; // rax
struct _IO_FILE *v8; // rdi
const char *v9; // r8
const char *v10; // r9
__int64 v11; // rbp
unsigned int v12; // eax
const char *v13; // [rsp-10h] [rbp-28h]
__int64 v14; // [rsp-10h] [rbp-28h]
__int64 v15; // [rsp-8h] [rbp-20h]
__int64 v16; // [rsp-8h] [rbp-20h]
const char *v17; // [rsp+0h] [rbp-18h]

if ( !a1 )
{
if ( (int)get_debug_level("core", 4LL) < -1 || dprint_crit )
return 0xFFFFFFFFLL;
++dprint_crit;
if ( !log_stderr )
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): parse_allow_header: Invalid parameter value\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_allow.c:48]: ",
"parse_allow_header");
LABEL_10:
--dprint_crit;
return 0xFFFFFFFFLL;
}
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v4 = *((_QWORD *)&log_level_info + 8);
v5 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): parse_allow_header: Invalid parameter value\n",
process_no,
v5,
v4,
"<core> [parser/parse_allow.c:48]: ",
"parse_allow_header");
LABEL_25:
if ( log_color )
dprint_color_reset(v15, v13);
goto LABEL_10;
}
result = 0LL;
if ( *(_QWORD *)(a1 + 48) )
return result;
v2 = (_QWORD *)qm_malloc(mem_block, 8LL);
v3 = v2;
if ( !v2 )
{
if ( (int)get_debug_level("core", 4LL) < -1 || dprint_crit )
return 0xFFFFFFFFLL;
++dprint_crit;
if ( !log_stderr )
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:parse_allow_header: out of pkg_memory\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_allow.c:59]: ",
"parse_allow_header");
goto LABEL_10;
}
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v11 = *((_QWORD *)&log_level_info + 8);
v12 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:parse_allow_header: out of pkg_memory\n",
process_no,
v12,
v11,
"<core> [parser/parse_allow.c:59]: ",
"parse_allow_header");
goto LABEL_25;
}
*v2 = 0LL;
result = parse_methods(a1 + 24, v2);
if ( (_DWORD)result )
{
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v6 = (const char *)*((_QWORD *)&log_level_info + 8);
v7 = my_pid();
v8 = stderr;
v16 = v7;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:parse_allow_header: bad allow body header\n",
process_no,
(unsigned int)v7,
v6,
"<core> [parser/parse_allow.c:65]: ",
"parse_allow_header");
if ( log_color )
dprint_color_reset(
v8,
"%2d(%d) %s: %s%s(): ERROR:parse_allow_header: bad allow body header\n",
v14,
v16,
v9,
v10,
v17);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:parse_allow_header: bad allow body header\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_allow.c:65]: ",
"parse_allow_header");
}
--dprint_crit;
}
qm_free(mem_block, v3);
result = 0xFFFFFFFFLL;
}
else
{
*((_DWORD *)v3 + 1) = 0;
*(_QWORD *)(a1 + 48) = v3;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
__int64 result; // rax
_QWORD *v2; // rax
_QWORD *v3; // rbp
__int64 v4; // rbx
unsigned int v5; // eax
const char *v6; // rbx
__int64 v7; // rax
struct _IO_FILE *v8; // rdi
const char *v9; // r8
const char *v10; // r9
__int64 v11; // rbp
unsigned int v12; // eax
const char *v13; // [rsp-10h] [rbp-28h]
__int64 v14; // [rsp-10h] [rbp-28h]
__int64 v15; // [rsp-8h] [rbp-20h]
__int64 v16; // [rsp-8h] [rbp-20h]
const char *v17; // [rsp+0h] [rbp-18h]

if ( !a1 )
{
if ( (int)get_debug_level("core", 4LL) < -1 || dprint_crit )
return 0xFFFFFFFFLL;
++dprint_crit;
if ( !log_stderr )
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): parse_allow_header: Invalid parameter value\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_allow.c:48]: ",
"parse_allow_header");
LABEL_10:
--dprint_crit;
return 0xFFFFFFFFLL;
}
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v4 = *((_QWORD *)&log_level_info + 8);
v5 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): parse_allow_header: Invalid parameter value\n",
process_no,
v5,
v4,
"<core> [parser/parse_allow.c:48]: ",
"parse_allow_header");
LABEL_25:
if ( log_color )
dprint_color_reset(v15, v13);
goto LABEL_10;
}
result = 0LL;
if ( *(_QWORD *)(a1 + 48) )
return result;
v2 = (_QWORD *)qm_malloc(mem_block, 8LL);
v3 = v2;
if ( !v2 )
{
if ( (int)get_debug_level("core", 4LL) < -1 || dprint_crit )
return 0xFFFFFFFFLL;
++dprint_crit;
if ( !log_stderr )
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:parse_allow_header: out of pkg_memory\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_allow.c:59]: ",
"parse_allow_header");
goto LABEL_10;
}
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v11 = *((_QWORD *)&log_level_info + 8);
v12 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:parse_allow_header: out of pkg_memory\n",
process_no,
v12,
v11,
"<core> [parser/parse_allow.c:59]: ",
"parse_allow_header");
goto LABEL_25;
}
*v2 = 0LL;
result = parse_methods(a1 + 24, v2);
if ( (_DWORD)result )
{
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v6 = (const char *)*((_QWORD *)&log_level_info + 8);
v7 = my_pid();
v8 = stderr;
v16 = v7;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:parse_allow_header: bad allow body header\n",
process_no,
(unsigned int)v7,
v6,
"<core> [parser/parse_allow.c:65]: ",
"parse_allow_header");
if ( log_color )
dprint_color_reset(
v8,
"%2d(%d) %s: %s%s(): ERROR:parse_allow_header: bad allow body header\n",
v14,
v16,
v9,
v10,
v17);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:parse_allow_header: bad allow body header\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_allow.c:65]: ",
"parse_allow_header");
}
--dprint_crit;
}
qm_free(mem_block, v3);
result = 0xFFFFFFFFLL;
}
else
{
*((_DWORD *)v3 + 1) = 0;
*(_QWORD *)(a1 + 48) = v3;
}
return result;
}

original_code:
int parse_allow_header(struct hdr_field* _hf)
{
 struct allow_body* ab = 0;
 if (!_hf) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "parse_allow_header: Invalid parameter value\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "48" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "parse_allow_header: Invalid parameter value\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "48" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "parse_allow_header: Invalid parameter value\n", process_no, my_pid(), ("<core> [" "parser/parse_allow.c" ":" "48" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_allow_header: Invalid parameter value\n", ("<core> [" "parser/parse_allow.c" ":" "48" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_allow_header: Invalid parameter value\n", ("<core> [" "parser/parse_allow.c" ":" "48" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
  if (_hf->parsed) {
   return 0;
 }
 ab = (struct allow_body*)qm_malloc(mem_block, (sizeof(struct allow_body)));
 if (ab == 0) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:parse_allow_header: out of pkg_memory\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "59" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:parse_allow_header: out of pkg_memory\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "59" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:parse_allow_header: out of pkg_memory\n", process_no, my_pid(), ("<core> [" "parser/parse_allow.c" ":" "59" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:parse_allow_header: out of pkg_memory\n", ("<core> [" "parser/parse_allow.c" ":" "59" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:parse_allow_header: out of pkg_memory\n", ("<core> [" "parser/parse_allow.c" ":" "59" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 memset(ab,'\0', sizeof(struct allow_body));
 if (parse_methods(&(_hf->body), &(ab->allow)) !=0 ) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:parse_allow_header: bad allow body header\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "65" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:parse_allow_header: bad allow body header\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "65" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:parse_allow_header: bad allow body header\n", process_no, my_pid(), ("<core> [" "parser/parse_allow.c" ":" "65" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:parse_allow_header: bad allow body header\n", ("<core> [" "parser/parse_allow.c" ":" "65" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:parse_allow_header: bad allow body header\n", ("<core> [" "parser/parse_allow.c" ":" "65" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  goto error;
 }
 ab->allow_all = 0;
 _hf->parsed = (void*)ab;
  return 0;
error:
 if (ab) qm_free(mem_block, (ab));
 return -1;
}

canonical_original_code:
int parse_allow_header(struct hdr_field *_hf)
{
 struct allow_body *ab = 0;
 if (!_hf) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "parse_allow_header: Invalid parameter value\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "48" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "parse_allow_header: Invalid parameter value\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "48" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "parse_allow_header: Invalid parameter value\n", process_no, my_pid(), ("<core> [" "parser/parse_allow.c" ":" "48" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_allow_header: Invalid parameter value\n", ("<core> [" "parser/parse_allow.c" ":" "48" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_allow_header: Invalid parameter value\n", ("<core> [" "parser/parse_allow.c" ":" "48" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
  if (_hf->parsed) {
   return 0;
 }
 ab = (struct allow_body *)qm_malloc(mem_block, (sizeof(struct allow_body)));
 if (ab == 0) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:parse_allow_header: out of pkg_memory\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "59" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:parse_allow_header: out of pkg_memory\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "59" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:parse_allow_header: out of pkg_memory\n", process_no, my_pid(), ("<core> [" "parser/parse_allow.c" ":" "59" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:parse_allow_header: out of pkg_memory\n", ("<core> [" "parser/parse_allow.c" ":" "59" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:parse_allow_header: out of pkg_memory\n", ("<core> [" "parser/parse_allow.c" ":" "59" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 memset(ab,'\0', sizeof(struct allow_body));
 if (parse_methods(&(_hf->body), &(ab->allow)) !=0 ) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:parse_allow_header: bad allow body header\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "65" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:parse_allow_header: bad allow body header\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_allow.c" ":" "65" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:parse_allow_header: bad allow body header\n", process_no, my_pid(), ("<core> [" "parser/parse_allow.c" ":" "65" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:parse_allow_header: bad allow body header\n", ("<core> [" "parser/parse_allow.c" ":" "65" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:parse_allow_header: bad allow body header\n", ("<core> [" "parser/parse_allow.c" ":" "65" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  goto error;
 }
 ab->allow_all = 0;
 _hf->parsed = (void *)ab;
  return 0;
error:
 if (ab) qm_free(mem_block, (ab));
 return -1;
}

variable_types: struct hdr_field { enum _hdr_types_t { HDR_ERROR_T=-1, HDR_OTHER_T=0, HDR_VIA_T=1, HDR_VIA1_T=1, HDR_VIA2_T=2, HDR_TO_T=3, HDR_FROM_T=4, HDR_CSEQ_T=5, HDR_CALLID_T=6, HDR_CONTACT_T=7, HDR_MAXFORWARDS_T=8, HDR_ROUTE_T=9, HDR_RECORDROUTE_T=10, HDR_CONTENTTYPE_T=11, HDR_CONTENTLENGTH_T=12, HDR_AUTHORIZATION_T=13, HDR_EXPIRES_T=14, HDR_PROXYAUTH_T=15, HDR_SUPPORTED_T=16, HDR_REQUIRE_T=17, HDR_PROXYREQUIRE_T=18, HDR_UNSUPPORTED_T=19, HDR_ALLOW_T=20, HDR_EVENT_T=21, HDR_ACCEPT_T=22, HDR_ACCEPTLANGUAGE_T=23, HDR_ORGANIZATION_T=24, HDR_PRIORITY_T=25, HDR_SUBJECT_T=26, HDR_USERAGENT_T=27, HDR_SERVER_T=28, HDR_CONTENTDISPOSITION_T=29, HDR_DIVERSION_T=30, HDR_RPID_T=31, HDR_REFER_TO_T=32, HDR_SIPIFMATCH_T=33, HDR_SESSIONEXPIRES_T=34, HDR_MIN_SE_T=35, HDR_SUBSCRIPTION_STATE_T=36, HDR_ACCEPTCONTACT_T=37, HDR_ALLOWEVENTS_T=38, HDR_CONTENTENCODING_T=39, HDR_REFERREDBY_T=40, HDR_REJECTCONTACT_T=41, HDR_REQUESTDISPOSITION_T=42, HDR_WWW_AUTHENTICATE_T=43, HDR_PROXY_AUTHENTICATE_T=44, HDR_DATE_T=45, HDR_IDENTITY_T=46, HDR_IDENTITY_INFO_T=47, HDR_RETRY_AFTER_T=48, HDR_PPI_T=49, HDR_PAI_T=50, HDR_PATH_T=51, HDR_PRIVACY_T=52, HDR_REASON_T=53, HDR_EOH_T=54 } type; struct _str { char *s; int len; } name; struct _str body; int len; void *parsed; struct hdr_field *next; } *

variable_types: struct allow_body { unsigned int allow; unsigned int allow_all; } *

user_defined_types: struct hdr_field { enum _hdr_types_t type; struct _str name; struct _str body; int len; void *parsed; struct hdr_field *next; }

user_defined_types: struct cfg_group_core { int debug; int log_facility; int memdbg; int use_dst_blacklist; unsigned int blst_timeout; unsigned int blst_max_mem; unsigned int blst_udp_imask; unsigned int blst_tcp_imask; unsigned int blst_tls_imask; unsigned int blst_sctp_imask; int dns_try_ipv6; int dns_try_naptr; int dns_udp_pref; int dns_tcp_pref; int dns_tls_pref; int dns_sctp_pref; int dns_retr_time; int dns_retr_no; int dns_servers_no; int dns_search_list; int dns_search_fmatch; int dns_reinit; int use_dns_cache; int dns_cache_flags; int use_dns_failover; int dns_srv_lb; unsigned int dns_neg_cache_ttl; unsigned int dns_cache_min_ttl; unsigned int dns_cache_max_ttl; unsigned int dns_cache_max_mem; int dns_cache_del_nonexp; int dns_cache_rec_pref; int mem_dump_pkg; int mem_dump_shm; int max_while_loops; int udp_mtu; int udp_mtu_try_proto; int udp4_raw; int udp4_raw_mtu; int udp4_raw_ttl; int force_rport; int memlog; int mem_summary; int mem_safety; int mem_join; int corelog; int latency_log; int latency_limit_db; int latency_limit_action; }


decompiled_code:
__int64 sctp_core_init()
{
const char *v1; // rbx
unsigned int v2; // eax
struct _IO_FILE *v3; // rdi
__int64 v4; // [rsp-18h] [rbp-18h]

if ( sctp_srapi_set )
return sctp_srapi();
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v1 = (const char *)*((_QWORD *)&log_level_info + 8);
v2 = my_pid();
v3 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): SCTP API not initialized\n",
process_no,
v2,
v1,
"<core> [sctp_core.c:35]: ",
"sctp_core_init");
if ( log_color )
dprint_color_reset(v3, "%2d(%d) %s: %s%s(): SCTP API not initialized\n", v4);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): SCTP API not initialized\n",
*((const char **)&log_level_info + 8),
"<core> [sctp_core.c:35]: ",
"sctp_core_init");
}
--dprint_crit;
}
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func0()
{
const char *v1; // rbx
unsigned int v2; // eax
struct _IO_FILE *v3; // rdi
__int64 v4; // [rsp-18h] [rbp-18h]

if ( sctp_srapi_set )
return sctp_srapi();
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v1 = (const char *)*((_QWORD *)&log_level_info + 8);
v2 = my_pid();
v3 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): SCTP API not initialized\n",
process_no,
v2,
v1,
"<core> [sctp_core.c:35]: ",
"sctp_core_init");
if ( log_color )
dprint_color_reset(v3, "%2d(%d) %s: %s%s(): SCTP API not initialized\n", v4);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): SCTP API not initialized\n",
*((const char **)&log_level_info + 8),
"<core> [sctp_core.c:35]: ",
"sctp_core_init");
}
--dprint_crit;
}
return 0xFFFFFFFFLL;
}

original_code:
int sctp_core_init(void)
{
 if(_sctp_srapi_set==0) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "SCTP API not initialized\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "35" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "SCTP API not initialized\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "35" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "SCTP API not initialized\n", process_no, my_pid(), ("<core> [" "sctp_core.c" ":" "35" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not initialized\n", ("<core> [" "sctp_core.c" ":" "35" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not initialized\n", ("<core> [" "sctp_core.c" ":" "35" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 return _sctp_srapi.init();
}

canonical_original_code:
int sctp_core_init()
{
 if(_sctp_srapi_set==0) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "SCTP API not initialized\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "35" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "SCTP API not initialized\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "35" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "SCTP API not initialized\n", process_no, my_pid(), ("<core> [" "sctp_core.c" ":" "35" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not initialized\n", ("<core> [" "sctp_core.c" ":" "35" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not initialized\n", ("<core> [" "sctp_core.c" ":" "35" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 return _sctp_srapi.init();
}


decompiled_code:
void sctp_core_destroy()
{
const char *v0; // rbx
unsigned int v1; // eax
struct _IO_FILE *v2; // rdi

if ( sctp_srapi_set )
{
(*(&sctp_srapi + 1))();
}
else if ( (int)get_debug_level("core", 4LL) > 1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(2LL);
v0 = (const char *)*((_QWORD *)&log_level_info + 14);
v1 = my_pid();
v2 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): SCTP API not initialized\n",
process_no,
v1,
v0,
"<core> [sctp_core.c:48]: ",
"sctp_core_destroy");
if ( log_color )
dprint_color_reset(v2, "%2d(%d) %s: %s%s(): SCTP API not initialized\n");
}
else
{
syslog(
*((_DWORD *)&log_level_info + 30) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): SCTP API not initialized\n",
*((const char **)&log_level_info + 14),
"<core> [sctp_core.c:48]: ",
"sctp_core_destroy");
}
--dprint_crit;
}
}

canonical_decompiled_code:
void func1()
{
const char *v0; // rbx
unsigned int v1; // eax
struct _IO_FILE *v2; // rdi

if ( sctp_srapi_set )
{
(*(&sctp_srapi + 1))();
}
else if ( (int)get_debug_level("core", 4LL) > 1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(2LL);
v0 = (const char *)*((_QWORD *)&log_level_info + 14);
v1 = my_pid();
v2 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): SCTP API not initialized\n",
process_no,
v1,
v0,
"<core> [sctp_core.c:48]: ",
"sctp_core_destroy");
if ( log_color )
dprint_color_reset(v2, "%2d(%d) %s: %s%s(): SCTP API not initialized\n");
}
else
{
syslog(
*((_DWORD *)&log_level_info + 30) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): SCTP API not initialized\n",
*((const char **)&log_level_info + 14),
"<core> [sctp_core.c:48]: ",
"sctp_core_destroy");
}
--dprint_crit;
}
}

original_code:
void sctp_core_destroy(void)
{
 if(_sctp_srapi_set==0) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((2)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((2)) >= -5) && (((2)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((2)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "SCTP API not initialized\n", process_no, my_pid(), (log_level_info[((2)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "48" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((2)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "SCTP API not initialized\n", (log_level_info[((2)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "48" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((2)); fprintf(stderr, "%2d(%d) %s" "%s(): " "SCTP API not initialized\n", process_no, my_pid(), ("<core> [" "sctp_core.c" ":" "48" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((2))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not initialized\n", ("<core> [" "sctp_core.c" ":" "48" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not initialized\n", ("<core> [" "sctp_core.c" ":" "48" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return;
 }
 _sctp_srapi.destroy();
}

canonical_original_code:
void sctp_core_destroy()
{
 if(_sctp_srapi_set==0) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((2)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((2)) >= -5) && (((2)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((2)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "SCTP API not initialized\n", process_no, my_pid(), (log_level_info[((2)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "48" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((2)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "SCTP API not initialized\n", (log_level_info[((2)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "48" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((2)); fprintf(stderr, "%2d(%d) %s" "%s(): " "SCTP API not initialized\n", process_no, my_pid(), ("<core> [" "sctp_core.c" ":" "48" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((2))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not initialized\n", ("<core> [" "sctp_core.c" ":" "48" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not initialized\n", ("<core> [" "sctp_core.c" ":" "48" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return;
 }
 _sctp_srapi.destroy();
}


decompiled_code:
// attributes: thunk
__int64 sctp_core_init_sock()
{
return xmmword_530();
}

canonical_decompiled_code:
__int64 func2()
{
return xmmword_530();
}

original_code:
int sctp_core_init_sock(struct socket_info* sock_info)
{
 return _sctp_srapi.init_sock(sock_info);
}

canonical_original_code:
int sctp_core_init_sock(struct socket_info *sock_info)
{
 return _sctp_srapi.init_sock(sock_info);
}

variable_types: struct socket_info { int socket; struct _str { char *s; int len; } name; struct ip_addr { unsigned int af; unsigned int len; union { unsigned long addrl[-1]; unsigned int addr32[4]; unsigned short addr16[8]; unsigned char addr[16]; } u; } address; struct _str address_str; struct _str port_no_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } s; struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } sin; struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; } sin6_addr; unsigned int sin6_scope_id; } sin6; } su; struct socket_info *next; struct socket_info *prev; unsigned short port_no; char proto; struct _str sock_str; struct addr_info { struct _str name; struct ip_addr address; struct _str address_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union su; struct addr_info *next; struct addr_info *prev; } *addr_info_lst; int workers; int workers_tcpidx; struct advertise_info { struct _str name; unsigned short port_no; struct _str port_no_str; struct _str address_str; struct ip_addr address; struct _str sock_str; } useinfo; } *

user_defined_types: struct socket_info { int socket; struct _str name; struct ip_addr address; struct _str address_str; struct _str port_no_str; enum si_flags flags; union sockaddr_union su; struct socket_info *next; struct socket_info *prev; unsigned short port_no; char proto; struct _str sock_str; struct addr_info *addr_info_lst; int workers; int workers_tcpidx; struct advertise_info useinfo; }

user_defined_types: union sockaddr_union { struct sockaddr s; struct sockaddr_in sin; struct sockaddr_in6 sin6; }

user_defined_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }

user_defined_types: struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr sin6_addr; unsigned int sin6_scope_id; }

user_defined_types: struct addr_info { struct _str name; struct ip_addr address; struct _str address_str; enum si_flags flags; union sockaddr_union su; struct addr_info *next; struct addr_info *prev; }


decompiled_code:
__int64 sctp_core_check_support()
{
const char *v1; // rbx
unsigned int v2; // eax
struct _IO_FILE *v3; // rdi

if ( sctp_srapi_set )
return (*(&xmmword_530 + 1))();
if ( (int)get_debug_level("core", 4LL) > 1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(2LL);
v1 = (const char *)*((_QWORD *)&log_level_info + 14);
v2 = my_pid();
v3 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): SCTP API not enabled - if you want to use it, load sctp module\n",
process_no,
v2,
v1,
"<core> [sctp_core.c:69]: ",
"sctp_core_check_support");
if ( log_color )
dprint_color_reset(v3, "%2d(%d) %s: %s%s(): SCTP API not enabled - if you want to use it, load sctp module\n");
}
else
{
syslog(
*((_DWORD *)&log_level_info + 30) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): SCTP API not enabled - if you want to use it, load sctp module\n",
*((const char **)&log_level_info + 14),
"<core> [sctp_core.c:69]: ",
"sctp_core_check_support");
}
--dprint_crit;
}
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func3()
{
const char *v1; // rbx
unsigned int v2; // eax
struct _IO_FILE *v3; // rdi

if ( sctp_srapi_set )
return (*(&xmmword_530 + 1))();
if ( (int)get_debug_level("core", 4LL) > 1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(2LL);
v1 = (const char *)*((_QWORD *)&log_level_info + 14);
v2 = my_pid();
v3 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): SCTP API not enabled - if you want to use it, load sctp module\n",
process_no,
v2,
v1,
"<core> [sctp_core.c:69]: ",
"sctp_core_check_support");
if ( log_color )
dprint_color_reset(v3, "%2d(%d) %s: %s%s(): SCTP API not enabled - if you want to use it, load sctp module\n");
}
else
{
syslog(
*((_DWORD *)&log_level_info + 30) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): SCTP API not enabled - if you want to use it, load sctp module\n",
*((const char **)&log_level_info + 14),
"<core> [sctp_core.c:69]: ",
"sctp_core_check_support");
}
--dprint_crit;
}
return 0xFFFFFFFFLL;
}

original_code:
int sctp_core_check_support(void)
{
 if(_sctp_srapi_set==0) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((2)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((2)) >= -5) && (((2)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((2)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "SCTP API not enabled" " - if you want to use it, load sctp module\n", process_no, my_pid(), (log_level_info[((2)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "69" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((2)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "SCTP API not enabled" " - if you want to use it, load sctp module\n", (log_level_info[((2)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "69" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((2)); fprintf(stderr, "%2d(%d) %s" "%s(): " "SCTP API not enabled" " - if you want to use it, load sctp module\n", process_no, my_pid(), ("<core> [" "sctp_core.c" ":" "69" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((2))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not enabled" " - if you want to use it, load sctp module\n", ("<core> [" "sctp_core.c" ":" "69" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not enabled" " - if you want to use it, load sctp module\n", ("<core> [" "sctp_core.c" ":" "69" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 return _sctp_srapi.check_support();
}

canonical_original_code:
int sctp_core_check_support()
{
 if(_sctp_srapi_set==0) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((2)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((2)) >= -5) && (((2)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((2)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "SCTP API not enabled" " - if you want to use it, load sctp module\n", process_no, my_pid(), (log_level_info[((2)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "69" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((2)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "SCTP API not enabled" " - if you want to use it, load sctp module\n", (log_level_info[((2)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "69" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((2)); fprintf(stderr, "%2d(%d) %s" "%s(): " "SCTP API not enabled" " - if you want to use it, load sctp module\n", process_no, my_pid(), ("<core> [" "sctp_core.c" ":" "69" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((2))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not enabled" " - if you want to use it, load sctp module\n", ("<core> [" "sctp_core.c" ":" "69" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API not enabled" " - if you want to use it, load sctp module\n", ("<core> [" "sctp_core.c" ":" "69" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 return _sctp_srapi.check_support();
}


decompiled_code:
// attributes: thunk
__int64 sctp_core_rcv_loop()
{
return xmmword_540();
}

canonical_decompiled_code:
__int64 func4()
{
return xmmword_540();
}

original_code:
int sctp_core_rcv_loop(void)
{
 return _sctp_srapi.rcv_loop();
}

canonical_original_code:
int sctp_core_rcv_loop()
{
 return _sctp_srapi.rcv_loop();
}


decompiled_code:
// attributes: thunk
__int64 sctp_core_msg_send()
{
return (*(&xmmword_540 + 1))();
}

original_code:
int sctp_core_msg_send(struct dest_info* dst, char* buf, unsigned len)
{
 return _sctp_srapi.msg_send(dst, buf, len);
}

canonical_original_code:
int sctp_core_msg_send(struct dest_info *dst, char *buf, unsigned int len)
{
 return _sctp_srapi.msg_send(dst, buf, len);
}

variable_types: struct dest_info { struct socket_info { int socket; struct _str { char *s; int len; } name; struct ip_addr { unsigned int af; unsigned int len; union { unsigned long addrl[-1]; unsigned int addr32[4]; unsigned short addr16[8]; unsigned char addr[16]; } u; } address; struct _str address_str; struct _str port_no_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } s; struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } sin; struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; } sin6_addr; unsigned int sin6_scope_id; } sin6; } su; struct socket_info *next; struct socket_info *prev; unsigned short port_no; char proto; struct _str sock_str; struct addr_info { struct _str name; struct ip_addr address; struct _str address_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union su; struct addr_info *next; struct addr_info *prev; } *addr_info_lst; int workers; int workers_tcpidx; struct advertise_info { struct _str name; unsigned short port_no; struct _str port_no_str; struct _str address_str; struct ip_addr address; struct _str sock_str; } useinfo; } *send_sock; union sockaddr_union to; int id; char proto; struct snd_flags { unsigned char f; unsigned char blst_imask; } send_flags; } *

variable_types:
buf
char *

variable_types:
len
unsigned int

user_defined_types: struct dest_info { struct socket_info *send_sock; union sockaddr_union to; int id; char proto; struct snd_flags send_flags; }


decompiled_code:
__int64 __fastcall sctp_core_register_api(const __m128i *a1)
{
__m128i v1; // xmm0
__int64 result; // rax
__int64 v3; // rbx
unsigned int v4; // eax
__int64 v5; // rdx
const char *v6; // r9
const char *v7; // rsi
__int64 v8; // r8
__int64 v9; // rcx
__int64 v10; // r8
struct _IO_FILE *v11; // rdi
__int64 v12; // rbx
unsigned int v13; // eax
__int64 v14; // [rsp-8h] [rbp-10h]

if ( !a1 || !a1->m128i_i64[0] )
{
if ( (int)get_debug_level("core", 4LL) < -1 || dprint_crit )
return 0xFFFFFFFFLL;
++dprint_crit;
if ( !log_stderr )
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): invalid parameters\n",
*((const char **)&log_level_info + 8),
"<core> [sctp_core.c:99]: ",
"sctp_core_register_api");
LABEL_9:
--dprint_crit;
return 0xFFFFFFFFLL;
}
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v3 = *((_QWORD *)&log_level_info + 8);
v4 = my_pid();
v5 = process_no;
v6 = "<core> [sctp_core.c:99]: ";
v7 = "%2d(%d) %s: %s%s(): invalid parameters\n";
v14 = v8;
v9 = v4;
v10 = v3;
LABEL_18:
v11 = stderr;
fprintf(stderr, v7, v5, v9, v10, v6, "sctp_core_register_api", v14);
if ( log_color )
dprint_color_reset(v11, v7);
goto LABEL_9;
}
if ( sctp_srapi_set != 1 )
{
v1 = _mm_loadu_si128(a1);
result = 0LL;
sctp_srapi_set = 1;
*(__m128i *)&sctp_srapi = v1;
*(__m128i *)&xmmword_530 = _mm_loadu_si128(a1 + 1);
*(__m128i *)&xmmword_540 = _mm_loadu_si128(a1 + 2);
return result;
}
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( !log_stderr )
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): SCTP API already initialized\n",
*((const char **)&log_level_info + 8),
"<core> [sctp_core.c:103]: ",
"sctp_core_register_api");
goto LABEL_9;
}
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v12 = *((_QWORD *)&log_level_info + 8);
v13 = my_pid();
v5 = process_no;
v6 = "<core> [sctp_core.c:103]: ";
v14 = 4LL;
v9 = v13;
v10 = v12;
v7 = "%2d(%d) %s: %s%s(): SCTP API already initialized\n";
goto LABEL_18;
}
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func6(const __m128i *a1)
{
__m128i v1; // xmm0
__int64 result; // rax
__int64 v3; // rbx
unsigned int v4; // eax
__int64 v5; // rdx
const char *v6; // r9
const char *v7; // rsi
__int64 v8; // r8
__int64 v9; // rcx
__int64 v10; // r8
struct _IO_FILE *v11; // rdi
__int64 v12; // rbx
unsigned int v13; // eax
__int64 v14; // [rsp-8h] [rbp-10h]

if ( !a1 || !a1->m128i_i64[0] )
{
if ( (int)get_debug_level("core", 4LL) < -1 || dprint_crit )
return 0xFFFFFFFFLL;
++dprint_crit;
if ( !log_stderr )
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): invalid parameters\n",
*((const char **)&log_level_info + 8),
"<core> [sctp_core.c:99]: ",
"sctp_core_register_api");
LABEL_9:
--dprint_crit;
return 0xFFFFFFFFLL;
}
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v3 = *((_QWORD *)&log_level_info + 8);
v4 = my_pid();
v5 = process_no;
v6 = "<core> [sctp_core.c:99]: ";
v7 = "%2d(%d) %s: %s%s(): invalid parameters\n";
v14 = v8;
v9 = v4;
v10 = v3;
LABEL_18:
v11 = stderr;
fprintf(stderr, v7, v5, v9, v10, v6, "sctp_core_register_api", v14);
if ( log_color )
dprint_color_reset(v11, v7);
goto LABEL_9;
}
if ( sctp_srapi_set != 1 )
{
v1 = _mm_loadu_si128(a1);
result = 0LL;
sctp_srapi_set = 1;
*(__m128i *)&sctp_srapi = v1;
*(__m128i *)&xmmword_530 = _mm_loadu_si128(a1 + 1);
*(__m128i *)&xmmword_540 = _mm_loadu_si128(a1 + 2);
return result;
}
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( !log_stderr )
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): SCTP API already initialized\n",
*((const char **)&log_level_info + 8),
"<core> [sctp_core.c:103]: ",
"sctp_core_register_api");
goto LABEL_9;
}
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v12 = *((_QWORD *)&log_level_info + 8);
v13 = my_pid();
v5 = process_no;
v6 = "<core> [sctp_core.c:103]: ";
v14 = 4LL;
v9 = v13;
v10 = v12;
v7 = "%2d(%d) %s: %s%s(): SCTP API already initialized\n";
goto LABEL_18;
}
return 0xFFFFFFFFLL;
}

original_code:
int sctp_core_register_api(sctp_srapi_t *api)
{
 if(api==((void *)0) || api->init==((void *)0)) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "invalid parameters\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "99" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "invalid parameters\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "99" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "invalid parameters\n", process_no, my_pid(), ("<core> [" "sctp_core.c" ":" "99" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "invalid parameters\n", ("<core> [" "sctp_core.c" ":" "99" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "invalid parameters\n", ("<core> [" "sctp_core.c" ":" "99" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 if(_sctp_srapi_set==1) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "SCTP API already initialized\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "103" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "SCTP API already initialized\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "103" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "SCTP API already initialized\n", process_no, my_pid(), ("<core> [" "sctp_core.c" ":" "103" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API already initialized\n", ("<core> [" "sctp_core.c" ":" "103" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API already initialized\n", ("<core> [" "sctp_core.c" ":" "103" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 _sctp_srapi_set = 1;
 memcpy(&_sctp_srapi, api, sizeof(sctp_srapi_t));
 return 0;
}

canonical_original_code:
int sctp_core_register_api(struct sctp_srapi *api)
{
 if(api==((void *)0) || api->init==((void *)0)) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "invalid parameters\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "99" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "invalid parameters\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "99" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "invalid parameters\n", process_no, my_pid(), ("<core> [" "sctp_core.c" ":" "99" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "invalid parameters\n", ("<core> [" "sctp_core.c" ":" "99" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "invalid parameters\n", ("<core> [" "sctp_core.c" ":" "99" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 if(_sctp_srapi_set==1) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "SCTP API already initialized\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "103" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "SCTP API already initialized\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "sctp_core.c" ":" "103" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "SCTP API already initialized\n", process_no, my_pid(), ("<core> [" "sctp_core.c" ":" "103" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API already initialized\n", ("<core> [" "sctp_core.c" ":" "103" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "SCTP API already initialized\n", ("<core> [" "sctp_core.c" ":" "103" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 _sctp_srapi_set = 1;
 memcpy(&_sctp_srapi, api, sizeof(sctp_srapi_t));
 return 0;
}

variable_types: struct sctp_srapi { int (*init)(); void (*destroy)(); int (*init_sock)(struct socket_info { int socket; struct _str { char *s; int len; } name; struct ip_addr { unsigned int af; unsigned int len; union { unsigned long addrl[-1]; unsigned int addr32[4]; unsigned short addr16[8]; unsigned char addr[16]; } u; } address; struct _str address_str; struct _str port_no_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } s; struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } sin; struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; } sin6_addr; unsigned int sin6_scope_id; } sin6; } su; struct socket_info *next; struct socket_info *prev; unsigned short port_no; char proto; struct _str sock_str; struct addr_info { struct _str name; struct ip_addr address; struct _str address_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union su; struct addr_info *next; struct addr_info *prev; } *addr_info_lst; int workers; int workers_tcpidx; struct advertise_info { struct _str name; unsigned short port_no; struct _str port_no_str; struct _str address_str; struct ip_addr address; struct _str sock_str; } useinfo; } *sock_info); int (*check_support)(); int (*rcv_loop)(); int (*msg_send)(struct dest_info { struct socket_info *send_sock; union sockaddr_union to; int id; char proto; struct snd_flags { unsigned char f; unsigned char blst_imask; } send_flags; } *dst, char *buf, unsigned int len); } *

user_defined_types: struct sctp_srapi { int (*init)(); void (*destroy)(); int (*init_sock)(struct socket_info *sock_info); int (*check_support)(); int (*rcv_loop)(); int (*msg_send)(struct dest_info *dst, char *buf, unsigned int len); }


decompiled_code:
__int64 __fastcall sca_event_from_str(__int64 a1)
{
const void *v1; // rbp
int v2; // ebx
__int64 result; // rax
int v4; // er8

if ( !a1 )
return 0xFFFFFFFFLL;
v1 = *(const void **)a1;
if ( !*(_QWORD *)a1 )
return 0xFFFFFFFFLL;
v2 = *(_DWORD *)(a1 + 8);
if ( v2 != *((_DWORD *)&SCA_EVENT_NAME_CALL_INFO + 2)
|| (v4 = memcmp(*(const void **)a1, SCA_EVENT_NAME_CALL_INFO, v2), result = 1LL, v4) )
{
if ( v2 == *((_DWORD *)&SCA_EVENT_NAME_LINE_SEIZE + 2) )
return memcmp(v1, SCA_EVENT_NAME_LINE_SEIZE, v2) == 0 ? 2 : -1;
return 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
const void *v1; // rbp
int v2; // ebx
__int64 result; // rax
int v4; // er8

if ( !a1 )
return 0xFFFFFFFFLL;
v1 = *(const void **)a1;
if ( !*(_QWORD *)a1 )
return 0xFFFFFFFFLL;
v2 = *(_DWORD *)(a1 + 8);
if ( v2 != *((_DWORD *)&SCA_EVENT_NAME_CALL_INFO + 2)
|| (v4 = memcmp(*(const void **)a1, SCA_EVENT_NAME_CALL_INFO, v2), result = 1LL, v4) )
{
if ( v2 == *((_DWORD *)&SCA_EVENT_NAME_LINE_SEIZE + 2) )
return memcmp(v1, SCA_EVENT_NAME_LINE_SEIZE, v2) == 0 ? 2 : -1;
return 0xFFFFFFFFLL;
}
return result;
}

original_code:
int
sca_event_from_str( str *event_str )
{
    int event = SCA_EVENT_TYPE_UNKNOWN;
    if ( event_str == ((void *)0) || event_str->s == ((void *)0) ) {
 return( SCA_EVENT_TYPE_UNKNOWN );
    }
    if ( (((*event_str).len == (SCA_EVENT_NAME_CALL_INFO).len) && (memcmp((*event_str).s, (SCA_EVENT_NAME_CALL_INFO).s, (*event_str).len) == 0))) {
 event = SCA_EVENT_TYPE_CALL_INFO;
    } else if ( (((*event_str).len == (SCA_EVENT_NAME_LINE_SEIZE).len) && (memcmp((*event_str).s, (SCA_EVENT_NAME_LINE_SEIZE).s, (*event_str).len) == 0))) {
 event = SCA_EVENT_TYPE_LINE_SEIZE;
    }
    return( event );
}

canonical_original_code:
int sca_event_from_str(struct _str *event_str)
{
    int event = SCA_EVENT_TYPE_UNKNOWN;
    if ( event_str == ((void *)0) || event_str->s == ((void *)0) ) {
 return( SCA_EVENT_TYPE_UNKNOWN );
    }
    if ( (((*event_str).len == (SCA_EVENT_NAME_CALL_INFO).len) && (memcmp((*event_str).s, (SCA_EVENT_NAME_CALL_INFO).s, (*event_str).len) == 0))) {
 event = SCA_EVENT_TYPE_CALL_INFO;
    } else if ( (((*event_str).len == (SCA_EVENT_NAME_LINE_SEIZE).len) && (memcmp((*event_str).s, (SCA_EVENT_NAME_LINE_SEIZE).s, (*event_str).len) == 0))) {
 event = SCA_EVENT_TYPE_LINE_SEIZE;
    }
    return( event );
}

variable_types: event int


decompiled_code:
const char *__fastcall sca_event_name_from_type(int a1)
{
if ( a1 == 1 )
return SCA_EVENT_NAME_CALL_INFO;
if ( a1 == 2 )
return SCA_EVENT_NAME_LINE_SEIZE;
return "unknown";
}

canonical_decompiled_code:
const char *__fastcall func1(int a1)
{
if ( a1 == 1 )
return SCA_EVENT_NAME_CALL_INFO;
if ( a1 == 2 )
return SCA_EVENT_NAME_LINE_SEIZE;
return "unknown";
}

original_code:
char *
sca_event_name_from_type( int event_type )
{
    switch ( event_type ) {
    case SCA_EVENT_TYPE_CALL_INFO:
 return( SCA_EVENT_NAME_CALL_INFO.s );
    case SCA_EVENT_TYPE_LINE_SEIZE:
 return( SCA_EVENT_NAME_LINE_SEIZE.s );
    default:
 break;
    }
    return( "unknown" );
}

canonical_original_code:
char *sca_event_name_from_type(int event_type)
{
    switch ( event_type ) {
    case SCA_EVENT_TYPE_CALL_INFO:
 return( SCA_EVENT_NAME_CALL_INFO.s );
    case SCA_EVENT_TYPE_LINE_SEIZE:
 return( SCA_EVENT_NAME_LINE_SEIZE.s );
    default:
 break;
    }
    return( "unknown" );
}

return_type: char *


decompiled_code:
int __fastcall sca_event_append_header_for_type(int a1, char *a2, int a3)
{
const char *v4; // rax
int result; // eax
int v6; // er8
const char *v7; // rax
const char *v8; // rbp
const char *v9; // r13
unsigned int v10; // eax
struct _IO_FILE *v11; // rdi
__int64 v12; // [rsp-8h] [rbp-30h]

v4 = sca_event_name_from_type(a1);
result = snprintf(a2, a3, "Event: %s%s", v4, "\r\n");
if ( result >= a3 )
{
v6 = get_debug_level("sca", 3LL);
result = -1;
if ( v6 >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v8 = sca_event_name_from_type(a1);
v9 = (const char *)*((_QWORD *)&log_level_info + 8);
v10 = my_pid();
v11 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): %s Event header too long",
process_no,
v10,
v9,
"sca [sca_event.c:74]: ",
"sca_event_append_header_for_type",
v8);
if ( log_color )
dprint_color_reset(v11, "%2d(%d) %s: %s%s(): %s Event header too long", v12);
}
else
{
v7 = sca_event_name_from_type(a1);
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): %s Event header too long",
*((const char **)&log_level_info + 8),
"sca [sca_event.c:74]: ",
"sca_event_append_header_for_type",
v7);
}
result = -1;
--dprint_crit;
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func2(int a1, char *a2, int a3)
{
const char *v4; // rax
int result; // eax
int v6; // er8
const char *v7; // rax
const char *v8; // rbp
const char *v9; // r13
unsigned int v10; // eax
struct _IO_FILE *v11; // rdi
__int64 v12; // [rsp-8h] [rbp-30h]

v4 = func1(a1);
result = snprintf(a2, a3, "Event: %s%s", v4, "\r\n");
if ( result >= a3 )
{
v6 = get_debug_level("sca", 3LL);
result = -1;
if ( v6 >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v8 = func1(a1);
v9 = (const char *)*((_QWORD *)&log_level_info + 8);
v10 = my_pid();
v11 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): %s Event header too long",
process_no,
v10,
v9,
"sca [sca_event.c:74]: ",
"sca_event_append_header_for_type",
v8);
if ( log_color )
dprint_color_reset(v11, "%2d(%d) %s: %s%s(): %s Event header too long", v12);
}
else
{
v7 = func1(a1);
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): %s Event header too long",
*((const char **)&log_level_info + 8),
"sca [sca_event.c:74]: ",
"sca_event_append_header_for_type",
v7);
}
result = -1;
--dprint_crit;
}
}
return result;
}

original_code:
int
sca_event_append_header_for_type( int event_type, char *hdrbuf, int maxlen )
{
    int len;
    len = snprintf( hdrbuf, maxlen, "Event: %s%s",
      sca_event_name_from_type( event_type ), "\r\n" );
    if ( len >= maxlen ) {
 do { if (get_debug_level("sca", (sizeof("sca")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "%s Event header too long", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("sca" " [" "sca_event.c" ":" "74" "]: ") , __func__, sca_event_name_from_type( event_type)); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "%s Event header too long", (log_level_info[((-1)) - (-5)].name), ("sca" " [" "sca_event.c" ":" "74" "]: ") , __func__, sca_event_name_from_type( event_type)); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "%s Event header too long", process_no, my_pid(), ("sca" " [" "sca_event.c" ":" "74" "]: ") , __func__, sca_event_name_from_type( event_type)); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "%s Event header too long", ("sca" " [" "sca_event.c" ":" "74" "]: ") , __func__, sca_event_name_from_type( event_type)); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "%s Event header too long", ("sca" " [" "sca_event.c" ":" "74" "]: ") , __func__, sca_event_name_from_type( event_type)); } } (dprint_crit--); } } while(0);
 return( -1 );
    }
    return( len );
}

canonical_original_code:
int sca_event_append_header_for_type(int event_type, char *hdrbuf, int maxlen)
{
    int len;
    len = snprintf( hdrbuf, maxlen, "Event: %s%s",
      sca_event_name_from_type( event_type ), "\r\n" );
    if ( len >= maxlen ) {
 do { if (get_debug_level("sca", (sizeof("sca")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "%s Event header too long", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("sca" " [" "sca_event.c" ":" "74" "]: ") , __func__, sca_event_name_from_type( event_type)); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "%s Event header too long", (log_level_info[((-1)) - (-5)].name), ("sca" " [" "sca_event.c" ":" "74" "]: ") , __func__, sca_event_name_from_type( event_type)); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "%s Event header too long", process_no, my_pid(), ("sca" " [" "sca_event.c" ":" "74" "]: ") , __func__, sca_event_name_from_type( event_type)); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "%s Event header too long", ("sca" " [" "sca_event.c" ":" "74" "]: ") , __func__, sca_event_name_from_type( event_type)); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "%s Event header too long", ("sca" " [" "sca_event.c" ":" "74" "]: ") , __func__, sca_event_name_from_type( event_type)); } } (dprint_crit--); } } while(0);
 return( -1 );
    }
    return( len );
}

variable_types:
hdrbuf
char *

variable_types: maxlen int

variable_types: len int


decompiled_code:
__int64 __fastcall crcitt_string_ex(char *a1, int a2, unsigned int a3)
{
int v3; // eax
char *v4; // rdx
int v5; // esi
char v6; // cl
char v7; // r9
char v8; // r11
char v9; // cl
char v10; // r9
unsigned __int16 v11; // ax
unsigned __int16 v12; // ax
unsigned __int16 v13; // ax

v3 = ~a3;
if ( !a2 )
return a3;
v4 = &a1[a2];
v5 = a2 & 3;
if ( !v5 )
goto LABEL_13;
if ( v5 != 1LL )
{
if ( v5 != 2LL )
{
v6 = *a1++;
LOWORD(v3) = ccitt_tab[(unsigned __int8)(v3 ^ v6)] ^ BYTE1(v3);
}
v7 = *a1++;
LOWORD(v3) = ccitt_tab[(unsigned __int8)(v3 ^ v7)] ^ BYTE1(v3);
}
v8 = *a1++;
LOWORD(v3) = ccitt_tab[(unsigned __int8)(v3 ^ v8)] ^ BYTE1(v3);
if ( a1 != v4 )
{
LABEL_13:
do
{
v9 = *a1;
v10 = a1[1];
a1 += 4;
v11 = ccitt_tab[(unsigned __int8)(v3 ^ v9)] ^ BYTE1(v3);
v12 = ccitt_tab[(unsigned __int8)(v11 ^ v10)] ^ HIBYTE(v11);
v13 = ccitt_tab[(unsigned __int8)(v12 ^ *(a1 - 2))] ^ HIBYTE(v12);
LOWORD(v3) = ccitt_tab[(unsigned __int8)(v13 ^ *(a1 - 1))] ^ HIBYTE(v13);
}
while ( a1 != v4 );
}
return (unsigned int)~v3;
}

canonical_decompiled_code:
__int64 __fastcall func1(char *a1, int a2, unsigned int a3)
{
int v3; // eax
char *v4; // rdx
int v5; // esi
char v6; // cl
char v7; // r9
char v8; // r11
char v9; // cl
char v10; // r9
unsigned __int16 v11; // ax
unsigned __int16 v12; // ax
unsigned __int16 v13; // ax

v3 = ~a3;
if ( !a2 )
return a3;
v4 = &a1[a2];
v5 = a2 & 3;
if ( !v5 )
goto LABEL_13;
if ( v5 != 1LL )
{
if ( v5 != 2LL )
{
v6 = *a1++;
LOWORD(v3) = ccitt_tab[(unsigned __int8)(v3 ^ v6)] ^ BYTE1(v3);
}
v7 = *a1++;
LOWORD(v3) = ccitt_tab[(unsigned __int8)(v3 ^ v7)] ^ BYTE1(v3);
}
v8 = *a1++;
LOWORD(v3) = ccitt_tab[(unsigned __int8)(v3 ^ v8)] ^ BYTE1(v3);
if ( a1 != v4 )
{
LABEL_13:
do
{
v9 = *a1;
v10 = a1[1];
a1 += 4;
v11 = ccitt_tab[(unsigned __int8)(v3 ^ v9)] ^ BYTE1(v3);
v12 = ccitt_tab[(unsigned __int8)(v11 ^ v10)] ^ HIBYTE(v11);
v13 = ccitt_tab[(unsigned __int8)(v12 ^ *(a1 - 2))] ^ HIBYTE(v12);
LOWORD(v3) = ccitt_tab[(unsigned __int8)(v13 ^ *(a1 - 1))] ^ HIBYTE(v13);
}
while ( a1 != v4 );
}
return (unsigned int)~v3;
}

original_code:
unsigned short crcitt_string_ex( char *s, int len, register unsigned short ccitt) {
 ccitt = ~ccitt;
 while( len ) {
  ccitt = (ccitt_tab[((ccitt) ^ (*s)) & 0xff] ^ ((ccitt) >> 8));
  s++; len--;
 }
 return ~ccitt;
}

canonical_original_code:
unsigned short crcitt_string_ex(char *s, int len, unsigned short ccitt) {
 ccitt = ~ccitt;
 while( len ) {
  ccitt = (ccitt_tab[((ccitt) ^ (*s)) & 0xff] ^ ((ccitt) >> 8));
  s++; len--;
 }
 return ~ccitt;
}

variable_types:
ccitt
unsigned short

return_type: unsigned short


decompiled_code:
__int64 __fastcall crcitt_string(char *a1, int a2)
{
return crcitt_string_ex(a1, a2, 0);
}

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

original_code:
unsigned short crcitt_string( char *s, int len )
{
 return crcitt_string_ex(s, len, 0);
}

canonical_original_code:
unsigned short crcitt_string(char *s, int len)
{
 return crcitt_string_ex(s, len, 0);
}

variable_types:
s
char *


decompiled_code:
void __fastcall crcitt_string_array(_BYTE *a1, __int64 a2, int a3)
{
unsigned __int16 v3; // bx
__int64 v4; // rdi
__int64 v5; // rcx
char *v6; // rdx
char *v7; // r8
int v8; // ecx
char v9; // r9
char v10; // r11
char v11; // cl
char v12; // r10
char v13; // al
unsigned __int16 v14; // bx
unsigned __int16 v15; // bx
unsigned __int16 v16; // bx
unsigned int v17; // edx
_BYTE *v18; // r11
bool v19; // zf
const char *v20; // rbx
unsigned int v21; // eax
struct _IO_FILE *v22; // rdi
_BYTE *v23; // [rsp+8h] [rbp-20h] BYREF
int v24[3]; // [rsp+1Ch] [rbp-Ch] BYREF

v23 = a1;
v24[0] = 4;
if ( a3 <= 0 )
{
v17 = 0;
}
else
{
v3 = -1;
v4 = a2 + 16LL * (unsigned int)(a3 - 1) + 16;
do
{
v5 = *(unsigned int *)(a2 + 8);
v6 = *(char **)a2;
if ( (_DWORD)v5 )
{
v7 = &v6[v5];
v8 = *(_DWORD *)(a2 + 8) & 3;
if ( !v8 )
goto LABEL_29;
if ( v8 != 1LL )
{
if ( v8 != 2LL )
{
v9 = *v6++;
v3 = ccitt_tab[(unsigned __int8)(v3 ^ v9)] ^ HIBYTE(v3);
}
v10 = *v6++;
v3 = ccitt_tab[(unsigned __int8)(v3 ^ v10)] ^ HIBYTE(v3);
}
v11 = *v6++;
v3 = ccitt_tab[(unsigned __int8)(v3 ^ v11)] ^ HIBYTE(v3);
if ( v6 != v7 )
{
LABEL_29:
do
{
v12 = *v6;
v13 = v6[1];
v6 += 4;
v14 = ccitt_tab[(unsigned __int8)(v3 ^ v12)] ^ HIBYTE(v3);
v15 = ccitt_tab[(unsigned __int8)(v14 ^ v13)] ^ HIBYTE(v14);
v16 = ccitt_tab[(unsigned __int8)(v15 ^ *(v6 - 2))] ^ HIBYTE(v15);
v3 = ccitt_tab[(unsigned __int8)(v16 ^ *(v6 - 1))] ^ HIBYTE(v16);
}
while ( v6 != v7 );
}
}
a2 += 16LL;
}
while ( v4 != a2 );
v17 = (unsigned __int16)~v3;
}
if ( (unsigned int)int2reverse_hex_constprop_0(&v23, v24, v17) == -1
&& (int)get_debug_level("core", 4LL) >= -2
&& !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(4294967294LL);
v20 = (const char *)*((_QWORD *)&log_level_info + 6);
v21 = my_pid();
v22 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR: crcitt_string_array: string conversion incomplete\n",
process_no,
v21,
v20,
"<core> [crc.c:246]: ",
"crcitt_string_array");
if ( log_color )
((void (__fastcall *)(struct _IO_FILE *))dprint_color_reset)(v22);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 14) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR: crcitt_string_array: string conversion incomplete\n",
*((const char **)&log_level_info + 6),
"<core> [crc.c:246]: ",
"crcitt_string_array");
}
--dprint_crit;
}
v18 = v23;
if ( v24[0] )
{
do
{
*v18 = 48;
v18 = v23 + 1;
v19 = v24[0]-- == 1;
++v23;
}
while ( !v19 );
}
}

canonical_decompiled_code:
void __fastcall func3(_BYTE *a1, __int64 a2, int a3)
{
unsigned __int16 v3; // bx
__int64 v4; // rdi
__int64 v5; // rcx
char *v6; // rdx
char *v7; // r8
int v8; // ecx
char v9; // r9
char v10; // r11
char v11; // cl
char v12; // r10
char v13; // al
unsigned __int16 v14; // bx
unsigned __int16 v15; // bx
unsigned __int16 v16; // bx
unsigned int v17; // edx
_BYTE *v18; // r11
bool v19; // zf
const char *v20; // rbx
unsigned int v21; // eax
struct _IO_FILE *v22; // rdi
_BYTE *v23; // [rsp+8h] [rbp-20h] BYREF
int v24[3]; // [rsp+1Ch] [rbp-Ch] BYREF

v23 = a1;
v24[0] = 4;
if ( a3 <= 0 )
{
v17 = 0;
}
else
{
v3 = -1;
v4 = a2 + 16LL * (unsigned int)(a3 - 1) + 16;
do
{
v5 = *(unsigned int *)(a2 + 8);
v6 = *(char **)a2;
if ( (_DWORD)v5 )
{
v7 = &v6[v5];
v8 = *(_DWORD *)(a2 + 8) & 3;
if ( !v8 )
goto LABEL_29;
if ( v8 != 1LL )
{
if ( v8 != 2LL )
{
v9 = *v6++;
v3 = ccitt_tab[(unsigned __int8)(v3 ^ v9)] ^ HIBYTE(v3);
}
v10 = *v6++;
v3 = ccitt_tab[(unsigned __int8)(v3 ^ v10)] ^ HIBYTE(v3);
}
v11 = *v6++;
v3 = ccitt_tab[(unsigned __int8)(v3 ^ v11)] ^ HIBYTE(v3);
if ( v6 != v7 )
{
LABEL_29:
do
{
v12 = *v6;
v13 = v6[1];
v6 += 4;
v14 = ccitt_tab[(unsigned __int8)(v3 ^ v12)] ^ HIBYTE(v3);
v15 = ccitt_tab[(unsigned __int8)(v14 ^ v13)] ^ HIBYTE(v14);
v16 = ccitt_tab[(unsigned __int8)(v15 ^ *(v6 - 2))] ^ HIBYTE(v15);
v3 = ccitt_tab[(unsigned __int8)(v16 ^ *(v6 - 1))] ^ HIBYTE(v16);
}
while ( v6 != v7 );
}
}
a2 += 16LL;
}
while ( v4 != a2 );
v17 = (unsigned __int16)~v3;
}
if ( (unsigned int)func0(&v23, v24, v17) == -1
&& (int)get_debug_level("core", 4LL) >= -2
&& !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(4294967294LL);
v20 = (const char *)*((_QWORD *)&log_level_info + 6);
v21 = my_pid();
v22 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR: crcitt_string_array: string conversion incomplete\n",
process_no,
v21,
v20,
"<core> [crc.c:246]: ",
"crcitt_string_array");
if ( log_color )
((void (__fastcall *)(struct _IO_FILE *))dprint_color_reset)(v22);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 14) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR: crcitt_string_array: string conversion incomplete\n",
*((const char **)&log_level_info + 6),
"<core> [crc.c:246]: ",
"crcitt_string_array");
}
--dprint_crit;
}
v18 = v23;
if ( v24[0] )
{
do
{
*v18 = 48;
v18 = v23 + 1;
v19 = v24[0]-- == 1;
++v23;
}
while ( !v19 );
}
}

original_code:
void crcitt_string_array( char *dst, str src[], int size )
{
 register int i;
 register unsigned short ccitt;
 register char *c;
 register int len;
 int str_len;
 ccitt = 0xFFFF;
 str_len=4;
 for (i=0; i<size; i++ ) {
  c=src[i].s;
  len=src[i].len;
  while(len) {
   ccitt = (ccitt_tab[((ccitt) ^ (*c)) & 0xff] ^ ((ccitt) >> 8));
   c++;len--;
  }
 }
 ccitt = ~ccitt;
 if (int2reverse_hex( &dst, &str_len, ccitt )==-1) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-2)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-2)) >= -5) && (((-2)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-2)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR: crcitt_string_array: string conversion incomplete\n", process_no, my_pid(), (log_level_info[((-2)) - (-5)].name), ("<core> [" "crc.c" ":" "246" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-2)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR: crcitt_string_array: string conversion incomplete\n", (log_level_info[((-2)) - (-5)].name), ("<core> [" "crc.c" ":" "246" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-2)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR: crcitt_string_array: string conversion incomplete\n", process_no, my_pid(), ("<core> [" "crc.c" ":" "246" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-2))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: crcitt_string_array: string conversion incomplete\n", ("<core> [" "crc.c" ":" "246" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: crcitt_string_array: string conversion incomplete\n", ("<core> [" "crc.c" ":" "246" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 }
 while( str_len ) {
  *dst='0';
  dst++;
  str_len--;
 }
}

canonical_original_code:
void crcitt_string_array(char *dst, struct _str src[], int size)
{
 register int i;
 register unsigned short ccitt;
 register char *c;
 register int len;
 int str_len;
 ccitt = 0xFFFF;
 str_len=4;
 for (i=0; i<size; i++ ) {
  c=src[i].s;
  len=src[i].len;
  while(len) {
   ccitt = (ccitt_tab[((ccitt) ^ (*c)) & 0xff] ^ ((ccitt) >> 8));
   c++;len--;
  }
 }
 ccitt = ~ccitt;
 if (int2reverse_hex( &dst, &str_len, ccitt )==-1) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-2)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-2)) >= -5) && (((-2)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-2)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR: crcitt_string_array: string conversion incomplete\n", process_no, my_pid(), (log_level_info[((-2)) - (-5)].name), ("<core> [" "crc.c" ":" "246" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-2)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR: crcitt_string_array: string conversion incomplete\n", (log_level_info[((-2)) - (-5)].name), ("<core> [" "crc.c" ":" "246" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-2)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR: crcitt_string_array: string conversion incomplete\n", process_no, my_pid(), ("<core> [" "crc.c" ":" "246" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-2))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: crcitt_string_array: string conversion incomplete\n", ("<core> [" "crc.c" ":" "246" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: crcitt_string_array: string conversion incomplete\n", ("<core> [" "crc.c" ":" "246" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 }
 while( str_len ) {
  *dst='0';
  dst++;
  str_len--;
 }
}

variable_types:
dst
char *

variable_types:
src
struct _str { char *s; int len; } []

variable_types: size int

variable_types: i int

variable_types:
c
char *