decompiled_code:
__int64 __fastcall parse_pai_ppi_body(const char *a1, unsigned int a2, _QWORD **a3)
{
const char *v4; // r14
_BYTE *v5; // rax
unsigned int v6; // ebp
__int64 v7; // rbx
_BYTE *v8; // rax
unsigned int *v9; // r13
_BYTE *v10; // rax
unsigned int *v11; // r15
_BYTE *v12; // rax
int v13; // er13
_BYTE *v14; // rax
_QWORD *v15; // rax
_QWORD *v16; // rax
int v17; // er14
__int64 v18; // r11
_QWORD *v19; // r9
_QWORD *v20; // rbp
__int64 v21; // r11
_QWORD *v22; // r9
const char *v24; // r14
unsigned int v25; // eax
const char *v26; // r12
unsigned int v27; // eax
_QWORD *v28; // rax
const char *v29; // r14
unsigned int v30; // eax
const char *v31; // r14
unsigned int v32; // eax
const char *v33; // r14
unsigned int v34; // eax

memset(&uri_b_3, 0, 0x1270uLL);
v4 = &a1[a2];
v5 = (_BYTE *)parse_addr_spec(a1, v4, &uri_b_3, 1LL);
v6 = uri_b_3;
if ( (_DWORD)uri_b_3 != -1 )
{
v7 = 1LL;
if ( *v5 != 44 )
goto LABEL_15;
v8 = (_BYTE *)parse_addr_spec(v5 + 1, v4, dword_1198, 1LL);
v6 = dword_1198[0];
if ( dword_1198[0] == -1 )
{
LABEL_32:
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v26 = (const char *)*((_QWORD *)&log_level_info + 8);
v27 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Error parsing PAI/PPI body %u '%.*s'\n",
process_no,
v27,
v26,
"<core> [parser/parse_ppi_pai.c:72]: ",
"parse_pai_ppi_body",
v7,
a2,
a1);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Error parsing PAI/PPI body %u '%.*s'\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_ppi_pai.c:72]: ",
"parse_pai_ppi_body",
(unsigned int)v7,
a2,
a1);
}
--dprint_crit;
}
return v6;
}
v7 = 2LL;
v9 = &dword_1198[118];
if ( *v8 == 44 )
{
do
{
v10 = (_BYTE *)parse_addr_spec(v8 + 1, v4, v9, 1LL);
v6 = *v9;
if ( *v9 == -1 )
goto LABEL_32;
v7 = (unsigned int)(v7 + 1);
v11 = v9 + 118;
if ( *v10 != 44 )
break;
v12 = (_BYTE *)parse_addr_spec(v10 + 1, v4, v9 + 118, 1LL);
v6 = v9[118];
if ( v6 == -1 )
goto LABEL_32;
v13 = v7;
v7 = (unsigned int)(v7 + 1);
if ( *v12 != 44 )
break;
v14 = (_BYTE *)parse_addr_spec(v12 + 1, v4, v11 + 118, 1LL);
v6 = v11[118];
if ( v6 == -1 )
goto LABEL_32;
v7 = (unsigned int)(v13 + 2);
if ( *v14 != 44 )
break;
v8 = (_BYTE *)parse_addr_spec(v14 + 1, v4, v11 + 236, 1LL);
v6 = v11[236];
if ( v6 == -1 )
goto LABEL_32;
v7 = (unsigned int)(v13 + 3);
v9 = v11 + 354;
}
while ( *v8 == 44 && (int)v7 <= 9 );
}
if ( (int)v7 > 9 )
{
if ( (int)get_debug_level("core", 4LL) >= 0 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0LL);
v29 = (const char *)*((_QWORD *)&log_level_info + 10);
v30 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Too many bodies in PAI/PPI header '%.*s'\n",
process_no,
v30,
v29,
"<core> [parser/parse_ppi_pai.c:79]: ",
"parse_pai_ppi_body",
a2,
a1);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 22) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Too many bodies in PAI/PPI header '%.*s'\n",
*((_QWORD *)&log_level_info + 10),
"<core> [parser/parse_ppi_pai.c:79]: ",
"parse_pai_ppi_body",
a2,
a1);
}
--dprint_crit;
}
if ( (int)get_debug_level("core", 4LL) >= 0 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0LL);
v31 = (const char *)*((_QWORD *)&log_level_info + 10);
v32 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Ignoring bodies beyond %u\n",
process_no,
v32,
v31,
"<core> [parser/parse_ppi_pai.c:80]: ",
"parse_pai_ppi_body",
10LL);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 22) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Ignoring bodies beyond %u\n",
*((const char **)&log_level_info + 10),
"<core> [parser/parse_ppi_pai.c:80]: ",
"parse_pai_ppi_body",
10LL);
}
--dprint_crit;
}
v28 = (_QWORD *)qm_malloc(mem_block, 472LL * (int)v7 + 24);
*a3 = v28;
if ( v28 )
{
*v28 = 0LL;
v28[1] = 0LL;
v28[2] = 0LL;
**a3 = *a3 + 3;
*((_DWORD *)*a3 + 2) = v7;
LABEL_17:
v16 = (_QWORD *)**a3;
*v16 = uri_b_3;
v16[58] = qword_1190;
qmemcpy(
(void *)((unsigned __int64)(v16 + 1) & 0xFFFFFFFFFFFFFFF8LL),
(const void *)((char *)&uri_b_3 - ((char *)v16 - ((unsigned __int64)(v16 + 1) & 0xFFFFFFFFFFFFFFF8LL))),
8LL * (((unsigned int)v16 - (((_DWORD)v16 + 8) & 0xFFFFFFF8) + 472) >> 3));
v17 = 1;
v18 = 472LL;
if ( (int)v7 > 1 )
{
if ( (((_BYTE)v7 - 1) & 1) == 0
|| (v19 = (_QWORD *)(**a3 + 472LL),
*v19 = *(&uri_b_3 + 59),
v19[58] = *(&qword_1190 + 59),
qmemcpy(
(void *)((unsigned __int64)(v19 + 1) & 0xFFFFFFFFFFFFFFF8LL),
(const void *)((char *)(&uri_b_3 + 59)
- ((char *)v19
- ((unsigned __int64)(v19 + 1) & 0xFFFFFFFFFFFFFFF8LL))),
8LL * (((unsigned int)v19 - (((_DWORD)v19 + 8) & 0xFFFFFFF8) + 472) >> 3)),
v17 = 2,
v18 = 944LL,
(int)v7 > 2) )
{
do
{
v20 = (_QWORD *)(**a3 + v18);
*v20 = *(__int64 *)((char *)&uri_b_3 + v18);
v20[58] = *(__int64 *)((char *)&qword_1190 + v18);
qmemcpy(
(void *)((unsigned __int64)(v20 + 1) & 0xFFFFFFFFFFFFFFF8LL),
(const void *)((char *)&uri_b_3
+ v18
- ((char *)v20
- ((unsigned __int64)(v20 + 1) & 0xFFFFFFFFFFFFFFF8LL))),
8LL * (((unsigned int)v20 - (((_DWORD)v20 + 8) & 0xFFFFFFF8) + 472) >> 3));
v21 = v18 + 472;
v22 = (_QWORD *)(**a3 + v21);
*v22 = *(__int64 *)((char *)&uri_b_3 + v21);
v22[58] = *(__int64 *)((char *)&qword_1190 + v21);
qmemcpy(
(void *)((unsigned __int64)(v22 + 1) & 0xFFFFFFFFFFFFFFF8LL),
(const void *)((char *)&uri_b_3
+ v21
- ((char *)v22
- ((unsigned __int64)(v22 + 1) & 0xFFFFFFFFFFFFFFF8LL))),
8LL * (((unsigned int)v22 - (((_DWORD)v22 + 8) & 0xFFFFFFF8) + 472) >> 3));
v17 += 2;
v18 = v21 + 472;
}
while ( (int)v7 > v17 );
}
}
return 0;
}
}
else
{
LABEL_15:
v15 = (_QWORD *)qm_malloc(mem_block, 472LL * (int)v7 + 24);
*a3 = v15;
if ( v15 )
{
*v15 = 0LL;
v15[1] = 0LL;
v15[2] = 0LL;
**a3 = *a3 + 3;
*((_DWORD *)*a3 + 2) = v7;
if ( (int)v7 <= 0 )
return 0;
goto LABEL_17;
}
}
v6 = -1;
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v33 = (const char *)*((_QWORD *)&log_level_info + 8);
v34 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): No pkg memory for pai/ppi body\n",
process_no,
v34,
v33,
"<core> [parser/parse_ppi_pai.c:85]: ",
"parse_pai_ppi_body");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): No pkg memory for pai/ppi body\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_ppi_pai.c:85]: ",
"parse_pai_ppi_body");
}
--dprint_crit;
v6 = -1;
}
return v6;
}
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v24 = (const char *)*((_QWORD *)&log_level_info + 8);
v25 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Error parsing PAI/PPI body %u '%.*s'\n",
process_no,
v25,
v24,
"<core> [parser/parse_ppi_pai.c:62]: ",
"parse_pai_ppi_body",
0LL,
a2,
a1);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Error parsing PAI/PPI body %u '%.*s'\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_ppi_pai.c:62]: ",
"parse_pai_ppi_body",
0LL,
a2,
a1);
}
--dprint_crit;
}
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, unsigned int a2, _QWORD **a3)
{
const char *v4; // r14
_BYTE *v5; // rax
unsigned int v6; // ebp
__int64 v7; // rbx
_BYTE *v8; // rax
unsigned int *v9; // r13
_BYTE *v10; // rax
unsigned int *v11; // r15
_BYTE *v12; // rax
int v13; // er13
_BYTE *v14; // rax
_QWORD *v15; // rax
_QWORD *v16; // rax
int v17; // er14
__int64 v18; // r11
_QWORD *v19; // r9
_QWORD *v20; // rbp
__int64 v21; // r11
_QWORD *v22; // r9
const char *v24; // r14
unsigned int v25; // eax
const char *v26; // r12
unsigned int v27; // eax
_QWORD *v28; // rax
const char *v29; // r14
unsigned int v30; // eax
const char *v31; // r14
unsigned int v32; // eax
const char *v33; // r14
unsigned int v34; // eax

memset(&uri_b_3, 0, 0x1270uLL);
v4 = &a1[a2];
v5 = (_BYTE *)parse_addr_spec(a1, v4, &uri_b_3, 1LL);
v6 = uri_b_3;
if ( (_DWORD)uri_b_3 != -1 )
{
v7 = 1LL;
if ( *v5 != 44 )
goto LABEL_15;
v8 = (_BYTE *)parse_addr_spec(v5 + 1, v4, dword_1198, 1LL);
v6 = dword_1198[0];
if ( dword_1198[0] == -1 )
{
LABEL_32:
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v26 = (const char *)*((_QWORD *)&log_level_info + 8);
v27 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Error parsing PAI/PPI body %u '%.*s'\n",
process_no,
v27,
v26,
"<core> [parser/parse_ppi_pai.c:72]: ",
"parse_pai_ppi_body",
v7,
a2,
a1);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Error parsing PAI/PPI body %u '%.*s'\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_ppi_pai.c:72]: ",
"parse_pai_ppi_body",
(unsigned int)v7,
a2,
a1);
}
--dprint_crit;
}
return v6;
}
v7 = 2LL;
v9 = &dword_1198[118];
if ( *v8 == 44 )
{
do
{
v10 = (_BYTE *)parse_addr_spec(v8 + 1, v4, v9, 1LL);
v6 = *v9;
if ( *v9 == -1 )
goto LABEL_32;
v7 = (unsigned int)(v7 + 1);
v11 = v9 + 118;
if ( *v10 != 44 )
break;
v12 = (_BYTE *)parse_addr_spec(v10 + 1, v4, v9 + 118, 1LL);
v6 = v9[118];
if ( v6 == -1 )
goto LABEL_32;
v13 = v7;
v7 = (unsigned int)(v7 + 1);
if ( *v12 != 44 )
break;
v14 = (_BYTE *)parse_addr_spec(v12 + 1, v4, v11 + 118, 1LL);
v6 = v11[118];
if ( v6 == -1 )
goto LABEL_32;
v7 = (unsigned int)(v13 + 2);
if ( *v14 != 44 )
break;
v8 = (_BYTE *)parse_addr_spec(v14 + 1, v4, v11 + 236, 1LL);
v6 = v11[236];
if ( v6 == -1 )
goto LABEL_32;
v7 = (unsigned int)(v13 + 3);
v9 = v11 + 354;
}
while ( *v8 == 44 && (int)v7 <= 9 );
}
if ( (int)v7 > 9 )
{
if ( (int)get_debug_level("core", 4LL) >= 0 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0LL);
v29 = (const char *)*((_QWORD *)&log_level_info + 10);
v30 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Too many bodies in PAI/PPI header '%.*s'\n",
process_no,
v30,
v29,
"<core> [parser/parse_ppi_pai.c:79]: ",
"parse_pai_ppi_body",
a2,
a1);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 22) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Too many bodies in PAI/PPI header '%.*s'\n",
*((_QWORD *)&log_level_info + 10),
"<core> [parser/parse_ppi_pai.c:79]: ",
"parse_pai_ppi_body",
a2,
a1);
}
--dprint_crit;
}
if ( (int)get_debug_level("core", 4LL) >= 0 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0LL);
v31 = (const char *)*((_QWORD *)&log_level_info + 10);
v32 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Ignoring bodies beyond %u\n",
process_no,
v32,
v31,
"<core> [parser/parse_ppi_pai.c:80]: ",
"parse_pai_ppi_body",
10LL);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 22) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Ignoring bodies beyond %u\n",
*((const char **)&log_level_info + 10),
"<core> [parser/parse_ppi_pai.c:80]: ",
"parse_pai_ppi_body",
10LL);
}
--dprint_crit;
}
v28 = (_QWORD *)qm_malloc(mem_block, 472LL * (int)v7 + 24);
*a3 = v28;
if ( v28 )
{
*v28 = 0LL;
v28[1] = 0LL;
v28[2] = 0LL;
**a3 = *a3 + 3;
*((_DWORD *)*a3 + 2) = v7;
LABEL_17:
v16 = (_QWORD *)**a3;
*v16 = uri_b_3;
v16[58] = qword_1190;
qmemcpy(
(void *)((unsigned __int64)(v16 + 1) & 0xFFFFFFFFFFFFFFF8LL),
(const void *)((char *)&uri_b_3 - ((char *)v16 - ((unsigned __int64)(v16 + 1) & 0xFFFFFFFFFFFFFFF8LL))),
8LL * (((unsigned int)v16 - (((_DWORD)v16 + 8) & 0xFFFFFFF8) + 472) >> 3));
v17 = 1;
v18 = 472LL;
if ( (int)v7 > 1 )
{
if ( (((_BYTE)v7 - 1) & 1) == 0
|| (v19 = (_QWORD *)(**a3 + 472LL),
*v19 = *(&uri_b_3 + 59),
v19[58] = *(&qword_1190 + 59),
qmemcpy(
(void *)((unsigned __int64)(v19 + 1) & 0xFFFFFFFFFFFFFFF8LL),
(const void *)((char *)(&uri_b_3 + 59)
- ((char *)v19
- ((unsigned __int64)(v19 + 1) & 0xFFFFFFFFFFFFFFF8LL))),
8LL * (((unsigned int)v19 - (((_DWORD)v19 + 8) & 0xFFFFFFF8) + 472) >> 3)),
v17 = 2,
v18 = 944LL,
(int)v7 > 2) )
{
do
{
v20 = (_QWORD *)(**a3 + v18);
*v20 = *(__int64 *)((char *)&uri_b_3 + v18);
v20[58] = *(__int64 *)((char *)&qword_1190 + v18);
qmemcpy(
(void *)((unsigned __int64)(v20 + 1) & 0xFFFFFFFFFFFFFFF8LL),
(const void *)((char *)&uri_b_3
+ v18
- ((char *)v20
- ((unsigned __int64)(v20 + 1) & 0xFFFFFFFFFFFFFFF8LL))),
8LL * (((unsigned int)v20 - (((_DWORD)v20 + 8) & 0xFFFFFFF8) + 472) >> 3));
v21 = v18 + 472;
v22 = (_QWORD *)(**a3 + v21);
*v22 = *(__int64 *)((char *)&uri_b_3 + v21);
v22[58] = *(__int64 *)((char *)&qword_1190 + v21);
qmemcpy(
(void *)((unsigned __int64)(v22 + 1) & 0xFFFFFFFFFFFFFFF8LL),
(const void *)((char *)&uri_b_3
+ v21
- ((char *)v22
- ((unsigned __int64)(v22 + 1) & 0xFFFFFFFFFFFFFFF8LL))),
8LL * (((unsigned int)v22 - (((_DWORD)v22 + 8) & 0xFFFFFFF8) + 472) >> 3));
v17 += 2;
v18 = v21 + 472;
}
while ( (int)v7 > v17 );
}
}
return 0;
}
}
else
{
LABEL_15:
v15 = (_QWORD *)qm_malloc(mem_block, 472LL * (int)v7 + 24);
*a3 = v15;
if ( v15 )
{
*v15 = 0LL;
v15[1] = 0LL;
v15[2] = 0LL;
**a3 = *a3 + 3;
*((_DWORD *)*a3 + 2) = v7;
if ( (int)v7 <= 0 )
return 0;
goto LABEL_17;
}
}
v6 = -1;
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v33 = (const char *)*((_QWORD *)&log_level_info + 8);
v34 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): No pkg memory for pai/ppi body\n",
process_no,
v34,
v33,
"<core> [parser/parse_ppi_pai.c:85]: ",
"parse_pai_ppi_body");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): No pkg memory for pai/ppi body\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_ppi_pai.c:85]: ",
"parse_pai_ppi_body");
}
--dprint_crit;
v6 = -1;
}
return v6;
}
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v24 = (const char *)*((_QWORD *)&log_level_info + 8);
v25 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): Error parsing PAI/PPI body %u '%.*s'\n",
process_no,
v25,
v24,
"<core> [parser/parse_ppi_pai.c:62]: ",
"parse_pai_ppi_body",
0LL,
a2,
a1);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): Error parsing PAI/PPI body %u '%.*s'\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_ppi_pai.c:62]: ",
"parse_pai_ppi_body",
0LL,
a2,
a1);
}
--dprint_crit;
}
return v6;
}

