decompiled_code:
__int64 mod_init()
{
const char *v1; // rbx
unsigned int v2; // eax

if ( (int)get_debug_level("db_cluster", 10LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v1 = (const char *)*((_QWORD *)&log_level_info + 16);
v2 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Setting up DB cluster\n",
process_no,
v2,
v1,
"db_cluster [db_cluster_mod.c:77]: ",
"mod_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Setting up DB cluster\n",
*((const char **)&log_level_info + 16),
"db_cluster [db_cluster_mod.c:77]: ",
"mod_init");
}
--dprint_crit;
}
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
const char *v1; // rbx
unsigned int v2; // eax

if ( (int)get_debug_level("db_cluster", 10LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v1 = (const char *)*((_QWORD *)&log_level_info + 16);
v2 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Setting up DB cluster\n",
process_no,
v2,
v1,
"db_cluster [db_cluster_mod.c:77]: ",
"mod_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Setting up DB cluster\n",
*((const char **)&log_level_info + 16),
"db_cluster [db_cluster_mod.c:77]: ",
"mod_init");
}
--dprint_crit;
}
return 0LL;
}

original_code:
int mod_init(void)
{
 do { if (get_debug_level("db_cluster", (sizeof("db_cluster")-1)) >= ((3)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((3)) >= -5) && (((3)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "Setting up DB cluster\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("db_cluster" " [" "db_cluster_mod.c" ":" "77" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((3)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "Setting up DB cluster\n", (log_level_info[((3)) - (-5)].name), ("db_cluster" " [" "db_cluster_mod.c" ":" "77" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Setting up DB cluster\n", process_no, my_pid(), ("db_cluster" " [" "db_cluster_mod.c" ":" "77" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((3))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Setting up DB cluster\n", ("db_cluster" " [" "db_cluster_mod.c" ":" "77" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Setting up DB cluster\n", ("db_cluster" " [" "db_cluster_mod.c" ":" "77" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 return 0;
}

canonical_original_code:
int mod_init()
{
 do { if (get_debug_level("db_cluster", (sizeof("db_cluster")-1)) >= ((3)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((3)) >= -5) && (((3)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "Setting up DB cluster\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("db_cluster" " [" "db_cluster_mod.c" ":" "77" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((3)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "Setting up DB cluster\n", (log_level_info[((3)) - (-5)].name), ("db_cluster" " [" "db_cluster_mod.c" ":" "77" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Setting up DB cluster\n", process_no, my_pid(), ("db_cluster" " [" "db_cluster_mod.c" ":" "77" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((3))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Setting up DB cluster\n", ("db_cluster" " [" "db_cluster_mod.c" ":" "77" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Setting up DB cluster\n", ("db_cluster" " [" "db_cluster_mod.c" ":" "77" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 return 0;
}

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


repo: virtualolson/who

decompiled_code:
__int64 __fastcall atomic_get_and_set_int(volatile __int32 *a1, __int32 a2)
{
return (unsigned int)_InterlockedExchange(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func0(volatile __int32 *a1, __int32 a2)
{
return (unsigned int)_InterlockedExchange(a1, a2);
}

original_code: inline static int atomic_get_and_set_int(volatile int* var, int v) { asm volatile( "xchgl %1, %0" " \n\t" : "+q"(v), "=m"(*var) : "m"(*var) : "memory" ); return v; }

canonical_original_code: inline static int atomic_get_and_set_int(int *var, int v) { asm volatile( "xchgl %1, %0" " \n\t" : "+q"(v), "=m"(*var) : "m"(*var) : "memory" ); return v; }

variable_types:
var
int *

variable_types: v int

return_type: int


decompiled_code:
__int64 __fastcall futex_get(volatile signed __int32 *a1)
{
__int64 result; // rax
int v2; // ebp
int v3; // ebp

result = atomic_cmpxchg_int(a1, 0, 1);
if ( (_DWORD)result )
{
v2 = 1024;
if ( (_DWORD)result == 2 )
{
do
{
LABEL_3:
syscall(202LL, a1, 0LL, 2LL, 0LL, 0LL, 0LL);
result = atomic_get_and_set_int(a1, 2);
}
while ( (_DWORD)result );
}
else
{
while ( 1 )
{
result = atomic_cmpxchg_int(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
v3 = v2 - 1;
result = atomic_cmpxchg_int(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = atomic_cmpxchg_int(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = atomic_cmpxchg_int(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = atomic_cmpxchg_int(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = atomic_cmpxchg_int(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = atomic_cmpxchg_int(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = atomic_cmpxchg_int(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
v2 = v3 - 7;
if ( !v2 )
{
for ( result = atomic_get_and_set_int(a1, 2); (_DWORD)result; result = atomic_get_and_set_int(a1, 2) )
syscall(202LL, a1, 0LL, 2LL, 0LL, 0LL, 0LL);
return result;
}
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(volatile signed __int32 *a1)
{
__int64 result; // rax
int v2; // ebp
int v3; // ebp

result = func1(a1, 0, 1);
if ( (_DWORD)result )
{
v2 = 1024;
if ( (_DWORD)result == 2 )
{
do
{
LABEL_3:
syscall(202LL, a1, 0LL, 2LL, 0LL, 0LL, 0LL);
result = func0(a1, 2);
}
while ( (_DWORD)result );
}
else
{
while ( 1 )
{
result = func1(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
v3 = v2 - 1;
result = func1(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = func1(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = func1(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = func1(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = func1(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = func1(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
result = func1(a1, 0, 1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_3;
v2 = v3 - 7;
if ( !v2 )
{
for ( result = func0(a1, 2); (_DWORD)result; result = func0(a1, 2) )
syscall(202LL, a1, 0LL, 2LL, 0LL, 0LL, 0LL);
return result;
}
}
}
}
return result;
}

original_code:
inline static void futex_get(futex_lock_t* lock)
{
 int v;
 register int i=1024;
retry:
 v=atomic_cmpxchg_int(&(lock)->val, 0, 1);
 if (__builtin_expect(!!(v==0), 1)){
  do {} while(0);
  return;
 }else if (__builtin_expect(!!(v==2), 0)){
  do{
   syscall(202 , (&(lock)->val), (0), (2), (0), (0), (0));
   v=atomic_get_and_set_int(&(lock)->val, 2);
  }while(v);
 }else{
  if (i>0){
   i--;
   goto retry;
  }
  v=atomic_get_and_set_int(&(lock)->val, 2);
  while(v){
   syscall(202 , (&(lock)->val), (0), (2), (0), (0), (0));
   v=atomic_get_and_set_int(&(lock)->val, 2);
  }
 }
 do {} while(0);
}

canonical_original_code:
inline static void futex_get(struct atomic_t *lock)
{
 int v;
 register int i = 1024;
retry:
 v=atomic_cmpxchg_int(&(lock)->val, 0, 1);
 if (__builtin_expect(!!(v==0), 1)){
  do {} while(0);
  return;
 }else if (__builtin_expect(!!(v==2), 0)){
  do{
   syscall(202 , (&(lock)->val), (0), (2), (0), (0), (0));
   v=atomic_get_and_set_int(&(lock)->val, 2);
  }while(v);
 }else{
  if (i>0){
   i--;
   goto retry;
  }
  v=atomic_get_and_set_int(&(lock)->val, 2);
  while(v){
   syscall(202 , (&(lock)->val), (0), (2), (0), (0), (0));
   v=atomic_get_and_set_int(&(lock)->val, 2);
  }
 }
 do {} while(0);
}

variable_types:
lock
struct atomic_t { int val; } *

variable_types: i int

return_type: void


decompiled_code:
__int64 __fastcall futex_release(volatile __int32 *a1)
{
__int64 result; // rax

result = atomic_get_and_set_int(a1, 0);
if ( (_DWORD)result == 2 )
result = syscall(202LL, a1, 1LL, 1LL, 0LL, 0LL, 0LL);
return result;
}

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

result = func0(a1, 0);
if ( (_DWORD)result == 2 )
result = syscall(202LL, a1, 1LL, 1LL, 0LL, 0LL, 0LL);
return result;
}

original_code:
inline static void futex_release(futex_lock_t* lock)
{
 int v;
 do {} while(0);
 v=atomic_get_and_set_int(&(lock)->val, 0);
 if (__builtin_expect(!!(v==2), 0)){
  syscall(202 , (&(lock)->val), (1), (1), (0), (0), (0));
 }
}

canonical_original_code:
inline static void futex_release(struct atomic_t *lock)
{
 int v;
 do {} while(0);
 v=atomic_get_and_set_int(&(lock)->val, 0);
 if (__builtin_expect(!!(v==2), 0)){
  syscall(202 , (&(lock)->val), (1), (1), (0), (0), (0));
 }
}


original_code:
static void tem_do_step(time_event_manager_t *tem)
{
 time_event_data_t *e, *n, *unprocessed_first, *unprocessed_last;
 time_event_slot_t *slot;

 if (tem->mutex) futex_get(tem->mutex);
 unprocessed_first = ((void *)0);
 unprocessed_last = ((void *)0);
 slot = &tem->time_slots[tem->tick_counter % tem->slot_cnt];
 e = slot->first;
 while (e) {
  n = e->next;
  if (e->tick_time == tem->tick_counter) {
   if (e->cb) e->cb(e);
  }
  else {
   e->prev = unprocessed_last;
   e->next = ((void *)0);
   if (unprocessed_last) unprocessed_last->next = e;
   else unprocessed_first = e;
   unprocessed_last = e;
  }
  e = n;
 }
 slot->first = unprocessed_first;
 slot->last = unprocessed_last;
 tem->tick_counter++;
 if (tem->mutex) futex_release(tem->mutex);

}

canonical_original_code:
static void tem_do_step(struct _time_event_manager_t *tem)
{
 struct _time_event_data_t *e; struct _time_event_data_t *n; struct _time_event_data_t *unprocessed_first; struct _time_event_data_t *unprocessed_last;
 struct _time_event_slot_t *slot;

 if (tem->mutex) futex_get(tem->mutex);
 unprocessed_first = ((void *)0);
 unprocessed_last = ((void *)0);
 slot = &tem->time_slots[tem->tick_counter % tem->slot_cnt];
 e = slot->first;
 while (e) {
  n = e->next;
  if (e->tick_time == tem->tick_counter) {
   if (e->cb) e->cb(e);
  }
  else {
   e->prev = unprocessed_last;
   e->next = ((void *)0);
   if (unprocessed_last) unprocessed_last->next = e;
   else unprocessed_first = e;
   unprocessed_last = e;
  }
  e = n;
 }
 slot->first = unprocessed_first;
 slot->last = unprocessed_last;
 tem->tick_counter++;
 if (tem->mutex) futex_release(tem->mutex);

}

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; } *

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 _time_event_slot_t { struct _time_event_data_t *first; }


decompiled_code:
__int64 tem_timer_cb()
{
__int64 result; // rax
__int64 v1; // rbx
__int64 v2; // rbp
int v3; // edx

result = tem_info;
if ( tem_info )
{
v1 = *(_QWORD *)tem_info;
while ( v1 )
{
v2 = v1;
v1 = *(_QWORD *)(v1 + 40);
v3 = *(_DWORD *)(v2 + 32) - 1;
*(_DWORD *)(v2 + 32) = v3;
if ( !v3 )
{
result = tem_do_step(v2);
*(_DWORD *)(v2 + 32) = *(_DWORD *)(v2 + 12);
}
}
}
return result;
}

original_code:
static void tem_timer_cb(unsigned int ticks, void *param)
{
 time_event_manager_t *e, *n;

 if (!tem_info) return;
 e = tem_info->first;
 while (e) {
  n = e->next;
  if (--e->process_timer_counter == 0) {
   tem_do_step(e);
   e->process_timer_counter = e->atomic_time;
  }
  e = n;
 }

}

canonical_original_code:
static void tem_timer_cb(unsigned int ticks, void *param)
{
 struct _time_event_manager_t *e; struct _time_event_manager_t *n;

 if (!tem_info) return;
 e = tem_info->first;
 while (e) {
  n = e->next;
  if (--e->process_timer_counter == 0) {
   tem_do_step(e);
   e->process_timer_counter = e->atomic_time;
  }
  e = n;
 }

}

variable_types:
ticks
unsigned int

variable_types:
param
void *

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 shm_malloc(unsigned int a1)
{
__int64 v1; // rbx

futex_get(mem_lock);
v1 = qm_malloc(shm_block, a1);
futex_release(mem_lock);
return v1;
}

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

func2(mem_lock);
v1 = qm_malloc(shm_block, a1);
func3(mem_lock);
return v1;
}

original_code:
inline static void* shm_malloc(unsigned int size)
{
 void *p;
 futex_get(mem_lock);
 p=qm_malloc(shm_block, (size));
 futex_release(mem_lock);
  return p;
}

canonical_original_code:
inline static void *shm_malloc(unsigned int size)
{
 void *p;
 futex_get(mem_lock);
 p=qm_malloc(shm_block, (size));
 futex_release(mem_lock);
  return p;
}

variable_types:
size
unsigned int

variable_types:
p
void *

return_type: void *


decompiled_code:
__int64 time_event_management_init()
{
__int64 result; // rax
__int64 v1; // rax
int v2; // er10
const char *v3; // rbx
unsigned int v4; // eax
int v5; // edx
const char *v6; // rbx
unsigned int v7; // eax

result = 0LL;
if ( !tem_info )
{
v1 = shm_malloc(0x18u);
tem_info = v1;
if ( v1 )
{
*(_QWORD *)v1 = 0LL;
*(_QWORD *)(v1 + 8) = 0LL;
futex_init((_DWORD *)(v1 + 16));
if ( (int)register_timer(tem_timer_cb, 0LL, 1LL) < 0 )
{
v5 = get_debug_level(&LC0, 3LL);
result = 0xFFFFFFFFLL;
if ( v5 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v6 = (const char *)*((_QWORD *)&log_level_info + 8);
v7 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): time_event_management_init(): can't register timer\n",
process_no,
v7,
v6,
"rls [time_event_manager.c:53]: ",
"time_event_management_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): time_event_management_init(): can't register timer\n",
*((const char **)&log_level_info + 8),
"rls [time_event_manager.c:53]: ",
"time_event_management_init");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
else
{
result = 0LL;
}
}
else
{
v2 = get_debug_level(&LC0, 3LL);
result = 0xFFFFFFFFLL;
if ( v2 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v3 = (const char *)*((_QWORD *)&log_level_info + 8);
v4 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): time_event_management_init(): can't allocate shared memory\n",
process_no,
v4,
v3,
"rls [time_event_manager.c:44]: ",
"time_event_management_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): time_event_management_init(): can't allocate shared memory\n",
*((const char **)&log_level_info + 8),
"rls [time_event_manager.c:44]: ",
"time_event_management_init");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
}
return result;
}

canonical_decompiled_code:
__int64 func7()
{
__int64 result; // rax
__int64 v1; // rax
int v2; // er10
const char *v3; // rbx
unsigned int v4; // eax
int v5; // edx
const char *v6; // rbx
unsigned int v7; // eax

result = 0LL;
if ( !tem_info )
{
v1 = func6(0x18u);
tem_info = v1;
if ( v1 )
{
*(_QWORD *)v1 = 0LL;
*(_QWORD *)(v1 + 8) = 0LL;
futex_init((_DWORD *)(v1 + 16));
if ( (int)register_timer(tem_timer_cb, 0LL, 1LL) < 0 )
{
v5 = get_debug_level(&LC0, 3LL);
result = 0xFFFFFFFFLL;
if ( v5 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v6 = (const char *)*((_QWORD *)&log_level_info + 8);
v7 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): time_event_management_init(): can't register timer\n",
process_no,
v7,
v6,
"rls [time_event_manager.c:53]: ",
"time_event_management_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): time_event_management_init(): can't register timer\n",
*((const char **)&log_level_info + 8),
"rls [time_event_manager.c:53]: ",
"time_event_management_init");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
else
{
result = 0LL;
}
}
else
{
v2 = get_debug_level(&LC0, 3LL);
result = 0xFFFFFFFFLL;
if ( v2 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v3 = (const char *)*((_QWORD *)&log_level_info + 8);
v4 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): time_event_management_init(): can't allocate shared memory\n",
process_no,
v4,
v3,
"rls [time_event_manager.c:44]: ",
"time_event_management_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): time_event_management_init(): can't allocate shared memory\n",
*((const char **)&log_level_info + 8),
"rls [time_event_manager.c:44]: ",
"time_event_management_init");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
}
return result;
}

original_code:
int time_event_management_init()
{
 if (tem_info) return 0;
 tem_info = (tem_info_t *)shm_malloc(sizeof(tem_info_t));
 if (!tem_info) {
  do { if (get_debug_level("rls", (sizeof("rls")-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(): " "time_event_management_init(): can't allocate shared memory\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "44" "]: ") , __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(): " "time_event_management_init(): can't allocate shared memory\n", (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "44" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "time_event_management_init(): can't allocate shared memory\n", process_no, my_pid(), ("rls" " [" "time_event_manager.c" ":" "44" "]: ") , __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(): " "time_event_management_init(): can't allocate shared memory\n", ("rls" " [" "time_event_manager.c" ":" "44" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "time_event_management_init(): can't allocate shared memory\n", ("rls" " [" "time_event_manager.c" ":" "44" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 tem_info->first = ((void *)0);
 tem_info->last = ((void *)0);
 futex_init(&tem_info->structure_mutex);
 if (register_timer(tem_timer_cb, ((void *)0), 1) < 0) {
  do { if (get_debug_level("rls", (sizeof("rls")-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(): " "time_event_management_init(): can't register timer\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "53" "]: ") , __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(): " "time_event_management_init(): can't register timer\n", (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "53" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "time_event_management_init(): can't register timer\n", process_no, my_pid(), ("rls" " [" "time_event_manager.c" ":" "53" "]: ") , __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(): " "time_event_management_init(): can't register timer\n", ("rls" " [" "time_event_manager.c" ":" "53" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "time_event_management_init(): can't register timer\n", ("rls" " [" "time_event_manager.c" ":" "53" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 return 0;
}

canonical_original_code:
int time_event_management_init()
{
 if (tem_info) return 0;
 tem_info = (struct tem_info_t *)shm_malloc(sizeof(tem_info_t));
 if (!tem_info) {
  do { if (get_debug_level("rls", (sizeof("rls")-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(): " "time_event_management_init(): can't allocate shared memory\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "44" "]: ") , __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(): " "time_event_management_init(): can't allocate shared memory\n", (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "44" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "time_event_management_init(): can't allocate shared memory\n", process_no, my_pid(), ("rls" " [" "time_event_manager.c" ":" "44" "]: ") , __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(): " "time_event_management_init(): can't allocate shared memory\n", ("rls" " [" "time_event_manager.c" ":" "44" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "time_event_management_init(): can't allocate shared memory\n", ("rls" " [" "time_event_manager.c" ":" "44" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 tem_info->first = ((void *)0);
 tem_info->last = ((void *)0);
 futex_init(&tem_info->structure_mutex);
 if (register_timer(tem_timer_cb, ((void *)0), 1) < 0) {
  do { if (get_debug_level("rls", (sizeof("rls")-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(): " "time_event_management_init(): can't register timer\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "53" "]: ") , __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(): " "time_event_management_init(): can't register timer\n", (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "53" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "time_event_management_init(): can't register timer\n", process_no, my_pid(), ("rls" " [" "time_event_manager.c" ":" "53" "]: ") , __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(): " "time_event_management_init(): can't register timer\n", ("rls" " [" "time_event_manager.c" ":" "53" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "time_event_management_init(): can't register timer\n", ("rls" " [" "time_event_manager.c" ":" "53" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 return 0;
}

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


decompiled_code:
__int64 __fastcall tem_init(__int64 a1, int a2, unsigned int a3, int a4, __int64 a5)
{
void *v7; // rdi
_QWORD *v8; // rbp
volatile __int32 *v9; // r12
__int64 v10; // rdx
__int64 result; // rax
int v12; // ecx
const char *v13; // rbx
unsigned int v14; // eax

if ( !a1 )
return 0xFFFFFFFFLL;
*(_DWORD *)(a1 + 20) = 0;
*(_DWORD *)(a1 + 12) = a2;
*(_DWORD *)(a1 + 8) = a3;
*(_DWORD *)(a1 + 16) = a4;
*(_QWORD *)(a1 + 24) = a5;
v7 = (void *)shm_malloc(16 * a3);
*(_QWORD *)a1 = v7;
if ( v7 )
{
memset(v7, 0, 16LL * a3);
*(_QWORD *)(a1 + 40) = 0LL;
*(_DWORD *)(a1 + 32) = a2;
v8 = (_QWORD *)tem_info;
v9 = (volatile __int32 *)(tem_info + 16);
futex_get((volatile signed __int32 *)(tem_info + 16));
*(_QWORD *)(a1 + 48) = v8[1];
v10 = v8[1];
if ( v10 )
*(_QWORD *)(v10 + 40) = a1;
else
*v8 = a1;
v8[1] = a1;
futex_release(v9);
result = 0LL;
}
else
{
v12 = get_debug_level(&LC0, 3LL);
result = 0xFFFFFFFFLL;
if ( v12 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v13 = (const char *)*((_QWORD *)&log_level_info + 8);
v14 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): can't initialize time event manager slots\n",
process_no,
v14,
v13,
"rls [time_event_manager.c:91]: ",
"tem_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): can't initialize time event manager slots\n",
*((const char **)&log_level_info + 8),
"rls [time_event_manager.c:91]: ",
"tem_init");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, int a2, unsigned int a3, int a4, __int64 a5)
{
void *v7; // rdi
_QWORD *v8; // rbp
volatile __int32 *v9; // r12
__int64 v10; // rdx
__int64 result; // rax
int v12; // ecx
const char *v13; // rbx
unsigned int v14; // eax

if ( !a1 )
return 0xFFFFFFFFLL;
*(_DWORD *)(a1 + 20) = 0;
*(_DWORD *)(a1 + 12) = a2;
*(_DWORD *)(a1 + 8) = a3;
*(_DWORD *)(a1 + 16) = a4;
*(_QWORD *)(a1 + 24) = a5;
v7 = (void *)func6(16 * a3);
*(_QWORD *)a1 = v7;
if ( v7 )
{
memset(v7, 0, 16LL * a3);
*(_QWORD *)(a1 + 40) = 0LL;
*(_DWORD *)(a1 + 32) = a2;
v8 = (_QWORD *)tem_info;
v9 = (volatile __int32 *)(tem_info + 16);
func2((volatile signed __int32 *)(tem_info + 16));
*(_QWORD *)(a1 + 48) = v8[1];
v10 = v8[1];
if ( v10 )
*(_QWORD *)(v10 + 40) = a1;
else
*v8 = a1;
v8[1] = a1;
func3(v9);
result = 0LL;
}
else
{
v12 = get_debug_level(&LC0, 3LL);
result = 0xFFFFFFFFLL;
if ( v12 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v13 = (const char *)*((_QWORD *)&log_level_info + 8);
v14 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): can't initialize time event manager slots\n",
process_no,
v14,
v13,
"rls [time_event_manager.c:91]: ",
"tem_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): can't initialize time event manager slots\n",
*((const char **)&log_level_info + 8),
"rls [time_event_manager.c:91]: ",
"tem_init");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
return result;
}

original_code:
int tem_init(time_event_manager_t *tm, unsigned int atomic_time,
  unsigned int slot_cnt, int enable_delay, gen_lock_t *mutex)
{
 if (!tm) return -1;
 tm->tick_counter = 0;
 tm->atomic_time = atomic_time;
 tm->slot_cnt = slot_cnt;
 tm->enable_delay = enable_delay;
 tm->mutex = mutex;
 tm->time_slots = (time_event_slot_t *)shm_malloc(slot_cnt * sizeof(time_event_slot_t));
 if (!tm->time_slots) {
  do { if (get_debug_level("rls", (sizeof("rls")-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(): " "can't initialize time event manager slots\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "91" "]: ") , __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(): " "can't initialize time event manager slots\n", (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "91" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "can't initialize time event manager slots\n", process_no, my_pid(), ("rls" " [" "time_event_manager.c" ":" "91" "]: ") , __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(): " "can't initialize time event manager slots\n", ("rls" " [" "time_event_manager.c" ":" "91" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "can't initialize time event manager slots\n", ("rls" " [" "time_event_manager.c" ":" "91" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 memset(tm->time_slots, 0, slot_cnt * sizeof(time_event_slot_t));
 tm->next = ((void *)0);
 tm->process_timer_counter = atomic_time;
 futex_get(&tem_info->structure_mutex);
 tm->prev = tem_info->last;
 if (tem_info->last) tem_info->last->next = tm;
 else tem_info->first = tm;
 tem_info->last = tm;
 futex_release(&tem_info->structure_mutex);
 return 0;
}

canonical_original_code:
int tem_init(struct _time_event_manager_t *tm, unsigned int atomic_time, unsigned int slot_cnt, int enable_delay, struct atomic_t *mutex)
{
 if (!tm) return -1;
 tm->tick_counter = 0;
 tm->atomic_time = atomic_time;
 tm->slot_cnt = slot_cnt;
 tm->enable_delay = enable_delay;
 tm->mutex = mutex;
 tm->time_slots = (struct _time_event_slot_t *)shm_malloc(slot_cnt * sizeof(time_event_slot_t));
 if (!tm->time_slots) {
  do { if (get_debug_level("rls", (sizeof("rls")-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(): " "can't initialize time event manager slots\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "91" "]: ") , __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(): " "can't initialize time event manager slots\n", (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "91" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "can't initialize time event manager slots\n", process_no, my_pid(), ("rls" " [" "time_event_manager.c" ":" "91" "]: ") , __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(): " "can't initialize time event manager slots\n", ("rls" " [" "time_event_manager.c" ":" "91" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "can't initialize time event manager slots\n", ("rls" " [" "time_event_manager.c" ":" "91" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 memset(tm->time_slots, 0, slot_cnt * sizeof(time_event_slot_t));
 tm->next = ((void *)0);
 tm->process_timer_counter = atomic_time;
 futex_get(&tem_info->structure_mutex);
 tm->prev = tem_info->last;
 if (tem_info->last) tem_info->last->next = tm;
 else tem_info->first = tm;
 tem_info->last = tm;
 futex_release(&tem_info->structure_mutex);
 return 0;
}

variable_types:
mutex
struct atomic_t *


decompiled_code:
__int64 __fastcall tem_create(int a1, unsigned int a2, int a3, __int64 a4)
{
__int64 v6; // rax
__int64 v7; // rbx
const char *v9; // r14
unsigned int v10; // eax

v6 = shm_malloc(0x38u);
v7 = v6;
if ( v6 )
{
if ( (unsigned int)tem_init(v6, a1, a2, a3, a4) )
{
futex_get(mem_lock);
qm_free(shm_block, v7);
futex_release(mem_lock);
v7 = 0LL;
}
}
else if ( (int)get_debug_level(&LC0, 3LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v9 = (const char *)*((_QWORD *)&log_level_info + 8);
v10 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): can't allocate time event manager\n",
process_no,
v10,
v9,
"rls [time_event_manager.c:117]: ",
"tem_create");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): can't allocate time event manager\n",
*((const char **)&log_level_info + 8),
"rls [time_event_manager.c:117]: ",
"tem_create");
}
--dprint_crit;
}
return v7;
}

canonical_decompiled_code:
__int64 __fastcall func9(int a1, unsigned int a2, int a3, __int64 a4)
{
__int64 v6; // rax
__int64 v7; // rbx
const char *v9; // r14
unsigned int v10; // eax

v6 = func6(0x38u);
v7 = v6;
if ( v6 )
{
if ( (unsigned int)func8(v6, a1, a2, a3, a4) )
{
func2(mem_lock);
qm_free(shm_block, v7);
func3(mem_lock);
v7 = 0LL;
}
}
else if ( (int)get_debug_level(&LC0, 3LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v9 = (const char *)*((_QWORD *)&log_level_info + 8);
v10 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): can't allocate time event manager\n",
process_no,
v10,
v9,
"rls [time_event_manager.c:117]: ",
"tem_create");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): can't allocate time event manager\n",
*((const char **)&log_level_info + 8),
"rls [time_event_manager.c:117]: ",
"tem_create");
}
--dprint_crit;
}
return v7;
}

original_code:
time_event_manager_t *tem_create(unsigned int atomic_time, unsigned int slot_cnt, int enable_delay, gen_lock_t *mutex)
{
 time_event_manager_t *tm;
 tm = (time_event_manager_t*)shm_malloc(sizeof(time_event_manager_t));
 if (!tm) {
  do { if (get_debug_level("rls", (sizeof("rls")-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(): " "can't allocate time event manager\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "117" "]: ") , __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(): " "can't allocate time event manager\n", (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "117" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "can't allocate time event manager\n", process_no, my_pid(), ("rls" " [" "time_event_manager.c" ":" "117" "]: ") , __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(): " "can't allocate time event manager\n", ("rls" " [" "time_event_manager.c" ":" "117" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "can't allocate time event manager\n", ("rls" " [" "time_event_manager.c" ":" "117" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return tm;
 }
 if (tem_init(tm, atomic_time, slot_cnt, enable_delay, mutex) != 0) {
  do { futex_get(mem_lock); qm_free(shm_block, (tm)); futex_release(mem_lock); }while(0);
  return ((void *)0);
 }
 return tm;
}

canonical_original_code:
struct _time_event_manager_t *tem_create(unsigned int atomic_time, unsigned int slot_cnt, int enable_delay, struct atomic_t *mutex)
{
 struct _time_event_manager_t *tm;
 tm = (struct _time_event_manager_t *)shm_malloc(sizeof(time_event_manager_t));
 if (!tm) {
  do { if (get_debug_level("rls", (sizeof("rls")-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(): " "can't allocate time event manager\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "117" "]: ") , __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(): " "can't allocate time event manager\n", (log_level_info[((-1)) - (-5)].name), ("rls" " [" "time_event_manager.c" ":" "117" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "can't allocate time event manager\n", process_no, my_pid(), ("rls" " [" "time_event_manager.c" ":" "117" "]: ") , __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(): " "can't allocate time event manager\n", ("rls" " [" "time_event_manager.c" ":" "117" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "can't allocate time event manager\n", ("rls" " [" "time_event_manager.c" ":" "117" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return tm;
 }
 if (tem_init(tm, atomic_time, slot_cnt, enable_delay, mutex) != 0) {
  do { futex_get(mem_lock); qm_free(shm_block, (tm)); futex_release(mem_lock); }while(0);
  return ((void *)0);
 }
 return tm;
}

return_type: 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; } *


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

if ( a1 )
{
v1 = (_QWORD *)tem_info;
v2 = (volatile __int32 *)(tem_info + 16);
futex_get((volatile signed __int32 *)(tem_info + 16));
v3 = a1[6];
if ( v3 )
*(_QWORD *)(v3 + 40) = a1[5];
else
*v1 = a1[5];
v4 = a1[5];
if ( v4 )
*(_QWORD *)(v4 + 48) = a1[6];
else
v1[1] = a1[6];
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 func10(_QWORD *a1)
{
_QWORD *v1; // r12
volatile __int32 *v2; // rbp
__int64 v3; // rax
__int64 v4; // rsi

if ( a1 )
{
v1 = (_QWORD *)tem_info;
v2 = (volatile __int32 *)(tem_info + 16);
func2((volatile signed __int32 *)(tem_info + 16));
v3 = a1[6];
if ( v3 )
*(_QWORD *)(v3 + 40) = a1[5];
else
*v1 = a1[5];
v4 = a1[5];
if ( v4 )
*(_QWORD *)(v4 + 48) = a1[6];
else
v1[1] = a1[6];
func3(v2);
if ( *a1 )
{
func2(mem_lock);
qm_free(shm_block, *a1);
func3(mem_lock);
}
func2(mem_lock);
qm_free(shm_block, a1);
func3(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);
 }
}


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 func11()
{
_QWORD **v0; // rbp
_QWORD *i; // rbx
__int64 result; // rax

v0 = (_QWORD **)tem_info;
tem_info = 0LL;
if ( v0 )
{
for ( i = *v0; i; func10(i) )
i = (_QWORD *)i[5];
func2(mem_lock);
qm_free(shm_block, v0);
result = func3(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; } *


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:
te
struct _time_event_data_t *

variable_types:
tick
unsigned int

variable_types:
s
unsigned int


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

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

canonical_decompiled_code:
void __fastcall func13(__int64 a1, unsigned int a2, __int64 a3)
{
volatile signed __int32 *v5; // rdi
volatile __int32 *v6; // rdi

v5 = *(volatile signed __int32 **)(a1 + 24);
if ( v5 )
func2(v5);
func12(a1, a2, a3);
v6 = *(volatile __int32 **)(a1 + 24);
if ( v6 )
func3(v6);
}

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


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 func15(__int64 a1, __int64 a2)
{
volatile signed __int32 *v3; // rdi
__int64 result; // rax
volatile __int32 *v5; // rdi

v3 = *(volatile signed __int32 **)(a1 + 24);
if ( v3 )
func2(v3);
result = func14(a1, a2);
v5 = *(volatile __int32 **)(a1 + 24);
if ( v5 )
result = func3(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: 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:
void reset_filters()
{
nr_filters = 1;
dword_30C = 1;
start_filters = 0;
dword_304 = 0;
}

canonical_decompiled_code:
void func1()
{
nr_filters = 1;
dword_30C = 1;
start_filters = 0;
dword_304 = 0;
}

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; // r13
const regex_t *v3; // rdi
__int64 result; // rax
__int64 v5; // rbx
const regex_t *v6; // rdi
regmatch_t v7[6]; // [rsp+8h] [rbp-30h] BYREF

if ( start_filters[0] >= nr_filters[0] )
{
LABEL_8:
result = 0xFFFFFFFFLL;
if ( default_rule != 12 )
{
if ( dword_304 >= dword_30C )
{
LABEL_15:
result = 2 * (unsigned int)(default_rule == 11) - 1;
}
else
{
v5 = dword_304;
while ( 1 )
{
v6 = (const regex_t *)qword_350[v5];
if ( v6 )
{
if ( !regexec(v6, string, 1uLL, v7, 0) )
break;
}
if ( nr_filters[1] <= (int)++v5 )
goto LABEL_15;
}
result = 0xFFFFFFFFLL;
}
}
}
else
{
v2 = start_filters[0];
while ( 1 )
{
v3 = (const regex_t *)rd_filters[v2];
if ( v3 )
{
if ( !regexec(v3, string, 1uLL, v7, 0) )
break;
}
if ( nr_filters[0] <= (int)++v2 )
goto LABEL_8;
}
result = 1LL;
}
return result;
}

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

if ( start_filters[0] >= nr_filters[0] )
{
LABEL_8:
result = 0xFFFFFFFFLL;
if ( default_rule != 12 )
{
if ( dword_304 >= dword_30C )
{
LABEL_15:
result = 2 * (unsigned int)(default_rule == 11) - 1;
}
else
{
v5 = dword_304;
while ( 1 )
{
v6 = (const regex_t *)qword_350[v5];
if ( v6 )
{
if ( !regexec(v6, string, 1uLL, v7, 0) )
break;
}
if ( nr_filters[1] <= (int)++v5 )
goto LABEL_15;
}
result = 0xFFFFFFFFLL;
}
}
}
else
{
v2 = start_filters[0];
while ( 1 )
{
v3 = (const regex_t *)rd_filters[v2];
if ( v3 )
{
if ( !regexec(v3, string, 1uLL, v7, 0) )
break;
}
if ( nr_filters[0] <= (int)++v2 )
goto LABEL_8;
}
result = 1LL;
}
return result;
}

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


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

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


decompiled_code:
__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:
__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
int v2; // edx
const char *v3; // rbp
unsigned int v4; // eax
_QWORD *v5; // rax
_QWORD *v6; // rbp
int v7; // edi
const char *v8; // rbp
unsigned int v9; // eax
const char *v10; // rbx
unsigned int v11; // eax

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

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
__int64 result; // rax
int v2; // edx
const char *v3; // rbp
unsigned int v4; // eax
_QWORD *v5; // rax
_QWORD *v6; // rbp
int v7; // edi
const char *v8; // rbp
unsigned int v9; // eax
const char *v10; // rbx
unsigned int v11; // eax

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


decompiled_code:
__int64 sctp_core_init()
{
__int64 result; // rax
int v1; // edx
const char *v2; // rbx
unsigned int v3; // eax

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

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax
int v1; // edx
const char *v2; // rbx
unsigned int v3; // eax

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

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

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();
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();
}
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

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();
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();
}
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:
__int64 sctp_core_init_sock()
{
return xmmword_590();
}

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

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