decompiled_code:
__int64 xml_add_events()
{
unsigned int v0; // er12
const char *v2; // rbx
unsigned int v3; // eax
struct _IO_FILE *v4; // rdi
__int64 v5; // rdx
const char *v6; // r8
const char *v7; // r9
const char *v8; // rbp
unsigned int v9; // eax
struct _IO_FILE *v10; // rdi
__int64 v11; // rdx
__int64 v12; // rcx
const char *v13; // r9
const char *v14; // rbx
unsigned int v15; // eax
struct _IO_FILE *v16; // rdi
const char *v17; // r9
const char *v18; // r13
unsigned int v19; // eax
struct _IO_FILE *v20; // rdi
__int64 v21; // r12
unsigned int v22; // eax
const char *v23; // r9
__int64 v24; // rcx
__int64 v25; // r10
__int64 v26; // r8
const char *v27; // rsi
__int64 v28; // rdx
struct _IO_FILE *v29; // rdi
__int64 v30; // rdx
__int64 v31; // rcx
__int64 v32; // r12
unsigned int v33; // eax
__int64 v34; // r9
__int64 v35; // r12
__int64 v36; // rax
__int64 v37; // rbp
__int64 v38; // rax
__int64 v39; // [rsp-10h] [rbp-D8h]
__int64 v40; // [rsp-10h] [rbp-D8h]
__int64 v41; // [rsp-8h] [rbp-D0h]
__int64 v42; // [rsp-8h] [rbp-D0h]
const char *v43; // [rsp+0h] [rbp-C8h] BYREF
__int64 v44[18]; // [rsp+8h] [rbp-C0h] BYREF

if ( !disable_presence )
{
memset(v44, 0, sizeof(v44));
v44[2] = (__int64)"application/pidf+xml";
v43 = "presence";
LODWORD(v44[0]) = 8;
LODWORD(v44[3]) = 20;
HIDWORD(v44[5]) = 1;
v44[8] = (__int64)&pres_apply_auth;
v44[9] = (__int64)&pres_watcher_allowed;
v44[10] = (__int64)&pres_agg_nbody;
v44[11] = (__int64)xml_publ_handl;
v44[13] = (__int64)&free_xml_body;
v44[4] = 0x200000E10LL;
v44[6] = (__int64)&pres_get_rules_doc;
v44[7] = (__int64)&pres_get_pidf_doc;
if ( (int)pres_add_event(&v43) < 0 )
{
if ( (int)get_debug_level("presence_xml", 12LL) < -1 || dprint_crit )
return (unsigned int)-1;
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v37 = *((_QWORD *)&log_level_info + 8);
v38 = my_pid();
v23 = "presence_xml [add_events.c:76]: ";
v27 = "%2d(%d) %s: %s%s(): while adding event presence\n";
v24 = (unsigned int)v38;
v26 = v37;
v42 = v38;
v28 = process_no;
goto LABEL_68;
}
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): while adding event presence\n",
*((const char **)&log_level_info + 8),
"presence_xml [add_events.c:76]: ",
"xml_add_events");
goto LABEL_51;
}
if ( (int)get_debug_level("presence_xml", 12LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v2 = (const char *)*((_QWORD *)&log_level_info + 16);
v3 = my_pid();
v4 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): added 'presence' event to presence module\n",
process_no,
v3,
v2,
"presence_xml [add_events.c:79]: ",
"xml_add_events");
if ( log_color )
dprint_color_reset(
v4,
"%2d(%d) %s: %s%s(): added 'presence' event to presence module\n",
v5,
log_color,
v6,
v7,
v43);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): added 'presence' event to presence module\n",
*((const char **)&log_level_info + 16),
"presence_xml [add_events.c:79]: ",
"xml_add_events");
}
--dprint_crit;
}
}
if ( !disable_winfo )
{
memset(v44, 0, sizeof(v44));
v43 = "presence.winfo";
LODWORD(v44[0]) = 14;
v44[2] = (__int64)"application/watcherinfo+xml";
LODWORD(v44[3]) = 27;
v44[13] = (__int64)&free_xml_body;
v44[4] = 0x100000E10LL;
if ( (int)pres_add_event(&v43) < 0 )
{
if ( (int)get_debug_level("presence_xml", 12LL) < -1 || dprint_crit )
return (unsigned int)-1;
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v32 = *((_QWORD *)&log_level_info + 8);
v33 = my_pid();
v27 = "%2d(%d) %s: %s%s(): while adding event presence.winfo\n";
v42 = v34;
v24 = v33;
v23 = "presence_xml [add_events.c:96]: ";
v26 = v32;
v28 = process_no;
goto LABEL_68;
}
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): while adding event presence.winfo\n",
*((const char **)&log_level_info + 8),
"presence_xml [add_events.c:96]: ",
"xml_add_events");
goto LABEL_51;
}
if ( (int)get_debug_level("presence_xml", 12LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v14 = (const char *)*((_QWORD *)&log_level_info + 16);
v15 = my_pid();
v16 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): added 'presence.winfo' event to presence module\n",
process_no,
v15,
v14,
"presence_xml [add_events.c:99]: ",
"xml_add_events");
if ( log_color )
dprint_color_reset(
v16,
"%2d(%d) %s: %s%s(): added 'presence.winfo' event to presence module\n",
v39,
v41,
(const char *)log_color,
v17,
v43);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): added 'presence.winfo' event to presence module\n",
*((const char **)&log_level_info + 16),
"presence_xml [add_events.c:99]: ",
"xml_add_events");
}
--dprint_crit;
}
}
if ( disable_bla )
goto LABEL_4;
memset(v44, 0, sizeof(v44));
v43 = "dialog;sla";
LODWORD(v44[0]) = 10;
v44[11] = (__int64)xml_publ_handl;
v44[2] = (__int64)"application/dialog-info+xml";
LODWORD(v44[3]) = 27;
v44[13] = (__int64)&free_xml_body;
v44[4] = 0x200000E10LL;
LODWORD(v44[5]) = 1;
if ( (int)pres_add_event(&v43) < 0 )
{
if ( (int)get_debug_level("presence_xml", 12LL) < -1 || dprint_crit )
return (unsigned int)-1;
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v35 = *((_QWORD *)&log_level_info + 8);
v36 = my_pid();
v23 = "presence_xml [add_events.c:117]: ";
v24 = (unsigned int)v36;
v26 = v35;
v27 = "%2d(%d) %s: %s%s(): while adding event dialog;sla\n";
v42 = v36;
v28 = process_no;
goto LABEL_68;
}
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): while adding event dialog;sla\n",
*((const char **)&log_level_info + 8),
"presence_xml [add_events.c:117]: ",
"xml_add_events");
LABEL_51:
--dprint_crit;
return (unsigned int)-1;
}
if ( (int)get_debug_level("presence_xml", 12LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v8 = (const char *)*((_QWORD *)&log_level_info + 16);
v9 = my_pid();
v10 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): added 'dialog;sla' event to presence module\n",
process_no,
v9,
v8,
"presence_xml [add_events.c:120]: ",
"xml_add_events");
if ( log_color )
dprint_color_reset(
v10,
"%2d(%d) %s: %s%s(): added 'dialog;sla' event to presence module\n",
v11,
v12,
(const char *)log_color,
v13,
v43);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): added 'dialog;sla' event to presence module\n",
*((const char **)&log_level_info + 16),
"presence_xml [add_events.c:120]: ",
"xml_add_events");
}
--dprint_crit;
}
LABEL_4:
if ( disable_xcapdiff )
return 0;
memset(v44, 0, sizeof(v44));
v43 = "xcap-diff";
LODWORD(v44[0]) = 9;
v44[2] = (__int64)"application/xcap-diff+xml";
LODWORD(v44[3]) = 25;
v44[4] = 0x200000E10LL;
if ( (int)pres_add_event(&v43) < 0 )
{
if ( (int)get_debug_level("presence_xml", 12LL) < -1 || dprint_crit )
return (unsigned int)-1;
++dprint_crit;
if ( !log_stderr )
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): while adding event xcap-diff\n",
*((const char **)&log_level_info + 8),
"presence_xml [add_events.c:136]: ",
"xml_add_events");
goto LABEL_51;
}
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v21 = *((_QWORD *)&log_level_info + 8);
v22 = my_pid();
v23 = "presence_xml [add_events.c:136]: ";
v24 = v22;
v42 = v25;
v26 = v21;
v27 = "%2d(%d) %s: %s%s(): while adding event xcap-diff\n";
v28 = process_no;
LABEL_68:
v29 = stderr;
fprintf(stderr, v27, v28, v24, v26, v23, "xml_add_events");
if ( log_color )
dprint_color_reset(v29, v27, v30, v31, v40, v42);
goto LABEL_51;
}
if ( (int)get_debug_level("presence_xml", 12LL) <= 2 )
return 0;
v0 = dprint_crit;
if ( dprint_crit )
return 0;
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v18 = (const char *)*((_QWORD *)&log_level_info + 16);
v19 = my_pid();
v20 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): added 'xcap-diff' event to presence module\n",
process_no,
v19,
v18,
"presence_xml [add_events.c:139]: ",
"xml_add_events");
if ( log_color )
dprint_color_reset(v20, (const char *)log_color);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): added 'xcap-diff' event to presence module\n",
*((const char **)&log_level_info + 16),
"presence_xml [add_events.c:139]: ",
"xml_add_events");
}
--dprint_crit;
return v0;
}