original_code:
int parse_pai_ppi_body(char *buf, int len, p_id_body_t **body)
{
 static to_body_t uri_b[10];
 int num_uri = 0;
 char *tmp;
 int i;
 memset(uri_b, 0, 10 * sizeof(to_body_t));
 tmp = parse_addr_spec(buf, buf+len, &uri_b[num_uri], 1);
 if (uri_b[num_uri].error == -1)
 {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "62" "]: ") , __func__, num_uri, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "62" "]: ") , __func__, num_uri, len, buf); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", process_no, my_pid(), ("<core> [" "parser/parse_ppi_pai.c" ":" "62" "]: ") , __func__, num_uri, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "62" "]: ") , __func__, num_uri, len, buf); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "62" "]: ") , __func__, num_uri, len, buf); } } (dprint_crit--); } } while(0);
  return -1;
 }
 num_uri++;
 while ((*tmp == ',') && (num_uri < 10))
 {
  tmp++;
  tmp = parse_addr_spec(tmp, buf+len, &uri_b[num_uri], 1);
  if (uri_b[num_uri].error == -1)
  {
   do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "72" "]: ") , __func__, num_uri, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "72" "]: ") , __func__, num_uri, len, buf); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", process_no, my_pid(), ("<core> [" "parser/parse_ppi_pai.c" ":" "72" "]: ") , __func__, num_uri, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "72" "]: ") , __func__, num_uri, len, buf); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "72" "]: ") , __func__, num_uri, len, buf); } } (dprint_crit--); } } while(0);
   return -1;
  }
  num_uri++;
 }
 if (num_uri >= 10)
 {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((0)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((0)) >= -5) && (((0)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((0)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "Too many bodies in PAI/PPI header '%.*s'\n", process_no, my_pid(), (log_level_info[((0)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "79" "]: ") , __func__, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((0)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "Too many bodies in PAI/PPI header '%.*s'\n", (log_level_info[((0)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "79" "]: ") , __func__, len, buf); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((0)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Too many bodies in PAI/PPI header '%.*s'\n", process_no, my_pid(), ("<core> [" "parser/parse_ppi_pai.c" ":" "79" "]: ") , __func__, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((0))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Too many bodies in PAI/PPI header '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "79" "]: ") , __func__, len, buf); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Too many bodies in PAI/PPI header '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "79" "]: ") , __func__, len, buf); } } (dprint_crit--); } } while(0);
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((0)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((0)) >= -5) && (((0)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((0)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "Ignoring bodies beyond %u\n", process_no, my_pid(), (log_level_info[((0)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "80" "]: ") , __func__, 10); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((0)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "Ignoring bodies beyond %u\n", (log_level_info[((0)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "80" "]: ") , __func__, 10); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((0)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Ignoring bodies beyond %u\n", process_no, my_pid(), ("<core> [" "parser/parse_ppi_pai.c" ":" "80" "]: ") , __func__, 10); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((0))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Ignoring bodies beyond %u\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "80" "]: ") , __func__, 10); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Ignoring bodies beyond %u\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "80" "]: ") , __func__, 10); } } (dprint_crit--); } } while(0);
 }
 *body = qm_malloc(mem_block, (sizeof(p_id_body_t) + num_uri * sizeof(to_body_t)));
 if (*body == ((void *)0))
 {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "No pkg memory for pai/ppi body\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "85" "]: ") , __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(): " "No pkg memory for pai/ppi body\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "85" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "No pkg memory for pai/ppi body\n", process_no, my_pid(), ("<core> [" "parser/parse_ppi_pai.c" ":" "85" "]: ") , __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(): " "No pkg memory for pai/ppi body\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "85" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "No pkg memory for pai/ppi body\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "85" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 memset(*body, 0, sizeof(p_id_body_t));
 (*body)->id = (to_body_t*)((char*)(*body) + sizeof(p_id_body_t));
 (*body)->num_ids = num_uri;
 for (i=0; i< num_uri; i++)
 {
  memcpy(&(*body)->id[i], &uri_b[i], sizeof(to_body_t));
 }
 return 0;
}

canonical_original_code:
int parse_pai_ppi_body(char *buf, int len, struct p_id_body **body)
{
 static struct to_body uri_b[10];
 int num_uri = 0;
 char *tmp;
 int i;
 memset(uri_b, 0, 10 * sizeof(to_body_t));
 tmp = parse_addr_spec(buf, buf+len, &uri_b[num_uri], 1);
 if (uri_b[num_uri].error == -1)
 {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "62" "]: ") , __func__, num_uri, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "62" "]: ") , __func__, num_uri, len, buf); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", process_no, my_pid(), ("<core> [" "parser/parse_ppi_pai.c" ":" "62" "]: ") , __func__, num_uri, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "62" "]: ") , __func__, num_uri, len, buf); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "62" "]: ") , __func__, num_uri, len, buf); } } (dprint_crit--); } } while(0);
  return -1;
 }
 num_uri++;
 while ((*tmp == ',') && (num_uri < 10))
 {
  tmp++;
  tmp = parse_addr_spec(tmp, buf+len, &uri_b[num_uri], 1);
  if (uri_b[num_uri].error == -1)
  {
   do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "72" "]: ") , __func__, num_uri, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "72" "]: ") , __func__, num_uri, len, buf); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", process_no, my_pid(), ("<core> [" "parser/parse_ppi_pai.c" ":" "72" "]: ") , __func__, num_uri, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "72" "]: ") , __func__, num_uri, len, buf); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Error parsing PAI/PPI body %u '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "72" "]: ") , __func__, num_uri, len, buf); } } (dprint_crit--); } } while(0);
   return -1;
  }
  num_uri++;
 }
 if (num_uri >= 10)
 {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((0)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((0)) >= -5) && (((0)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((0)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "Too many bodies in PAI/PPI header '%.*s'\n", process_no, my_pid(), (log_level_info[((0)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "79" "]: ") , __func__, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((0)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "Too many bodies in PAI/PPI header '%.*s'\n", (log_level_info[((0)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "79" "]: ") , __func__, len, buf); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((0)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Too many bodies in PAI/PPI header '%.*s'\n", process_no, my_pid(), ("<core> [" "parser/parse_ppi_pai.c" ":" "79" "]: ") , __func__, len, buf); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((0))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Too many bodies in PAI/PPI header '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "79" "]: ") , __func__, len, buf); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Too many bodies in PAI/PPI header '%.*s'\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "79" "]: ") , __func__, len, buf); } } (dprint_crit--); } } while(0);
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((0)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((0)) >= -5) && (((0)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((0)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "Ignoring bodies beyond %u\n", process_no, my_pid(), (log_level_info[((0)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "80" "]: ") , __func__, 10); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((0)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "Ignoring bodies beyond %u\n", (log_level_info[((0)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "80" "]: ") , __func__, 10); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((0)); fprintf(stderr, "%2d(%d) %s" "%s(): " "Ignoring bodies beyond %u\n", process_no, my_pid(), ("<core> [" "parser/parse_ppi_pai.c" ":" "80" "]: ") , __func__, 10); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((0))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Ignoring bodies beyond %u\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "80" "]: ") , __func__, 10); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "Ignoring bodies beyond %u\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "80" "]: ") , __func__, 10); } } (dprint_crit--); } } while(0);
 }
 *body = qm_malloc(mem_block, (sizeof(p_id_body_t) + num_uri * sizeof(to_body_t)));
 if (*body == ((void *)0))
 {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "No pkg memory for pai/ppi body\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "85" "]: ") , __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(): " "No pkg memory for pai/ppi body\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_ppi_pai.c" ":" "85" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "No pkg memory for pai/ppi body\n", process_no, my_pid(), ("<core> [" "parser/parse_ppi_pai.c" ":" "85" "]: ") , __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(): " "No pkg memory for pai/ppi body\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "85" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "No pkg memory for pai/ppi body\n", ("<core> [" "parser/parse_ppi_pai.c" ":" "85" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 memset(*body, 0, sizeof(p_id_body_t));
 (*body)->id = (struct to_body *)((char *)(*body) + sizeof(p_id_body_t));
 (*body)->num_ids = num_uri;
 for (i=0; i< num_uri; i++)
 {
  memcpy(&(*body)->id[i], &uri_b[i], sizeof(to_body_t));
 }
 return 0;
}

variable_types:
buf
char *

variable_types: len int

variable_types: struct p_id_body { 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; } *id; int num_ids; struct p_id_body *next; } **

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; } [10]

variable_types:
tmp
char *

variable_types: i int

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

user_defined_types: struct p_id_body { struct to_body *id; int num_ids; struct p_id_body *next; }

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


repo: virtualolson/who

decompiled_code:
__int64 __fastcall free_pai_ppi_body(__int64 a1)
{
if ( a1 )
qm_free(mem_block, a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
if ( a1 )
qm_free(mem_block, a1);
return 0LL;
}

original_code:
int free_pai_ppi_body(p_id_body_t *pid_b)
{
 if (pid_b != ((void *)0))
 {
  qm_free(mem_block, (pid_b));
 }
 return 0;
}

canonical_original_code:
int free_pai_ppi_body(struct p_id_body *pid_b)
{
 if (pid_b != ((void *)0))
 {
  qm_free(mem_block, (pid_b));
 }
 return 0;
}

variable_types: struct p_id_body { 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; } *id; int num_ids; struct p_id_body *next; } *

return_type: 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_get(volatile signed __int32 *a1)
{
__int64 result; // rax
int v2; // ebp
int v3; // ebp

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

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

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

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

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

variable_types:
lock
struct atomic_t { int val; } *

return_type: void


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

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

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

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

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

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


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

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

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

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

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

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

variable_types:
size
unsigned int

variable_types:
p
void *

return_type: void *


original_code:
int ht_init(hash_table_t *ht, hash_func_t hash_func, key_cmp_func_t cmp_keys, int size)
{
 if (!ht) return -1;
 if ((!hash_func) || (!cmp_keys)) return -1;
 ht->cslots = (ht_cslot_t*)shm_malloc(size * sizeof(ht_cslot_t));
 if (!ht->cslots) return -1;
 memset(ht->cslots, 0, size * sizeof(ht_cslot_t));
 ht->size = size;
 ht->hash = hash_func;
 ht->cmp = cmp_keys;
 ht->find_cnt = 0;
 ht->cmp_cnt = 0;
 ht->nocmp_cnt = 0;
 ht->missed_cnt = 0;
 return 0;
}

canonical_original_code:
int ht_init(struct hash_table *ht, unsigned int (*hash_func)(void *k), int (*cmp_keys)(void *a, void *b), int size)
{
 if (!ht) return -1;
 if ((!hash_func) || (!cmp_keys)) return -1;
 ht->cslots = (struct ht_cslot *)shm_malloc(size * sizeof(ht_cslot_t));
 if (!ht->cslots) return -1;
 memset(ht->cslots, 0, size * sizeof(ht_cslot_t));
 ht->size = size;
 ht->hash = hash_func;
 ht->cmp = cmp_keys;
 ht->find_cnt = 0;
 ht->cmp_cnt = 0;
 ht->nocmp_cnt = 0;
 ht->missed_cnt = 0;
 return 0;
}

variable_types: struct hash_table { unsigned int (*hash)(void *k); int (*cmp)(void *a, void *b); struct ht_cslot { struct ht_element { void *key; void *data; struct ht_element *next; } *first; struct ht_element *last; int cnt; } *cslots; int size; int find_cnt; int cmp_cnt; int nocmp_cnt; int missed_cnt; } *

variable_types: size int

user_defined_types: struct hash_table { unsigned int (*hash)(void *k); int (*cmp)(void *a, void *b); struct ht_cslot *cslots; int size; int find_cnt; int cmp_cnt; int nocmp_cnt; int missed_cnt; }

user_defined_types: struct ht_cslot { struct ht_element *first; struct ht_element *last; int cnt; }


decompiled_code:
__int64 __fastcall ht_destroy(__int64 a1)
{
__int64 v1; // r13
__int64 v2; // rbx
__int64 v3; // r12
__int64 result; // rax

if ( a1 )
{
if ( *(_QWORD *)(a1 + 16) )
{
if ( *(int *)(a1 + 24) > 0 )
{
v1 = 0LL;
do
{
v2 = *(_QWORD *)(*(_QWORD *)(a1 + 16) + 24 * v1);
while ( v2 )
{
v3 = v2;
v2 = *(_QWORD *)(v2 + 16);
futex_get(mem_lock);
qm_free(shm_block, v3);
futex_release(mem_lock);
}
++v1;
}
while ( *(_DWORD *)(a1 + 24) > (int)v1 );
}
futex_get(mem_lock);
qm_free(shm_block, *(_QWORD *)(a1 + 16));
result = futex_release(mem_lock);
}
*(_QWORD *)(a1 + 16) = 0LL;
}
return result;
}

original_code:
void ht_destroy(hash_table_t *ht)
{
 ht_element_t *e, *n;
 int i;
 if (!ht) return;
 if (ht->cslots) {
  for (i = 0; i < ht->size; i++) {
   e = ht->cslots[i].first;
   while (e) {
    n = e->next;
    do { futex_get(mem_lock); qm_free(shm_block, (e)); futex_release(mem_lock); }while(0);
    e = n;
   }
  }
  do { futex_get(mem_lock); qm_free(shm_block, (ht->cslots)); futex_release(mem_lock); }while(0);
 }
 ht->cslots = ((void *)0);
}

canonical_original_code:
void ht_destroy(struct hash_table *ht)
{
 struct ht_element *e; struct ht_element *n;
 int i;
 if (!ht) return;
 if (ht->cslots) {
  for (i = 0; i < ht->size; i++) {
   e = ht->cslots[i].first;
   while (e) {
    n = e->next;
    do { futex_get(mem_lock); qm_free(shm_block, (e)); futex_release(mem_lock); }while(0);
    e = n;
   }
  }
  do { futex_get(mem_lock); qm_free(shm_block, (ht->cslots)); futex_release(mem_lock); }while(0);
 }
 ht->cslots = ((void *)0);
}

variable_types: struct ht_element { void *key; void *data; struct ht_element *next; } *


original_code:
int ht_add(hash_table_t *ht, ht_key_t key, ht_data_t data)
{
 int h;
 ht_element_t *new_e;
 if (!ht) return -1;
 new_e = (ht_element_t*)shm_malloc(sizeof(ht_element_t));
 if (!new_e) return -1;
 new_e->next = ((void *)0);
 new_e->key = key;
 new_e->data = data;
 h = ht->hash(key) % ht->size;
 if (h < 0) h = -h;
 if (!ht->cslots[h].last) {
  ht->cslots[h].first = new_e;
 }
 else {
  ht->cslots[h].last->next = new_e;
 }
 ht->cslots[h].cnt++;
 ht->cslots[h].last = new_e;
 return 0;
}

canonical_original_code:
int ht_add(struct hash_table *ht, void *key, void *data)
{
 int h;
 struct ht_element *new_e;
 if (!ht) return -1;
 new_e = (struct ht_element *)shm_malloc(sizeof(ht_element_t));
 if (!new_e) return -1;
 new_e->next = ((void *)0);
 new_e->key = key;
 new_e->data = data;
 h = ht->hash(key) % ht->size;
 if (h < 0) h = -h;
 if (!ht->cslots[h].last) {
  ht->cslots[h].first = new_e;
 }
 else {
  ht->cslots[h].last->next = new_e;
 }
 ht->cslots[h].cnt++;
 ht->cslots[h].last = new_e;
 return 0;
}

variable_types:
key
void *

variable_types:
data
void *

variable_types: h int

user_defined_types: struct ht_element { void *key; void *data; struct ht_element *next; }


original_code:
ht_data_t ht_find(hash_table_t *ht, ht_key_t key)
{
 int h;
 ht_element_t *e;
 if (!ht) return ((void *)0);
 ht->find_cnt++;
 h = ht->hash(key) % ht->size;
 if (h < 0) h = -h;
 e = ht->cslots[h].first;
 if (!e) ht->nocmp_cnt++;
 while (e) {
  ht->cmp_cnt++;
  if (ht->cmp(e->key, key) == 0) return e->data;
  e = e->next;
 }
 ht->missed_cnt++;
 return ((void *)0);
}

canonical_original_code:
void *ht_find(struct hash_table *ht, void *key)
{
 int h;
 struct ht_element *e;
 if (!ht) return ((void *)0);
 ht->find_cnt++;
 h = ht->hash(key) % ht->size;
 if (h < 0) h = -h;
 e = ht->cslots[h].first;
 if (!e) ht->nocmp_cnt++;
 while (e) {
  ht->cmp_cnt++;
  if (ht->cmp(e->key, key) == 0) return e->data;
  e = e->next;
 }
 ht->missed_cnt++;
 return ((void *)0);
}


original_code:
ht_data_t ht_remove(hash_table_t *ht, ht_key_t key)
{
 int h;
 ht_element_t *e,*p;
 ht_data_t data;
 if (!ht) return ((void *)0);
 h = ht->hash(key) % ht->size;
 if (h < 0) h = -h;
 e = ht->cslots[h].first;
 p = ((void *)0);
 while (e) {
  if (ht->cmp(e->key, key) == 0) {
   if (p) p->next = e->next;
   else ht->cslots[h].first = e->next;
   ht->cslots[h].cnt--;
   if (!e->next) ht->cslots[h].last = p;
   data = e->data;
   do { futex_get(mem_lock); qm_free(shm_block, (e)); futex_release(mem_lock); }while(0);
   return data;
  }
  p = e;
  e = e->next;
 }
 return ((void *)0);
}

canonical_original_code:
void *ht_remove(struct hash_table *ht, void *key)
{
 int h;
 struct ht_element *e; struct ht_element *p;
 void *data;
 if (!ht) return ((void *)0);
 h = ht->hash(key) % ht->size;
 if (h < 0) h = -h;
 e = ht->cslots[h].first;
 p = ((void *)0);
 while (e) {
  if (ht->cmp(e->key, key) == 0) {
   if (p) p->next = e->next;
   else ht->cslots[h].first = e->next;
   ht->cslots[h].cnt--;
   if (!e->next) ht->cslots[h].last = p;
   data = e->data;
   do { futex_get(mem_lock); qm_free(shm_block, (e)); futex_release(mem_lock); }while(0);
   return data;
  }
  p = e;
  e = e->next;
 }
 return ((void *)0);
}


original_code:
ht_element_t *get_first_ht_element(hash_table_t *ht, ht_traversal_info_t *info)
{
 int i;
 if (!info) return ((void *)0);
 info->ht = ht;
 info->current = ((void *)0);
 for (i = 0; i < ht->size; i++) {
  if (ht->cslots[i].first) {
   info->current = ht->cslots[i].first;
   break;
  }
 }
 info->slot_pos = i;
 return info->current;
}

canonical_original_code:
struct ht_element *get_first_ht_element(struct hash_table *ht, struct ht_traversal_info_t *info)
{
 int i;
 if (!info) return ((void *)0);
 info->ht = ht;
 info->current = ((void *)0);
 for (i = 0; i < ht->size; i++) {
  if (ht->cslots[i].first) {
   info->current = ht->cslots[i].first;
   break;
  }
 }
 info->slot_pos = i;
 return info->current;
}

variable_types: struct hash_table { unsigned int (*hash)(void *k); int (*cmp)(void *a, void *b); struct ht_cslot { struct ht_element *first; struct ht_element *last; int cnt; } *cslots; int size; int find_cnt; int cmp_cnt; int nocmp_cnt; int missed_cnt; } *

variable_types: struct ht_traversal_info_t { struct hash_table *ht; int slot_pos; struct ht_element *current; } *

return_type: struct ht_element { void *key; void *data; struct ht_element *next; } *


original_code:
ht_element_t *get_next_ht_element(ht_traversal_info_t *info)
{
 int i;
 if (!info) return ((void *)0);
 if (info->current) info->current = info->current->next;
 if (info->current) return info->current;
 else {
  for (i = info->slot_pos + 1; i < info->ht->size; i++) {
   if (info->ht->cslots[i].first) {
    info->current = info->ht->cslots[i].first;
    break;
   }
  }
  info->slot_pos = i;
 }
 return info->current;
}

canonical_original_code:
struct ht_element *get_next_ht_element(struct ht_traversal_info_t *info)
{
 int i;
 if (!info) return ((void *)0);
 if (info->current) info->current = info->current->next;
 if (info->current) return info->current;
 else {
  for (i = info->slot_pos + 1; i < info->ht->size; i++) {
   if (info->ht->cslots[i].first) {
    info->current = info->ht->cslots[i].first;
    break;
   }
  }
  info->slot_pos = i;
 }
 return info->current;
}

variable_types: struct ht_traversal_info_t { struct hash_table { unsigned int (*hash)(void *k); int (*cmp)(void *a, void *b); struct ht_cslot { struct ht_element *first; struct ht_element *last; int cnt; } *cslots; int size; int find_cnt; int cmp_cnt; int nocmp_cnt; int missed_cnt; } *ht; int slot_pos; struct ht_element *current; } *

user_defined_types: struct ht_traversal_info_t { struct hash_table *ht; int slot_pos; struct ht_element *current; }


rshash

original_code:
unsigned int rshash(const char* str, unsigned int len)
{
 unsigned int b = 378551;
 unsigned int a = 63689;
 unsigned int hash = 0;
 unsigned int i = 0;
 for(i = 0; i < len; str++, i++) {
  hash = hash * a + (*str);
  a = a * b;
 }
 return (hash & 0x7FFFFFFF);
}

canonical_original_code:
unsigned int rshash(char *str, unsigned int len)
{
 unsigned int b = 378551;
 unsigned int a = 63689;
 unsigned int hash = 0;
 unsigned int i = 0;
 for(i = 0; i < len; str++, i++) {
  hash = hash * a + (*str);
  a = a * b;
 }
 return (hash & 0x7FFFFFFF);
}

variable_types:
str
char *

variable_types:
len
unsigned int

variable_types:
b
unsigned int

variable_types:
a
unsigned int

variable_types:
hash
unsigned int

variable_types:
i
unsigned int

return_type: unsigned int


decompiled_code:
__int64 __fastcall add_lump_rpl2(__int64 a1, const void *a2, int a3, unsigned int a4)
{
__int64 v4; // rbp
size_t v6; // r15
_QWORD *v7; // rax
_QWORD *v8; // r12
int v9; // edi
__int64 result; // rax
const char *v11; // rbx
unsigned int v12; // eax
int v13; // er15
const char *v14; // rbp
unsigned int v15; // eax
int v16; // er10
const char *v17; // r13
unsigned int v18; // eax
__int64 v19; // rcx
__int64 v20; // rax
const char *v21; // rbp
unsigned int v22; // eax
_QWORD *v23; // rax

v4 = a4;
if ( (a4 & 6) == 6 || (a4 & 6) == 0 || (a4 & 0x20) != 0 )
{
v9 = get_debug_level("core", 4LL);
result = 0LL;
if ( v9 >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v11 = (const char *)*((_QWORD *)&log_level_info + 8);
v12 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:add_lump_rpl: bad flags combination (%d)!\n",
process_no,
v12,
v11,
"<core> [data_lump_rpl.c:63]: ",
"add_lump_rpl2",
v4);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:add_lump_rpl: bad flags combination (%d)!\n",
*((const char **)&log_level_info + 8),
"<core> [data_lump_rpl.c:63]: ",
"add_lump_rpl2",
(unsigned int)v4);
}
--dprint_crit;
result = 0LL;
}
return result;
}
if ( a3 <= 0 || !a2 )
{
v13 = get_debug_level("core", 4LL);
result = 0LL;
if ( v13 >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v14 = (const char *)*((_QWORD *)&log_level_info + 8);
v15 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:add_lump_rpl: I won't add an empty lump!\n",
process_no,
v15,
v14,
"<core> [data_lump_rpl.c:67]: ",
"add_lump_rpl2");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:add_lump_rpl: I won't add an empty lump!\n",
*((const char **)&log_level_info + 8),
"<core> [data_lump_rpl.c:67]: ",
"add_lump_rpl2");
}
--dprint_crit;
result = 0LL;
}
return result;
}
if ( (a4 & 8) == 0 )
{
v6 = a3;
v7 = (_QWORD *)qm_malloc(mem_block, a3 + 32LL);
v8 = v7;
if ( v7 )
{
*v7 = v7 + 4;
memcpy(v7 + 4, a2, v6);
goto LABEL_53;
}
LABEL_27:
v16 = get_debug_level("core", 4LL);
result = 0LL;
if ( v16 >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v17 = (const char *)*((_QWORD *)&log_level_info + 8);
v18 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:add_lump_rpl : no free pkg memory !\n",
process_no,
v18,
v17,
"<core> [data_lump_rpl.c:75]: ",
"add_lump_rpl2");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:add_lump_rpl : no free pkg memory !\n",
*((const char **)&log_level_info + 8),
"<core> [data_lump_rpl.c:75]: ",
"add_lump_rpl2");
}
--dprint_crit;
result = 0LL;
}
return result;
}
v23 = (_QWORD *)qm_malloc(mem_block, 32LL);
v8 = v23;
if ( !v23 )
goto LABEL_27;
*v23 = a2;
LABEL_53:
*((_DWORD *)v8 + 2) = a3;
*((_DWORD *)v8 + 4) = v4;
v8[3] = 0LL;
v19 = *(_QWORD *)(a1 + 1456);
if ( v19 )
{
if ( (v4 & 4) != 0 )
{
while ( (*(_BYTE *)(v19 + 16) & 4) == 0 )
{
if ( !*(_QWORD *)(v19 + 24) )
{
v20 = v19;
goto LABEL_56;
}
v19 = *(_QWORD *)(v19 + 24);
}
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v21 = (const char *)*((_QWORD *)&log_level_info + 8);
v22 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:add_lump_rpl: LUMP_RPL_BODY already added!\n",
process_no,
v22,
v21,
"<core> [data_lump_rpl.c:99]: ",
"add_lump_rpl2");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:add_lump_rpl: LUMP_RPL_BODY already added!\n",
*((const char **)&log_level_info + 8),
"<core> [data_lump_rpl.c:99]: ",
"add_lump_rpl2");
}
--dprint_crit;
}
qm_free(mem_block, v8);
result = 0LL;
}
else
{
do
{
v20 = v19;
v19 = *(_QWORD *)(v19 + 24);
}
while ( v19 );
LABEL_56:
*(_QWORD *)(v20 + 24) = v8;
result = v20 + 24;
}
}
else
{
*(_QWORD *)(a1 + 1456) = v8;
result = a1 + 1456;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, const void *a2, int a3, unsigned int a4)
{
__int64 v4; // rbp
size_t v6; // r15
_QWORD *v7; // rax
_QWORD *v8; // r12
int v9; // edi
__int64 result; // rax
const char *v11; // rbx
unsigned int v12; // eax
int v13; // er15
const char *v14; // rbp
unsigned int v15; // eax
int v16; // er10
const char *v17; // r13
unsigned int v18; // eax
__int64 v19; // rcx
__int64 v20; // rax
const char *v21; // rbp
unsigned int v22; // eax
_QWORD *v23; // rax

v4 = a4;
if ( (a4 & 6) == 6 || (a4 & 6) == 0 || (a4 & 0x20) != 0 )
{
v9 = get_debug_level("core", 4LL);
result = 0LL;
if ( v9 >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v11 = (const char *)*((_QWORD *)&log_level_info + 8);
v12 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:add_lump_rpl: bad flags combination (%d)!\n",
process_no,
v12,
v11,
"<core> [data_lump_rpl.c:63]: ",
"add_lump_rpl2",
v4);
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:add_lump_rpl: bad flags combination (%d)!\n",
*((const char **)&log_level_info + 8),
"<core> [data_lump_rpl.c:63]: ",
"add_lump_rpl2",
(unsigned int)v4);
}
--dprint_crit;
result = 0LL;
}
return result;
}
if ( a3 <= 0 || !a2 )
{
v13 = get_debug_level("core", 4LL);
result = 0LL;
if ( v13 >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v14 = (const char *)*((_QWORD *)&log_level_info + 8);
v15 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:add_lump_rpl: I won't add an empty lump!\n",
process_no,
v15,
v14,
"<core> [data_lump_rpl.c:67]: ",
"add_lump_rpl2");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:add_lump_rpl: I won't add an empty lump!\n",
*((const char **)&log_level_info + 8),
"<core> [data_lump_rpl.c:67]: ",
"add_lump_rpl2");
}
--dprint_crit;
result = 0LL;
}
return result;
}
if ( (a4 & 8) == 0 )
{
v6 = a3;
v7 = (_QWORD *)qm_malloc(mem_block, a3 + 32LL);
v8 = v7;
if ( v7 )
{
*v7 = v7 + 4;
memcpy(v7 + 4, a2, v6);
goto LABEL_53;
}
LABEL_27:
v16 = get_debug_level("core", 4LL);
result = 0LL;
if ( v16 >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v17 = (const char *)*((_QWORD *)&log_level_info + 8);
v18 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:add_lump_rpl : no free pkg memory !\n",
process_no,
v18,
v17,
"<core> [data_lump_rpl.c:75]: ",
"add_lump_rpl2");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:add_lump_rpl : no free pkg memory !\n",
*((const char **)&log_level_info + 8),
"<core> [data_lump_rpl.c:75]: ",
"add_lump_rpl2");
}
--dprint_crit;
result = 0LL;
}
return result;
}
v23 = (_QWORD *)qm_malloc(mem_block, 32LL);
v8 = v23;
if ( !v23 )
goto LABEL_27;
*v23 = a2;
LABEL_53:
*((_DWORD *)v8 + 2) = a3;
*((_DWORD *)v8 + 4) = v4;
v8[3] = 0LL;
v19 = *(_QWORD *)(a1 + 1456);
if ( v19 )
{
if ( (v4 & 4) != 0 )
{
while ( (*(_BYTE *)(v19 + 16) & 4) == 0 )
{
if ( !*(_QWORD *)(v19 + 24) )
{
v20 = v19;
goto LABEL_56;
}
v19 = *(_QWORD *)(v19 + 24);
}
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v21 = (const char *)*((_QWORD *)&log_level_info + 8);
v22 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR:add_lump_rpl: LUMP_RPL_BODY already added!\n",
process_no,
v22,
v21,
"<core> [data_lump_rpl.c:99]: ",
"add_lump_rpl2");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR:add_lump_rpl: LUMP_RPL_BODY already added!\n",
*((const char **)&log_level_info + 8),
"<core> [data_lump_rpl.c:99]: ",
"add_lump_rpl2");
}
--dprint_crit;
}
qm_free(mem_block, v8);
result = 0LL;
}
else
{
do
{
v20 = v19;
v19 = *(_QWORD *)(v19 + 24);
}
while ( v19 );
LABEL_56:
*(_QWORD *)(v20 + 24) = v8;
result = v20 + 24;
}
}
else
{
*(_QWORD *)(a1 + 1456) = v8;
result = a1 + 1456;
}
return result;
}

