decompiled_code:
__int64 __fastcall parse_methods(__int64 a1, _DWORD *a2)
{
unsigned int v2; // ebx
unsigned int v3; // ebp
const char *v4; // rbp
unsigned int v5; // eax
const char *v7; // rbp
unsigned int v8; // eax
const char *v9; // rbx
unsigned int v10; // eax
const char *v11; // rbx
unsigned int v12; // eax
int v13; // [rsp+Ch] [rbp-2Ch] BYREF
unsigned __int8 *v14; // [rsp+10h] [rbp-28h] BYREF
unsigned int v15; // [rsp+18h] [rbp-20h]

v13 = 0;
if ( a1 && a2 )
{
v15 = *(_DWORD *)(a1 + 8);
v14 = *(unsigned __int8 **)a1;
trim_leading(&v14);
*a2 = 0;
v2 = v15;
if ( v15 )
{
while ( (unsigned int)parse_method_advance((char **)&v14, &v13) )
{
*a2 |= v13;
trim_leading(&v14);
v2 = v15;
if ( !v15 )
return v2;
if ( *v14 != 44 )
{
v2 = -1;
if ( (int)get_debug_level("core", 4LL) >= -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: parse_methods: Comma expected\n",
process_no,
v12,
v11,
"<core> [parser/parse_methods.c:401]: ",
"parse_methods");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR: parse_methods: Comma expected\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_methods.c:401]: ",
"parse_methods");
}
--dprint_crit;
v2 = -1;
}
return v2;
}
--v15;
++v14;
trim_leading(&v14);
v2 = v15;
if ( !v15 )
{
if ( (int)get_debug_level("core", 4LL) >= -1 )
{
v3 = dprint_crit;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v9 = (const char *)*((_QWORD *)&log_level_info + 8);
v10 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR: parse_methods: Method expected\n",
process_no,
v10,
v9,
"<core> [parser/parse_methods.c:397]: ",
"parse_methods");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR: parse_methods: Method expected\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_methods.c:397]: ",
"parse_methods");
}
--dprint_crit;
v2 = v3;
}
}
return v2;
}
}
v2 = -1;
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v7 = (const char *)*((_QWORD *)&log_level_info + 8);
v8 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR: parse_methods: Invalid method\n",
process_no,
v8,
v7,
"<core> [parser/parse_methods.c:386]: ",
"parse_methods");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR: parse_methods: Invalid method\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_methods.c:386]: ",
"parse_methods");
}
--dprint_crit;
v2 = -1;
}
}
}
else
{
v2 = -1;
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v4 = (const char *)*((_QWORD *)&log_level_info + 8);
v5 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): parse_methods: Invalid parameter value\n",
process_no,
v5,
v4,
"<core> [parser/parse_methods.c:367]: ",
"parse_methods");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): parse_methods: Invalid parameter value\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_methods.c:367]: ",
"parse_methods");
}
--dprint_crit;
v2 = -1;
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, _DWORD *a2)
{
unsigned int v2; // ebx
unsigned int v3; // ebp
const char *v4; // rbp
unsigned int v5; // eax
const char *v7; // rbp
unsigned int v8; // eax
const char *v9; // rbx
unsigned int v10; // eax
const char *v11; // rbx
unsigned int v12; // eax
int v13; // [rsp+Ch] [rbp-2Ch] BYREF
unsigned __int8 *v14; // [rsp+10h] [rbp-28h] BYREF
unsigned int v15; // [rsp+18h] [rbp-20h]

v13 = 0;
if ( a1 && a2 )
{
v15 = *(_DWORD *)(a1 + 8);
v14 = *(unsigned __int8 **)a1;
func0(&v14);
*a2 = 0;
v2 = v15;
if ( v15 )
{
while ( (unsigned int)func2((char **)&v14, &v13) )
{
*a2 |= v13;
func0(&v14);
v2 = v15;
if ( !v15 )
return v2;
if ( *v14 != 44 )
{
v2 = -1;
if ( (int)get_debug_level("core", 4LL) >= -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: parse_methods: Comma expected\n",
process_no,
v12,
v11,
"<core> [parser/parse_methods.c:401]: ",
"parse_methods");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR: parse_methods: Comma expected\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_methods.c:401]: ",
"parse_methods");
}
--dprint_crit;
v2 = -1;
}
return v2;
}
--v15;
++v14;
func0(&v14);
v2 = v15;
if ( !v15 )
{
if ( (int)get_debug_level("core", 4LL) >= -1 )
{
v3 = dprint_crit;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v9 = (const char *)*((_QWORD *)&log_level_info + 8);
v10 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR: parse_methods: Method expected\n",
process_no,
v10,
v9,
"<core> [parser/parse_methods.c:397]: ",
"parse_methods");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR: parse_methods: Method expected\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_methods.c:397]: ",
"parse_methods");
}
--dprint_crit;
v2 = v3;
}
}
return v2;
}
}
v2 = -1;
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v7 = (const char *)*((_QWORD *)&log_level_info + 8);
v8 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): ERROR: parse_methods: Invalid method\n",
process_no,
v8,
v7,
"<core> [parser/parse_methods.c:386]: ",
"parse_methods");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): ERROR: parse_methods: Invalid method\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_methods.c:386]: ",
"parse_methods");
}
--dprint_crit;
v2 = -1;
}
}
}
else
{
v2 = -1;
if ( (int)get_debug_level("core", 4LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v4 = (const char *)*((_QWORD *)&log_level_info + 8);
v5 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): parse_methods: Invalid parameter value\n",
process_no,
v5,
v4,
"<core> [parser/parse_methods.c:367]: ",
"parse_methods");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): parse_methods: Invalid parameter value\n",
*((const char **)&log_level_info + 8),
"<core> [parser/parse_methods.c:367]: ",
"parse_methods");
}
--dprint_crit;
v2 = -1;
}
}
return v2;
}