canonical_decompiled_code:
__int64 func1()
{
unsigned int v0; // er12
const char *v2; // rbx
unsigned int v3; // eax
struct _IO_FILE *v4; // rdi
__int64 v5; // rdx
const char *v6; // r8
const char *v7; // r9
const char *v8; // rbp
unsigned int v9; // eax
struct _IO_FILE *v10; // rdi
__int64 v11; // rdx
__int64 v12; // rcx
const char *v13; // r9
const char *v14; // rbx
unsigned int v15; // eax
struct _IO_FILE *v16; // rdi
const char *v17; // r9
const char *v18; // r13
unsigned int v19; // eax
struct _IO_FILE *v20; // rdi
__int64 v21; // r12
unsigned int v22; // eax
const char *v23; // r9
__int64 v24; // rcx
__int64 v25; // r10
__int64 v26; // r8
const char *v27; // rsi
__int64 v28; // rdx
struct _IO_FILE *v29; // rdi
__int64 v30; // rdx
__int64 v31; // rcx
__int64 v32; // r12
unsigned int v33; // eax
__int64 v34; // r9
__int64 v35; // r12
__int64 v36; // rax
__int64 v37; // rbp
__int64 v38; // rax
__int64 v39; // [rsp-10h] [rbp-D8h]
__int64 v40; // [rsp-10h] [rbp-D8h]
__int64 v41; // [rsp-8h] [rbp-D0h]
__int64 v42; // [rsp-8h] [rbp-D0h]
const char *v43; // [rsp+0h] [rbp-C8h] BYREF
__int64 v44[18]; // [rsp+8h] [rbp-C0h] BYREF

if ( !disable_presence )
{
memset(v44, 0, sizeof(v44));
v44[2] = (__int64)"application/pidf+xml";
v43 = "presence";
LODWORD(v44[0]) = 8;
LODWORD(v44[3]) = 20;
HIDWORD(v44[5]) = 1;
v44[8] = (__int64)&pres_apply_auth;
v44[9] = (__int64)&pres_watcher_allowed;
v44[10] = (__int64)&pres_agg_nbody;
v44[11] = (__int64)xml_publ_handl;
v44[13] = (__int64)&free_xml_body;
v44[4] = 0x200000E10LL;
v44[6] = (__int64)&pres_get_rules_doc;
v44[7] = (__int64)&pres_get_pidf_doc;
if ( (int)pres_add_event(&v43) < 0 )
{
if ( (int)get_debug_level("presence_xml", 12LL) < -1 || dprint_crit )
return (unsigned int)-1;
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v37 = *((_QWORD *)&log_level_info + 8);
v38 = my_pid();
v23 = "presence_xml [add_events.c:76]: ";
v27 = "%2d(%d) %s: %s%s(): while adding event presence\n";
v24 = (unsigned int)v38;
v26 = v37;
v42 = v38;
v28 = process_no;
goto LABEL_68;
}
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): while adding event presence\n",
*((const char **)&log_level_info + 8),
"presence_xml [add_events.c:76]: ",
"xml_add_events");
goto LABEL_51;
}
if ( (int)get_debug_level("presence_xml", 12LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v2 = (const char *)*((_QWORD *)&log_level_info + 16);
v3 = my_pid();
v4 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): added 'presence' event to presence module\n",
process_no,
v3,
v2,
"presence_xml [add_events.c:79]: ",
"xml_add_events");
if ( log_color )
dprint_color_reset(
v4,
"%2d(%d) %s: %s%s(): added 'presence' event to presence module\n",
v5,
log_color,
v6,
v7,
v43);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): added 'presence' event to presence module\n",
*((const char **)&log_level_info + 16),
"presence_xml [add_events.c:79]: ",
"xml_add_events");
}
--dprint_crit;
}
}
if ( !disable_winfo )
{
memset(v44, 0, sizeof(v44));
v43 = "presence.winfo";
LODWORD(v44[0]) = 14;
v44[2] = (__int64)"application/watcherinfo+xml";
LODWORD(v44[3]) = 27;
v44[13] = (__int64)&free_xml_body;
v44[4] = 0x100000E10LL;
if ( (int)pres_add_event(&v43) < 0 )
{
if ( (int)get_debug_level("presence_xml", 12LL) < -1 || dprint_crit )
return (unsigned int)-1;
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v32 = *((_QWORD *)&log_level_info + 8);
v33 = my_pid();
v27 = "%2d(%d) %s: %s%s(): while adding event presence.winfo\n";
v42 = v34;
v24 = v33;
v23 = "presence_xml [add_events.c:96]: ";
v26 = v32;
v28 = process_no;
goto LABEL_68;
}
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): while adding event presence.winfo\n",
*((const char **)&log_level_info + 8),
"presence_xml [add_events.c:96]: ",
"xml_add_events");
goto LABEL_51;
}
if ( (int)get_debug_level("presence_xml", 12LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v14 = (const char *)*((_QWORD *)&log_level_info + 16);
v15 = my_pid();
v16 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): added 'presence.winfo' event to presence module\n",
process_no,
v15,
v14,
"presence_xml [add_events.c:99]: ",
"xml_add_events");
if ( log_color )
dprint_color_reset(
v16,
"%2d(%d) %s: %s%s(): added 'presence.winfo' event to presence module\n",
v39,
v41,
(const char *)log_color,
v17,
v43);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): added 'presence.winfo' event to presence module\n",
*((const char **)&log_level_info + 16),
"presence_xml [add_events.c:99]: ",
"xml_add_events");
}
--dprint_crit;
}
}
if ( disable_bla )
goto LABEL_4;
memset(v44, 0, sizeof(v44));
v43 = "dialog;sla";
LODWORD(v44[0]) = 10;
v44[11] = (__int64)xml_publ_handl;
v44[2] = (__int64)"application/dialog-info+xml";
LODWORD(v44[3]) = 27;
v44[13] = (__int64)&free_xml_body;
v44[4] = 0x200000E10LL;
LODWORD(v44[5]) = 1;
if ( (int)pres_add_event(&v43) < 0 )
{
if ( (int)get_debug_level("presence_xml", 12LL) < -1 || dprint_crit )
return (unsigned int)-1;
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v35 = *((_QWORD *)&log_level_info + 8);
v36 = my_pid();
v23 = "presence_xml [add_events.c:117]: ";
v24 = (unsigned int)v36;
v26 = v35;
v27 = "%2d(%d) %s: %s%s(): while adding event dialog;sla\n";
v42 = v36;
v28 = process_no;
goto LABEL_68;
}
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): while adding event dialog;sla\n",
*((const char **)&log_level_info + 8),
"presence_xml [add_events.c:117]: ",
"xml_add_events");
LABEL_51:
--dprint_crit;
return (unsigned int)-1;
}
if ( (int)get_debug_level("presence_xml", 12LL) > 2 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v8 = (const char *)*((_QWORD *)&log_level_info + 16);
v9 = my_pid();
v10 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): added 'dialog;sla' event to presence module\n",
process_no,
v9,
v8,
"presence_xml [add_events.c:120]: ",
"xml_add_events");
if ( log_color )
dprint_color_reset(
v10,
"%2d(%d) %s: %s%s(): added 'dialog;sla' event to presence module\n",
v11,
v12,
(const char *)log_color,
v13,
v43);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): added 'dialog;sla' event to presence module\n",
*((const char **)&log_level_info + 16),
"presence_xml [add_events.c:120]: ",
"xml_add_events");
}
--dprint_crit;
}
LABEL_4:
if ( disable_xcapdiff )
return 0;
memset(v44, 0, sizeof(v44));
v43 = "xcap-diff";
LODWORD(v44[0]) = 9;
v44[2] = (__int64)"application/xcap-diff+xml";
LODWORD(v44[3]) = 25;
v44[4] = 0x200000E10LL;
if ( (int)pres_add_event(&v43) < 0 )
{
if ( (int)get_debug_level("presence_xml", 12LL) < -1 || dprint_crit )
return (unsigned int)-1;
++dprint_crit;
if ( !log_stderr )
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): while adding event xcap-diff\n",
*((const char **)&log_level_info + 8),
"presence_xml [add_events.c:136]: ",
"xml_add_events");
goto LABEL_51;
}
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v21 = *((_QWORD *)&log_level_info + 8);
v22 = my_pid();
v23 = "presence_xml [add_events.c:136]: ";
v24 = v22;
v42 = v25;
v26 = v21;
v27 = "%2d(%d) %s: %s%s(): while adding event xcap-diff\n";
v28 = process_no;
LABEL_68:
v29 = stderr;
fprintf(stderr, v27, v28, v24, v26, v23, "xml_add_events");
if ( log_color )
dprint_color_reset(v29, v27, v30, v31, v40, v42);
goto LABEL_51;
}
if ( (int)get_debug_level("presence_xml", 12LL) <= 2 )
return 0;
v0 = dprint_crit;
if ( dprint_crit )
return 0;
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v18 = (const char *)*((_QWORD *)&log_level_info + 16);
v19 = my_pid();
v20 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): added 'xcap-diff' event to presence module\n",
process_no,
v19,
v18,
"presence_xml [add_events.c:139]: ",
"xml_add_events");
if ( log_color )
dprint_color_reset(v20, (const char *)log_color);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): added 'xcap-diff' event to presence module\n",
*((const char **)&log_level_info + 16),
"presence_xml [add_events.c:139]: ",
"xml_add_events");
}
--dprint_crit;
return v0;
}