original_code:
struct lump_rpl** add_lump_rpl2(struct sip_msg *msg, char *s,
         int len, int flags)
{
 struct lump_rpl *lump = 0;
 struct lump_rpl *foo;
 struct lump_rpl** ret;
 if ( (flags&((1<<1)|(1<<2)))==((1<<1)|(1<<2))
 || (flags&((1<<1)|(1<<2)))==0 || (flags&(1<<5)) ) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:add_lump_rpl: bad flags combination (%d)!\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "63" "]: ") , __func__,flags); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:add_lump_rpl: bad flags combination (%d)!\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "63" "]: ") , __func__,flags); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:add_lump_rpl: bad flags combination (%d)!\n", process_no, my_pid(), ("<core> [" "data_lump_rpl.c" ":" "63" "]: ") , __func__,flags); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl: bad flags combination (%d)!\n", ("<core> [" "data_lump_rpl.c" ":" "63" "]: ") , __func__,flags); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl: bad flags combination (%d)!\n", ("<core> [" "data_lump_rpl.c" ":" "63" "]: ") , __func__,flags); } } (dprint_crit--); } } while(0);
  goto error;
 }
 if (len<=0 || s==0) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:add_lump_rpl: I won't add an empty lump!\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "67" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:add_lump_rpl: I won't add an empty lump!\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "67" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:add_lump_rpl: I won't add an empty lump!\n", process_no, my_pid(), ("<core> [" "data_lump_rpl.c" ":" "67" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl: I won't add an empty lump!\n", ("<core> [" "data_lump_rpl.c" ":" "67" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl: I won't add an empty lump!\n", ("<core> [" "data_lump_rpl.c" ":" "67" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  goto error;
 }
 lump = (struct lump_rpl*) qm_malloc(mem_block, (sizeof(struct lump_rpl) + ((flags&(1<<3))?0:len)));
 if (!lump) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:add_lump_rpl : no free pkg memory !\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "75" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:add_lump_rpl : no free pkg memory !\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "75" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:add_lump_rpl : no free pkg memory !\n", process_no, my_pid(), ("<core> [" "data_lump_rpl.c" ":" "75" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl : no free pkg memory !\n", ("<core> [" "data_lump_rpl.c" ":" "75" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl : no free pkg memory !\n", ("<core> [" "data_lump_rpl.c" ":" "75" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  goto error;
 }
 if (flags&(1<<3)) {
  lump->text.s = s;
 } else {
  lump->text.s = ((char*)lump)+sizeof(struct lump_rpl);
  memcpy( lump->text.s, s, len);
 }
 lump->text.len = len;
 lump->flags = flags;
 lump->next = 0;
 if (!msg->reply_lump) {
  msg->reply_lump = lump;
  ret=&msg->reply_lump;
 }else{
  if (!(flags&(1<<2)))
   for(foo=msg->reply_lump;foo->next;foo=foo->next);
  else
   for(foo=msg->reply_lump; ;foo=foo->next) {
    if (foo->flags&(1<<2)) {
     do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:add_lump_rpl: LUMP_RPL_BODY " "already added!\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "99" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:add_lump_rpl: LUMP_RPL_BODY " "already added!\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "99" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:add_lump_rpl: LUMP_RPL_BODY " "already added!\n", process_no, my_pid(), ("<core> [" "data_lump_rpl.c" ":" "99" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl: LUMP_RPL_BODY " "already added!\n", ("<core> [" "data_lump_rpl.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(): " "ERROR:add_lump_rpl: LUMP_RPL_BODY " "already added!\n", ("<core> [" "data_lump_rpl.c" ":" "99" "]: ") , __func__); } } (dprint_crit--); } } while(0);
     qm_free(mem_block, (lump));
     goto error;
    }
    if (foo->next==0)
     break;
   }
  foo->next = lump;
  ret= &(foo->next);
 }
 return ret;