original_code:
int parse_methods(const str* const _body, unsigned int* const _methods)
 {
  str next;
  unsigned int method;
 method=0;
 if (!_body || !_methods) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "parse_methods: Invalid parameter value\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "367" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "parse_methods: Invalid parameter value\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "367" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "parse_methods: Invalid parameter value\n", process_no, my_pid(), ("<core> [" "parser/parse_methods.c" ":" "367" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_methods: Invalid parameter value\n", ("<core> [" "parser/parse_methods.c" ":" "367" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_methods: Invalid parameter value\n", ("<core> [" "parser/parse_methods.c" ":" "367" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 next.len = _body->len;
 next.s = _body->s;
  trim_leading(&next);
   *_methods = 0;
  if (next.len == 0) {
   return 0;
  }
  while (1) {
   if (parse_method_advance(&next, &method)) {
    *_methods |= method;
   } else {
    do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR: parse_methods: Invalid method\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "386" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR: parse_methods: Invalid method\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "386" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR: parse_methods: Invalid method\n", process_no, my_pid(), ("<core> [" "parser/parse_methods.c" ":" "386" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Invalid method\n", ("<core> [" "parser/parse_methods.c" ":" "386" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Invalid method\n", ("<core> [" "parser/parse_methods.c" ":" "386" "]: ") , __func__); } } (dprint_crit--); } } while(0);
    return -1;
   }
   trim_leading(&next);
   if (next.len) {
    if (next.s[0] == ',') {
     next.len--;
     next.s++;
     trim_leading(&next);
     if (next.len == 0) {
      do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR: parse_methods: Method expected\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "397" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR: parse_methods: Method expected\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "397" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR: parse_methods: Method expected\n", process_no, my_pid(), ("<core> [" "parser/parse_methods.c" ":" "397" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Method expected\n", ("<core> [" "parser/parse_methods.c" ":" "397" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Method expected\n", ("<core> [" "parser/parse_methods.c" ":" "397" "]: ") , __func__); } } (dprint_crit--); } } while(0);
      return 0;
     }
    } else {
     do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR: parse_methods: Comma expected\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "401" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR: parse_methods: Comma expected\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "401" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR: parse_methods: Comma expected\n", process_no, my_pid(), ("<core> [" "parser/parse_methods.c" ":" "401" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Comma expected\n", ("<core> [" "parser/parse_methods.c" ":" "401" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Comma expected\n", ("<core> [" "parser/parse_methods.c" ":" "401" "]: ") , __func__); } } (dprint_crit--); } } while(0);
     return -1;
    }
   } else {
    break;
   }
  }
  return 0;
 }

canonical_original_code:
int parse_methods(struct _str *_body, unsigned int *_methods)
 {
  struct _str next;
  unsigned int method;
 method=0;
 if (!_body || !_methods) {
  do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "parse_methods: Invalid parameter value\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "367" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "parse_methods: Invalid parameter value\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "367" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "parse_methods: Invalid parameter value\n", process_no, my_pid(), ("<core> [" "parser/parse_methods.c" ":" "367" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_methods: Invalid parameter value\n", ("<core> [" "parser/parse_methods.c" ":" "367" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "parse_methods: Invalid parameter value\n", ("<core> [" "parser/parse_methods.c" ":" "367" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 next.len = _body->len;
 next.s = _body->s;
  trim_leading(&next);
   *_methods = 0;
  if (next.len == 0) {
   return 0;
  }
  while (1) {
   if (parse_method_advance(&next, &method)) {
    *_methods |= method;
   } else {
    do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR: parse_methods: Invalid method\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "386" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR: parse_methods: Invalid method\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "386" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR: parse_methods: Invalid method\n", process_no, my_pid(), ("<core> [" "parser/parse_methods.c" ":" "386" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Invalid method\n", ("<core> [" "parser/parse_methods.c" ":" "386" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Invalid method\n", ("<core> [" "parser/parse_methods.c" ":" "386" "]: ") , __func__); } } (dprint_crit--); } } while(0);
    return -1;
   }
   trim_leading(&next);
   if (next.len) {
    if (next.s[0] == ',') {
     next.len--;
     next.s++;
     trim_leading(&next);
     if (next.len == 0) {
      do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR: parse_methods: Method expected\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "397" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR: parse_methods: Method expected\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "397" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR: parse_methods: Method expected\n", process_no, my_pid(), ("<core> [" "parser/parse_methods.c" ":" "397" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Method expected\n", ("<core> [" "parser/parse_methods.c" ":" "397" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Method expected\n", ("<core> [" "parser/parse_methods.c" ":" "397" "]: ") , __func__); } } (dprint_crit--); } } while(0);
      return 0;
     }
    } else {
     do { if (get_debug_level("core", (sizeof("core")-1)) >= ((-1)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((-1)) >= -5) && (((-1)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "ERROR: parse_methods: Comma expected\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "401" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "ERROR: parse_methods: Comma expected\n", (log_level_info[((-1)) - (-5)].name), ("<core> [" "parser/parse_methods.c" ":" "401" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "ERROR: parse_methods: Comma expected\n", process_no, my_pid(), ("<core> [" "parser/parse_methods.c" ":" "401" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Comma expected\n", ("<core> [" "parser/parse_methods.c" ":" "401" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "ERROR: parse_methods: Comma expected\n", ("<core> [" "parser/parse_methods.c" ":" "401" "]: ") , __func__); } } (dprint_crit--); } } while(0);
     return -1;
    }
   } else {
    break;
   }
  }
  return 0;
 }

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

variable_types:
method
unsigned int


repo: virtualolson/who

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

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

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

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

variable_types:
var
int *

variable_types: v int

return_type: int


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

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

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

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

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

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

variable_types:
lock
struct atomic_t { int val; } *

variable_types: i int

return_type: void


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

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

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

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

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

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


decompiled_code:
__int64 __fastcall notify_watchers(__int64 a1, __int64 a2, unsigned int a3)
{
__int64 i; // rbx
__int64 result; // rax

for ( i = *(_QWORD *)(a1 + 72); i; i = *(_QWORD *)(i + 16) )
result = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, _QWORD))i)(a1 + 8, a2 + 32, a3, *(_QWORD *)(i + 8));
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2, unsigned int a3)
{
__int64 i; // rbx
__int64 result; // rax

for ( i = *(_QWORD *)(a1 + 72); i; i = *(_QWORD *)(i + 16) )
result = (*(__int64 (__fastcall **)(__int64, __int64, _QWORD, _QWORD))i)(a1 + 8, a2 + 32, a3, *(_QWORD *)(i + 8));
return result;
}

original_code:
void notify_watchers(struct urecord* _r, ucontact_t *_c, int state)
{
 notify_cb_t* n;
 n = _r->watchers;
        while(n) {
  n->cb(&_r->uid, &_c->c, state, n->data);
  n = n->next;
 }
}

canonical_original_code:
void notify_watchers(struct urecord *_r, struct ucontact *_c, int state)
{
 struct notify_cb *n;
 n = _r->watchers;
        while(n) {
  n->cb(&_r->uid, &_c->c, state, n->data);
  n = n->next;
 }
}

variable_types: struct urecord { struct _str { char *s; int len; } *domain; struct _str uid; struct ucontact { struct _str *domain; struct _str *uid; struct _str aor; struct _str c; struct _str received; struct socket_info { int socket; struct _str name; struct ip_addr { unsigned int af; unsigned int len; union { unsigned long addrl[-1]; unsigned int addr32[4]; unsigned short addr16[8]; unsigned char addr[16]; } u; } address; struct _str address_str; struct _str port_no_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } s; struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } sin; struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; } sin6_addr; unsigned int sin6_scope_id; } sin6; } su; struct socket_info *next; struct socket_info *prev; unsigned short port_no; char proto; struct _str sock_str; struct addr_info { struct _str name; struct ip_addr address; struct _str address_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union su; struct addr_info *next; struct addr_info *prev; } *addr_info_lst; int workers; int workers_tcpidx; struct advertise_info { struct _str name; unsigned short port_no; struct _str port_no_str; struct _str address_str; struct ip_addr address; struct _str sock_str; } useinfo; } *sock; long expires; int q; struct _str callid; int cseq; enum cstate { CS_NEW=0, CS_SYNC=1, CS_DIRTY=2 } state; unsigned int flags; struct _str user_agent; struct _str instance; int server_id; struct ucontact *next; struct ucontact *prev; struct usr_avp { unsigned short id; unsigned int flags; struct usr_avp *next; union usr_avp_data { void *p; long l; char data[-1]; } d; } *avps; } *contacts; struct hslot { int n; struct urecord *first; struct urecord *last; struct udomain { struct _str *name; int users; int expired; int db_cmd_idx; struct hslot *table; struct { int n; struct urecord *first; struct urecord *last; } d_ll; struct atomic_t { int val; } lock; } *d; } *slot; struct { struct urecord *prev; struct urecord *next; } d_ll; struct { struct urecord *prev; struct urecord *next; } s_ll; struct notify_cb { void (*cb)(struct _str *uid, struct _str *_contact, enum pres_state { PRES_OFFLINE=0, PRES_ONLINE=1 } _p, void *_d); void *data; struct notify_cb *next; } *watchers; } *

variable_types: state int

variable_types: struct notify_cb { void (*cb)(struct _str { char *s; int len; } *uid, struct _str *_contact, enum pres_state { PRES_OFFLINE=0, PRES_ONLINE=1 } _p, void *_d); void *data; struct notify_cb *next; } *

user_defined_types: struct urecord { struct _str *domain; struct _str uid; struct ucontact *contacts; struct hslot *slot; struct { struct urecord *prev; struct urecord *next; } d_ll; struct { struct urecord *prev; struct urecord *next; } s_ll; struct notify_cb *watchers; }

user_defined_types: struct notify_cb { void (*cb)(struct _str *uid, struct _str *_contact, enum pres_state _p, void *_d); void *data; struct notify_cb *next; }

user_defined_types: struct ucontact { struct _str *domain; struct _str *uid; struct _str aor; struct _str c; struct _str received; struct socket_info *sock; long expires; int q; struct _str callid; int cseq; enum cstate state; unsigned int flags; struct _str user_agent; struct _str instance; int server_id; struct ucontact *next; struct ucontact *prev; struct usr_avp *avps; }

user_defined_types: struct hslot { int n; struct urecord *first; struct urecord *last; struct udomain *d; }

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 usr_avp { unsigned short id; unsigned int flags; struct usr_avp *next; union usr_avp_data d; }

user_defined_types: struct udomain { struct _str *name; int users; int expired; int db_cmd_idx; struct hslot *table; struct { int n; struct urecord *first; struct urecord *last; } d_ll; struct atomic_t lock; }

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

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

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

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


decompiled_code:
__int64 __fastcall add_watcher(__int64 a1, __int64 a2, __int64 a3)
{
_QWORD *v4; // rax
_QWORD *v5; // rbp
__int64 v6; // r13
__int64 result; // rax
int v8; // edx
const char *v9; // r13
unsigned int v10; // eax

v4 = (_QWORD *)shm_malloc(0x18u);
if ( v4 )
{
v5 = v4;
*v4 = a2;
v4[1] = a3;
v4[2] = *(_QWORD *)(a1 + 72);
*(_QWORD *)(a1 + 72) = v4;
v6 = *(_QWORD *)(a1 + 24);
if ( v6 )
{
do
{
((void (__fastcall *)(__int64, __int64, __int64, _QWORD))*v5)(a1 + 8, v6 + 32, 1LL, v5[1]);
v6 = *(_QWORD *)(v6 + 160);
}
while ( v6 );
result = 0LL;
}
else
{
result = 0LL;
}
}
else
{
v8 = get_debug_level("usrloc", 6LL);
result = 0xFFFFFFFFLL;
if ( v8 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v9 = (const char *)*((_QWORD *)&log_level_info + 8);
v10 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): add_watcher(): No memory left\n",
process_no,
v10,
v9,
"usrloc [notify.c:58]: ",
"add_watcher");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): add_watcher(): No memory left\n",
*((const char **)&log_level_info + 8),
"usrloc [notify.c:58]: ",
"add_watcher");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2, __int64 a3)
{
_QWORD *v4; // rax
_QWORD *v5; // rbp
__int64 v6; // r13
__int64 result; // rax
int v8; // edx
const char *v9; // r13
unsigned int v10; // eax

v4 = (_QWORD *)func4(0x18u);
if ( v4 )
{
v5 = v4;
*v4 = a2;
v4[1] = a3;
v4[2] = *(_QWORD *)(a1 + 72);
*(_QWORD *)(a1 + 72) = v4;
v6 = *(_QWORD *)(a1 + 24);
if ( v6 )
{
do
{
((void (__fastcall *)(__int64, __int64, __int64, _QWORD))*v5)(a1 + 8, v6 + 32, 1LL, v5[1]);
v6 = *(_QWORD *)(v6 + 160);
}
while ( v6 );
result = 0LL;
}
else
{
result = 0LL;
}
}
else
{
v8 = get_debug_level("usrloc", 6LL);
result = 0xFFFFFFFFLL;
if ( v8 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v9 = (const char *)*((_QWORD *)&log_level_info + 8);
v10 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): add_watcher(): No memory left\n",
process_no,
v10,
v9,
"usrloc [notify.c:58]: ",
"add_watcher");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): add_watcher(): No memory left\n",
*((const char **)&log_level_info + 8),
"usrloc [notify.c:58]: ",
"add_watcher");
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
return result;
}

original_code:
int add_watcher(struct urecord* _r, notcb_t _c, void* _d)
{
 notify_cb_t* ptr;
 ucontact_t *c;
 ptr = (notify_cb_t*)shm_malloc(sizeof(notify_cb_t));
 if (ptr == 0) {
  do { if (get_debug_level("usrloc", (sizeof("usrloc")-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(): " "add_watcher(): No memory left\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "58" "]: ") , __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(): " "add_watcher(): No memory left\n", (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "58" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "add_watcher(): No memory left\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "58" "]: ") , __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(): " "add_watcher(): No memory left\n", ("usrloc" " [" "notify.c" ":" "58" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "add_watcher(): No memory left\n", ("usrloc" " [" "notify.c" ":" "58" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 ptr->cb = _c;
 ptr->data = _d;
 ptr->next = _r->watchers;
 _r->watchers = ptr;
 c = _r->contacts;
 while (c) {
  ptr->cb(&_r->uid, &c->c, PRES_ONLINE, ptr->data);
  c = c->next;
 }
 return 0;
}

canonical_original_code:
int add_watcher(struct urecord *_r, void (*_c)(struct _str *uid, struct _str *_contact, enum pres_state _p, void *_d), void *_d)
{
 struct notify_cb *ptr;
 struct ucontact *c;
 ptr = (struct notify_cb *)shm_malloc(sizeof(notify_cb_t));
 if (ptr == 0) {
  do { if (get_debug_level("usrloc", (sizeof("usrloc")-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(): " "add_watcher(): No memory left\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "58" "]: ") , __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(): " "add_watcher(): No memory left\n", (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "58" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "add_watcher(): No memory left\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "58" "]: ") , __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(): " "add_watcher(): No memory left\n", ("usrloc" " [" "notify.c" ":" "58" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "add_watcher(): No memory left\n", ("usrloc" " [" "notify.c" ":" "58" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return -1;
 }
 ptr->cb = _c;
 ptr->data = _d;
 ptr->next = _r->watchers;
 _r->watchers = ptr;
 c = _r->contacts;
 while (c) {
  ptr->cb(&_r->uid, &c->c, PRES_ONLINE, ptr->data);
  c = c->next;
 }
 return 0;
}

variable_types: void (*)(struct _str *uid, struct _str *_contact, enum pres_state { PRES_OFFLINE=0, PRES_ONLINE=1 } _p, void *_d)

variable_types: struct ucontact { struct _str { char *s; int len; } *domain; struct _str *uid; struct _str aor; struct _str c; struct _str received; struct socket_info { int socket; struct _str name; struct ip_addr { unsigned int af; unsigned int len; union { unsigned long addrl[-1]; unsigned int addr32[4]; unsigned short addr16[8]; unsigned char addr[16]; } u; } address; struct _str address_str; struct _str port_no_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } s; struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } sin; struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; } sin6_addr; unsigned int sin6_scope_id; } sin6; } su; struct socket_info *next; struct socket_info *prev; unsigned short port_no; char proto; struct _str sock_str; struct addr_info { struct _str name; struct ip_addr address; struct _str address_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union su; struct addr_info *next; struct addr_info *prev; } *addr_info_lst; int workers; int workers_tcpidx; struct advertise_info { struct _str name; unsigned short port_no; struct _str port_no_str; struct _str address_str; struct ip_addr address; struct _str sock_str; } useinfo; } *sock; long expires; int q; struct _str callid; int cseq; enum cstate { CS_NEW=0, CS_SYNC=1, CS_DIRTY=2 } state; unsigned int flags; struct _str user_agent; struct _str instance; int server_id; struct ucontact *next; struct ucontact *prev; struct usr_avp { unsigned short id; unsigned int flags; struct usr_avp *next; union usr_avp_data { void *p; long l; char data[-1]; } d; } *avps; } *

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


decompiled_code:
__int64 __fastcall register_watcher(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 result; // rax
int v7; // ebp
char *v8; // r10
const char *v9; // rbx
int v10; // er12
const char *v11; // rbp
unsigned int v12; // eax
int v13; // er8
const char *v14; // rbx
unsigned int v15; // eax
const char *v16; // r12
unsigned int v17; // eax
__int64 v18; // [rsp+0h] [rbp-28h] BYREF
__int64 v19[4]; // [rsp+8h] [rbp-20h] BYREF

if ( (int)find_domain(&dom, v19) > 0 )
{
v7 = get_debug_level("usrloc", 6LL);
result = 0xFFFFFFFFLL;
if ( v7 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v9 = dom;
if ( !dom )
v9 = (const char *)&LC4;
v10 = *((_DWORD *)&dom + 2);
v11 = (const char *)*((_QWORD *)&log_level_info + 8);
v12 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): register_watcher(): Domain '%.*s' not found\n",
process_no,
v12,
v11,
"usrloc [notify.c:101]: ",
"register_watcher",
v10,
v9);
if ( log_color )
dprint_color_reset();
}
else
{
v8 = dom;
if ( !dom )
v8 = (char *)&LC4;
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): register_watcher(): Domain '%.*s' not found\n",
*((_QWORD *)&log_level_info + 8),
"usrloc [notify.c:101]: ",
"register_watcher",
*((unsigned int *)&dom + 2),
v8);
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
else
{
lock_udomain(v19[0]);
if ( (int)get_urecord(v19[0], a2, &v18) > 0 && (int)insert_urecord(v19[0], a2, &v18) < 0 )
{
unlock_udomain(v19[0]);
v13 = get_debug_level("usrloc", 6LL);
result = 4294967294LL;
if ( v13 >= -1 )
{
result = 4294967294LL;
if ( !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(): register_watcher(): Error while creating a new record\n",
process_no,
v15,
v14,
"usrloc [notify.c:110]: ",
"register_watcher");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): register_watcher(): Error while creating a new record\n",
*((const char **)&log_level_info + 8),
"usrloc [notify.c:110]: ",
"register_watcher");
}
--dprint_crit;
result = 4294967294LL;
}
}
}
else if ( (int)add_watcher(v18, a3, a4) < 0 )
{
if ( (int)get_debug_level("usrloc", 6LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v16 = (const char *)*((_QWORD *)&log_level_info + 8);
v17 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): register_watcher(): Error while adding a watcher\n",
process_no,
v17,
v16,
"usrloc [notify.c:116]: ",
"register_watcher");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): register_watcher(): Error while adding a watcher\n",
*((const char **)&log_level_info + 8),
"usrloc [notify.c:116]: ",
"register_watcher");
}
--dprint_crit;
}
release_urecord(v18);
unlock_udomain(v19[0]);
result = 4294967293LL;
}
else
{
unlock_udomain(v19[0]);
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 result; // rax
int v7; // ebp
char *v8; // r10
const char *v9; // rbx
int v10; // er12
const char *v11; // rbp
unsigned int v12; // eax
int v13; // er8
const char *v14; // rbx
unsigned int v15; // eax
const char *v16; // r12
unsigned int v17; // eax
__int64 v18; // [rsp+0h] [rbp-28h] BYREF
__int64 v19[4]; // [rsp+8h] [rbp-20h] BYREF

if ( (int)find_domain(&dom, v19) > 0 )
{
v7 = get_debug_level("usrloc", 6LL);
result = 0xFFFFFFFFLL;
if ( v7 >= -1 )
{
result = 0xFFFFFFFFLL;
if ( !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v9 = dom;
if ( !dom )
v9 = (const char *)&LC4;
v10 = *((_DWORD *)&dom + 2);
v11 = (const char *)*((_QWORD *)&log_level_info + 8);
v12 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): register_watcher(): Domain '%.*s' not found\n",
process_no,
v12,
v11,
"usrloc [notify.c:101]: ",
"register_watcher",
v10,
v9);
if ( log_color )
dprint_color_reset();
}
else
{
v8 = dom;
if ( !dom )
v8 = (char *)&LC4;
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): register_watcher(): Domain '%.*s' not found\n",
*((_QWORD *)&log_level_info + 8),
"usrloc [notify.c:101]: ",
"register_watcher",
*((unsigned int *)&dom + 2),
v8);
}
--dprint_crit;
result = 0xFFFFFFFFLL;
}
}
}
else
{
lock_udomain(v19[0]);
if ( (int)get_urecord(v19[0], a2, &v18) > 0 && (int)insert_urecord(v19[0], a2, &v18) < 0 )
{
unlock_udomain(v19[0]);
v13 = get_debug_level("usrloc", 6LL);
result = 4294967294LL;
if ( v13 >= -1 )
{
result = 4294967294LL;
if ( !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(): register_watcher(): Error while creating a new record\n",
process_no,
v15,
v14,
"usrloc [notify.c:110]: ",
"register_watcher");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): register_watcher(): Error while creating a new record\n",
*((const char **)&log_level_info + 8),
"usrloc [notify.c:110]: ",
"register_watcher");
}
--dprint_crit;
result = 4294967294LL;
}
}
}
else if ( (int)func6(v18, a3, a4) < 0 )
{
if ( (int)get_debug_level("usrloc", 6LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v16 = (const char *)*((_QWORD *)&log_level_info + 8);
v17 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): register_watcher(): Error while adding a watcher\n",
process_no,
v17,
v16,
"usrloc [notify.c:116]: ",
"register_watcher");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): register_watcher(): Error while adding a watcher\n",
*((const char **)&log_level_info + 8),
"usrloc [notify.c:116]: ",
"register_watcher");
}
--dprint_crit;
}
release_urecord(v18);
unlock_udomain(v19[0]);
result = 4294967293LL;
}
else
{
unlock_udomain(v19[0]);
result = 0LL;
}
}
return result;
}