original_code:
int xml_add_events(void)
{
 pres_ev_t event;
 if (!disable_presence) {
  memset(&event, 0, sizeof(pres_ev_t));
  event.name.s= "presence";
  event.name.len= 8;
  event.content_type.s= "application/pidf+xml";
  event.content_type.len= 20;
  event.type= 1<< 1;
  event.req_auth= 1;
  event.apply_auth_nbody= pres_apply_auth;
  event.get_auth_status= pres_watcher_allowed;
  event.agg_nbody= pres_agg_nbody;
  event.evs_publ_handl= xml_publ_handl;
  event.free_body= free_xml_body;
  event.default_expires= 3600;
  event.get_rules_doc= pres_get_rules_doc;
  event.get_pidf_doc= pres_get_pidf_doc;
  if(pres_add_event(&event)< 0)
  {
   do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "while adding event presence\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "76" "]: ") , __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(): " "while adding event presence\n", (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "76" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "while adding event presence\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "76" "]: ") , __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(): " "while adding event presence\n", ("presence_xml" " [" "add_events.c" ":" "76" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "while adding event presence\n", ("presence_xml" " [" "add_events.c" ":" "76" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -1;
  }
  do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "added 'presence' event to presence module\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "79" "]: ") , __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(): " "added 'presence' event to presence module\n", (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "79" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "added 'presence' event to presence module\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "79" "]: ") , __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(): " "added 'presence' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "79" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "added 'presence' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "79" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 }
 if (!disable_winfo) {
  memset(&event, 0, sizeof(pres_ev_t));
  event.name.s= "presence.winfo";
  event.name.len= 14;
  event.content_type.s= "application/watcherinfo+xml";
  event.content_type.len= 27;
  event.type= 1<< 0;
  event.free_body= free_xml_body;
  event.default_expires= 3600;
  if(pres_add_event(&event)< 0)
  {
   do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "while adding event presence.winfo\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "96" "]: ") , __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(): " "while adding event presence.winfo\n", (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "96" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "while adding event presence.winfo\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "96" "]: ") , __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(): " "while adding event presence.winfo\n", ("presence_xml" " [" "add_events.c" ":" "96" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "while adding event presence.winfo\n", ("presence_xml" " [" "add_events.c" ":" "96" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -1;
  }
  do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "added 'presence.winfo' event to presence module\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "99" "]: ") , __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(): " "added 'presence.winfo' event to presence module\n", (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "99" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "added 'presence.winfo' event to presence module\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "99" "]: ") , __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(): " "added 'presence.winfo' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "99" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "added 'presence.winfo' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "99" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 }
 if (!disable_bla) {
  memset(&event, 0, sizeof(pres_ev_t));
  event.name.s= "dialog;sla";
  event.name.len= 10;
  event.etag_not_new= 1;
  event.evs_publ_handl= xml_publ_handl;
  event.content_type.s= "application/dialog-info+xml";
  event.content_type.len= 27;
  event.type= 1<< 1;
  event.free_body= free_xml_body;
  event.default_expires= 3600;
  if(pres_add_event(&event)< 0)
  {
   do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "while adding event dialog;sla\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "117" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "while adding event dialog;sla\n", (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "117" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "while adding event dialog;sla\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "117" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "while adding event dialog;sla\n", ("presence_xml" " [" "add_events.c" ":" "117" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "while adding event dialog;sla\n", ("presence_xml" " [" "add_events.c" ":" "117" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -1;
  }
  do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "added 'dialog;sla' event to presence module\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "120" "]: ") , __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(): " "added 'dialog;sla' event to presence module\n", (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "120" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "added 'dialog;sla' event to presence module\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "120" "]: ") , __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(): " "added 'dialog;sla' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "120" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "added 'dialog;sla' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "120" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 }
 if (!disable_xcapdiff) {
  memset(&event, 0, sizeof(pres_ev_t));
  event.name.s= "xcap-diff";
  event.name.len= 9;
  event.content_type.s= "application/xcap-diff+xml";
  event.content_type.len= 25;
  event.type= 1<< 1;
  event.default_expires= 3600;
  if(pres_add_event(&event)< 0)
  {
   do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "while adding event xcap-diff\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "136" "]: ") , __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(): " "while adding event xcap-diff\n", (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "136" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "while adding event xcap-diff\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "136" "]: ") , __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(): " "while adding event xcap-diff\n", ("presence_xml" " [" "add_events.c" ":" "136" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "while adding event xcap-diff\n", ("presence_xml" " [" "add_events.c" ":" "136" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -1;
  }
  do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "added 'xcap-diff' event to presence module\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "139" "]: ") , __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(): " "added 'xcap-diff' event to presence module\n", (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "139" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "added 'xcap-diff' event to presence module\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "139" "]: ") , __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(): " "added 'xcap-diff' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "139" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "added 'xcap-diff' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "139" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 }
 return 0;
}

canonical_original_code:
int xml_add_events()
{
 struct pres_ev event;
 if (!disable_presence) {
  memset(&event, 0, sizeof(pres_ev_t));
  event.name.s= "presence";
  event.name.len= 8;
  event.content_type.s= "application/pidf+xml";
  event.content_type.len= 20;
  event.type= 1<< 1;
  event.req_auth= 1;
  event.apply_auth_nbody= pres_apply_auth;
  event.get_auth_status= pres_watcher_allowed;
  event.agg_nbody= pres_agg_nbody;
  event.evs_publ_handl= xml_publ_handl;
  event.free_body= free_xml_body;
  event.default_expires= 3600;
  event.get_rules_doc= pres_get_rules_doc;
  event.get_pidf_doc= pres_get_pidf_doc;
  if(pres_add_event(&event)< 0)
  {
   do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "while adding event presence\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "76" "]: ") , __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(): " "while adding event presence\n", (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "76" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "while adding event presence\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "76" "]: ") , __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(): " "while adding event presence\n", ("presence_xml" " [" "add_events.c" ":" "76" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "while adding event presence\n", ("presence_xml" " [" "add_events.c" ":" "76" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -1;
  }
  do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "added 'presence' event to presence module\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "79" "]: ") , __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(): " "added 'presence' event to presence module\n", (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "79" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "added 'presence' event to presence module\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "79" "]: ") , __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(): " "added 'presence' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "79" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "added 'presence' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "79" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 }
 if (!disable_winfo) {
  memset(&event, 0, sizeof(pres_ev_t));
  event.name.s= "presence.winfo";
  event.name.len= 14;
  event.content_type.s= "application/watcherinfo+xml";
  event.content_type.len= 27;
  event.type= 1<< 0;
  event.free_body= free_xml_body;
  event.default_expires= 3600;
  if(pres_add_event(&event)< 0)
  {
   do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "while adding event presence.winfo\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "96" "]: ") , __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(): " "while adding event presence.winfo\n", (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "96" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "while adding event presence.winfo\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "96" "]: ") , __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(): " "while adding event presence.winfo\n", ("presence_xml" " [" "add_events.c" ":" "96" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "while adding event presence.winfo\n", ("presence_xml" " [" "add_events.c" ":" "96" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -1;
  }
  do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "added 'presence.winfo' event to presence module\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "99" "]: ") , __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(): " "added 'presence.winfo' event to presence module\n", (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "99" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "added 'presence.winfo' event to presence module\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "99" "]: ") , __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(): " "added 'presence.winfo' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "99" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "added 'presence.winfo' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "99" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 }
 if (!disable_bla) {
  memset(&event, 0, sizeof(pres_ev_t));
  event.name.s= "dialog;sla";
  event.name.len= 10;
  event.etag_not_new= 1;
  event.evs_publ_handl= xml_publ_handl;
  event.content_type.s= "application/dialog-info+xml";
  event.content_type.len= 27;
  event.type= 1<< 1;
  event.free_body= free_xml_body;
  event.default_expires= 3600;
  if(pres_add_event(&event)< 0)
  {
   do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "while adding event dialog;sla\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "117" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "while adding event dialog;sla\n", (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "117" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "while adding event dialog;sla\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "117" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "while adding event dialog;sla\n", ("presence_xml" " [" "add_events.c" ":" "117" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "while adding event dialog;sla\n", ("presence_xml" " [" "add_events.c" ":" "117" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -1;
  }
  do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "added 'dialog;sla' event to presence module\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "120" "]: ") , __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(): " "added 'dialog;sla' event to presence module\n", (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "120" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "added 'dialog;sla' event to presence module\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "120" "]: ") , __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(): " "added 'dialog;sla' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "120" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "added 'dialog;sla' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "120" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 }
 if (!disable_xcapdiff) {
  memset(&event, 0, sizeof(pres_ev_t));
  event.name.s= "xcap-diff";
  event.name.len= 9;
  event.content_type.s= "application/xcap-diff+xml";
  event.content_type.len= 25;
  event.type= 1<< 1;
  event.default_expires= 3600;
  if(pres_add_event(&event)< 0)
  {
   do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "while adding event xcap-diff\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "136" "]: ") , __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(): " "while adding event xcap-diff\n", (log_level_info[((-1)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "136" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "while adding event xcap-diff\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "136" "]: ") , __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(): " "while adding event xcap-diff\n", ("presence_xml" " [" "add_events.c" ":" "136" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "while adding event xcap-diff\n", ("presence_xml" " [" "add_events.c" ":" "136" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -1;
  }
  do { if (get_debug_level("presence_xml", (sizeof("presence_xml")-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(): " "added 'xcap-diff' event to presence module\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "139" "]: ") , __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(): " "added 'xcap-diff' event to presence module\n", (log_level_info[((3)) - (-5)].name), ("presence_xml" " [" "add_events.c" ":" "139" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "added 'xcap-diff' event to presence module\n", process_no, my_pid(), ("presence_xml" " [" "add_events.c" ":" "139" "]: ") , __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(): " "added 'xcap-diff' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "139" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "added 'xcap-diff' event to presence module\n", ("presence_xml" " [" "add_events.c" ":" "139" "]: ") , __func__); } } (dprint_crit--); } } while(0);
 }
 return 0;
}

variable_types: struct pres_ev { struct _str { char *s; int len; } name; struct event { enum event_type { EVENT_OTHER=0, EVENT_PRESENCE=1, EVENT_PRESENCE_WINFO=2, EVENT_SIP_PROFILE=3, EVENT_XCAP_CHANGE=4, EVENT_DIALOG=5, EVENT_MESSAGE_SUMMARY=6, EVENT_UA_PROFILE=7 } type; struct _str name; struct event_params { union param_hooks { struct contact_hooks { struct param { enum ptype { P_OTHER=0, P_Q=1, P_EXPIRES=2, P_METHODS=3, P_RECEIVED=4, P_TRANSPORT=5, P_LR=6, P_R2=7, P_MADDR=8, P_TTL=9, P_DSTIP=10, P_DSTPORT=11, P_INSTANCE=12, P_REG_ID=13, P_FTAG=14, P_CALL_ID=15, P_FROM_TAG=16, P_TO_TAG=17, P_ISD=18, P_SLA=19, P_MA=20, P_OB=21 } type; struct _str name; struct _str body; int len; struct param *next; } *expires; struct param *q; struct param *methods; struct param *received; struct param *instance; struct param *reg_id; struct param *ob; } contact; struct uri_hooks { struct param *transport; struct param *lr; struct param *r2; struct param *maddr; struct param *ttl; struct param *dstip; struct param *dstport; struct param *ftag; struct param *ob; } uri; struct event_dialog_hooks { struct param *call_id; struct param *from_tag; struct param *to_tag; struct param *include_session_description; struct param *sla; struct param *ma; } event_dialog; } hooks; struct param *list; } params; } *evp; struct _str content_type; int default_expires; int type; int etag_not_new; int req_auth; int (*get_rules_doc)(struct _str *user, struct _str *domain, struct _str **rules_doc); int (*get_pidf_doc)(struct _str *user, struct _str *domain, struct _str *file_uri, struct _str **rules_doc); int (*apply_auth_nbody)(struct _str *, struct subscription { struct _str pres_uri; struct _str to_user; struct _str to_domain; struct _str from_user; struct _str from_domain; struct _str watcher_user; struct _str watcher_domain; struct pres_ev *event; struct _str event_id; struct _str to_tag; struct _str from_tag; struct _str callid; struct _str sockinfo_str; unsigned int remote_cseq; unsigned int local_cseq; struct _str contact; struct _str local_contact; struct _str record_route; unsigned int expires; unsigned int status; struct _str reason; int version; int send_on_cback; int db_flag; struct _str *auth_rules_doc; int recv_event; int internal_update_flag; int updated; int updated_winfo; struct subscription *next; } *, struct _str **); int (*get_auth_status)(struct subscription *subs); struct _str *(*agg_nbody)(struct _str *pres_user, struct _str *pres_domain, struct _str **body_array, int n, int off_index); int (*evs_publ_handl)(struct sip_msg { unsigned int id; int pid; struct timeval { long tv_sec; long tv_usec; } tval; struct snd_flags { unsigned char f; unsigned char blst_imask; } fwd_send_flags; struct snd_flags rpl_send_flags; struct msg_start { int type; int len; union { struct { struct _str method; struct _str uri; struct _str version; int method_value; } request; struct { struct _str version; struct _str status; struct _str reason; unsigned int statuscode; } reply; } u; } first_line; struct via_body { int error; struct _str hdr; struct _str name; struct _str version; struct _str transport; struct _str host; short proto; unsigned short port; struct _str port_str; struct _str params; struct _str comment; int bsize; struct via_param { int type; struct _str name; struct _str value; char *start; int size; struct via_param *next; } *param_lst; struct via_param *last_param; struct via_param *branch; struct _str tid; struct via_param *received; struct via_param *rport; struct via_param *i; struct via_param *alias; struct via_body *next; } *via1; struct via_body *via2; struct hdr_field { enum _hdr_types_t { HDR_ERROR_T=-1, HDR_OTHER_T=0, HDR_VIA_T=1, HDR_VIA1_T=1, HDR_VIA2_T=2, HDR_TO_T=3, HDR_FROM_T=4, HDR_CSEQ_T=5, HDR_CALLID_T=6, HDR_CONTACT_T=7, HDR_MAXFORWARDS_T=8, HDR_ROUTE_T=9, HDR_RECORDROUTE_T=10, HDR_CONTENTTYPE_T=11, HDR_CONTENTLENGTH_T=12, HDR_AUTHORIZATION_T=13, HDR_EXPIRES_T=14, HDR_PROXYAUTH_T=15, HDR_SUPPORTED_T=16, HDR_REQUIRE_T=17, HDR_PROXYREQUIRE_T=18, HDR_UNSUPPORTED_T=19, HDR_ALLOW_T=20, HDR_EVENT_T=21, HDR_ACCEPT_T=22, HDR_ACCEPTLANGUAGE_T=23, HDR_ORGANIZATION_T=24, HDR_PRIORITY_T=25, HDR_SUBJECT_T=26, HDR_USERAGENT_T=27, HDR_SERVER_T=28, HDR_CONTENTDISPOSITION_T=29, HDR_DIVERSION_T=30, HDR_RPID_T=31, HDR_REFER_TO_T=32, HDR_SIPIFMATCH_T=33, HDR_SESSIONEXPIRES_T=34, HDR_MIN_SE_T=35, HDR_SUBSCRIPTION_STATE_T=36, HDR_ACCEPTCONTACT_T=37, HDR_ALLOWEVENTS_T=38, HDR_CONTENTENCODING_T=39, HDR_REFERREDBY_T=40, HDR_REJECTCONTACT_T=41, HDR_REQUESTDISPOSITION_T=42, HDR_WWW_AUTHENTICATE_T=43, HDR_PROXY_AUTHENTICATE_T=44, HDR_DATE_T=45, HDR_IDENTITY_T=46, HDR_IDENTITY_INFO_T=47, HDR_RETRY_AFTER_T=48, HDR_PPI_T=49, HDR_PAI_T=50, HDR_PATH_T=51, HDR_PRIVACY_T=52, HDR_REASON_T=53, HDR_EOH_T=54 } type; struct _str name; struct _str body; int len; void *parsed; struct hdr_field *next; } *headers; struct hdr_field *last_header; unsigned long long parsed_flag; struct hdr_field *h_via1; struct hdr_field *h_via2; struct hdr_field *callid; struct hdr_field *to; struct hdr_field *cseq; struct hdr_field *from; struct hdr_field *contact; struct hdr_field *maxforwards; struct hdr_field *route; struct hdr_field *record_route; struct hdr_field *content_type; struct hdr_field *content_length; struct hdr_field *authorization; struct hdr_field *expires; struct hdr_field *proxy_auth; struct hdr_field *supported; struct hdr_field *require; struct hdr_field *proxy_require; struct hdr_field *unsupported; struct hdr_field *allow; struct hdr_field *event; struct hdr_field *accept; struct hdr_field *accept_language; struct hdr_field *organization; struct hdr_field *priority; struct hdr_field *subject; struct hdr_field *user_agent; struct hdr_field *server; struct hdr_field *content_disposition; struct hdr_field *diversion; struct hdr_field *rpid; struct hdr_field *refer_to; struct hdr_field *session_expires; struct hdr_field *min_se; struct hdr_field *sipifmatch; struct hdr_field *subscription_state; struct hdr_field *date; struct hdr_field *identity; struct hdr_field *identity_info; struct hdr_field *pai; struct hdr_field *ppi; struct hdr_field *path; struct hdr_field *privacy; struct msg_body { enum msg_body_type { MSG_BODY_UNKNOWN=0, MSG_BODY_SDP=1 } type; void (*free)(struct msg_body **ptr); } *body; char *eoh; char *unparsed; struct receive_info { struct ip_addr { unsigned int af; unsigned int len; union { unsigned long addrl[-1]; unsigned int addr32[4]; unsigned short addr16[8]; unsigned char addr[16]; } u; } src_ip; struct ip_addr dst_ip; unsigned short src_port; unsigned short dst_port; int proto_reserved1; int proto_reserved2; union sockaddr_union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } s; struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } sin; struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; } sin6_addr; unsigned int sin6_scope_id; } sin6; } src_su; struct socket_info { int socket; struct _str name; struct ip_addr address; struct _str address_str; struct _str port_no_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union su; struct socket_info *next; struct socket_info *prev; unsigned short port_no; char proto; struct _str sock_str; struct addr_info { struct _str name; struct ip_addr address; struct _str address_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union su; struct addr_info *next; struct addr_info *prev; } *addr_info_lst; int workers; int workers_tcpidx; struct advertise_info { struct _str name; unsigned short port_no; struct _str port_no_str; struct _str address_str; struct ip_addr address; struct _str sock_str; } useinfo; } *bind_address; char proto; } rcv; char *buf; unsigned int len; struct _str new_uri; struct _str dst_uri; int parsed_uri_ok; struct sip_uri { struct _str user; struct _str passwd; struct _str host; struct _str port; struct _str params; struct _str sip_params; struct _str headers; unsigned short port_no; unsigned short proto; enum _uri_type { ERROR_URI_T=0, SIP_URI_T=1, SIPS_URI_T=2, TEL_URI_T=3, TELS_URI_T=4, URN_URI_T=5 } type; enum _uri_flags { URI_USER_NORMALIZE=1, URI_SIP_USER_PHONE=2 } flags; struct _str transport; struct _str ttl; struct _str user_param; struct _str maddr; struct _str method; struct _str lr; struct _str r2; struct _str gr; struct _str transport_val; struct _str ttl_val; struct _str user_param_val; struct _str maddr_val; struct _str method_val; struct _str lr_val; struct _str r2_val; struct _str gr_val; } parsed_uri; int parsed_orig_ruri_ok; struct sip_uri parsed_orig_ruri; struct lump { enum _hdr_types_t { HDR_ERROR_T=-1, HDR_OTHER_T=0, HDR_VIA_T=1, HDR_VIA1_T=1, HDR_VIA2_T=2, HDR_TO_T=3, HDR_FROM_T=4, HDR_CSEQ_T=5, HDR_CALLID_T=6, HDR_CONTACT_T=7, HDR_MAXFORWARDS_T=8, HDR_ROUTE_T=9, HDR_RECORDROUTE_T=10, HDR_CONTENTTYPE_T=11, HDR_CONTENTLENGTH_T=12, HDR_AUTHORIZATION_T=13, HDR_EXPIRES_T=14, HDR_PROXYAUTH_T=15, HDR_SUPPORTED_T=16, HDR_REQUIRE_T=17, HDR_PROXYREQUIRE_T=18, HDR_UNSUPPORTED_T=19, HDR_ALLOW_T=20, HDR_EVENT_T=21, HDR_ACCEPT_T=22, HDR_ACCEPTLANGUAGE_T=23, HDR_ORGANIZATION_T=24, HDR_PRIORITY_T=25, HDR_SUBJECT_T=26, HDR_USERAGENT_T=27, HDR_SERVER_T=28, HDR_CONTENTDISPOSITION_T=29, HDR_DIVERSION_T=30, HDR_RPID_T=31, HDR_REFER_TO_T=32, HDR_SIPIFMATCH_T=33, HDR_SESSIONEXPIRES_T=34, HDR_MIN_SE_T=35, HDR_SUBSCRIPTION_STATE_T=36, HDR_ACCEPTCONTACT_T=37, HDR_ALLOWEVENTS_T=38, HDR_CONTENTENCODING_T=39, HDR_REFERREDBY_T=40, HDR_REJECTCONTACT_T=41, HDR_REQUESTDISPOSITION_T=42, HDR_WWW_AUTHENTICATE_T=43, HDR_PROXY_AUTHENTICATE_T=44, HDR_DATE_T=45, HDR_IDENTITY_T=46, HDR_IDENTITY_INFO_T=47, HDR_RETRY_AFTER_T=48, HDR_PPI_T=49, HDR_PAI_T=50, HDR_PATH_T=51, HDR_PRIVACY_T=52, HDR_REASON_T=53, HDR_EOH_T=54 } type; enum lump_op { LUMP_NOP=0, LUMP_DEL=1, LUMP_ADD=2, LUMP_ADD_SUBST=3, LUMP_ADD_OPT=4 } op; union { int offset; enum lump_subst { SUBST_NOP=0, SUBST_RCV_IP=1, SUBST_SND_IP=2, SUBST_RCV_PORT=3, SUBST_SND_PORT=4, SUBST_RCV_PROTO=5, SUBST_SND_PROTO=6, SUBST_RCV_ALL=7, SUBST_SND_ALL=8 } subst; enum lump_conditions { COND_FALSE=0, COND_TRUE=1, COND_IF_DIFF_REALMS=2, COND_IF_DIFF_AF=3, COND_IF_DIFF_PROTO=4, COND_IF_DIFF_PORT=5, COND_IF_DIFF_IP=6, COND_IF_RAND=7 } cond; char *value; } u; int len; struct lump *before; struct lump *after; struct lump *next; enum lump_flag { LUMPFLAG_NONE=0, LUMPFLAG_DUPED=1, LUMPFLAG_SHMEM=2, LUMPFLAG_BRANCH=4, LUMPFLAG_COND_TRUE=8 } flags; } *add_rm; struct lump *body_lumps; struct lump_rpl { struct _str text; int flags; struct lump_rpl *next; } *reply_lump; char add_to_branch_s[-1]; int add_to_branch_len; unsigned int hash_index; unsigned int msg_flags; unsigned int flags; struct _str set_global_address; struct _str set_global_port; struct socket_info *force_send_socket; struct _str path_vec; struct _str instance; unsigned int reg_id; struct _str ruid; struct _str location_ua; struct msg_ldata { struct ocd_flow { int decoded; struct receive_info rcv; } flow; } ldv; } *); int (*evs_subs_handl)(struct sip_msg *); void (*free_body)(char *body); struct _str *(*aux_body_processing)(struct subscription *subs, struct _str *body); void (*aux_free_body)(char *body); struct pres_ev *wipeer; struct pres_ev *next; }

user_defined_types: struct pres_ev { struct _str name; struct event *evp; struct _str content_type; int default_expires; int type; int etag_not_new; int req_auth; int (*get_rules_doc)(struct _str *user, struct _str *domain, struct _str **rules_doc); int (*get_pidf_doc)(struct _str *user, struct _str *domain, struct _str *file_uri, struct _str **rules_doc); int (*apply_auth_nbody)(struct _str *, struct subscription *, struct _str **); int (*get_auth_status)(struct subscription *subs); struct _str *(*agg_nbody)(struct _str *pres_user, struct _str *pres_domain, struct _str **body_array, int n, int off_index); int (*evs_publ_handl)(struct sip_msg *); int (*evs_subs_handl)(struct sip_msg *); void (*free_body)(char *body); struct _str *(*aux_body_processing)(struct subscription *subs, struct _str *body); void (*aux_free_body)(char *body); struct pres_ev *wipeer; struct pres_ev *next; }

user_defined_types: struct sip_msg { unsigned int id; int pid; struct timeval tval; struct snd_flags fwd_send_flags; struct snd_flags rpl_send_flags; struct msg_start first_line; struct via_body *via1; struct via_body *via2; struct hdr_field *headers; struct hdr_field *last_header; unsigned long long parsed_flag; struct hdr_field *h_via1; struct hdr_field *h_via2; struct hdr_field *callid; struct hdr_field *to; struct hdr_field *cseq; struct hdr_field *from; struct hdr_field *contact; struct hdr_field *maxforwards; struct hdr_field *route; struct hdr_field *record_route; struct hdr_field *content_type; struct hdr_field *content_length; struct hdr_field *authorization; struct hdr_field *expires; struct hdr_field *proxy_auth; struct hdr_field *supported; struct hdr_field *require; struct hdr_field *proxy_require; struct hdr_field *unsupported; struct hdr_field *allow; struct hdr_field *event; struct hdr_field *accept; struct hdr_field *accept_language; struct hdr_field *organization; struct hdr_field *priority; struct hdr_field *subject; struct hdr_field *user_agent; struct hdr_field *server; struct hdr_field *content_disposition; struct hdr_field *diversion; struct hdr_field *rpid; struct hdr_field *refer_to; struct hdr_field *session_expires; struct hdr_field *min_se; struct hdr_field *sipifmatch; struct hdr_field *subscription_state; struct hdr_field *date; struct hdr_field *identity; struct hdr_field *identity_info; struct hdr_field *pai; struct hdr_field *ppi; struct hdr_field *path; struct hdr_field *privacy; struct msg_body *body; char *eoh; char *unparsed; struct receive_info rcv; char *buf; unsigned int len; struct _str new_uri; struct _str dst_uri; int parsed_uri_ok; struct sip_uri parsed_uri; int parsed_orig_ruri_ok; struct sip_uri parsed_orig_ruri; struct lump *add_rm; struct lump *body_lumps; struct lump_rpl *reply_lump; char add_to_branch_s[-1]; int add_to_branch_len; unsigned int hash_index; unsigned int msg_flags; unsigned int flags; struct _str set_global_address; struct _str set_global_port; struct socket_info *force_send_socket; struct _str path_vec; struct _str instance; unsigned int reg_id; struct _str ruid; struct _str location_ua; struct msg_ldata ldv; }

user_defined_types: struct receive_info { struct ip_addr src_ip; struct ip_addr dst_ip; unsigned short src_port; unsigned short dst_port; int proto_reserved1; int proto_reserved2; union sockaddr_union src_su; struct socket_info *bind_address; char proto; }

user_defined_types: struct sip_uri { struct _str user; struct _str passwd; struct _str host; struct _str port; struct _str params; struct _str sip_params; struct _str headers; unsigned short port_no; unsigned short proto; enum _uri_type type; enum _uri_flags flags; struct _str transport; struct _str ttl; struct _str user_param; struct _str maddr; struct _str method; struct _str lr; struct _str r2; struct _str gr; struct _str transport_val; struct _str ttl_val; struct _str user_param_val; struct _str maddr_val; struct _str method_val; struct _str lr_val; struct _str r2_val; struct _str gr_val; }

user_defined_types: struct msg_ldata { struct ocd_flow flow; }

user_defined_types: struct via_body { int error; struct _str hdr; struct _str name; struct _str version; struct _str transport; struct _str host; short proto; unsigned short port; struct _str port_str; struct _str params; struct _str comment; int bsize; struct via_param *param_lst; struct via_param *last_param; struct via_param *branch; struct _str tid; struct via_param *received; struct via_param *rport; struct via_param *i; struct via_param *alias; struct via_body *next; }

user_defined_types: struct msg_body { enum msg_body_type type; void (*free)(struct msg_body **ptr); }

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

user_defined_types: struct lump { enum _hdr_types_t type; enum lump_op op; union { int offset; enum lump_subst subst; enum lump_conditions cond; char *value; } u; int len; struct lump *before; struct lump *after; struct lump *next; enum lump_flag flags; }

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

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

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

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


repo: virtualolson/who

decompiled_code:
__int64 init_modules()
{
init_mod_Router();
init_mod_Core();
init_mod_Ranks();
init_mod_Logger();
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
init_mod_Router();
init_mod_Core();
init_mod_Ranks();
init_mod_Logger();
return 0LL;
}

original_code:
int init_modules(void)
{
    init_mod_Router();
    init_mod_Core();
    init_mod_Ranks();
    init_mod_Logger();
    return 0;
}

canonical_original_code:
int init_modules()
{
    init_mod_Router();
    init_mod_Core();
    init_mod_Ranks();
    init_mod_Logger();
    return 0;
}

return_type: int


decompiled_code:
__int64 __fastcall parse_to(__int64 a1, __int64 a2, __int64 a3)
{
return parse_addr_spec(a1, a2, a3, 0LL);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3)
{
return parse_addr_spec(a1, a2, a3, 0LL);
}

original_code:
char* parse_to(char* const buffer, const char* const end, struct to_body* const to_b)
{
 return parse_addr_spec(buffer, end, to_b, 0);
}

canonical_original_code:
char *parse_to(char *buffer, char *end, struct to_body *to_b)
{
 return parse_addr_spec(buffer, end, to_b, 0);
}

variable_types:
buffer
char *

variable_types:
end
char *

variable_types: struct to_body { int error; struct _str { char *s; int len; } body; struct _str uri; struct _str display; struct _str tag_value; struct sip_uri { struct _str user; struct _str passwd; struct _str host; struct _str port; struct _str params; struct _str sip_params; struct _str headers; unsigned short port_no; unsigned short proto; enum _uri_type { ERROR_URI_T=0, SIP_URI_T=1, SIPS_URI_T=2, TEL_URI_T=3, TELS_URI_T=4, URN_URI_T=5 } type; enum _uri_flags { URI_USER_NORMALIZE=1, URI_SIP_USER_PHONE=2 } flags; struct _str transport; struct _str ttl; struct _str user_param; struct _str maddr; struct _str method; struct _str lr; struct _str r2; struct _str gr; struct _str transport_val; struct _str ttl_val; struct _str user_param_val; struct _str maddr_val; struct _str method_val; struct _str lr_val; struct _str r2_val; struct _str gr_val; } parsed_uri; struct to_param { int type; struct _str name; struct _str value; struct to_param *next; } *param_lst; struct to_param *last_param; } *

return_type: char *

user_defined_types: struct to_body { int error; struct _str body; struct _str uri; struct _str display; struct _str tag_value; struct sip_uri parsed_uri; struct to_param *param_lst; struct to_param *last_param; }


decompiled_code:
int __fastcall sock_get_ttl(int a1)
{
int result; // eax
int optval; // [rsp+8h] [rbp-10h] BYREF
socklen_t optlen[3]; // [rsp+Ch] [rbp-Ch] BYREF

optlen[0] = 4;
result = getsockopt(a1, 0, 2, &optval, optlen);
if ( result != -1 )
result = optval;
return result;
}

canonical_decompiled_code:
int __fastcall func0(int a1)
{
int result; // eax
int optval; // [rsp+8h] [rbp-10h] BYREF
socklen_t optlen[3]; // [rsp+Ch] [rbp-Ch] BYREF

optlen[0] = 4;
result = getsockopt(a1, 0, 2, &optval, optlen);
if ( result != -1 )
result = optval;
return result;
}

original_code:
int sock_get_ttl(int sock)
{
 int ioptval;
 unsigned int ioptvallen;
 ioptvallen=sizeof(ioptval);
 if (getsockopt( sock, IPPROTO_IP, 2, (void*) &ioptval,
      &ioptvallen) == -1 )
 {
  return -1;
 }
 return ioptval;
}

canonical_original_code:
int sock_get_ttl(int sock)
{
 int ioptval;
 unsigned int ioptvallen;
 ioptvallen=sizeof(ioptval);
 if (getsockopt( sock, IPPROTO_IP, 2, (void *) &ioptval,
      &ioptvallen) == -1 )
 {
  return -1;
 }
 return ioptval;
}

variable_types: sock int

variable_types: ioptval int

variable_types:
ioptvallen
unsigned int


decompiled_code:
int __fastcall sock_set_ttl(int a1)
{
int result; // eax
int optval[3]; // [rsp+Ch] [rbp-Ch] BYREF

result = setsockopt(a1, 0, 2, optval, 4u);
if ( result != -1 )
result = optval[0];
return result;
}

canonical_decompiled_code:
int __fastcall func1(int a1)
{
int result; // eax
int optval[3]; // [rsp+Ch] [rbp-Ch] BYREF

result = setsockopt(a1, 0, 2, optval, 4u);
if ( result != -1 )
result = optval[0];
return result;
}

original_code:
int sock_set_ttl(int sock, int ttl)
{
 int ioptval;
 if (setsockopt( sock, IPPROTO_IP, 2, (void*) &ioptval,
     sizeof(ioptval)) == -1 )
  return -1;
 return ioptval;
}

canonical_original_code:
int sock_set_ttl(int sock, int ttl)
{
 int ioptval;
 if (setsockopt( sock, IPPROTO_IP, 2, (void *) &ioptval,
     sizeof(ioptval)) == -1 )
  return -1;
 return ioptval;
}

variable_types: ttl int


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_release(volatile __int32 *a1)
{
__int64 result; // rax
__int64 v2; // [rsp-10h] [rbp-18h]

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

canonical_decompiled_code:
__int64 __fastcall func1(volatile __int32 *a1)
{
__int64 result; // rax
__int64 v2; // [rsp-10h] [rbp-18h]

result = func0(a1, 0);
if ( (_DWORD)result == 2 )
{
syscall(202LL, a1, 1LL, 1LL, 0LL, 0LL, 0LL);
result = v2;
}
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));
 }
}

variable_types:
lock
struct atomic_t { int val; } *

return_type: void


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

result = atomic_cmpxchg_int_constprop_0(a1);
if ( (_DWORD)result )
{
if ( (_DWORD)result == 2 )
{
do
{
LABEL_24:
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_constprop_0(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = atomic_cmpxchg_int_constprop_0(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = atomic_cmpxchg_int_constprop_0(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = atomic_cmpxchg_int_constprop_0(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = atomic_cmpxchg_int_constprop_0(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = atomic_cmpxchg_int_constprop_0(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = atomic_cmpxchg_int_constprop_0(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = atomic_cmpxchg_int_constprop_0(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
if ( v2 == 7 )
{
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 func3(volatile signed __int32 *a1)
{
__int64 result; // rax
int v2; // ecx

result = func2(a1);
if ( (_DWORD)result )
{
if ( (_DWORD)result == 2 )
{
do
{
LABEL_24:
syscall(202LL, a1, 0LL, 2LL, 0LL, 0LL, 0LL);
result = func0(a1, 2);
}
while ( (_DWORD)result );
}
else
{
while ( 1 )
{
result = func2(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = func2(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = func2(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = func2(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = func2(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = func2(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = func2(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
result = func2(a1);
if ( !(_DWORD)result )
break;
if ( (_DWORD)result == 2 )
goto LABEL_24;
if ( v2 == 7 )
{
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: i int


decompiled_code:
__int64 __fastcall shm_malloc(unsigned int a1)
{
__int64 v1; // r12

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

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int a1)
{
__int64 v1; // r12

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

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

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

variable_types:
size
unsigned int

variable_types:
p
void *

return_type: void *


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

if ( a1 )
{
futex_get(mem_lock);
qm_free(shm_block, a1);
result = futex_release(mem_lock);
}
return result;
}

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

if ( a1 )
{
func3(mem_lock);
qm_free(shm_block, a1);
result = func1(mem_lock);
}
return result;
}

original_code:
void free_reference_counter_group(reference_counter_group_t *grp)
{
 int i;
 if (grp) {
  for (i = 0; i < grp->mutex_cnt; i++) {
   ;
  }
  do { futex_get(mem_lock); qm_free(shm_block, (grp)); futex_release(mem_lock); }while(0);
 }
}

canonical_original_code:
void free_reference_counter_group(struct reference_counter_group_t *grp)
{
 int i;
 if (grp) {
  for (i = 0; i < grp->mutex_cnt; i++) {
   ;
  }
  do { futex_get(mem_lock); qm_free(shm_block, (grp)); futex_release(mem_lock); }while(0);
 }
}

variable_types: struct reference_counter_group_t { int mutex_cnt; int mutex_to_assign; struct atomic_t { int val; } mutexes[1]; } *

user_defined_types: struct reference_counter_group_t { int mutex_cnt; int mutex_to_assign; struct atomic_t mutexes[1]; }


decompiled_code:
__int64 __fastcall add_reference(__int64 a1)
{
volatile signed __int32 *v2; // rdi
__int64 result; // rax
volatile __int32 *v4; // rdi

if ( a1 )
{
v2 = *(volatile signed __int32 **)(a1 + 8);
if ( v2 )
{
result = futex_get(v2);
v4 = *(volatile __int32 **)(a1 + 8);
++*(_DWORD *)a1;
if ( v4 )
result = futex_release(v4);
}
else
{
++*(_DWORD *)a1;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1)
{
volatile signed __int32 *v2; // rdi
__int64 result; // rax
volatile __int32 *v4; // rdi

if ( a1 )
{
v2 = *(volatile signed __int32 **)(a1 + 8);
if ( v2 )
{
result = func3(v2);
v4 = *(volatile __int32 **)(a1 + 8);
++*(_DWORD *)a1;
if ( v4 )
result = func1(v4);
}
else
{
++*(_DWORD *)a1;
}
}
return result;
}

original_code:
void add_reference(reference_counter_data_t *ref)
{
 if (ref) {
  if (ref->mutex) futex_get(ref->mutex);
  ref->cntr++;
  if (ref->mutex) futex_release(ref->mutex);
 }
}

canonical_original_code:
void add_reference(struct reference_counter_data_t *ref)
{
 if (ref) {
  if (ref->mutex) futex_get(ref->mutex);
  ref->cntr++;
  if (ref->mutex) futex_release(ref->mutex);
 }
}

variable_types: struct reference_counter_data_t { int cntr; struct atomic_t { int val; } *mutex; } *

user_defined_types: struct reference_counter_data_t { int cntr; struct atomic_t *mutex; }


decompiled_code:
__int64 __fastcall get_reference_count(_QWORD *a1)
{
unsigned int v1; // er12
volatile signed __int32 *v3; // rdi
volatile __int32 *v4; // rdi

v1 = 0;
if ( !a1 )
return v1;
v3 = (volatile signed __int32 *)a1[1];
if ( v3 )
{
futex_get(v3);
v4 = (volatile __int32 *)a1[1];
v1 = *(_DWORD *)a1;
if ( v4 )
futex_release(v4);
return v1;
}
return *(unsigned int *)a1;
}

canonical_decompiled_code:
__int64 __fastcall func9(_QWORD *a1)
{
unsigned int v1; // er12
volatile signed __int32 *v3; // rdi
volatile __int32 *v4; // rdi

v1 = 0;
if ( !a1 )
return v1;
v3 = (volatile signed __int32 *)a1[1];
if ( v3 )
{
func3(v3);
v4 = (volatile __int32 *)a1[1];
v1 = *(_DWORD *)a1;
if ( v4 )
func1(v4);
return v1;
}
return *(unsigned int *)a1;
}

original_code:
int get_reference_count(reference_counter_data_t *ref)
{
 int res = 0;
 if (ref) {
  if (ref->mutex) futex_get(ref->mutex);
  res = ref->cntr;
  if (ref->mutex) futex_release(ref->mutex);
 }
 return res;
}

canonical_original_code:
int get_reference_count(struct reference_counter_data_t *ref)
{
 int res = 0;
 if (ref) {
  if (ref->mutex) futex_get(ref->mutex);
  res = ref->cntr;
  if (ref->mutex) futex_release(ref->mutex);
 }
 return res;
}

variable_types: res int


decompiled_code:
_BOOL8 __fastcall remove_reference(__int64 a1)
{
_BOOL4 v1; // ebx
volatile signed __int32 *v3; // rdi
int v4; // ecx
volatile __int32 *v5; // rdi
int v7; // eax

v1 = 0;
if ( !a1 )
return v1;
v3 = *(volatile signed __int32 **)(a1 + 8);
if ( v3 )
{
futex_get(v3);
v4 = *(_DWORD *)a1;
v5 = *(volatile __int32 **)(a1 + 8);
if ( *(int *)a1 > 0 )
*(_DWORD *)a1 = --v4;
v1 = v4 == 0;
if ( v5 )
futex_release(v5);
return v1;
}
v7 = *(_DWORD *)a1;
if ( *(int *)a1 > 0 )
*(_DWORD *)a1 = --v7;
return v7 == 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func10(__int64 a1)
{
_BOOL4 v1; // ebx
volatile signed __int32 *v3; // rdi
int v4; // ecx
volatile __int32 *v5; // rdi
int v7; // eax

v1 = 0;
if ( !a1 )
return v1;
v3 = *(volatile signed __int32 **)(a1 + 8);
if ( v3 )
{
func3(v3);
v4 = *(_DWORD *)a1;
v5 = *(volatile __int32 **)(a1 + 8);
if ( *(int *)a1 > 0 )
*(_DWORD *)a1 = --v4;
v1 = v4 == 0;
if ( v5 )
func1(v5);
return v1;
}
v7 = *(_DWORD *)a1;
if ( *(int *)a1 > 0 )
*(_DWORD *)a1 = --v7;
return v7 == 0;
}

original_code:
int remove_reference(reference_counter_data_t *ref)
{
 int res = 0;
 if (ref) {
  if (ref->mutex) futex_get(ref->mutex);
  if (ref->cntr > 0) ref->cntr--;
  if (ref->cntr == 0) res = 1;
  if (ref->mutex) futex_release(ref->mutex);
 }
 return res;
}

canonical_original_code:
int remove_reference(struct reference_counter_data_t *ref)
{
 int res = 0;
 if (ref) {
  if (ref->mutex) futex_get(ref->mutex);
  if (ref->cntr > 0) ref->cntr--;
  if (ref->cntr == 0) res = 1;
  if (ref->mutex) futex_release(ref->mutex);
 }
 return res;
}


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

v1 = *(_QWORD *)(a1 + 64);
if ( !v1 )
return init_mi_tree(400LL, "bdb_reload missing db arg", 21LL);
if ( *(_QWORD *)(v1 + 40) )
return init_mi_tree(400LL, "Too few or too many arguments", 29LL);
if ( !*(_DWORD *)(v1 + 8) )
return init_mi_tree(400LL, "bdb_reload missing db arg", 21LL);
if ( (unsigned int)bdb_reload(*(_QWORD *)v1) )
result = init_mi_tree(500LL, "db_berkeley Reload Failed", 26LL);
else
result = init_mi_tree(200LL, "OK", 2LL);
return result;
}

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

v1 = *(_QWORD *)(a1 + 64);
if ( !v1 )
return init_mi_tree(400LL, "bdb_reload missing db arg", 21LL);
if ( *(_QWORD *)(v1 + 40) )
return init_mi_tree(400LL, "Too few or too many arguments", 29LL);
if ( !*(_DWORD *)(v1 + 8) )
return init_mi_tree(400LL, "bdb_reload missing db arg", 21LL);
if ( (unsigned int)bdb_reload(*(_QWORD *)v1) )
result = init_mi_tree(500LL, "db_berkeley Reload Failed", 26LL);
else
result = init_mi_tree(200LL, "OK", 2LL);
return result;
}

original_code:
struct mi_root* mi_bdb_reload(struct mi_root *cmd, void *param)
{
 struct mi_node *node;
 str *db_path;
 node = cmd->node.kids;
 if (node && node->next)
  return init_mi_tree( 400, "Too few or too many arguments", (sizeof("Too few or too many arguments")-1));
 db_path = &node->value;
 if (!db_path || db_path->len == 0)
  return init_mi_tree( 400, "bdb_reload missing db arg", 21);
 if (bdb_reload(db_path->s) == 0)
 {
  return init_mi_tree( 200, "OK", (sizeof("OK")-1));
 }
 else
 {
  return init_mi_tree( 500, "db_berkeley Reload Failed", 26);
 }
}

canonical_original_code:
struct mi_root *mi_bdb_reload(struct mi_root *cmd, void *param)
{
 struct mi_node *node;
 struct _str *db_path;
 node = cmd->node.kids;
 if (node && node->next)
  return init_mi_tree( 400, "Too few or too many arguments", (sizeof("Too few or too many arguments")-1));
 db_path = &node->value;
 if (!db_path || db_path->len == 0)
  return init_mi_tree( 400, "bdb_reload missing db arg", 21);
 if (bdb_reload(db_path->s) == 0)
 {
  return init_mi_tree( 200, "OK", (sizeof("OK")-1));
 }
 else
 {
  return init_mi_tree( 500, "db_berkeley Reload Failed", 26);
 }
}

variable_types:
cmd
struct mi_root *

variable_types:
param
void *

variable_types: struct mi_node { struct _str { char *s; int len; } value; struct _str name; struct mi_node *kids; struct mi_node *next; struct mi_node *last; struct mi_attr { struct _str name; struct _str value; struct mi_attr *next; } *attributes; } *

return_type: struct mi_root { unsigned int code; struct _str { char *s; int len; } reason; struct mi_handler { void (*handler_f)(struct mi_root *, struct mi_handler *, int); void *param; } *async_hdl; struct mi_node { struct _str value; struct _str name; struct mi_node *kids; struct mi_node *next; struct mi_node *last; struct mi_attr { struct _str name; struct _str value; struct mi_attr *next; } *attributes; } node; } *

user_defined_types: struct mi_node { struct _str value; struct _str name; struct mi_node *kids; struct mi_node *next; struct mi_node *last; struct mi_attr *attributes; }

user_defined_types: struct mi_root { unsigned int code; struct _str reason; struct mi_handler *async_hdl; struct mi_node node; }


decompiled_code:
__int64 __fastcall new_credentials(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rbx
__int64 result; // rax
int v4; // er8
const char *v5; // rbp
unsigned int v6; // eax
struct _IO_FILE *v7; // rdi
__int64 v8; // [rsp-10h] [rbp-28h]

v1 = qm_malloc(mem_block, 224LL);
if ( v1 )
{
v2 = v1;
init_dig_cred(v1 + 8);
*(_BYTE *)(v2 + 216) = 0;
result = 0LL;
*(_QWORD *)v2 = 0LL;
*(_QWORD *)(a1 + 48) = v2;
}
else
{
v4 = get_debug_level("core", 4LL);
result = 0xFFFFFFFFLL;
if ( v4 >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v5 = (const char *)*((_QWORD *)&log_level_info + 8);
v6 = my_pid();
v7 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): parse_credentials(): No memory left\n",
process_no,
v6,
v5,
"<core> [parser/digest/digest.c:45]: ",
"new_credentials");
if ( log_color )
dprint_color_reset(v7, "%2d(%d) %s: %s%s(): parse_credentials(): No memory left\n", v8);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): parse_credentials(): No memory left\n",
*((const char **)&log_level_info + 8),
"<core> [parser/digest/digest.c:45]: ",
"new_credentials");
}
result = 0xFFFFFFFFLL;
--dprint_crit;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rbx
__int64 result; // rax
int v4; // er8
const char *v5; // rbp
unsigned int v6; // eax
struct _IO_FILE *v7; // rdi
__int64 v8; // [rsp-10h] [rbp-28h]

v1 = qm_malloc(mem_block, 224LL);
if ( v1 )
{
v2 = v1;
init_dig_cred(v1 + 8);
*(_BYTE *)(v2 + 216) = 0;
result = 0LL;
*(_QWORD *)v2 = 0LL;
*(_QWORD *)(a1 + 48) = v2;
}
else
{
v4 = get_debug_level("core", 4LL);
result = 0xFFFFFFFFLL;
if ( v4 >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v5 = (const char *)*((_QWORD *)&log_level_info + 8);
v6 = my_pid();
v7 = stderr;
fprintf(
stderr,
"%2d(%d) %s: %s%s(): parse_credentials(): No memory left\n",
process_no,
v6,
v5,
"<core> [parser/digest/digest.c:45]: ",
"new_credentials");
if ( log_color )
dprint_color_reset(v7, "%2d(%d) %s: %s%s(): parse_credentials(): No memory left\n", v8);
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): parse_credentials(): No memory left\n",
*((const char **)&log_level_info + 8),
"<core> [parser/digest/digest.c:45]: ",
"new_credentials");
}
result = 0xFFFFFFFFLL;
--dprint_crit;
}
}
return result;
}

original_code:
static inline int new_credentials(struct hdr_field* _h)
{
 auth_body_t* b;
 b = (auth_body_t*)qm_malloc(mem_block, (sizeof(auth_body_t)));
 if (b == 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(): " "parse_credentials(): No memory left\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/digest/digest.c" ":" "45" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "parse_credentials(): No memory left\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/digest/digest.c" ":" "45" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "parse_credentials(): No memory left\n", process_no, my_pid(), ("<core> [" "parser/digest/digest.c" ":" "45" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_credentials(): No memory left\n", ("<core> [" "parser/digest/digest.c" ":" "45" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_credentials(): No memory left\n", ("<core> [" "parser/digest/digest.c" ":" "45" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 init_dig_cred(&(b->digest));
 b->stale = 0;
 b->authorized = 0;
 _h->parsed = (void*)b;
 return 0;
}

canonical_original_code:
static inline int new_credentials(struct hdr_field *_h)
{
 struct auth_body *b;
 b = (struct auth_body *)qm_malloc(mem_block, (sizeof(auth_body_t)));
 if (b == 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(): " "parse_credentials(): No memory left\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/digest/digest.c" ":" "45" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "parse_credentials(): No memory left\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/digest/digest.c" ":" "45" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "parse_credentials(): No memory left\n", process_no, my_pid(), ("<core> [" "parser/digest/digest.c" ":" "45" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_credentials(): No memory left\n", ("<core> [" "parser/digest/digest.c" ":" "45" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_credentials(): No memory left\n", ("<core> [" "parser/digest/digest.c" ":" "45" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 init_dig_cred(&(b->digest));
 b->stale = 0;
 b->authorized = 0;
 _h->parsed = (void *)b;
 return 0;
}

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

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

user_defined_types: struct auth_body { struct hdr_field *authorized; struct dig_cred digest; unsigned char stale; }

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

user_defined_types: struct dig_cred { struct username username; struct _str realm; struct _str nonce; struct _str uri; struct _str response; struct algorithm alg; struct _str cnonce; struct _str opaque; struct qp qop; struct _str nc; }

user_defined_types: struct algorithm { struct _str alg_str; enum alg alg_parsed; }

user_defined_types: struct qp { struct _str qop_str; enum qop_type qop_parsed; }