error:
 return 0;
}

canonical_original_code:
struct lump_rpl **add_lump_rpl2(struct sip_msg *msg, char *s, int len, int flags)
{
 struct lump_rpl *lump = 0;
 struct lump_rpl *foo;
 struct lump_rpl **ret;
 if ( (flags&((1<<1)|(1<<2)))==((1<<1)|(1<<2))
 || (flags&((1<<1)|(1<<2)))==0 || (flags&(1<<5)) ) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:add_lump_rpl: bad flags combination (%d)!\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "63" "]: ") , __func__,flags); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:add_lump_rpl: bad flags combination (%d)!\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "63" "]: ") , __func__,flags); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:add_lump_rpl: bad flags combination (%d)!\n", process_no, my_pid(), ("<core> [" "data_lump_rpl.c" ":" "63" "]: ") , __func__,flags); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl: bad flags combination (%d)!\n", ("<core> [" "data_lump_rpl.c" ":" "63" "]: ") , __func__,flags); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl: bad flags combination (%d)!\n", ("<core> [" "data_lump_rpl.c" ":" "63" "]: ") , __func__,flags); } } (dprint_crit--); } } while(0);
  goto error;
 }
 if (len<=0 || s==0) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:add_lump_rpl: I won't add an empty lump!\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "67" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:add_lump_rpl: I won't add an empty lump!\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "67" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:add_lump_rpl: I won't add an empty lump!\n", process_no, my_pid(), ("<core> [" "data_lump_rpl.c" ":" "67" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl: I won't add an empty lump!\n", ("<core> [" "data_lump_rpl.c" ":" "67" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl: I won't add an empty lump!\n", ("<core> [" "data_lump_rpl.c" ":" "67" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  goto error;
 }
 lump = (struct lump_rpl *) qm_malloc(mem_block, (sizeof(struct lump_rpl) + ((flags&(1<<3))?0:len)));
 if (!lump) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:add_lump_rpl : no free pkg memory !\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "75" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:add_lump_rpl : no free pkg memory !\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "75" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:add_lump_rpl : no free pkg memory !\n", process_no, my_pid(), ("<core> [" "data_lump_rpl.c" ":" "75" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl : no free pkg memory !\n", ("<core> [" "data_lump_rpl.c" ":" "75" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl : no free pkg memory !\n", ("<core> [" "data_lump_rpl.c" ":" "75" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  goto error;
 }
 if (flags&(1<<3)) {
  lump->text.s = s;
 } else {
  lump->text.s = ((char *)lump)+sizeof(struct lump_rpl);
  memcpy( lump->text.s, s, len);
 }
 lump->text.len = len;
 lump->flags = flags;
 lump->next = 0;
 if (!msg->reply_lump) {
  msg->reply_lump = lump;
  ret=&msg->reply_lump;
 }else{
  if (!(flags&(1<<2)))
   for(foo=msg->reply_lump;foo->next;foo=foo->next);
  else
   for(foo=msg->reply_lump; ;foo=foo->next) {
    if (foo->flags&(1<<2)) {
     do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR:add_lump_rpl: LUMP_RPL_BODY " "already added!\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "99" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR:add_lump_rpl: LUMP_RPL_BODY " "already added!\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "data_lump_rpl.c" ":" "99" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR:add_lump_rpl: LUMP_RPL_BODY " "already added!\n", process_no, my_pid(), ("<core> [" "data_lump_rpl.c" ":" "99" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR:add_lump_rpl: LUMP_RPL_BODY " "already added!\n", ("<core> [" "data_lump_rpl.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(): " "ERROR:add_lump_rpl: LUMP_RPL_BODY " "already added!\n", ("<core> [" "data_lump_rpl.c" ":" "99" "]: ") , __func__); } } (dprint_crit--); } } while(0);
     qm_free(mem_block, (lump));
     goto error;
    }
    if (foo->next==0)
     break;
   }
  foo->next = lump;
  ret= &(foo->next);
 }
 return ret;