original_code:
int register_watcher(str* _f, str* _t, notcb_t _c, void* _data)
{
 udomain_t* d;
 urecord_t* r;
 if (find_domain(&dom, &d) > 0) {
  do { if (get_debug_level("usrloc", (sizeof("usrloc")-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(): " "register_watcher(): Domain '%.*s' not found\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "101" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "register_watcher(): Domain '%.*s' not found\n", (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "101" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "register_watcher(): Domain '%.*s' not found\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "101" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "register_watcher(): Domain '%.*s' not found\n", ("usrloc" " [" "notify.c" ":" "101" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "register_watcher(): Domain '%.*s' not found\n", ("usrloc" " [" "notify.c" ":" "101" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); } } (dprint_crit--); } } while(0);
  return -1;
 }
 lock_udomain(d);
 if (get_urecord(d, _t, &r) > 0) {
  if (insert_urecord(d, _t, &r) < 0) {
   unlock_udomain(d);
   do { if (get_debug_level("usrloc", (sizeof("usrloc")-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(): " "register_watcher(): Error while creating a new record\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "110" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "register_watcher(): Error while creating a new record\n", (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "110" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "register_watcher(): Error while creating a new record\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "110" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "register_watcher(): Error while creating a new record\n", ("usrloc" " [" "notify.c" ":" "110" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "register_watcher(): Error while creating a new record\n", ("usrloc" " [" "notify.c" ":" "110" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -2;
  }
 }
 if (add_watcher(r, _c, _data) < 0) {
  do { if (get_debug_level("usrloc", (sizeof("usrloc")-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(): " "register_watcher(): Error while adding a watcher\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "116" "]: ") , __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(): " "register_watcher(): Error while adding a watcher\n", (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "116" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "register_watcher(): Error while adding a watcher\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "116" "]: ") , __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(): " "register_watcher(): Error while adding a watcher\n", ("usrloc" " [" "notify.c" ":" "116" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "register_watcher(): Error while adding a watcher\n", ("usrloc" " [" "notify.c" ":" "116" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  release_urecord(r);
  unlock_udomain(d);
  return -3;
 }
 unlock_udomain(d);
 return 0;
}

canonical_original_code:
int register_watcher(struct _str *_f, struct _str *_t, void (*_c)(struct _str *uid, struct _str *_contact, enum pres_state _p, void *_d), void *_data)
{
 struct udomain *d;
 struct urecord *r;
 if (find_domain(&dom, &d) > 0) {
  do { if (get_debug_level("usrloc", (sizeof("usrloc")-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(): " "register_watcher(): Domain '%.*s' not found\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "101" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "register_watcher(): Domain '%.*s' not found\n", (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "101" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "register_watcher(): Domain '%.*s' not found\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "101" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "register_watcher(): Domain '%.*s' not found\n", ("usrloc" " [" "notify.c" ":" "101" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "register_watcher(): Domain '%.*s' not found\n", ("usrloc" " [" "notify.c" ":" "101" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); } } (dprint_crit--); } } while(0);
  return -1;
 }
 lock_udomain(d);
 if (get_urecord(d, _t, &r) > 0) {
  if (insert_urecord(d, _t, &r) < 0) {
   unlock_udomain(d);
   do { if (get_debug_level("usrloc", (sizeof("usrloc")-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(): " "register_watcher(): Error while creating a new record\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "110" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "register_watcher(): Error while creating a new record\n", (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "110" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "register_watcher(): Error while creating a new record\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "110" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "register_watcher(): Error while creating a new record\n", ("usrloc" " [" "notify.c" ":" "110" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "register_watcher(): Error while creating a new record\n", ("usrloc" " [" "notify.c" ":" "110" "]: ") , __func__); } } (dprint_crit--); } } while(0);
   return -2;
  }
 }
 if (add_watcher(r, _c, _data) < 0) {
  do { if (get_debug_level("usrloc", (sizeof("usrloc")-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(): " "register_watcher(): Error while adding a watcher\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "116" "]: ") , __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(): " "register_watcher(): Error while adding a watcher\n", (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "116" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "register_watcher(): Error while adding a watcher\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "116" "]: ") , __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(): " "register_watcher(): Error while adding a watcher\n", ("usrloc" " [" "notify.c" ":" "116" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "register_watcher(): Error while adding a watcher\n", ("usrloc" " [" "notify.c" ":" "116" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  release_urecord(r);
  unlock_udomain(d);
  return -3;
 }
 unlock_udomain(d);
 return 0;
}

variable_types: struct udomain { struct _str { char *s; int len; } *name; int users; int expired; int db_cmd_idx; struct hslot { int n; struct urecord { struct _str *domain; struct _str uid; struct ucontact { struct _str *domain; struct _str *uid; struct _str aor; struct _str c; struct _str received; struct socket_info { int socket; struct _str name; struct ip_addr { unsigned int af; unsigned int len; union { unsigned long addrl[-1]; unsigned int addr32[4]; unsigned short addr16[8]; unsigned char addr[16]; } u; } address; struct _str address_str; struct _str port_no_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } s; struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } sin; struct sockaddr_in6 { unsigned short sin6_family; unsigned short sin6_port; unsigned int sin6_flowinfo; struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; } sin6_addr; unsigned int sin6_scope_id; } sin6; } su; struct socket_info *next; struct socket_info *prev; unsigned short port_no; char proto; struct _str sock_str; struct addr_info { struct _str name; struct ip_addr address; struct _str address_str; enum si_flags { SI_NONE=0, SI_IS_IP=1, SI_IS_LO=2, SI_IS_MCAST=4, SI_IS_ANY=8, SI_IS_MHOMED=16 } flags; union sockaddr_union su; struct addr_info *next; struct addr_info *prev; } *addr_info_lst; int workers; int workers_tcpidx; struct advertise_info { struct _str name; unsigned short port_no; struct _str port_no_str; struct _str address_str; struct ip_addr address; struct _str sock_str; } useinfo; } *sock; long expires; int q; struct _str callid; int cseq; enum cstate { CS_NEW=0, CS_SYNC=1, CS_DIRTY=2 } state; unsigned int flags; struct _str user_agent; struct _str instance; int server_id; struct ucontact *next; struct ucontact *prev; struct usr_avp { unsigned short id; unsigned int flags; struct usr_avp *next; union usr_avp_data { void *p; long l; char data[-1]; } d; } *avps; } *contacts; struct hslot *slot; struct { struct urecord *prev; struct urecord *next; } d_ll; struct { struct urecord *prev; struct urecord *next; } s_ll; struct notify_cb { void (*cb)(struct _str *uid, struct _str *_contact, enum pres_state { PRES_OFFLINE=0, PRES_ONLINE=1 } _p, void *_d); void *data; struct notify_cb *next; } *watchers; } *first; struct urecord *last; struct udomain *d; } *table; struct { int n; struct urecord *first; struct urecord *last; } d_ll; struct atomic_t { int val; } lock; } *


decompiled_code:
__int64 __fastcall unregister_watcher(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
unsigned int v6; // ebx
char *v8; // rbp
const char *v9; // rbx
int v10; // er12
const char *v11; // rbp
unsigned int v12; // eax
const char *v13; // r12
unsigned int v14; // eax
__int64 v15; // [rsp+0h] [rbp-28h] BYREF
__int64 v16[4]; // [rsp+8h] [rbp-20h] BYREF

if ( (int)find_domain(&dom, v16) > 0 )
{
v6 = -1;
if ( (int)get_debug_level("usrloc", 6LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v9 = dom;
if ( !dom )
v9 = (const char *)&LC4;
v10 = *((_DWORD *)&dom + 2);
v11 = (const char *)*((_QWORD *)&log_level_info + 8);
v12 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): unregister_watcher(): Domain '%.*s' not found\n",
process_no,
v12,
v11,
"usrloc [notify.c:134]: ",
"unregister_watcher",
v10,
v9);
if ( log_color )
dprint_color_reset();
}
else
{
v8 = dom;
if ( !dom )
v8 = (char *)&LC4;
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): unregister_watcher(): Domain '%.*s' not found\n",
*((_QWORD *)&log_level_info + 8),
"usrloc [notify.c:134]: ",
"unregister_watcher",
*((unsigned int *)&dom + 2),
v8);
}
--dprint_crit;
v6 = -1;
}
}
else
{
lock_udomain(v16[0]);
if ( (int)get_urecord(v16[0], a2, &v15) > 0 )
{
unlock_udomain(v16[0]);
v6 = 0;
if ( (int)get_debug_level("usrloc", 6LL) > 2 )
{
v6 = dprint_crit;
if ( dprint_crit )
{
v6 = 0;
}
else
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v13 = (const char *)*((_QWORD *)&log_level_info + 16);
v14 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): unregister_watcher(): Record not found\n",
process_no,
v14,
v13,
"usrloc [notify.c:142]: ",
"unregister_watcher");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): unregister_watcher(): Record not found\n",
*((const char **)&log_level_info + 16),
"usrloc [notify.c:142]: ",
"unregister_watcher");
}
--dprint_crit;
}
}
}
else
{
remove_watcher(v15, a3, a4);
release_urecord(v15);
unlock_udomain(v16[0]);
v6 = 0;
}
}
return v6;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
unsigned int v6; // ebx
char *v8; // rbp
const char *v9; // rbx
int v10; // er12
const char *v11; // rbp
unsigned int v12; // eax
const char *v13; // r12
unsigned int v14; // eax
__int64 v15; // [rsp+0h] [rbp-28h] BYREF
__int64 v16[4]; // [rsp+8h] [rbp-20h] BYREF

if ( (int)find_domain(&dom, v16) > 0 )
{
v6 = -1;
if ( (int)get_debug_level("usrloc", 6LL) >= -1 && !dprint_crit )
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(0xFFFFFFFFLL);
v9 = dom;
if ( !dom )
v9 = (const char *)&LC4;
v10 = *((_DWORD *)&dom + 2);
v11 = (const char *)*((_QWORD *)&log_level_info + 8);
v12 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): unregister_watcher(): Domain '%.*s' not found\n",
process_no,
v12,
v11,
"usrloc [notify.c:134]: ",
"unregister_watcher",
v10,
v9);
if ( log_color )
dprint_color_reset();
}
else
{
v8 = dom;
if ( !dom )
v8 = (char *)&LC4;
syslog(
*((_DWORD *)&log_level_info + 18) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): unregister_watcher(): Domain '%.*s' not found\n",
*((_QWORD *)&log_level_info + 8),
"usrloc [notify.c:134]: ",
"unregister_watcher",
*((unsigned int *)&dom + 2),
v8);
}
--dprint_crit;
v6 = -1;
}
}
else
{
lock_udomain(v16[0]);
if ( (int)get_urecord(v16[0], a2, &v15) > 0 )
{
unlock_udomain(v16[0]);
v6 = 0;
if ( (int)get_debug_level("usrloc", 6LL) > 2 )
{
v6 = dprint_crit;
if ( dprint_crit )
{
v6 = 0;
}
else
{
++dprint_crit;
if ( log_stderr )
{
if ( log_color )
dprint_color(3LL);
v13 = (const char *)*((_QWORD *)&log_level_info + 16);
v14 = my_pid();
fprintf(
stderr,
"%2d(%d) %s: %s%s(): unregister_watcher(): Record not found\n",
process_no,
v14,
v13,
"usrloc [notify.c:142]: ",
"unregister_watcher");
if ( log_color )
dprint_color_reset();
}
else
{
syslog(
*((_DWORD *)&log_level_info + 34) | *(_DWORD *)(core_cfg + 4LL),
"%s: %s%s(): unregister_watcher(): Record not found\n",
*((const char **)&log_level_info + 16),
"usrloc [notify.c:142]: ",
"unregister_watcher");
}
--dprint_crit;
}
}
}
else
{
func7(v15, a3, a4);
release_urecord(v15);
unlock_udomain(v16[0]);
v6 = 0;
}
}
return v6;
}

original_code:
int unregister_watcher(str* _f, str* _t, notcb_t _c, void* _data)
{
 udomain_t* d;
 urecord_t* r;
 if (find_domain(&dom, &d) > 0) {
  do { if (get_debug_level("usrloc", (sizeof("usrloc")-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(): " "unregister_watcher(): Domain '%.*s' not found\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "134" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "unregister_watcher(): Domain '%.*s' not found\n", (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "134" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "unregister_watcher(): Domain '%.*s' not found\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "134" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "unregister_watcher(): Domain '%.*s' not found\n", ("usrloc" " [" "notify.c" ":" "134" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "unregister_watcher(): Domain '%.*s' not found\n", ("usrloc" " [" "notify.c" ":" "134" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); } } (dprint_crit--); } } while(0);
  return -1;
 }
 lock_udomain(d);
 if (get_urecord(d, _t, &r) > 0) {
  unlock_udomain(d);
  do { if (get_debug_level("usrloc", (sizeof("usrloc")-1)) >= ((3)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((3)) >= -5) && (((3)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "unregister_watcher(): Record not found\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "142" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((3)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "unregister_watcher(): Record not found\n", (log_level_info[((3)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "142" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "unregister_watcher(): Record not found\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "142" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((3))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "unregister_watcher(): Record not found\n", ("usrloc" " [" "notify.c" ":" "142" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "unregister_watcher(): Record not found\n", ("usrloc" " [" "notify.c" ":" "142" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return 0;
 }
 remove_watcher(r, _c, _data);
 release_urecord(r);
 unlock_udomain(d);
 return 0;
}

canonical_original_code:
int unregister_watcher(struct _str *_f, struct _str *_t, void (*_c)(struct _str *uid, struct _str *_contact, enum pres_state _p, void *_d), void *_data)
{
 struct udomain *d;
 struct urecord *r;
 if (find_domain(&dom, &d) > 0) {
  do { if (get_debug_level("usrloc", (sizeof("usrloc")-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(): " "unregister_watcher(): Domain '%.*s' not found\n", process_no, my_pid(), (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "134" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((-1)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "unregister_watcher(): Domain '%.*s' not found\n", (log_level_info[((-1)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "134" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((-1)); fprintf(stderr, "%2d(%d) %s" "%s(): " "unregister_watcher(): Domain '%.*s' not found\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "134" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((-1))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "unregister_watcher(): Domain '%.*s' not found\n", ("usrloc" " [" "notify.c" ":" "134" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "unregister_watcher(): Domain '%.*s' not found\n", ("usrloc" " [" "notify.c" ":" "134" "]: ") , __func__, dom.len, ((dom.s)?(dom.s):"")); } } (dprint_crit--); } } while(0);
  return -1;
 }
 lock_udomain(d);
 if (get_urecord(d, _t, &r) > 0) {
  unlock_udomain(d);
  do { if (get_debug_level("usrloc", (sizeof("usrloc")-1)) >= ((3)) && (dprint_crit==0)) { (dprint_crit++); if (__builtin_expect(!!((((3)) >= -5) && (((3)) <= 3)), 1)){ if (__builtin_expect(!!(log_stderr), 0)) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s: %s" "%s(): " "unregister_watcher(): Record not found\n", process_no, my_pid(), (log_level_info[((3)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "142" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { syslog((log_level_info[((3)) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s: %s" "%s(): " "unregister_watcher(): Record not found\n", (log_level_info[((3)) - (-5)].name), ("usrloc" " [" "notify.c" ":" "142" "]: ") , __func__); } } else { if (log_stderr) { if (__builtin_expect(!!(log_color), 0)) dprint_color((3)); fprintf(stderr, "%2d(%d) %s" "%s(): " "unregister_watcher(): Record not found\n", process_no, my_pid(), ("usrloc" " [" "notify.c" ":" "142" "]: ") , __func__); if (__builtin_expect(!!(log_color), 0)) dprint_color_reset(); } else { if (((3))<-5) syslog((log_level_info[(-5) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "unregister_watcher(): Record not found\n", ("usrloc" " [" "notify.c" ":" "142" "]: ") , __func__); else syslog((log_level_info[(3) - (-5)].syslog_level) | (((0) != 0) ? (0) : ((struct cfg_group_core *)core_cfg)->log_facility), "%s" "%s(): " "unregister_watcher(): Record not found\n", ("usrloc" " [" "notify.c" ":" "142" "]: ") , __func__); } } (dprint_crit--); } } while(0);
  return 0;
 }
 remove_watcher(r, _c, _data);
 release_urecord(r);
 unlock_udomain(d);
 return 0;
}

user_defined_types: enum pres_state { PRES_OFFLINE=0, PRES_ONLINE=1 }

user_defined_types: enum cstate { CS_NEW=0, CS_SYNC=1, CS_DIRTY=2 }

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

user_defined_types: 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 }

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

user_defined_types: union usr_avp_data { void *p; long l; char data[-1]; }

user_defined_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; }

user_defined_types: struct in6_addr { union { unsigned char __u6_addr8[16]; unsigned short __u6_addr16[8]; unsigned int __u6_addr32[4]; } __in6_u; }