decompiled_code:
__int64 __fastcall sca_dialog_create_replaces_header(_QWORD *a1, _QWORD *a2)
{
void *v4; // rax
int v5; // ebx
__int64 v6; // r9
int v7; // er10
__int64 v8; // rdx
int v9; // ebx
int v10; // ebx
unsigned int v11; // esi
__int64 v13; // rdi
const char *v14; // r13
int v15; // er12
const char *v16; // rbx
unsigned int v17; // eax

if ( !a2 )
_assert_fail("replaces_hdr != NULL", "sca_dialog.c", 0x50u, "sca_dialog_create_replaces_header");
if ( a1[2] && *((int *)a1 + 6) > 0 && a1[4] && *((int *)a1 + 10) > 0 && a1[6] && *((int *)a1 + 14) > 0 )
{
*a2 = 0LL;
a2[1] = 0LL;
v4 = (void *)qm_malloc(mem_block, *((int *)a1 + 2) + 30LL);
*a2 = v4;
qmemcpy(v4, "Replaces: ", 10);
memcpy((void *)(*a2 + 10LL), (const void *)a1[2], *((int *)a1 + 6));
v5 = *((_DWORD *)a1 + 6);
*(_BYTE *)(*a2 + v5 + 10) = 59;
v6 = *a2 + v5 + 11;
*(_DWORD *)v6 = 1949134708;
*(_WORD *)(v6 + 4) = 26465;
*(_BYTE *)(v6 + 6) = 61;
memcpy((void *)(*a2 + v5 + 18), (const void *)a1[6], *((int *)a1 + 14));
v7 = *((_DWORD *)a1 + 14) + v5 + 18;
*(_BYTE *)(*a2 + v7) = 59;
v8 = *a2 + v7 + 1;
*(_QWORD *)v8 = 0x6761742D6D6F7266LL;
*(_BYTE *)(v8 + 8) = 61;
v9 = v7 + 10;
memcpy((void *)(*a2 + v7 + 10), (const void *)a1[4], *((int *)a1 + 10));
v10 = *((_DWORD *)a1 + 10) + v9;
*(_WORD *)(*a2 + v10) = 2573;
v11 = v10 + 2;
*((_DWORD *)a2 + 2) = v10 + 2;
}
else
{
v11 = -1;
if ( (int)get_debug_level("sca", 3LL) >= -1 )
{
v13 = dprint_crit;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
{
v13 = 0xFFFFFFFFLL;
dprint_color(0xFFFFFFFFLL);
}
v14 = (const char *)*a1;
v15 = *((_DWORD *)a1 + 2);
v16 = (const char *)*((_QWORD *)&log_level_info + 8);
v17 = my_pid(v13, 0xFFFFFFFFLL);
fprintf(
stderr,
"%2d(%d) %s: %s%s(): sca_dialog_create_replaces_header: dialog %.*s is not a confirmed dialog, cannot build Replaces header",
process_no,
v17,
v16,
"sca [sca_dialog.c:84]: ",
"sca_dialog_create_replaces_header",
v15,
v14);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): sca_dialog_create_replaces_header: dialog %.*s is not a confirmed dialog, cannot build Replaces header",
*((_QWORD *)&log_level_info + 8),
"sca [sca_dialog.c:84]: ",
"sca_dialog_create_replaces_header",
*((unsigned int *)a1 + 2),
*a1);
}
--dprint_crit;
v11 = -1;
}
}
}
return v11;
}

canonical_decompiled_code:
__int64 __fastcall func1(_QWORD *a1, _QWORD *a2)
{
void *v4; // rax
int v5; // ebx
__int64 v6; // r9
int v7; // er10
__int64 v8; // rdx
int v9; // ebx
int v10; // ebx
unsigned int v11; // esi
__int64 v13; // rdi
const char *v14; // r13
int v15; // er12
const char *v16; // rbx
unsigned int v17; // eax

if ( !a2 )
_assert_fail("replaces_hdr != NULL", "sca_dialog.c", 0x50u, "sca_dialog_create_replaces_header");
if ( a1[2] && *((int *)a1 + 6) > 0 && a1[4] && *((int *)a1 + 10) > 0 && a1[6] && *((int *)a1 + 14) > 0 )
{
*a2 = 0LL;
a2[1] = 0LL;
v4 = (void *)qm_malloc(mem_block, *((int *)a1 + 2) + 30LL);
*a2 = v4;
qmemcpy(v4, "Replaces: ", 10);
memcpy((void *)(*a2 + 10LL), (const void *)a1[2], *((int *)a1 + 6));
v5 = *((_DWORD *)a1 + 6);
*(_BYTE *)(*a2 + v5 + 10) = 59;
v6 = *a2 + v5 + 11;
*(_DWORD *)v6 = 1949134708;
*(_WORD *)(v6 + 4) = 26465;
*(_BYTE *)(v6 + 6) = 61;
memcpy((void *)(*a2 + v5 + 18), (const void *)a1[6], *((int *)a1 + 14));
v7 = *((_DWORD *)a1 + 14) + v5 + 18;
*(_BYTE *)(*a2 + v7) = 59;
v8 = *a2 + v7 + 1;
*(_QWORD *)v8 = 0x6761742D6D6F7266LL;
*(_BYTE *)(v8 + 8) = 61;
v9 = v7 + 10;
memcpy((void *)(*a2 + v7 + 10), (const void *)a1[4], *((int *)a1 + 10));
v10 = *((_DWORD *)a1 + 10) + v9;
*(_WORD *)(*a2 + v10) = 2573;
v11 = v10 + 2;
*((_DWORD *)a2 + 2) = v10 + 2;
}
else
{
v11 = -1;
if ( (int)get_debug_level("sca", 3LL) >= -1 )
{
v13 = dprint_crit;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
{
v13 = 0xFFFFFFFFLL;
dprint_color(0xFFFFFFFFLL);
}
v14 = (const char *)*a1;
v15 = *((_DWORD *)a1 + 2);
v16 = (const char *)*((_QWORD *)&log_level_info + 8);
v17 = my_pid(v13, 0xFFFFFFFFLL);
fprintf(
stderr,
"%2d(%d) %s: %s%s(): sca_dialog_create_replaces_header: dialog %.*s is not a confirmed dialog, cannot build Replaces header",
process_no,
v17,
v16,
"sca [sca_dialog.c:84]: ",
"sca_dialog_create_replaces_header",
v15,
v14);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): sca_dialog_create_replaces_header: dialog %.*s is not a confirmed dialog, cannot build Replaces header",
*((_QWORD *)&log_level_info + 8),
"sca [sca_dialog.c:84]: ",
"sca_dialog_create_replaces_header",
*((unsigned int *)a1 + 2),
*a1);
}
--dprint_crit;
v11 = -1;
}
}
}
return v11;
}