error:
 return 0;
}

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

variable_types:
s
char *

variable_types: len int

variable_types: flags int

variable_types: struct lump_rpl { struct _str { char *s; int len; } text; int flags; struct lump_rpl *next; } **

user_defined_types: struct lump_rpl { struct _str text; int flags; struct lump_rpl *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 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 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 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 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 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; }


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

if ( a1 )
{
if ( (*(_DWORD *)(a1 + 16) & 0x18) == 8 )
{
if ( *(_QWORD *)a1 )
qm_free(mem_block, *(_QWORD *)a1);
}
result = qm_free(mem_block, a1);
}
return result;
}

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

if ( a1 )
{
if ( (*(_DWORD *)(a1 + 16) & 0x18) == 8 )
{
if ( *(_QWORD *)a1 )
qm_free(mem_block, *(_QWORD *)a1);
}
result = qm_free(mem_block, a1);
}
return result;
}

original_code:
void free_lump_rpl(struct lump_rpl* lump)
{
 if (lump) {
  if (!((lump->flags)&(1<<4)) && ((lump->flags)&(1<<3))
  && lump->text.s)
   qm_free(mem_block, (lump->text.s));
  qm_free(mem_block, (lump));
 }
}

canonical_original_code:
void free_lump_rpl(struct lump_rpl *lump)
{
 if (lump) {
  if (!((lump->flags)&(1<<4)) && ((lump->flags)&(1<<3))
  && lump->text.s)
   qm_free(mem_block, (lump->text.s));
  qm_free(mem_block, (lump));
 }
}

variable_types: struct lump_rpl { struct _str { char *s; int len; } text; int flags; struct lump_rpl *next; } *