
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Unknown calling convention */
/* WARNING: Enum "MHD_FLAG": Some values do not have unique names */
/* WARNING: Enum "gnutls_pk_algorithm_t": Some values do not have unique names */
/* WARNING: Enum "gnutls_certificate_type_t": Some values do not have unique names */

MHD_Response *
MHD_create_response_for_upgrade(MHD_UpgradeHandler upgrade_handler,void *upgrade_handler_cls)

{
  MHD_Response *response;
  int iVar1;
  
  if (upgrade_handler != (MHD_UpgradeHandler)0x0) {
    response = (MHD_Response *)calloc(1,0x60);
    if (response != (MHD_Response *)0x0) {
      iVar1 = pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0);
      if (iVar1 != 0) {
        free(response);
        return (MHD_Response *)0x0;
      }
      response->upgrade_handler = upgrade_handler;
      *(undefined4 *)&response->total_size = 0xffffffff;
      response->upgrade_handler_cls = upgrade_handler_cls;
      *(undefined4 *)((int)&response->total_size + 4) = 0xffffffff;
      response->reference_count = 1;
      iVar1 = MHD_add_response_header(response,"Connection","Upgrade");
      if (iVar1 != 0) {
        return response;
      }
      MHD_destroy_response(response);
    }
  }
  return (MHD_Response *)0x0;
}



/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

void * MHD_create_response_for_upgrade(int param_1,undefined4 param_2)

{
  void *__ptr;
  int iVar1;
  
  if (param_1 != 0) {
    __ptr = calloc(1,0x60);
    if (__ptr != (void *)0x0) {
      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);
      if (iVar1 != 0) {
        free(__ptr);
        return (void *)0x0;
      }
      *(int *)((int)__ptr + 0x14) = param_1;
      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;
      *(undefined4 *)((int)__ptr + 0x18) = param_2;
      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;
      *(undefined4 *)((int)__ptr + 0x54) = 1;
      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");
      if (iVar1 != 0) {
        return __ptr;
      }
      MHD_destroy_response(__ptr);
    }
  }
  return (void *)0x0;
}