original_code:
int
sca_dialog_create_replaces_header( sca_dialog *dlg, str *replaces_hdr )
{
    int len;
    ((void) sizeof ((replaces_hdr != ((void *)0)) ? 1 : 0), __extension__ ({ if (replaces_hdr != ((void *)0)) ; else __assert_fail ("replaces_hdr != NULL", "sca_dialog.c", 80, __extension__ __PRETTY_FUNCTION__); }));
    if ( ((&dlg->call_id) == ((void *)0) || ((&dlg->call_id)->s == ((void *)0) || (&dlg->call_id)->len <= 0 )) || ((&dlg->from_tag) == ((void *)0) || ((&dlg->from_tag)->s == ((void *)0) || (&dlg->from_tag)->len <= 0 )) ||
  ((&dlg->to_tag) == ((void *)0) || ((&dlg->to_tag)->s == ((void *)0) || (&dlg->to_tag)->len <= 0 ))) {
 do { if (get_debug_level("sca", (sizeof("sca")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "sca_dialog_create_replaces_header: dialog %.*s is not a " "confirmed dialog, cannot build Replaces header", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("sca" " [" "sca_dialog.c" ":" "84" "]: ") , __func__, ((&dlg->id != (str *)0) ? (&dlg->id)->len : 0), ((&dlg->id != (str *)0) ? (&dlg->id)->s : "")); 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(): " "sca_dialog_create_replaces_header: dialog %.*s is not a " "confirmed dialog, cannot build Replaces header", (log_level_info[((-1)) - (-5)].name), ("sca" " [" "sca_dialog.c" ":" "84" "]: ") , __func__, ((&dlg->id != (str *)0) ? (&dlg->id)->len : 0), ((&dlg->id != (str *)0) ? (&dlg->id)->s : "")); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "sca_dialog_create_replaces_header: dialog %.*s is not a " "confirmed dialog, cannot build Replaces header", process_no, my_pid(), ("sca" " [" "sca_dialog.c" ":" "84" "]: ") , __func__, ((&dlg->id != (str *)0) ? (&dlg->id)->len : 0), ((&dlg->id != (str *)0) ? (&dlg->id)->s : "")); 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(): " "sca_dialog_create_replaces_header: dialog %.*s is not a " "confirmed dialog, cannot build Replaces header", ("sca" " [" "sca_dialog.c" ":" "84" "]: ") , __func__, ((&dlg->id != (str *)0) ? (&dlg->id)->len : 0), ((&dlg->id != (str *)0) ? (&dlg->id)->s : "")); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "sca_dialog_create_replaces_header: dialog %.*s is not a " "confirmed dialog, cannot build Replaces header", ("sca" " [" "sca_dialog.c" ":" "84" "]: ") , __func__, ((&dlg->id != (str *)0) ? (&dlg->id)->len : 0), ((&dlg->id != (str *)0) ? (&dlg->id)->s : "")); } } (dprint_crit--); } } while(0);
 return( -1 );
    }
    memset( replaces_hdr, 0, sizeof( str ));
    replaces_hdr->s = qm_malloc(mem_block, (strlen( "Replaces: " ) + strlen( "to-tag=" ) + strlen( "from-tag=" ) + dlg->id.len + 2 + 2));
    memcpy( replaces_hdr->s, "Replaces: ",
     strlen( "Replaces: " ) );
    len = strlen( "Replaces: " );
    memcpy( replaces_hdr->s + len, dlg->call_id.s, dlg->call_id.len );
    len += dlg->call_id.len;
    memcpy( replaces_hdr->s + len, ";", strlen( ";" ));
    len += strlen( ";" );
    memcpy( replaces_hdr->s + len, "to-tag=",
     strlen( "to-tag=" ) );
    len += strlen( "to-tag=" );
    memcpy( replaces_hdr->s + len, dlg->to_tag.s, dlg->to_tag.len );
    len += dlg->to_tag.len;
    memcpy( replaces_hdr->s + len, ";", strlen( ";" ));
    len += strlen( ";" );
    memcpy( replaces_hdr->s + len, "from-tag=",
     strlen( "from-tag=" ) );
    len += strlen( "from-tag=" );
    memcpy( replaces_hdr->s + len, dlg->from_tag.s, dlg->from_tag.len );
    len += dlg->from_tag.len;
    memcpy( replaces_hdr->s + len, "\r\n", (sizeof("\r\n") - 1) );
    len += (sizeof("\r\n") - 1);
    replaces_hdr->len = len;
    return( len );
}

canonical_original_code:
int sca_dialog_create_replaces_header(struct _sca_dialog *dlg, struct _str *replaces_hdr)
{
    int len;
    ((void) sizeof ((replaces_hdr != ((void *)0)) ? 1 : 0), __extension__ ({ if (replaces_hdr != ((void *)0)) ; else __assert_fail ("replaces_hdr != NULL", "sca_dialog.c", 80, __extension__ __PRETTY_FUNCTION__); }));
    if ( ((&dlg->call_id) == ((void *)0) || ((&dlg->call_id)->s == ((void *)0) || (&dlg->call_id)->len <= 0 )) || ((&dlg->from_tag) == ((void *)0) || ((&dlg->from_tag)->s == ((void *)0) || (&dlg->from_tag)->len <= 0 )) ||
  ((&dlg->to_tag) == ((void *)0) || ((&dlg->to_tag)->s == ((void *)0) || (&dlg->to_tag)->len <= 0 ))) {
 do { if (get_debug_level("sca", (sizeof("sca")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "sca_dialog_create_replaces_header: dialog %.*s is not a " "confirmed dialog, cannot build Replaces header", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("sca" " [" "sca_dialog.c" ":" "84" "]: ") , __func__, ((&dlg->id != (struct _str *)0) ? (&dlg->id)->len : 0), ((&dlg->id != (struct _str *)0) ? (&dlg->id)->s : "")); 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(): " "sca_dialog_create_replaces_header: dialog %.*s is not a " "confirmed dialog, cannot build Replaces header", (log_level_info[((-1)) - (-5)].name), ("sca" " [" "sca_dialog.c" ":" "84" "]: ") , __func__, ((&dlg->id != (struct _str *)0) ? (&dlg->id)->len : 0), ((&dlg->id != (struct _str *)0) ? (&dlg->id)->s : "")); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "sca_dialog_create_replaces_header: dialog %.*s is not a " "confirmed dialog, cannot build Replaces header", process_no, my_pid(), ("sca" " [" "sca_dialog.c" ":" "84" "]: ") , __func__, ((&dlg->id != (struct _str *)0) ? (&dlg->id)->len : 0), ((&dlg->id != (struct _str *)0) ? (&dlg->id)->s : "")); 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(): " "sca_dialog_create_replaces_header: dialog %.*s is not a " "confirmed dialog, cannot build Replaces header", ("sca" " [" "sca_dialog.c" ":" "84" "]: ") , __func__, ((&dlg->id != (struct _str *)0) ? (&dlg->id)->len : 0), ((&dlg->id != (struct _str *)0) ? (&dlg->id)->s : "")); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "sca_dialog_create_replaces_header: dialog %.*s is not a " "confirmed dialog, cannot build Replaces header", ("sca" " [" "sca_dialog.c" ":" "84" "]: ") , __func__, ((&dlg->id != (struct _str *)0) ? (&dlg->id)->len : 0), ((&dlg->id != (struct _str *)0) ? (&dlg->id)->s : "")); } } (dprint_crit--); } } while(0);
 return( -1 );
    }
    memset( replaces_hdr, 0, sizeof( str ));
    replaces_hdr->s = qm_malloc(mem_block, (strlen( "Replaces: " ) + strlen( "to-tag=" ) + strlen( "from-tag=" ) + dlg->id.len + 2 + 2));
    memcpy( replaces_hdr->s, "Replaces: ",
     strlen( "Replaces: " ) );
    len = strlen( "Replaces: " );
    memcpy( replaces_hdr->s + len, dlg->call_id.s, dlg->call_id.len );
    len += dlg->call_id.len;
    memcpy( replaces_hdr->s + len, ";", strlen( ";" ));
    len += strlen( ";" );
    memcpy( replaces_hdr->s + len, "to-tag=",
     strlen( "to-tag=" ) );
    len += strlen( "to-tag=" );
    memcpy( replaces_hdr->s + len, dlg->to_tag.s, dlg->to_tag.len );
    len += dlg->to_tag.len;
    memcpy( replaces_hdr->s + len, ";", strlen( ";" ));
    len += strlen( ";" );
    memcpy( replaces_hdr->s + len, "from-tag=",
     strlen( "from-tag=" ) );
    len += strlen( "from-tag=" );
    memcpy( replaces_hdr->s + len, dlg->from_tag.s, dlg->from_tag.len );
    len += dlg->from_tag.len;
    memcpy( replaces_hdr->s + len, "\r\n", (sizeof("\r\n") - 1) );
    len += (sizeof("\r\n") - 1);
    replaces_hdr->len = len;
    return( len );
}


repo: virtualolson/who

decompiled_code:
__int64 __fastcall db_fld_init(__int64 a1)
{
__int64 v1; // rbx

v1 = a1;
if ( !*(_QWORD *)(a1 + 136) )
return 0LL;
while ( (int)db_gen_init(v1) >= 0 )
{
v1 += 176LL;
if ( !*(_QWORD *)(v1 + 136) )
return 0LL;
}
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
__int64 v1; // rbx

v1 = a1;
if ( !*(_QWORD *)(a1 + 136) )
return 0LL;
while ( (int)db_gen_init(v1) >= 0 )
{
v1 += 176LL;
if ( !*(_QWORD *)(v1 + 136) )
return 0LL;
}
return 0xFFFFFFFFLL;
}

original_code:
int db_fld_init(db_fld_t* fld)
{
 int i;
 for(i = 0; !((fld[i]).name == ((void *)0)); i++) {
  if (db_gen_init(&fld[i].gen) < 0) return -1;
 }
 return 0;
}

canonical_original_code:
int db_fld_init(struct db_fld *fld)
{
 int i;
 for(i = 0; !((fld[i]).name == ((void *)0)); i++) {
  if (db_gen_init(&fld[i].gen) < 0) return -1;
 }
 return 0;
}

variable_types: struct db_fld { struct db_gen { struct { struct db_gen *stqe_next; } next; struct db_drv { void (*free)(struct db_gen *db_struct, struct db_drv *payload); } *data[16]; } gen; char *name; enum db_fld_type { DB_NONE=0, DB_INT=1, DB_FLOAT=2, DB_DOUBLE=3, DB_CSTR=4, DB_STR=5, DB_DATETIME=6, DB_BLOB=7, DB_BITMAP=8 } type; unsigned int flags; union db_fld_val { int int4; float flt; double dbl; long time; char *cstr; struct _str { char *s; int len; } lstr; struct _str blob; unsigned int bitmap; long long int8; } v; enum db_fld_op { DB_EQ=0, DB_NE=1, DB_LT=2, DB_GT=3, DB_LEQ=4, DB_GEQ=5 } op; } *

variable_types: i int

return_type: int

user_defined_types: struct db_fld { struct db_gen gen; char *name; enum db_fld_type type; unsigned int flags; union db_fld_val v; enum db_fld_op op; }

user_defined_types: struct db_gen { struct { struct db_gen *stqe_next; } next; struct db_drv *data[16]; }

user_defined_types: union db_fld_val { int int4; float flt; double dbl; long time; char *cstr; struct _str lstr; struct _str blob; unsigned int bitmap; long long int8; }


decompiled_code:
__int64 __fastcall db_fld_close(__int64 a1)
{
__int64 i; // rbx
__int64 result; // rax

for ( i = a1; *(_QWORD *)(i + 136); i += 176LL )
result = db_gen_free(i);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
__int64 i; // rbx
__int64 result; // rax

for ( i = a1; *(_QWORD *)(i + 136); i += 176LL )
result = db_gen_free(i);
return result;
}

original_code:
void db_fld_close(db_fld_t* fld)
{
 int i;
 for(i = 0; !((fld[i]).name == ((void *)0)); i++) {
  db_gen_free(&fld[i].gen);
 }
}

canonical_original_code:
void db_fld_close(struct db_fld *fld)
{
 int i;
 for(i = 0; !((fld[i]).name == ((void *)0)); i++) {
  db_gen_free(&fld[i].gen);
 }
}

return_type: void

user_defined_types: enum db_fld_type { DB_NONE=0, DB_INT=1, DB_FLOAT=2, DB_DOUBLE=3, DB_CSTR=4, DB_STR=5, DB_DATETIME=6, DB_BLOB=7, DB_BITMAP=8 }

user_defined_types: enum db_fld_op { DB_EQ=0, DB_NE=1, DB_LT=2, DB_GT=3, DB_LEQ=4, DB_GEQ=5 }

user_defined_types: struct db_drv { void (*free)(struct db_gen *db_struct, struct db_drv *payload); }