PUSH EDI
PUSH ESI
PUSH EBX
MOV EDI,dword ptr [ESP + 0x10]
CALL 0x00013810
ADD EBX,0x11514
TEST EDI,EDI
JZ 0x00023954
SUB ESP,0x8
PUSH 0x60
PUSH 0x1
CALL 0x000137b0
ADD ESP,0x10
MOV ESI,EAX
TEST EAX,EAX
JZ 0x00023954
SUB ESP,0x8
LEA EAX,[EAX + 0x1c]
PUSH 0x0
PUSH EAX
CALL 0x000131a0
ADD ESP,0x10
TEST EAX,EAX
JNZ 0x00023960
MOV EAX,dword ptr [ESP + 0x14]
SUB ESP,0x4
MOV dword ptr [ESI + 0x14],EDI
MOV dword ptr [ESI + 0x34],0xffffffff
MOV dword ptr [ESI + 0x18],EAX
LEA EAX,[EBX + 0xffff7a23]
MOV dword ptr [ESI + 0x38],0xffffffff
MOV dword ptr [ESI + 0x54],0x1
PUSH EAX
LEA EAX,[EBX + 0xffff5266]
PUSH EAX
PUSH ESI
CALL 0x000134e0
ADD ESP,0x10
TEST EAX,EAX
JZ 0x00023948
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
RET
SUB ESP,0xc
PUSH ESI
CALL 0x000131b0
ADD ESP,0x10
XOR ESI,ESI
POP EBX
MOV EAX,ESI
POP ESI
POP EDI
RET
SUB ESP,0xc
PUSH ESI
XOR ESI,ESI
CALL 0x000137d0
ADD ESP,0x10
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
RET
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nvoid * MHD_create_response_for_upgrade(int param_1,undefined4 param_2)\n\n{\n  void *__ptr;\n  int iVar1;\n  \n  if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }\n  return (void *)0x0;\n}\n\n" comment (function_definition "void * MHD_create_response_for_upgrade(int param_1,undefined4 param_2)\n\n{\n  void *__ptr;\n  int iVar1;\n  \n  if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }\n  return (void *)0x0;\n}" primitive_type (pointer_declarator "* MHD_create_response_for_upgrade(int param_1,undefined4 param_2)" * (function_declarator "MHD_create_response_for_upgrade(int param_1,undefined4 param_2)" identifier (parameter_list "(int param_1,undefined4 param_2)" ( (parameter_declaration "int param_1" primitive_type identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) )))) (compound_statement "{\n  void *__ptr;\n  int iVar1;\n  \n  if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }\n  return (void *)0x0;\n}" { (declaration "void *__ptr;" primitive_type (pointer_declarator "*__ptr" * identifier) ;) (declaration "int iVar1;" primitive_type identifier ;) (if_statement "if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }" if (parenthesized_expression "(param_1 != 0)" ( (binary_expression "param_1 != 0" identifier != number_literal) )) (compound_statement "{\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }" { (expression_statement "__ptr = calloc(1,0x60);" (assignment_expression "__ptr = calloc(1,0x60)" identifier = (call_expression "calloc(1,0x60)" identifier (argument_list "(1,0x60)" ( number_literal , number_literal )))) ;) (if_statement "if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }" if (parenthesized_expression "(__ptr != (void *)0x0)" ( (binary_expression "__ptr != (void *)0x0" identifier != (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }" { (expression_statement "iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);" (assignment_expression "iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0)" identifier = (call_expression "pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0)" identifier (argument_list "((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0)" ( (cast_expression "(pthread_mutex_t *)((int)__ptr + 0x1c)" ( (type_descriptor "pthread_mutex_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x1c)" ( (binary_expression "(int)__ptr + 0x1c" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) ))) , (cast_expression "(pthread_mutexattr_t *)0x0" ( (type_descriptor "pthread_mutexattr_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) )))) ;) (if_statement "if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n        free(__ptr);\n        return (void *)0x0;\n      }" { (expression_statement "free(__ptr);" (call_expression "free(__ptr)" identifier (argument_list "(__ptr)" ( identifier ))) ;) (return_statement "return (void *)0x0;" return (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (expression_statement "*(int *)((int)__ptr + 0x14) = param_1;" (assignment_expression "*(int *)((int)__ptr + 0x14) = param_1" (pointer_expression "*(int *)((int)__ptr + 0x14)" * (cast_expression "(int *)((int)__ptr + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x14)" ( (binary_expression "(int)__ptr + 0x14" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) )))) = identifier) ;) (expression_statement "*(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x34) = 0xffffffff" (pointer_expression "*(undefined4 *)((int)__ptr + 0x34)" * (cast_expression "(undefined4 *)((int)__ptr + 0x34)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x34)" ( (binary_expression "(int)__ptr + 0x34" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) )))) = number_literal) ;) (expression_statement "*(undefined4 *)((int)__ptr + 0x18) = param_2;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x18) = param_2" (pointer_expression "*(undefined4 *)((int)__ptr + 0x18)" * (cast_expression "(undefined4 *)((int)__ptr + 0x18)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x18)" ( (binary_expression "(int)__ptr + 0x18" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) )))) = identifier) ;) (expression_statement "*(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x38) = 0xffffffff" (pointer_expression "*(undefined4 *)((int)__ptr + 0x38)" * (cast_expression "(undefined4 *)((int)__ptr + 0x38)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x38)" ( (binary_expression "(int)__ptr + 0x38" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) )))) = number_literal) ;) (expression_statement "*(undefined4 *)((int)__ptr + 0x54) = 1;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x54) = 1" (pointer_expression "*(undefined4 *)((int)__ptr + 0x54)" * (cast_expression "(undefined4 *)((int)__ptr + 0x54)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x54)" ( (binary_expression "(int)__ptr + 0x54" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) )))) = number_literal) ;) (expression_statement "iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");" (assignment_expression "iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade")" identifier = (call_expression "MHD_add_response_header(__ptr,"Connection","Upgrade")" identifier (argument_list "(__ptr,"Connection","Upgrade")" ( identifier , (string_literal ""Connection"" " string_content ") , (string_literal ""Upgrade"" " string_content ") )))) ;) (if_statement "if (iVar1 != 0) {\n        return __ptr;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n        return __ptr;\n      }" { (return_statement "return __ptr;" return identifier ;) })) (expression_statement "MHD_destroy_response(__ptr);" (call_expression "MHD_destroy_response(__ptr)" identifier (argument_list "(__ptr)" ( identifier ))) ;) })) })) (return_statement "return (void *)0x0;" return (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* WARNING: Unknown calling convention */\n/* WARNING: Enum "MHD_FLAG": Some values do not have unique names */\n/* WARNING: Enum "gnutls_pk_algorithm_t": Some values do not have unique names */\n/* WARNING: Enum "gnutls_certificate_type_t": Some values do not have unique names */\n\nMHD_Response *\nMHD_create_response_for_upgrade(MHD_UpgradeHandler upgrade_handler,void *upgrade_handler_cls)\n\n{\n  MHD_Response *response;\n  int iVar1;\n  \n  if (upgrade_handler != (MHD_UpgradeHandler)0x0) {\n    response = (MHD_Response *)calloc(1,0x60);\n    if (response != (MHD_Response *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(response);\n        return (MHD_Response *)0x0;\n      }\n      response->upgrade_handler = upgrade_handler;\n      *(undefined4 *)&response->total_size = 0xffffffff;\n      response->upgrade_handler_cls = upgrade_handler_cls;\n      *(undefined4 *)((int)&response->total_size + 4) = 0xffffffff;\n      response->reference_count = 1;\n      iVar1 = MHD_add_response_header(response,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return response;\n      }\n      MHD_destroy_response(response);\n    }\n  }\n  return (MHD_Response *)0x0;\n}\n\n" comment comment comment comment comment (function_definition "MHD_Response *\nMHD_create_response_for_upgrade(MHD_UpgradeHandler upgrade_handler,void *upgrade_handler_cls)\n\n{\n  MHD_Response *response;\n  int iVar1;\n  \n  if (upgrade_handler != (MHD_UpgradeHandler)0x0) {\n    response = (MHD_Response *)calloc(1,0x60);\n    if (response != (MHD_Response *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(response);\n        return (MHD_Response *)0x0;\n      }\n      response->upgrade_handler = upgrade_handler;\n      *(undefined4 *)&response->total_size = 0xffffffff;\n      response->upgrade_handler_cls = upgrade_handler_cls;\n      *(undefined4 *)((int)&response->total_size + 4) = 0xffffffff;\n      response->reference_count = 1;\n      iVar1 = MHD_add_response_header(response,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return response;\n      }\n      MHD_destroy_response(response);\n    }\n  }\n  return (MHD_Response *)0x0;\n}" type_identifier (pointer_declarator "*\nMHD_create_response_for_upgrade(MHD_UpgradeHandler upgrade_handler,void *upgrade_handler_cls)" * (function_declarator "MHD_create_response_for_upgrade(MHD_UpgradeHandler upgrade_handler,void *upgrade_handler_cls)" identifier (parameter_list "(MHD_UpgradeHandler upgrade_handler,void *upgrade_handler_cls)" ( (parameter_declaration "MHD_UpgradeHandler upgrade_handler" type_identifier identifier) , (parameter_declaration "void *upgrade_handler_cls" primitive_type (pointer_declarator "*upgrade_handler_cls" * identifier)) )))) (compound_statement "{\n  MHD_Response *response;\n  int iVar1;\n  \n  if (upgrade_handler != (MHD_UpgradeHandler)0x0) {\n    response = (MHD_Response *)calloc(1,0x60);\n    if (response != (MHD_Response *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(response);\n        return (MHD_Response *)0x0;\n      }\n      response->upgrade_handler = upgrade_handler;\n      *(undefined4 *)&response->total_size = 0xffffffff;\n      response->upgrade_handler_cls = upgrade_handler_cls;\n      *(undefined4 *)((int)&response->total_size + 4) = 0xffffffff;\n      response->reference_count = 1;\n      iVar1 = MHD_add_response_header(response,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return response;\n      }\n      MHD_destroy_response(response);\n    }\n  }\n  return (MHD_Response *)0x0;\n}" { (declaration "MHD_Response *response;" type_identifier (pointer_declarator "*response" * identifier) ;) (declaration "int iVar1;" primitive_type identifier ;) (if_statement "if (upgrade_handler != (MHD_UpgradeHandler)0x0) {\n    response = (MHD_Response *)calloc(1,0x60);\n    if (response != (MHD_Response *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(response);\n        return (MHD_Response *)0x0;\n      }\n      response->upgrade_handler = upgrade_handler;\n      *(undefined4 *)&response->total_size = 0xffffffff;\n      response->upgrade_handler_cls = upgrade_handler_cls;\n      *(undefined4 *)((int)&response->total_size + 4) = 0xffffffff;\n      response->reference_count = 1;\n      iVar1 = MHD_add_response_header(response,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return response;\n      }\n      MHD_destroy_response(response);\n    }\n  }" if (parenthesized_expression "(upgrade_handler != (MHD_UpgradeHandler)0x0)" ( (binary_expression "upgrade_handler != (MHD_UpgradeHandler)0x0" identifier != (cast_expression "(MHD_UpgradeHandler)0x0" ( (type_descriptor "MHD_UpgradeHandler" type_identifier) ) number_literal)) )) (compound_statement "{\n    response = (MHD_Response *)calloc(1,0x60);\n    if (response != (MHD_Response *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(response);\n        return (MHD_Response *)0x0;\n      }\n      response->upgrade_handler = upgrade_handler;\n      *(undefined4 *)&response->total_size = 0xffffffff;\n      response->upgrade_handler_cls = upgrade_handler_cls;\n      *(undefined4 *)((int)&response->total_size + 4) = 0xffffffff;\n      response->reference_count = 1;\n      iVar1 = MHD_add_response_header(response,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return response;\n      }\n      MHD_destroy_response(response);\n    }\n  }" { (expression_statement "response = (MHD_Response *)calloc(1,0x60);" (assignment_expression "response = (MHD_Response *)calloc(1,0x60)" identifier = (cast_expression "(MHD_Response *)calloc(1,0x60)" ( (type_descriptor "MHD_Response *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "calloc(1,0x60)" identifier (argument_list "(1,0x60)" ( number_literal , number_literal ))))) ;) (if_statement "if (response != (MHD_Response *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(response);\n        return (MHD_Response *)0x0;\n      }\n      response->upgrade_handler = upgrade_handler;\n      *(undefined4 *)&response->total_size = 0xffffffff;\n      response->upgrade_handler_cls = upgrade_handler_cls;\n      *(undefined4 *)((int)&response->total_size + 4) = 0xffffffff;\n      response->reference_count = 1;\n      iVar1 = MHD_add_response_header(response,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return response;\n      }\n      MHD_destroy_response(response);\n    }" if (parenthesized_expression "(response != (MHD_Response *)0x0)" ( (binary_expression "response != (MHD_Response *)0x0" identifier != (cast_expression "(MHD_Response *)0x0" ( (type_descriptor "MHD_Response *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(response);\n        return (MHD_Response *)0x0;\n      }\n      response->upgrade_handler = upgrade_handler;\n      *(undefined4 *)&response->total_size = 0xffffffff;\n      response->upgrade_handler_cls = upgrade_handler_cls;\n      *(undefined4 *)((int)&response->total_size + 4) = 0xffffffff;\n      response->reference_count = 1;\n      iVar1 = MHD_add_response_header(response,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return response;\n      }\n      MHD_destroy_response(response);\n    }" { (expression_statement "iVar1 = pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0);" (assignment_expression "iVar1 = pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0)" identifier = (call_expression "pthread_mutex_init((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0)" identifier (argument_list "((pthread_mutex_t *)&response->mutex,(pthread_mutexattr_t *)0x0)" ( (cast_expression "(pthread_mutex_t *)&response->mutex" ( (type_descriptor "pthread_mutex_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&response->mutex" & (field_expression "response->mutex" identifier -> field_identifier))) , (cast_expression "(pthread_mutexattr_t *)0x0" ( (type_descriptor "pthread_mutexattr_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) )))) ;) (if_statement "if (iVar1 != 0) {\n        free(response);\n        return (MHD_Response *)0x0;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n        free(response);\n        return (MHD_Response *)0x0;\n      }" { (expression_statement "free(response);" (call_expression "free(response)" identifier (argument_list "(response)" ( identifier ))) ;) (return_statement "return (MHD_Response *)0x0;" return (cast_expression "(MHD_Response *)0x0" ( (type_descriptor "MHD_Response *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (expression_statement "response->upgrade_handler = upgrade_handler;" (assignment_expression "response->upgrade_handler = upgrade_handler" (field_expression "response->upgrade_handler" identifier -> field_identifier) = identifier) ;) (expression_statement "*(undefined4 *)&response->total_size = 0xffffffff;" (assignment_expression "*(undefined4 *)&response->total_size = 0xffffffff" (pointer_expression "*(undefined4 *)&response->total_size" * (cast_expression "(undefined4 *)&response->total_size" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&response->total_size" & (field_expression "response->total_size" identifier -> field_identifier)))) = number_literal) ;) (expression_statement "response->upgrade_handler_cls = upgrade_handler_cls;" (assignment_expression "response->upgrade_handler_cls = upgrade_handler_cls" (field_expression "response->upgrade_handler_cls" identifier -> field_identifier) = identifier) ;) (expression_statement "*(undefined4 *)((int)&response->total_size + 4) = 0xffffffff;" (assignment_expression "*(undefined4 *)((int)&response->total_size + 4) = 0xffffffff" (pointer_expression "*(undefined4 *)((int)&response->total_size + 4)" * (cast_expression "(undefined4 *)((int)&response->total_size + 4)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)&response->total_size + 4)" ( (binary_expression "(int)&response->total_size + 4" (cast_expression "(int)&response->total_size" ( (type_descriptor "int" primitive_type) ) (pointer_expression "&response->total_size" & (field_expression "response->total_size" identifier -> field_identifier))) + number_literal) )))) = number_literal) ;) (expression_statement "response->reference_count = 1;" (assignment_expression "response->reference_count = 1" (field_expression "response->reference_count" identifier -> field_identifier) = number_literal) ;) (expression_statement "iVar1 = MHD_add_response_header(response,"Connection","Upgrade");" (assignment_expression "iVar1 = MHD_add_response_header(response,"Connection","Upgrade")" identifier = (call_expression "MHD_add_response_header(response,"Connection","Upgrade")" identifier (argument_list "(response,"Connection","Upgrade")" ( identifier , (string_literal ""Connection"" " string_content ") , (string_literal ""Upgrade"" " string_content ") )))) ;) (if_statement "if (iVar1 != 0) {\n        return response;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n        return response;\n      }" { (return_statement "return response;" return identifier ;) })) (expression_statement "MHD_destroy_response(response);" (call_expression "MHD_destroy_response(response)" identifier (argument_list "(response)" ( identifier ))) ;) })) })) (return_statement "return (MHD_Response *)0x0;" return (cast_expression "(MHD_Response *)0x0" ( (type_descriptor "MHD_Response *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit "void * MHD_create_response_for_upgrade(int param_1,undefined4 param_2)\n\n{\n  void *__ptr;\n  int iVar1;\n  \n  if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }\n  return (void *)0x0;\n}\n\n" (function_definition "void * MHD_create_response_for_upgrade(int param_1,undefined4 param_2)\n\n{\n  void *__ptr;\n  int iVar1;\n  \n  if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }\n  return (void *)0x0;\n}" primitive_type (pointer_declarator "* MHD_create_response_for_upgrade(int param_1,undefined4 param_2)" * (function_declarator "MHD_create_response_for_upgrade(int param_1,undefined4 param_2)" identifier (parameter_list "(int param_1,undefined4 param_2)" ( (parameter_declaration "int param_1" primitive_type identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) )))) (compound_statement "{\n  void *__ptr;\n  int iVar1;\n  \n  if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }\n  return (void *)0x0;\n}" { (declaration "void *__ptr;" primitive_type (pointer_declarator "*__ptr" * identifier) ;) (declaration "int iVar1;" primitive_type identifier ;) (if_statement "if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }" if (parenthesized_expression "(param_1 != 0)" ( (binary_expression "param_1 != 0" identifier != number_literal) )) (compound_statement "{\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }" { (expression_statement "__ptr = calloc(1,0x60);" (assignment_expression "__ptr = calloc(1,0x60)" identifier = (call_expression "calloc(1,0x60)" identifier (argument_list "(1,0x60)" ( number_literal , number_literal )))) ;) (if_statement "if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }" if (parenthesized_expression "(__ptr != (void *)0x0)" ( (binary_expression "__ptr != (void *)0x0" identifier != (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }" { (expression_statement "iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);" (assignment_expression "iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0)" identifier = (call_expression "pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0)" identifier (argument_list "((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0)" ( (cast_expression "(pthread_mutex_t *)((int)__ptr + 0x1c)" ( (type_descriptor "pthread_mutex_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x1c)" ( (binary_expression "(int)__ptr + 0x1c" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) ))) , (cast_expression "(pthread_mutexattr_t *)0x0" ( (type_descriptor "pthread_mutexattr_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal) )))) ;) (if_statement "if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n        free(__ptr);\n        return (void *)0x0;\n      }" { (expression_statement "free(__ptr);" (call_expression "free(__ptr)" identifier (argument_list "(__ptr)" ( identifier ))) ;) (return_statement "return (void *)0x0;" return (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) ;) })) (expression_statement "*(int *)((int)__ptr + 0x14) = param_1;" (assignment_expression "*(int *)((int)__ptr + 0x14) = param_1" (pointer_expression "*(int *)((int)__ptr + 0x14)" * (cast_expression "(int *)((int)__ptr + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x14)" ( (binary_expression "(int)__ptr + 0x14" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) )))) = identifier) ;) (expression_statement "*(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x34) = 0xffffffff" (pointer_expression "*(undefined4 *)((int)__ptr + 0x34)" * (cast_expression "(undefined4 *)((int)__ptr + 0x34)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x34)" ( (binary_expression "(int)__ptr + 0x34" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) )))) = number_literal) ;) (expression_statement "*(undefined4 *)((int)__ptr + 0x18) = param_2;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x18) = param_2" (pointer_expression "*(undefined4 *)((int)__ptr + 0x18)" * (cast_expression "(undefined4 *)((int)__ptr + 0x18)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x18)" ( (binary_expression "(int)__ptr + 0x18" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) )))) = identifier) ;) (expression_statement "*(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x38) = 0xffffffff" (pointer_expression "*(undefined4 *)((int)__ptr + 0x38)" * (cast_expression "(undefined4 *)((int)__ptr + 0x38)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x38)" ( (binary_expression "(int)__ptr + 0x38" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) )))) = number_literal) ;) (expression_statement "*(undefined4 *)((int)__ptr + 0x54) = 1;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x54) = 1" (pointer_expression "*(undefined4 *)((int)__ptr + 0x54)" * (cast_expression "(undefined4 *)((int)__ptr + 0x54)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)__ptr + 0x54)" ( (binary_expression "(int)__ptr + 0x54" (cast_expression "(int)__ptr" ( (type_descriptor "int" primitive_type) ) identifier) + number_literal) )))) = number_literal) ;) (expression_statement "iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");" (assignment_expression "iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade")" identifier = (call_expression "MHD_add_response_header(__ptr,"Connection","Upgrade")" identifier (argument_list "(__ptr,"Connection","Upgrade")" ( identifier , (string_literal ""Connection"" " string_content ") , (string_literal ""Upgrade"" " string_content ") )))) ;) (if_statement "if (iVar1 != 0) {\n        return __ptr;\n      }" if (parenthesized_expression "(iVar1 != 0)" ( (binary_expression "iVar1 != 0" identifier != number_literal) )) (compound_statement "{\n        return __ptr;\n      }" { (return_statement "return __ptr;" return identifier ;) })) (expression_statement "MHD_destroy_response(__ptr);" (call_expression "MHD_destroy_response(__ptr)" identifier (argument_list "(__ptr)" ( identifier ))) ;) })) })) (return_statement "return (void *)0x0;" return (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) ;) })))
(translation_unit (function_definition TYPE (pointer_declarator * (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) )))) (compound_statement { (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( LIT , LIT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) + LIT) ))) , (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (return_statement return (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ;) })) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) + LIT) )))) = IDENT) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) + LIT) )))) = LIT) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) + LIT) )))) = IDENT) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) + LIT) )))) = LIT) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) + LIT) )))) = LIT) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , (string_literal " string_content ") , (string_literal " string_content ") )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) })) })) (return_statement return (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT) ;) })))
(function_definition "void * MHD_create_response_for_upgrade(int param_1,undefined4 param_2)\n\n{\n  void *__ptr;\n  int iVar1;\n  \n  if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }\n  return (void *)0x0;\n}" (primitive_type "void") (pointer_declarator "* MHD_create_response_for_upgrade(int param_1,undefined4 param_2)" (* "*") (function_declarator "MHD_create_response_for_upgrade(int param_1,undefined4 param_2)" (identifier "MHD_create_response_for_upgrade") (parameter_list "(int param_1,undefined4 param_2)" (( "(") (parameter_declaration "int param_1" (primitive_type "int") (identifier "param_1")) (, ",") (parameter_declaration "undefined4 param_2" (type_identifier "undefined4") (identifier "param_2")) () ")")))) (compound_statement "{\n  void *__ptr;\n  int iVar1;\n  \n  if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }\n  return (void *)0x0;\n}" ({ "{") (declaration "void *__ptr;" (primitive_type "void") (pointer_declarator "*__ptr" (* "*") (identifier "__ptr")) (; ";")) (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (if_statement "if (param_1 != 0) {\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }" (if "if") (parenthesized_expression "(param_1 != 0)" (( "(") (binary_expression "param_1 != 0" (identifier "param_1") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    __ptr = calloc(1,0x60);\n    if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }\n  }" ({ "{") (expression_statement "__ptr = calloc(1,0x60);" (assignment_expression "__ptr = calloc(1,0x60)" (identifier "__ptr") (= "=") (call_expression "calloc(1,0x60)" (identifier "calloc") (argument_list "(1,0x60)" (( "(") (number_literal "1") (, ",") (number_literal "0x60") () ")")))) (; ";")) (if_statement "if (__ptr != (void *)0x0) {\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }" (if "if") (parenthesized_expression "(__ptr != (void *)0x0)" (( "(") (binary_expression "__ptr != (void *)0x0" (identifier "__ptr") (!= "!=") (cast_expression "(void *)0x0" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);\n      if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }\n      *(int *)((int)__ptr + 0x14) = param_1;\n      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x18) = param_2;\n      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;\n      *(undefined4 *)((int)__ptr + 0x54) = 1;\n      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");\n      if (iVar1 != 0) {\n        return __ptr;\n      }\n      MHD_destroy_response(__ptr);\n    }" ({ "{") (expression_statement "iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);" (assignment_expression "iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0)" (identifier "iVar1") (= "=") (call_expression "pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0)" (identifier "pthread_mutex_init") (argument_list "((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0)" (( "(") (cast_expression "(pthread_mutex_t *)((int)__ptr + 0x1c)" (( "(") (type_descriptor "pthread_mutex_t *" (type_identifier "pthread_mutex_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((int)__ptr + 0x1c)" (( "(") (binary_expression "(int)__ptr + 0x1c" (cast_expression "(int)__ptr" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "__ptr")) (+ "+") (number_literal "0x1c")) () ")"))) (, ",") (cast_expression "(pthread_mutexattr_t *)0x0" (( "(") (type_descriptor "pthread_mutexattr_t *" (type_identifier "pthread_mutexattr_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) () ")")))) (; ";")) (if_statement "if (iVar1 != 0) {\n        free(__ptr);\n        return (void *)0x0;\n      }" (if "if") (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n        free(__ptr);\n        return (void *)0x0;\n      }" ({ "{") (expression_statement "free(__ptr);" (call_expression "free(__ptr)" (identifier "free") (argument_list "(__ptr)" (( "(") (identifier "__ptr") () ")"))) (; ";")) (return_statement "return (void *)0x0;" (return "return") (cast_expression "(void *)0x0" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) (; ";")) (} "}"))) (expression_statement "*(int *)((int)__ptr + 0x14) = param_1;" (assignment_expression "*(int *)((int)__ptr + 0x14) = param_1" (pointer_expression "*(int *)((int)__ptr + 0x14)" (* "*") (cast_expression "(int *)((int)__ptr + 0x14)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((int)__ptr + 0x14)" (( "(") (binary_expression "(int)__ptr + 0x14" (cast_expression "(int)__ptr" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "__ptr")) (+ "+") (number_literal "0x14")) () ")")))) (= "=") (identifier "param_1")) (; ";")) (expression_statement "*(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x34) = 0xffffffff" (pointer_expression "*(undefined4 *)((int)__ptr + 0x34)" (* "*") (cast_expression "(undefined4 *)((int)__ptr + 0x34)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((int)__ptr + 0x34)" (( "(") (binary_expression "(int)__ptr + 0x34" (cast_expression "(int)__ptr" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "__ptr")) (+ "+") (number_literal "0x34")) () ")")))) (= "=") (number_literal "0xffffffff")) (; ";")) (expression_statement "*(undefined4 *)((int)__ptr + 0x18) = param_2;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x18) = param_2" (pointer_expression "*(undefined4 *)((int)__ptr + 0x18)" (* "*") (cast_expression "(undefined4 *)((int)__ptr + 0x18)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((int)__ptr + 0x18)" (( "(") (binary_expression "(int)__ptr + 0x18" (cast_expression "(int)__ptr" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "__ptr")) (+ "+") (number_literal "0x18")) () ")")))) (= "=") (identifier "param_2")) (; ";")) (expression_statement "*(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x38) = 0xffffffff" (pointer_expression "*(undefined4 *)((int)__ptr + 0x38)" (* "*") (cast_expression "(undefined4 *)((int)__ptr + 0x38)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((int)__ptr + 0x38)" (( "(") (binary_expression "(int)__ptr + 0x38" (cast_expression "(int)__ptr" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "__ptr")) (+ "+") (number_literal "0x38")) () ")")))) (= "=") (number_literal "0xffffffff")) (; ";")) (expression_statement "*(undefined4 *)((int)__ptr + 0x54) = 1;" (assignment_expression "*(undefined4 *)((int)__ptr + 0x54) = 1" (pointer_expression "*(undefined4 *)((int)__ptr + 0x54)" (* "*") (cast_expression "(undefined4 *)((int)__ptr + 0x54)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "((int)__ptr + 0x54)" (( "(") (binary_expression "(int)__ptr + 0x54" (cast_expression "(int)__ptr" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "__ptr")) (+ "+") (number_literal "0x54")) () ")")))) (= "=") (number_literal "1")) (; ";")) (expression_statement "iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");" (assignment_expression "iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade")" (identifier "iVar1") (= "=") (call_expression "MHD_add_response_header(__ptr,"Connection","Upgrade")" (identifier "MHD_add_response_header") (argument_list "(__ptr,"Connection","Upgrade")" (( "(") (identifier "__ptr") (, ",") (string_literal ""Connection"" (" """) (string_content "Connection") (" """)) (, ",") (string_literal ""Upgrade"" (" """) (string_content "Upgrade") (" """)) () ")")))) (; ";")) (if_statement "if (iVar1 != 0) {\n        return __ptr;\n      }" (if "if") (parenthesized_expression "(iVar1 != 0)" (( "(") (binary_expression "iVar1 != 0" (identifier "iVar1") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n        return __ptr;\n      }" ({ "{") (return_statement "return __ptr;" (return "return") (identifier "__ptr") (; ";")) (} "}"))) (expression_statement "MHD_destroy_response(__ptr);" (call_expression "MHD_destroy_response(__ptr)" (identifier "MHD_destroy_response") (argument_list "(__ptr)" (( "(") (identifier "__ptr") () ")"))) (; ";")) (} "}"))) (} "}"))) (return_statement "return (void *)0x0;" (return "return") (cast_expression "(void *)0x0" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0")) (; ";")) (} "}")))