decompiled_code:
char *__fastcall db_fld(__int64 a1)
{
char *v1; // rax
char *v2; // r14
char *v3; // rbp
__int64 v4; // rbx
__int64 v5; // rcx
int v6; // er12
__int64 v7; // r15
char *v8; // rbp
const char *v9; // rbp
unsigned int v10; // eax
__int64 v11; // r8
char *v12; // r13
__int64 v13; // rbp
__int64 v14; // rcx
char *v15; // r13

v1 = (char *)qm_malloc(mem_block, 176 * a1);
v2 = v1;
if ( !v1 )
{
if ( (int)get_debug_level("core", 4LL) >= -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(): db_fld: No memory left\n",
process_no,
v10,
v9,
"<core> [db_fld.c:83]: ",
"db_fld");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): db_fld: No memory left\n",
*((const char **)&log_level_info + 8),
"<core> [db_fld.c:83]: ",
"db_fld");
}
--dprint_crit;
}
return v2;
}
memset(v1, 0, 176 * a1);
if ( !a1 )
return v2;
v3 = v2;
v4 = 0LL;
v5 = a1 & 7;
if ( (a1 & 7) == 0 )
{
LABEL_24:
while ( 1 )
{
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
break;
v7 = v4 + 1;
LODWORD(v4) = v7;
v8 = v3 + 176;
v6 = v7;
if ( (int)db_gen_init(v8) < 0 )
break;
LODWORD(v4) = v7 + 1;
v6 = v7 + 1;
if ( (int)db_gen_init(v8 + 176) < 0 )
break;
LODWORD(v4) = v7 + 2;
v6 = v7 + 2;
if ( (int)db_gen_init(v8 + 352) < 0 )
break;
LODWORD(v4) = v7 + 3;
v6 = v7 + 3;
if ( (int)db_gen_init(v8 + 528) < 0 )
break;
LODWORD(v4) = v7 + 4;
v6 = v7 + 4;
if ( (int)db_gen_init(v8 + 704) < 0 )
break;
LODWORD(v4) = v7 + 5;
v6 = v7 + 5;
if ( (int)db_gen_init(v8 + 880) < 0 )
break;
LODWORD(v4) = v7 + 6;
v6 = v7 + 6;
if ( (int)db_gen_init(v8 + 1056) < 0 )
break;
v4 = v7 + 7;
v3 = v8 + 1232;
if ( a1 == v7 + 7 )
return v2;
}
goto LABEL_43;
}
if ( v5 != 1 )
{
if ( v5 != 2 )
{
if ( v5 != 3 )
{
if ( v5 != 4 )
{
if ( v5 != 5 )
{
if ( v5 != 6 )
{
v6 = 0;
if ( (int)db_gen_init(v2) < 0 )
goto LABEL_43;
v4 = 1LL;
v3 = v2 + 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
{
LABEL_43:
if ( v6 >= 0 )
{
v11 = 176LL * v6;
v12 = &v2[v11];
v13 = (__int64)&v2[v11 - 176 + -176 * (unsigned int)v4];
v14 = ((_BYTE)v4 + 1) & 7;
if ( (((_BYTE)v4 + 1) & 7) == 0 )
goto LABEL_63;
if ( v14 != 1 )
{
if ( v14 != 2 )
{
if ( v14 != 3 )
{
if ( v14 != 4 )
{
if ( v14 != 5 )
{
if ( v14 != 6 )
{
db_gen_free(&v2[v11]);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
if ( v12 != (char *)v13 )
{
LABEL_63:
do
{
db_gen_free(v12);
v15 = v12 - 176;
db_gen_free(v15);
db_gen_free(v15 - 176);
db_gen_free(v15 - 352);
db_gen_free(v15 - 528);
db_gen_free(v15 - 704);
db_gen_free(v15 - 880);
db_gen_free(v15 - 1056);
v12 = v15 - 1232;
}
while ( v12 != (char *)v13 );
}
}
qm_free(mem_block, v2);
return 0LL;
}
++v4;
v3 += 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
goto LABEL_43;
++v4;
v3 += 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
goto LABEL_43;
++v4;
v3 += 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
goto LABEL_43;
++v4;
v3 += 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
goto LABEL_43;
++v4;
v3 += 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
goto LABEL_43;
++v4;
v3 += 176;
if ( a1 != v4 )
goto LABEL_24;
return v2;
}

canonical_decompiled_code:
char *__fastcall func2(__int64 a1)
{
char *v1; // rax
char *v2; // r14
char *v3; // rbp
__int64 v4; // rbx
__int64 v5; // rcx
int v6; // er12
__int64 v7; // r15
char *v8; // rbp
const char *v9; // rbp
unsigned int v10; // eax
__int64 v11; // r8
char *v12; // r13
__int64 v13; // rbp
__int64 v14; // rcx
char *v15; // r13

v1 = (char *)qm_malloc(mem_block, 176 * a1);
v2 = v1;
if ( !v1 )
{
if ( (int)get_debug_level("core", 4LL) >= -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(): db_fld: No memory left\n",
process_no,
v10,
v9,
"<core> [db_fld.c:83]: ",
"db_fld");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): db_fld: No memory left\n",
*((const char **)&log_level_info + 8),
"<core> [db_fld.c:83]: ",
"db_fld");
}
--dprint_crit;
}
return v2;
}
memset(v1, 0, 176 * a1);
if ( !a1 )
return v2;
v3 = v2;
v4 = 0LL;
v5 = a1 & 7;
if ( (a1 & 7) == 0 )
{
LABEL_24:
while ( 1 )
{
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
break;
v7 = v4 + 1;
LODWORD(v4) = v7;
v8 = v3 + 176;
v6 = v7;
if ( (int)db_gen_init(v8) < 0 )
break;
LODWORD(v4) = v7 + 1;
v6 = v7 + 1;
if ( (int)db_gen_init(v8 + 176) < 0 )
break;
LODWORD(v4) = v7 + 2;
v6 = v7 + 2;
if ( (int)db_gen_init(v8 + 352) < 0 )
break;
LODWORD(v4) = v7 + 3;
v6 = v7 + 3;
if ( (int)db_gen_init(v8 + 528) < 0 )
break;
LODWORD(v4) = v7 + 4;
v6 = v7 + 4;
if ( (int)db_gen_init(v8 + 704) < 0 )
break;
LODWORD(v4) = v7 + 5;
v6 = v7 + 5;
if ( (int)db_gen_init(v8 + 880) < 0 )
break;
LODWORD(v4) = v7 + 6;
v6 = v7 + 6;
if ( (int)db_gen_init(v8 + 1056) < 0 )
break;
v4 = v7 + 7;
v3 = v8 + 1232;
if ( a1 == v7 + 7 )
return v2;
}
goto LABEL_43;
}
if ( v5 != 1 )
{
if ( v5 != 2 )
{
if ( v5 != 3 )
{
if ( v5 != 4 )
{
if ( v5 != 5 )
{
if ( v5 != 6 )
{
v6 = 0;
if ( (int)db_gen_init(v2) < 0 )
goto LABEL_43;
v4 = 1LL;
v3 = v2 + 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
{
LABEL_43:
if ( v6 >= 0 )
{
v11 = 176LL * v6;
v12 = &v2[v11];
v13 = (__int64)&v2[v11 - 176 + -176 * (unsigned int)v4];
v14 = ((_BYTE)v4 + 1) & 7;
if ( (((_BYTE)v4 + 1) & 7) == 0 )
goto LABEL_63;
if ( v14 != 1 )
{
if ( v14 != 2 )
{
if ( v14 != 3 )
{
if ( v14 != 4 )
{
if ( v14 != 5 )
{
if ( v14 != 6 )
{
db_gen_free(&v2[v11]);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
}
db_gen_free(v12);
v12 -= 176;
if ( v12 != (char *)v13 )
{
LABEL_63:
do
{
db_gen_free(v12);
v15 = v12 - 176;
db_gen_free(v15);
db_gen_free(v15 - 176);
db_gen_free(v15 - 352);
db_gen_free(v15 - 528);
db_gen_free(v15 - 704);
db_gen_free(v15 - 880);
db_gen_free(v15 - 1056);
v12 = v15 - 1232;
}
while ( v12 != (char *)v13 );
}
}
qm_free(mem_block, v2);
return 0LL;
}
++v4;
v3 += 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
goto LABEL_43;
++v4;
v3 += 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
goto LABEL_43;
++v4;
v3 += 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
goto LABEL_43;
++v4;
v3 += 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
goto LABEL_43;
++v4;
v3 += 176;
}
v6 = v4;
if ( (int)db_gen_init(v3) < 0 )
goto LABEL_43;
++v4;
v3 += 176;
if ( a1 != v4 )
goto LABEL_24;
return v2;
}

original_code:
db_fld_t* db_fld(size_t n)
{
 int i;
 db_fld_t* newp;
 newp = (db_fld_t*)qm_malloc(mem_block, (sizeof(db_fld_t) * n));
 if (newp == ((void *)0)) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "db_fld: No memory left\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_fld.c" ":" "83" "]: ") , __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(): " "db_fld: No memory left\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_fld.c" ":" "83" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "db_fld: No memory left\n", process_no, my_pid(), ("<core> [" "db_fld.c" ":" "83" "]: ") , __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(): " "db_fld: No memory left\n", ("<core> [" "db_fld.c" ":" "83" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "db_fld: No memory left\n", ("<core> [" "db_fld.c" ":" "83" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return ((void *)0);
 }
 memset(newp, '\0', sizeof(db_fld_t) * n);
 for(i = 0; i < n; i++) {
  if (db_gen_init(&newp[i].gen) < 0) goto error;
 }
 return newp;
 error:
 if (newp) {
  while(i >= 0) {
   db_gen_free(&newp[i].gen);
   i--;
  }
  qm_free(mem_block, (newp));
 }
 return ((void *)0);
}

canonical_original_code:
struct db_fld *db_fld(unsigned long n)
{
 int i;
 struct db_fld *newp;
 newp = (struct db_fld *)qm_malloc(mem_block, (sizeof(db_fld_t) * n));
 if (newp == ((void *)0)) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "db_fld: No memory left\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_fld.c" ":" "83" "]: ") , __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(): " "db_fld: No memory left\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_fld.c" ":" "83" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "db_fld: No memory left\n", process_no, my_pid(), ("<core> [" "db_fld.c" ":" "83" "]: ") , __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(): " "db_fld: No memory left\n", ("<core> [" "db_fld.c" ":" "83" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "db_fld: No memory left\n", ("<core> [" "db_fld.c" ":" "83" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return ((void *)0);
 }
 memset(newp, '\0', sizeof(db_fld_t) * n);
 for(i = 0; i < n; i++) {
  if (db_gen_init(&newp[i].gen) < 0) goto error;
 }
 return newp;
 error:
 if (newp) {
  while(i >= 0) {
   db_gen_free(&newp[i].gen);
   i--;
  }
  qm_free(mem_block, (newp));
 }
 return ((void *)0);
}

variable_types:
n
unsigned long

return_type: struct db_fld { struct db_gen { struct { struct db_gen *stqe_next; } next; struct db_drv { void (*free)(struct db_gen *db_struct, struct db_drv *payload); } *data[16]; } gen; char *name; enum db_fld_type { DB_NONE=0, DB_INT=1, DB_FLOAT=2, DB_DOUBLE=3, DB_CSTR=4, DB_STR=5, DB_DATETIME=6, DB_BLOB=7, DB_BITMAP=8 } type; unsigned int flags; union db_fld_val { int int4; float flt; double dbl; long time; char *cstr; struct _str { char *s; int len; } lstr; struct _str blob; unsigned int bitmap; long long int8; } v; enum db_fld_op { DB_EQ=0, DB_NE=1, DB_LT=2, DB_GT=3, DB_LEQ=4, DB_GEQ=5 } op; } *

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


decompiled_code:
__int64 __fastcall db_fld_free(__int64 a1)
{
__int64 v1; // rbx
__int64 result; // rax

if ( a1 && *(_QWORD *)(a1 + 136) )
{
v1 = a1;
do
{
db_gen_free(v1);
v1 += 176LL;
}
while ( *(_QWORD *)(v1 + 136) );
result = qm_free(mem_block, a1);
}
return result;
}

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

if ( a1 && *(_QWORD *)(a1 + 136) )
{
v1 = a1;
do
{
db_gen_free(v1);
v1 += 176LL;
}
while ( *(_QWORD *)(v1 + 136) );
result = qm_free(mem_block, a1);
}
return result;
}

original_code:
void db_fld_free(db_fld_t* fld)
{
 int i;
 if (((fld) == ((void *)0) || (fld)[0].name == ((void *)0))) return;
 for(i = 0; !((fld[i]).name == ((void *)0)); i++) {
  db_gen_free(&fld[i].gen);
 }
 qm_free(mem_block, (fld));
}

canonical_original_code:
void db_fld_free(struct db_fld *fld)
{
 int i;
 if (((fld) == ((void *)0) || (fld)[0].name == ((void *)0))) return;
 for(i = 0; !((fld[i]).name == ((void *)0)); i++) {
  db_gen_free(&fld[i].gen);
 }
 qm_free(mem_block, (fld));
}


decompiled_code:
__int64 __fastcall corex_alias_subdomains_param(__int64 a1, __int64 a2)
{
__int64 result; // rax

if ( a2 )
result = corex_add_alias_subdomains(a2);
else
result = 0xFFFFFFFFLL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2)
{
__int64 result; // rax

if ( a2 )
result = corex_add_alias_subdomains(a2);
else
result = 0xFFFFFFFFLL;
return result;
}

original_code:
int corex_alias_subdomains_param(modparam_t type, void *val)
{
 if(val==((void *)0))
  goto error;
 return corex_add_alias_subdomains((char*)val);
error:
 return -1;
}

canonical_original_code:
int corex_alias_subdomains_param(unsigned int type, void *val)
{
 if(val==((void *)0))
  goto error;
 return corex_add_alias_subdomains((char *)val);
error:
 return -1;
}

variable_types:
type
unsigned int

variable_types:
val
void *


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

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

original_code:
static int child_init(int rank)
{
 if (rank!=0)
  return 0;
 return 0;
}

variable_types: rank int


decompiled_code:
void mod_destroy()
{
;
}

canonical_decompiled_code:
void func1()
{
;
}

original_code:
static void mod_destroy(void)
{
}

canonical_original_code:
static void mod_destroy()
{
}


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

if ( (int)corex_init_rpc() < 0 )
{
v1 = get_debug_level("corex", 5LL);
result = 0xFFFFFFFFLL;
if ( v1 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !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(): failed to register RPC commands\n",
process_no,
v3,
v2,
"corex [corex_mod.c:104]: ",
"mod_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): failed to register RPC commands\n",
*((const char **)&log_level_info + 8),
"corex [corex_mod.c:104]: ",
"mod_init");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
else if ( (int)corex_register_check_self() < 0 )
{
v4 = get_debug_level("corex", 5LL);
result = 0xFFFFFFFFLL;
if ( v4 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v5 = (const char *)*((_QWORD *)&log_level_info + 8);
v6 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): failed to register check self callback\n",
process_no,
v6,
v5,
"corex [corex_mod.c:110]: ",
"mod_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): failed to register check self callback\n",
*((const char **)&log_level_info + 8),
"corex [corex_mod.c:110]: ",
"mod_init");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
else
{
result = 0LL;
}
return result;
}

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

if ( (int)corex_init_rpc() < 0 )
{
v1 = get_debug_level("corex", 5LL);
result = 0xFFFFFFFFLL;
if ( v1 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !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(): failed to register RPC commands\n",
process_no,
v3,
v2,
"corex [corex_mod.c:104]: ",
"mod_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): failed to register RPC commands\n",
*((const char **)&log_level_info + 8),
"corex [corex_mod.c:104]: ",
"mod_init");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
else if ( (int)corex_register_check_self() < 0 )
{
v4 = get_debug_level("corex", 5LL);
result = 0xFFFFFFFFLL;
if ( v4 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v5 = (const char *)*((_QWORD *)&log_level_info + 8);
v6 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): failed to register check self callback\n",
process_no,
v6,
v5,
"corex [corex_mod.c:110]: ",
"mod_init");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): failed to register check self callback\n",
*((const char **)&log_level_info + 8),
"corex [corex_mod.c:110]: ",
"mod_init");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
else
{
result = 0LL;
}
return result;
}

original_code:
static int mod_init(void)
{
 if(corex_init_rpc()<0)
 {
  do { if (get_debug_level("corex", (sizeof("corex")-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(): " "failed to register RPC commands\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("corex" " [" "corex_mod.c" ":" "104" "]: ") , __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(): " "failed to register RPC commands\n", (log_level_info[((-1)) - (-5)].name), ("corex" " [" "corex_mod.c" ":" "104" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "failed to register RPC commands\n", process_no, my_pid(), ("corex" " [" "corex_mod.c" ":" "104" "]: ") , __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(): " "failed to register RPC commands\n", ("corex" " [" "corex_mod.c" ":" "104" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "failed to register RPC commands\n", ("corex" " [" "corex_mod.c" ":" "104" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 if(corex_register_check_self()<0)
 {
  do { if (get_debug_level("corex", (sizeof("corex")-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(): " "failed to register check self callback\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("corex" " [" "corex_mod.c" ":" "110" "]: ") , __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(): " "failed to register check self callback\n", (log_level_info[((-1)) - (-5)].name), ("corex" " [" "corex_mod.c" ":" "110" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "failed to register check self callback\n", process_no, my_pid(), ("corex" " [" "corex_mod.c" ":" "110" "]: ") , __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(): " "failed to register check self callback\n", ("corex" " [" "corex_mod.c" ":" "110" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "failed to register check self callback\n", ("corex" " [" "corex_mod.c" ":" "110" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 return 0;
}

canonical_original_code:
static int mod_init()
{
 if(corex_init_rpc()<0)
 {
  do { if (get_debug_level("corex", (sizeof("corex")-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(): " "failed to register RPC commands\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("corex" " [" "corex_mod.c" ":" "104" "]: ") , __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(): " "failed to register RPC commands\n", (log_level_info[((-1)) - (-5)].name), ("corex" " [" "corex_mod.c" ":" "104" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "failed to register RPC commands\n", process_no, my_pid(), ("corex" " [" "corex_mod.c" ":" "104" "]: ") , __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(): " "failed to register RPC commands\n", ("corex" " [" "corex_mod.c" ":" "104" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "failed to register RPC commands\n", ("corex" " [" "corex_mod.c" ":" "104" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 if(corex_register_check_self()<0)
 {
  do { if (get_debug_level("corex", (sizeof("corex")-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(): " "failed to register check self callback\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("corex" " [" "corex_mod.c" ":" "110" "]: ") , __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(): " "failed to register check self callback\n", (log_level_info[((-1)) - (-5)].name), ("corex" " [" "corex_mod.c" ":" "110" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "failed to register check self callback\n", process_no, my_pid(), ("corex" " [" "corex_mod.c" ":" "110" "]: ") , __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(): " "failed to register check self callback\n", ("corex" " [" "corex_mod.c" ":" "110" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "failed to register check self callback\n", ("corex" " [" "corex_mod.c" ":" "110" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 return 0;
}


decompiled_code:
__int64 __fastcall pool_get(__int64 a1)
{
__int64 v1; // rbx
const char *v2; // rbx
unsigned int v3; // eax

if ( a1 )
{
v1 = db_pool;
if ( db_pool )
{
while ( !(unsigned __int8)cmp_db_id(a1, *(_QWORD *)v1) )
{
v1 = *(_QWORD *)(v1 + 16);
if ( !v1 )
return v1;
}
++*(_DWORD *)(v1 + 8);
}
}
else
{
v1 = 0LL;
if ( (int)get_debug_level("core", 4LL) >= -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(): invalid parameter value\n",
process_no,
v3,
v2,
"<core> [db_pool.c:48]: ",
"pool_get");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): invalid parameter value\n",
*((const char **)&log_level_info + 8),
"<core> [db_pool.c:48]: ",
"pool_get");
}
--dprint_crit;
v1 = 0LL;
}
}
return v1;
}

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

if ( a1 )
{
v1 = db_pool;
if ( db_pool )
{
while ( !(unsigned __int8)cmp_db_id(a1, *(_QWORD *)v1) )
{
v1 = *(_QWORD *)(v1 + 16);
if ( !v1 )
return v1;
}
++*(_DWORD *)(v1 + 8);
}
}
else
{
v1 = 0LL;
if ( (int)get_debug_level("core", 4LL) >= -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(): invalid parameter value\n",
process_no,
v3,
v2,
"<core> [db_pool.c:48]: ",
"pool_get");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): invalid parameter value\n",
*((const char **)&log_level_info + 8),
"<core> [db_pool.c:48]: ",
"pool_get");
}
--dprint_crit;
v1 = 0LL;
}
}
return v1;
}

original_code:
struct pool_con* pool_get(const struct db_id* id)
{
 struct pool_con* ptr;
 if (!id) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "invalid parameter value\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_pool.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(): " "invalid parameter value\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_pool.c" ":" "48" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "invalid parameter value\n", process_no, my_pid(), ("<core> [" "db_pool.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(): " "invalid parameter value\n", ("<core> [" "db_pool.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(): " "invalid parameter value\n", ("<core> [" "db_pool.c" ":" "48" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return 0;
 }
 ptr = db_pool;
 while (ptr) {
  if (cmp_db_id(id, ptr->id)) {
   ptr->ref++;
   return ptr;
  }
  ptr = ptr->next;
 }
 return 0;
}

canonical_original_code:
struct pool_con *pool_get(struct db_id *id)
{
 struct pool_con *ptr;
 if (!id) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "invalid parameter value\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_pool.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(): " "invalid parameter value\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_pool.c" ":" "48" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "invalid parameter value\n", process_no, my_pid(), ("<core> [" "db_pool.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(): " "invalid parameter value\n", ("<core> [" "db_pool.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(): " "invalid parameter value\n", ("<core> [" "db_pool.c" ":" "48" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return 0;
 }
 ptr = db_pool;
 while (ptr) {
  if (cmp_db_id(id, ptr->id)) {
   ptr->ref++;
   return ptr;
  }
  ptr = ptr->next;
 }
 return 0;
}

variable_types:
id
struct db_id *

variable_types: struct pool_con { struct db_id { char *scheme; char *username; char *password; char *host; unsigned short port; char *database; int pid; int poolid; } *id; unsigned int ref; struct pool_con *next; } *

user_defined_types: struct pool_con { struct db_id *id; unsigned int ref; struct pool_con *next; }


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

if ( a1 )
{
result = db_pool;
*(_QWORD *)(a1 + 16) = db_pool;
db_pool = a1;
}
return result;
}

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

if ( a1 )
{
result = db_pool;
*(_QWORD *)(a1 + 16) = db_pool;
db_pool = a1;
}
return result;
}

original_code:
void pool_insert(struct pool_con* con)
{
 if (!con) return;
 con->next = db_pool;
 db_pool = con;
}

canonical_original_code:
void pool_insert(struct pool_con *con)
{
 if (!con) return;
 con->next = db_pool;
 db_pool = con;
}

user_defined_types: struct db_id { char *scheme; char *username; char *password; char *host; unsigned short port; char *database; int pid; int poolid; }


decompiled_code:
__int64 __fastcall pool_remove(__int64 a1)
{
__int64 v1; // rcx
__int64 result; // rax
const char *v3; // rbp
unsigned int v4; // eax
const char *v5; // rbp
unsigned int v6; // eax
int v7; // ebx
const char *v8; // rbx
unsigned int v9; // eax

if ( !a1 )
return 4294967294LL;
if ( *(_DWORD *)(a1 + 8) > 1u )
{
if ( (int)get_debug_level("core", 4LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v3 = (const char *)*((_QWORD *)&log_level_info + 16);
v4 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): connection still kept in the pool\n",
process_no,
v4,
v3,
"<core> [db_pool.c:97]: ",
"pool_remove");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): connection still kept in the pool\n",
*((const char **)&log_level_info + 16),
"<core> [db_pool.c:97]: ",
"pool_remove");
}
--dprint_crit;
}
--*(_DWORD *)(a1 + 8);
result = 0LL;
}
else
{
if ( (int)get_debug_level("core", 4LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v5 = (const char *)*((_QWORD *)&log_level_info + 16);
v6 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): removing connection from the pool\n",
process_no,
v6,
v5,
"<core> [db_pool.c:102]: ",
"pool_remove");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): removing connection from the pool\n",
*((const char **)&log_level_info + 16),
"<core> [db_pool.c:102]: ",
"pool_remove");
}
--dprint_crit;
}
v1 = db_pool;
if ( db_pool == a1 )
{
db_pool = *(_QWORD *)(a1 + 16);
result = 1LL;
}
else
{
while ( v1 )
{
if ( *(_QWORD *)(v1 + 16) == a1 )
{
*(_QWORD *)(v1 + 16) = *(_QWORD *)(a1 + 16);
return 1LL;
}
v1 = *(_QWORD *)(v1 + 16);
}
v7 = get_debug_level("core", 4LL);
result = 0xFFFFFFFFLL;
if ( v7 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !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(): weird, connection not found in the pool\n",
process_no,
v9,
v8,
"<core> [db_pool.c:113]: ",
"pool_remove");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): weird, connection not found in the pool\n",
*((const char **)&log_level_info + 8),
"<core> [db_pool.c:113]: ",
"pool_remove");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
__int64 v1; // rcx
__int64 result; // rax
const char *v3; // rbp
unsigned int v4; // eax
const char *v5; // rbp
unsigned int v6; // eax
int v7; // ebx
const char *v8; // rbx
unsigned int v9; // eax

if ( !a1 )
return 4294967294LL;
if ( *(_DWORD *)(a1 + 8) > 1u )
{
if ( (int)get_debug_level("core", 4LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v3 = (const char *)*((_QWORD *)&log_level_info + 16);
v4 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): connection still kept in the pool\n",
process_no,
v4,
v3,
"<core> [db_pool.c:97]: ",
"pool_remove");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): connection still kept in the pool\n",
*((const char **)&log_level_info + 16),
"<core> [db_pool.c:97]: ",
"pool_remove");
}
--dprint_crit;
}
--*(_DWORD *)(a1 + 8);
result = 0LL;
}
else
{
if ( (int)get_debug_level("core", 4LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v5 = (const char *)*((_QWORD *)&log_level_info + 16);
v6 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): removing connection from the pool\n",
process_no,
v6,
v5,
"<core> [db_pool.c:102]: ",
"pool_remove");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): removing connection from the pool\n",
*((const char **)&log_level_info + 16),
"<core> [db_pool.c:102]: ",
"pool_remove");
}
--dprint_crit;
}
v1 = db_pool;
if ( db_pool == a1 )
{
db_pool = *(_QWORD *)(a1 + 16);
result = 1LL;
}
else
{
while ( v1 )
{
if ( *(_QWORD *)(v1 + 16) == a1 )
{
*(_QWORD *)(v1 + 16) = *(_QWORD *)(a1 + 16);
return 1LL;
}
v1 = *(_QWORD *)(v1 + 16);
}
v7 = get_debug_level("core", 4LL);
result = 0xFFFFFFFFLL;
if ( v7 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !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(): weird, connection not found in the pool\n",
process_no,
v9,
v8,
"<core> [db_pool.c:113]: ",
"pool_remove");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): weird, connection not found in the pool\n",
*((const char **)&log_level_info + 8),
"<core> [db_pool.c:113]: ",
"pool_remove");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
}
return result;
}

original_code:
int pool_remove(struct pool_con* con)
{
 struct pool_con* ptr;
 if (!con) return -2;
 if (con->ref > 1) {
  do { if (get_debug_level("core", (sizeof("core")-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(): " "connection still kept in the pool\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("<core> [" "db_pool.c" ":" "97" "]: ") , __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(): " "connection still kept in the pool\n", (log_level_info[((3)) - (-5)].name), ("<core> [" "db_pool.c" ":" "97" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "connection still kept in the pool\n", process_no, my_pid(), ("<core> [" "db_pool.c" ":" "97" "]: ") , __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(): " "connection still kept in the pool\n", ("<core> [" "db_pool.c" ":" "97" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "connection still kept in the pool\n", ("<core> [" "db_pool.c" ":" "97" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  con->ref--;
  return 0;
 }
 do { if (get_debug_level("core", (sizeof("core")-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(): " "removing connection from the pool\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("<core> [" "db_pool.c" ":" "102" "]: ") , __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(): " "removing connection from the pool\n", (log_level_info[((3)) - (-5)].name), ("<core> [" "db_pool.c" ":" "102" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "removing connection from the pool\n", process_no, my_pid(), ("<core> [" "db_pool.c" ":" "102" "]: ") , __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(): " "removing connection from the pool\n", ("<core> [" "db_pool.c" ":" "102" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "removing connection from the pool\n", ("<core> [" "db_pool.c" ":" "102" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 if (db_pool == con) {
  db_pool = db_pool->next;
 } else {
  ptr = db_pool;
  while(ptr) {
   if (ptr->next == con) break;
   ptr = ptr->next;
  }
  if (!ptr) {
   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(): " "weird, connection not found in the pool\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_pool.c" ":" "113" "]: ") , __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(): " "weird, connection not found in the pool\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_pool.c" ":" "113" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "weird, connection not found in the pool\n", process_no, my_pid(), ("<core> [" "db_pool.c" ":" "113" "]: ") , __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(): " "weird, connection not found in the pool\n", ("<core> [" "db_pool.c" ":" "113" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "weird, connection not found in the pool\n", ("<core> [" "db_pool.c" ":" "113" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -1;
  } else {
   ptr->next = con->next;
  }
 }
 return 1;
}

canonical_original_code:
int pool_remove(struct pool_con *con)
{
 struct pool_con *ptr;
 if (!con) return -2;
 if (con->ref > 1) {
  do { if (get_debug_level("core", (sizeof("core")-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(): " "connection still kept in the pool\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("<core> [" "db_pool.c" ":" "97" "]: ") , __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(): " "connection still kept in the pool\n", (log_level_info[((3)) - (-5)].name), ("<core> [" "db_pool.c" ":" "97" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "connection still kept in the pool\n", process_no, my_pid(), ("<core> [" "db_pool.c" ":" "97" "]: ") , __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(): " "connection still kept in the pool\n", ("<core> [" "db_pool.c" ":" "97" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "connection still kept in the pool\n", ("<core> [" "db_pool.c" ":" "97" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  con->ref--;
  return 0;
 }
 do { if (get_debug_level("core", (sizeof("core")-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(): " "removing connection from the pool\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("<core> [" "db_pool.c" ":" "102" "]: ") , __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(): " "removing connection from the pool\n", (log_level_info[((3)) - (-5)].name), ("<core> [" "db_pool.c" ":" "102" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "removing connection from the pool\n", process_no, my_pid(), ("<core> [" "db_pool.c" ":" "102" "]: ") , __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(): " "removing connection from the pool\n", ("<core> [" "db_pool.c" ":" "102" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "removing connection from the pool\n", ("<core> [" "db_pool.c" ":" "102" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 if (db_pool == con) {
  db_pool = db_pool->next;
 } else {
  ptr = db_pool;
  while(ptr) {
   if (ptr->next == con) break;
   ptr = ptr->next;
  }
  if (!ptr) {
   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(): " "weird, connection not found in the pool\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_pool.c" ":" "113" "]: ") , __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(): " "weird, connection not found in the pool\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "db_pool.c" ":" "113" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "weird, connection not found in the pool\n", process_no, my_pid(), ("<core> [" "db_pool.c" ":" "113" "]: ") , __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(): " "weird, connection not found in the pool\n", ("<core> [" "db_pool.c" ":" "113" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "weird, connection not found in the pool\n", ("<core> [" "db_pool.c" ":" "113" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -1;
  } else {
   ptr->next = con->next;
  }
 }
 return 1;
}


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


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


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


decompiled_code:
__int64 __fastcall free_pres_actions(_QWORD **a1)
{
_QWORD *v1; // rbx
_QWORD *v2; // r12
__int64 result; // rax

if ( a1 )
{
v1 = *a1;
while ( v1 )
{
v2 = v1;
v1 = (_QWORD *)*v1;
futex_get(mem_lock);
qm_free(shm_block, v2);
futex_release(mem_lock);
}
futex_get(mem_lock);
qm_free(shm_block, a1);
result = futex_release(mem_lock);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(_QWORD **a1)
{
_QWORD *v1; // rbx
_QWORD *v2; // r12
__int64 result; // rax

if ( a1 )
{
v1 = *a1;
while ( v1 )
{
v2 = v1;
v1 = (_QWORD *)*v1;
func2(mem_lock);
qm_free(shm_block, v2);
func3(mem_lock);
}
func2(mem_lock);
qm_free(shm_block, a1);
result = func3(mem_lock);
}
return result;
}

original_code:
void free_pres_actions(cp_actions_t *a)
{
 cp_unknown_t *u, *nu;
 if (!a) return;
 u = a->unknown;
 while (u) {
  nu = u->next;
  do { futex_get(mem_lock); qm_free(shm_block, (u)); futex_release(mem_lock); }while(0);
  u = nu;
 }
 do { futex_get(mem_lock); qm_free(shm_block, (a)); futex_release(mem_lock); }while(0);
}

canonical_original_code:
void free_pres_actions(struct cp_actions_t *a)
{
 struct _cp_unknown_t *u; struct _cp_unknown_t *nu;
 if (!a) return;
 u = a->unknown;
 while (u) {
  nu = u->next;
  do { futex_get(mem_lock); qm_free(shm_block, (u)); futex_release(mem_lock); }while(0);
  u = nu;
 }
 do { futex_get(mem_lock); qm_free(shm_block, (a)); futex_release(mem_lock); }while(0);
}

variable_types: struct cp_actions_t { struct _cp_unknown_t { struct _cp_unknown_t *next; char data[1]; } *unknown; } *

user_defined_types: struct cp_actions_t { struct _cp_unknown_t *unknown; }


decompiled_code:
__int64 __fastcall get_pres_rules(__int64 a1, __int64 a2, __int64 a3, _QWORD *a4)
{
__int64 v6; // rax
const char *v7; // rbx
unsigned int v8; // ebx
const char *v10; // r12
unsigned int v11; // eax
const char *v12; // r13
unsigned int v13; // eax
int v14; // er12
int v15; // er9
const char *v16; // r8
const char *v17; // r13
const char *v18; // rbp
unsigned int v19; // eax
unsigned int v20; // [rsp+4h] [rbp-34h] BYREF
__int64 v21[6]; // [rsp+8h] [rbp-30h] BYREF

v21[0] = 0LL;
v20 = 0;
if ( a4 )
*a4 = 0LL;
v6 = xcap_uri_for_users_document(0LL, a1, a2, a3);
v7 = (const char *)v6;
if ( v6 )
{
if ( (unsigned int)xcap_query(v6, a3, v21, &v20) )
{
if ( (int)get_debug_level("core", 4LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v12 = (const char *)*((_QWORD *)&log_level_info + 16);
v13 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): XCAP problems for uri '%s'\n",
process_no,
v13,
v12,
"<core> [pres_rules.c:56]: ",
"get_pres_rules",
v7);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): XCAP problems for uri '%s'\n",
*((const char **)&log_level_info + 16),
"<core> [pres_rules.c:56]: ",
"get_pres_rules",
v7);
}
--dprint_crit;
}
if ( v21[0] )
{
futex_get(mem_lock);
qm_free(shm_block, v21[0]);
futex_release(mem_lock);
}
futex_get(mem_lock);
qm_free(shm_block, v7);
futex_release(mem_lock);
v8 = -7;
}
else
{
futex_get(mem_lock);
qm_free(shm_block, v7);
futex_release(mem_lock);
v8 = parse_pres_rules(v21[0], v20, a4);
if ( v8 )
{
if ( (int)get_debug_level("core", 4LL) >= -1 )
{
v14 = dprint_crit;
if ( !dprint_crit )
{
++dprint_crit;
v15 = log_stderr;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v17 = (const char *)&LC0;
if ( a1 )
{
v17 = *(const char **)a1;
v14 = *(_DWORD *)(a1 + 8);
}
v18 = (const char *)*((_QWORD *)&log_level_info + 8);
v19 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Error occured during parsing pres-rules for %.*s!\n",
process_no,
v19,
v18,
"<core> [pres_rules.c:66]: ",
"get_pres_rules",
v14,
v17);
if ( log_color )
dprint_color_reset();
}
else
{
v16 = (const char *)&LC0;
if ( a1 )
{
v16 = *(const char **)a1;
v15 = *(_DWORD *)(a1 + 8);
}
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Error occured during parsing pres-rules for %.*s!\n",
*((const char **)&log_level_info + 8),
"<core> [pres_rules.c:66]: ",
"get_pres_rules",
v15,
v16);
}
--dprint_crit;
}
}
}
if ( v21[0] )
{
futex_get(mem_lock);
qm_free(shm_block, v21[0]);
futex_release(mem_lock);
}
}
}
else
{
v8 = -7;
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(): can't build XCAP uri\n",
process_no,
v11,
v10,
"<core> [pres_rules.c:50]: ",
"get_pres_rules");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): can't build XCAP uri\n",
*((const char **)&log_level_info + 8),
"<core> [pres_rules.c:50]: ",
"get_pres_rules");
}
--dprint_crit;
v8 = -7;
}
}
return v8;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2, __int64 a3, _QWORD *a4)
{
__int64 v6; // rax
const char *v7; // rbx
unsigned int v8; // ebx
const char *v10; // r12
unsigned int v11; // eax
const char *v12; // r13
unsigned int v13; // eax
int v14; // er12
int v15; // er9
const char *v16; // r8
const char *v17; // r13
const char *v18; // rbp
unsigned int v19; // eax
unsigned int v20; // [rsp+4h] [rbp-34h] BYREF
__int64 v21[6]; // [rsp+8h] [rbp-30h] BYREF

v21[0] = 0LL;
v20 = 0;
if ( a4 )
*a4 = 0LL;
v6 = xcap_uri_for_users_document(0LL, a1, a2, a3);
v7 = (const char *)v6;
if ( v6 )
{
if ( (unsigned int)xcap_query(v6, a3, v21, &v20) )
{
if ( (int)get_debug_level("core", 4LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v12 = (const char *)*((_QWORD *)&log_level_info + 16);
v13 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): XCAP problems for uri '%s'\n",
process_no,
v13,
v12,
"<core> [pres_rules.c:56]: ",
"get_pres_rules",
v7);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): XCAP problems for uri '%s'\n",
*((const char **)&log_level_info + 16),
"<core> [pres_rules.c:56]: ",
"get_pres_rules",
v7);
}
--dprint_crit;
}
if ( v21[0] )
{
func2(mem_lock);
qm_free(shm_block, v21[0]);
func3(mem_lock);
}
func2(mem_lock);
qm_free(shm_block, v7);
func3(mem_lock);
v8 = -7;
}
else
{
func2(mem_lock);
qm_free(shm_block, v7);
func3(mem_lock);
v8 = parse_pres_rules(v21[0], v20, a4);
if ( v8 )
{
if ( (int)get_debug_level("core", 4LL) >= -1 )
{
v14 = dprint_crit;
if ( !dprint_crit )
{
++dprint_crit;
v15 = log_stderr;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v17 = (const char *)&LC0;
if ( a1 )
{
v17 = *(const char **)a1;
v14 = *(_DWORD *)(a1 + 8);
}
v18 = (const char *)*((_QWORD *)&log_level_info + 8);
v19 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Error occured during parsing pres-rules for %.*s!\n",
process_no,
v19,
v18,
"<core> [pres_rules.c:66]: ",
"get_pres_rules",
v14,
v17);
if ( log_color )
dprint_color_reset();
}
else
{
v16 = (const char *)&LC0;
if ( a1 )
{
v16 = *(const char **)a1;
v15 = *(_DWORD *)(a1 + 8);
}
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Error occured during parsing pres-rules for %.*s!\n",
*((const char **)&log_level_info + 8),
"<core> [pres_rules.c:66]: ",
"get_pres_rules",
v15,
v16);
}
--dprint_crit;
}
}
}
if ( v21[0] )
{
func2(mem_lock);
qm_free(shm_block, v21[0]);
func3(mem_lock);
}
}
}
else
{
v8 = -7;
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(): can't build XCAP uri\n",
process_no,
v11,
v10,
"<core> [pres_rules.c:50]: ",
"get_pres_rules");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): can't build XCAP uri\n",
*((const char **)&log_level_info + 8),
"<core> [pres_rules.c:50]: ",
"get_pres_rules");
}
--dprint_crit;
v8 = -7;
}
}
return v8;
}

original_code:
int get_pres_rules(const str_t *username, const str_t *filename,
  xcap_query_params_t *xcap_params, cp_ruleset_t **dst)
{
 char *data = ((void *)0);
 int dsize = 0;
 char *uri = ((void *)0);
 int res = 0;
 if (dst) *dst = ((void *)0);
 uri = xcap_uri_for_users_document(xcap_doc_pres_rules,
    username, filename, xcap_params);
 if (!uri) {
  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(): " "can't build XCAP uri\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "50" "]: ") , __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 build XCAP uri\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "50" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "can't build XCAP uri\n", process_no, my_pid(), ("<core> [" "pres_rules.c" ":" "50" "]: ") , __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 build XCAP uri\n", ("<core> [" "pres_rules.c" ":" "50" "]: ") , __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 build XCAP uri\n", ("<core> [" "pres_rules.c" ":" "50" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return (-7);
 }
 res = xcap_query(uri, xcap_params, &data, &dsize);
 if (res != 0) {
  do { if (get_debug_level("core", (sizeof("core")-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(): " "XCAP problems for uri \'%s\'\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "56" "]: ") , __func__, uri); 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(): " "XCAP problems for uri \'%s\'\n", (log_level_info[((3)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "56" "]: ") , __func__, uri); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "XCAP problems for uri \'%s\'\n", process_no, my_pid(), ("<core> [" "pres_rules.c" ":" "56" "]: ") , __func__, uri); 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(): " "XCAP problems for uri \'%s\'\n", ("<core> [" "pres_rules.c" ":" "56" "]: ") , __func__, uri); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "XCAP problems for uri \'%s\'\n", ("<core> [" "pres_rules.c" ":" "56" "]: ") , __func__, uri); } } (dprint_crit--); } } while(0);
  if (data) do { futex_get(mem_lock); qm_free(shm_block, (data)); futex_release(mem_lock); }while(0);
  do { futex_get(mem_lock); qm_free(shm_block, (uri)); futex_release(mem_lock); }while(0);
  return (-7);
 }
 do { futex_get(mem_lock); qm_free(shm_block, (uri)); futex_release(mem_lock); }while(0);
 res = parse_pres_rules(data, dsize, dst);
 if (res != 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 occured during parsing pres-rules for %.*s!\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "66" "]: ") , __func__, ((username)?(username)->len:0), username ? username->s : ""); 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 occured during parsing pres-rules for %.*s!\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "66" "]: ") , __func__, ((username)?(username)->len:0), username ? username->s : ""); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Error occured during parsing pres-rules for %.*s!\n", process_no, my_pid(), ("<core> [" "pres_rules.c" ":" "66" "]: ") , __func__, ((username)?(username)->len:0), username ? username->s : ""); 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 occured during parsing pres-rules for %.*s!\n", ("<core> [" "pres_rules.c" ":" "66" "]: ") , __func__, ((username)?(username)->len:0), username ? username->s : ""); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Error occured during parsing pres-rules for %.*s!\n", ("<core> [" "pres_rules.c" ":" "66" "]: ") , __func__, ((username)?(username)->len:0), username ? username->s : ""); } } (dprint_crit--); } } while(0);
 }
 if (data) do { futex_get(mem_lock); qm_free(shm_block, (data)); futex_release(mem_lock); }while(0);
 return res;
}

canonical_original_code:
int get_pres_rules(struct _str *username, struct _str *filename, struct xcap_query_params_t *xcap_params, struct cp_ruleset_t **dst)
{
 char *data = ((void *)0);
 int dsize = 0;
 char *uri = ((void *)0);
 int res = 0;
 if (dst) *dst = ((void *)0);
 uri = xcap_uri_for_users_document(xcap_doc_pres_rules,
    username, filename, xcap_params);
 if (!uri) {
  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(): " "can't build XCAP uri\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "50" "]: ") , __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 build XCAP uri\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "50" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "can't build XCAP uri\n", process_no, my_pid(), ("<core> [" "pres_rules.c" ":" "50" "]: ") , __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 build XCAP uri\n", ("<core> [" "pres_rules.c" ":" "50" "]: ") , __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 build XCAP uri\n", ("<core> [" "pres_rules.c" ":" "50" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return (-7);
 }
 res = xcap_query(uri, xcap_params, &data, &dsize);
 if (res != 0) {
  do { if (get_debug_level("core", (sizeof("core")-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(): " "XCAP problems for uri \'%s\'\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "56" "]: ") , __func__, uri); 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(): " "XCAP problems for uri \'%s\'\n", (log_level_info[((3)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "56" "]: ") , __func__, uri); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "XCAP problems for uri \'%s\'\n", process_no, my_pid(), ("<core> [" "pres_rules.c" ":" "56" "]: ") , __func__, uri); 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(): " "XCAP problems for uri \'%s\'\n", ("<core> [" "pres_rules.c" ":" "56" "]: ") , __func__, uri); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "XCAP problems for uri \'%s\'\n", ("<core> [" "pres_rules.c" ":" "56" "]: ") , __func__, uri); } } (dprint_crit--); } } while(0);
  if (data) do { futex_get(mem_lock); qm_free(shm_block, (data)); futex_release(mem_lock); }while(0);
  do { futex_get(mem_lock); qm_free(shm_block, (uri)); futex_release(mem_lock); }while(0);
  return (-7);
 }
 do { futex_get(mem_lock); qm_free(shm_block, (uri)); futex_release(mem_lock); }while(0);
 res = parse_pres_rules(data, dsize, dst);
 if (res != 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 occured during parsing pres-rules for %.*s!\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "66" "]: ") , __func__, ((username)?(username)->len:0), username ? username->s : ""); 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 occured during parsing pres-rules for %.*s!\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "pres_rules.c" ":" "66" "]: ") , __func__, ((username)?(username)->len:0), username ? username->s : ""); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Error occured during parsing pres-rules for %.*s!\n", process_no, my_pid(), ("<core> [" "pres_rules.c" ":" "66" "]: ") , __func__, ((username)?(username)->len:0), username ? username->s : ""); 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 occured during parsing pres-rules for %.*s!\n", ("<core> [" "pres_rules.c" ":" "66" "]: ") , __func__, ((username)?(username)->len:0), username ? username->s : ""); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Error occured during parsing pres-rules for %.*s!\n", ("<core> [" "pres_rules.c" ":" "66" "]: ") , __func__, ((username)?(username)->len:0), username ? username->s : ""); } } (dprint_crit--); } } while(0);
 }
 if (data) do { futex_get(mem_lock); qm_free(shm_block, (data)); futex_release(mem_lock); }while(0);
 return res;
}

variable_types:
username
struct _str { char *s; int len; } *

variable_types:
filename
struct _str *

variable_types: struct xcap_query_params_t { struct _str xcap_root; struct _str auth_user; struct _str auth_pass; int enable_unverified_ssl_peer; } *

variable_types: struct cp_ruleset_t { struct _cp_rule_t { struct _cp_rule_t *next; struct cp_conditions_t { struct cp_validity_t { long from; long to; } *validity; struct cp_identity_t { struct _cp_id_t { struct _cp_id_t *next; struct _str entity; } *ids; struct _cp_domain_t { struct _cp_domain_t *next; struct _str domain; } *domains; struct _cp_except_t { struct _cp_except_t *next; struct _str entity; } *excepts; struct cp_any_identity_t { struct _cp_domain_t *domains; struct _cp_except_domain_t { struct _cp_except_domain_t *next; struct _str domain; } *except_domains; } *any_identity; } *identity; struct _cp_sphere_t { struct _cp_sphere_t *next; struct _str value; } *spheres; } *conditions; struct cp_actions_t { struct _cp_unknown_t { struct _cp_unknown_t *next; char data[1]; } *unknown; } *actions; struct cp_transformations_t { struct _cp_unknown_t *unknown; } *transformations; struct _str id; } *rules; } **

variable_types:
data
char *

variable_types: dsize int

variable_types:
uri
char *

variable_types: res int

user_defined_types: struct cp_ruleset_t { struct _cp_rule_t *rules; }

user_defined_types: struct _cp_rule_t { struct _cp_rule_t *next; struct cp_conditions_t *conditions; struct cp_actions_t *actions; struct cp_transformations_t *transformations; struct _str id; }

user_defined_types: struct cp_conditions_t { struct cp_validity_t *validity; struct cp_identity_t *identity; struct _cp_sphere_t *spheres; }

user_defined_types: struct cp_identity_t { struct _cp_id_t *ids; struct _cp_domain_t *domains; struct _cp_except_t *excepts; struct cp_any_identity_t *any_identity; }

user_defined_types: struct cp_any_identity_t { struct _cp_domain_t *domains; struct _cp_except_domain_t *except_domains; }