/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Unknown calling convention */
/* WARNING: Enum "MHD_FLAG": Some values do not have unique names */
/* WARNING: Enum "gnutls_pk_algorithm_t": Some values do not have unique names */
/* WARNING: Enum "gnutls_certificate_type_t": Some values do not have unique names */

type_1 *
function_1(type_2 var_1,void *upgrade_handler_cls)

{
  type_1 *var_3;
  int var_5;
  
  if (var_1 != (type_2)0x0) {
    var_3 = (type_1 *)var_2(1,0x60);
    if (var_3 != (type_1 *)0x0) {
      var_5 = var_4((type_3 *)&var_3->mutex,(type_4 *)0x0);
      if (var_5 != 0) {
        var_6(var_3);
        return (type_1 *)0x0;
      }
      var_3->var_1 = var_1;
      *(type_5 *)&var_3->total_size = 0xffffffff;
      var_3->upgrade_handler_cls = upgrade_handler_cls;
      *(type_5 *)((int)&var_3->total_size + 4) = 0xffffffff;
      var_3->reference_count = 1;
      var_5 = var_7(var_3,"Connection","Upgrade");
      if (var_5 != 0) {
        return var_3;
      }
      var_8(var_3);
    }
  }
  return (type_1 *)0x0;
}


(translation_unit (function_definition type: (primitive_type) declarator: (pointer_declarator declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (primitive_type) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier))))) body: (compound_statement (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (primitive_type) declarator: (identifier)) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (number_literal) (number_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (number_literal)))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)) right: (number_literal)))) (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (number_literal)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier)))) (return_statement (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (number_literal))))) (expression_statement (assignment_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)) right: (number_literal))))) right: (identifier))) (expression_statement (assignment_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)) right: (number_literal))))) right: (number_literal))) (expression_statement (assignment_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)) right: (number_literal))))) right: (identifier))) (expression_statement (assignment_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)) right: (number_literal))))) right: (number_literal))) (expression_statement (assignment_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (primitive_type)) value: (identifier)) right: (number_literal))))) right: (number_literal))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (string_literal (string_content)) (string_literal (string_content)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier)))))))) (return_statement (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (number_literal))))))

/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */

void * MASKED(int param_1,undefined4 param_2)

{
  void *__ptr;
  int iVar1;
  
  if (param_1 != 0) {
    __ptr = calloc(1,0x60);
    if (__ptr != (void *)0x0) {
      iVar1 = pthread_mutex_init((pthread_mutex_t *)((int)__ptr + 0x1c),(pthread_mutexattr_t *)0x0);
      if (iVar1 != 0) {
        free(__ptr);
        return (void *)0x0;
      }
      *(int *)((int)__ptr + 0x14) = param_1;
      *(undefined4 *)((int)__ptr + 0x34) = 0xffffffff;
      *(undefined4 *)((int)__ptr + 0x18) = param_2;
      *(undefined4 *)((int)__ptr + 0x38) = 0xffffffff;
      *(undefined4 *)((int)__ptr + 0x54) = 1;
      iVar1 = MHD_add_response_header(__ptr,"Connection","Upgrade");
      if (iVar1 != 0) {
        return __ptr;
      }
      MHD_destroy_response(__ptr);
    }
  }
  return (void *)0x0;
}

