
/* 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 */

int psk_gnutls_adapter(gnutls_session_t session,char *username,gnutls_datum_t *key)

{
  MHD_Daemon *daemon;
  MHD_Connection *pMVar1;
  int iVar2;
  uchar *__dest;
  size_t sVar3;
  int in_GS_OFFSET;
  char *val;
  void *app_psk;
  size_t app_psk_size;
  int local_20;
  undefined4 uStack_14;
  
  uStack_14 = 0x19939;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pMVar1 = (MHD_Connection *)gnutls_session_get_ptr(session);
  if (pMVar1 == (MHD_Connection *)0x0) {
    val = "Internal server error. This should be impossible.\n";
    (*mhd_panic)(mhd_panic_cls,"daemon.c",0x896,
                 "Internal server error. This should be impossible.\n");
    sVar3 = MHD_http_unescape(val);
    return sVar3;
  }
  daemon = pMVar1->daemon;
  if (daemon->cred_callback == (MHD_PskServerCredentialsCallback)0x0) {
    iVar2 = -1;
    MHD_DLOG(daemon,"PSK not supported by this server.\n");
  }
  else {
    iVar2 = (*daemon->cred_callback)
                      (daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size);
    if (iVar2 == 0) {
      __dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size);
      key->data = __dest;
      if (__dest == (uchar *)0x0) {
        iVar2 = -1;
        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");
        free(app_psk);
      }
      else {
        key->size = app_psk_size;
        memcpy(__dest,app_psk,app_psk_size);
        free(app_psk);
        iVar2 = 0;
      }
    }
    else {
      iVar2 = -1;
    }
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return iVar2;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail_local();
}



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

undefined4 FUN_00019930(undefined4 param_1,undefined4 param_2,undefined4 *param_3)

{
  int iVar1;
  int iVar2;
  void *__dest;
  undefined4 uVar3;
  int in_GS_OFFSET;
  char *pcVar4;
  void *local_28;
  size_t local_24;
  int local_20;
  undefined4 uStack_14;
  
  uStack_14 = 0x19939;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iVar2 = gnutls_session_get_ptr(param_1);
  if (iVar2 == 0) {
    pcVar4 = "Internal server error. This should be impossible.\n";
    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,
                    "Internal server error. This should be impossible.\n");
    uVar3 = MHD_http_unescape(pcVar4);
    return uVar3;
  }
  iVar1 = *(int *)(iVar2 + 0x18);
  if (*(code **)(iVar1 + 0x124) == (code *)0x0) {
    uVar3 = 0xffffffff;
    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");
  }
  else {
    iVar2 = (**(code **)(iVar1 + 0x124))
                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);
    if (iVar2 == 0) {
      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);
      *param_3 = __dest;
      if (__dest == (void *)0x0) {
        uVar3 = 0xffffffff;
        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");
        free(local_28);
      }
      else {
        param_3[1] = local_24;
        memcpy(__dest,local_28,local_24);
        free(local_28);
        uVar3 = 0;
      }
    }
    else {
      uVar3 = 0xffffffff;
    }
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar3;
  }
                    /* WARNING: Subroutine does not return */
  FUN_00028540();
}


PUSH EBP
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x00013810
ADD EBX,0x1a4a7
SUB ESP,0x28
MOV EAX,GS:[0x14]
MOV dword ptr [ESP + 0x18],EAX
XOR EAX,EAX
MOV ESI,dword ptr [ESP + 0x40]
MOV EDI,dword ptr [ESP + 0x44]
PUSH dword ptr [ESP + 0x3c]
CALL 0x00013510
ADD ESP,0x10
TEST EAX,EAX
JZ 0x00019a3a
MOV EBP,dword ptr [EAX + 0x18]
MOV EDX,dword ptr [EBP + 0x124]
TEST EDX,EDX
JZ 0x00019a1b
SUB ESP,0xc
LEA ECX,[ESP + 0x14]
PUSH ECX
LEA ECX,[ESP + 0x14]
PUSH ECX
PUSH ESI
PUSH EAX
PUSH dword ptr [EBP + 0x128]
CALL EDX
MOV ESI,EAX
ADD ESP,0x20
TEST EAX,EAX
JNZ 0x000199f0
SUB ESP,0xc
MOV EAX,dword ptr [EBX + 0x1fc]
PUSH dword ptr [ESP + 0x14]
CALL dword ptr [EAX]
MOV dword ptr [EDI],EAX
ADD ESP,0x10
TEST EAX,EAX
JZ 0x000199f7
MOV EDX,dword ptr [ESP + 0x8]
SUB ESP,0x4
MOV dword ptr [EDI + 0x4],EDX
PUSH EDX
PUSH dword ptr [ESP + 0xc]
PUSH EAX
CALL 0x00013160
POP EAX
PUSH dword ptr [ESP + 0x10]
CALL 0x000137d0
ADD ESP,0x10
MOV EDI,dword ptr [ESP + 0xc]
XOR EDI,dword ptr GS:[0x14]
MOV EAX,ESI
JNZ 0x00019a35
ADD ESP,0x1c
POP EBX
POP ESI
POP EDI
POP EBP
RET
MOV ESI,0xffffffff
JMP 0x000199d5
SUB ESP,0x8
LEA EAX,[EBX + 0xffff66b8]
MOV ESI,0xffffffff
PUSH EAX
PUSH EBP
CALL 0x00020aa0
POP EDX
PUSH dword ptr [ESP + 0x10]
CALL 0x000137d0
ADD ESP,0x10
JMP 0x000199d5
SUB ESP,0x8
LEA EAX,[EBX + 0xffff6694]
MOV ESI,0xffffffff
PUSH EAX
PUSH EBP
CALL 0x00020aa0
ADD ESP,0x10
JMP 0x000199d5
CALL 0x00028540
LEA EAX,[EBX + 0xffff6660]
PUSH EAX
LEA EAX,[EBX + 0xffff6264]
PUSH 0x896
PUSH EAX
PUSH dword ptr [EBX + 0x288]
CALL dword ptr [EBX + 0x28c]
LEA ESI,[ESI]
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nundefined4 FUN_00019930(undefined4 param_1,undefined4 param_2,undefined4 *param_3)\n\n{\n  int iVar1;\n  int iVar2;\n  void *__dest;\n  undefined4 uVar3;\n  int in_GS_OFFSET;\n  char *pcVar4;\n  void *local_28;\n  size_t local_24;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  iVar2 = gnutls_session_get_ptr(param_1);\n  if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }\n  iVar1 = *(int *)(iVar2 + 0x18);\n  if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_00028540();\n}\n\n" comment (function_definition "undefined4 FUN_00019930(undefined4 param_1,undefined4 param_2,undefined4 *param_3)\n\n{\n  int iVar1;\n  int iVar2;\n  void *__dest;\n  undefined4 uVar3;\n  int in_GS_OFFSET;\n  char *pcVar4;\n  void *local_28;\n  size_t local_24;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  iVar2 = gnutls_session_get_ptr(param_1);\n  if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }\n  iVar1 = *(int *)(iVar2 + 0x18);\n  if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_00028540();\n}" type_identifier (function_declarator "FUN_00019930(undefined4 param_1,undefined4 param_2,undefined4 *param_3)" identifier (parameter_list "(undefined4 param_1,undefined4 param_2,undefined4 *param_3)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "undefined4 *param_3" type_identifier (pointer_declarator "*param_3" * identifier)) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  void *__dest;\n  undefined4 uVar3;\n  int in_GS_OFFSET;\n  char *pcVar4;\n  void *local_28;\n  size_t local_24;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  iVar2 = gnutls_session_get_ptr(param_1);\n  if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }\n  iVar1 = *(int *)(iVar2 + 0x18);\n  if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_00028540();\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "void *__dest;" primitive_type (pointer_declarator "*__dest" * identifier) ;) (declaration "undefined4 uVar3;" type_identifier identifier ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "char *pcVar4;" primitive_type (pointer_declarator "*pcVar4" * identifier) ;) (declaration "void *local_28;" primitive_type (pointer_declarator "*local_28" * identifier) ;) (declaration "size_t local_24;" primitive_type identifier ;) (declaration "int local_20;" primitive_type identifier ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x19939;" (assignment_expression "uStack_14 = 0x19939" identifier = number_literal) ;) (expression_statement "local_20 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_20 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "iVar2 = gnutls_session_get_ptr(param_1);" (assignment_expression "iVar2 = gnutls_session_get_ptr(param_1)" identifier = (call_expression "gnutls_session_get_ptr(param_1)" identifier (argument_list "(param_1)" ( identifier )))) ;) (if_statement "if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }" { (expression_statement "pcVar4 = "Internal server error. This should be impossible.\n";" (assignment_expression "pcVar4 = "Internal server error. This should be impossible.\n"" identifier = (string_literal ""Internal server error. This should be impossible.\n"" " string_content escape_sequence ")) ;) (expression_statement "(*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");" (call_expression "(*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n")" (parenthesized_expression "(*DAT_0003406c)" ( (pointer_expression "*DAT_0003406c" * identifier) )) (argument_list "(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n")" ( identifier , (string_literal ""daemon.c"" " string_content ") , number_literal , (string_literal ""Internal server error. This should be impossible.\n"" " string_content escape_sequence ") ))) ;) (expression_statement "uVar3 = MHD_http_unescape(pcVar4);" (assignment_expression "uVar3 = MHD_http_unescape(pcVar4)" identifier = (call_expression "MHD_http_unescape(pcVar4)" identifier (argument_list "(pcVar4)" ( identifier )))) ;) (return_statement "return uVar3;" return identifier ;) })) (expression_statement "iVar1 = *(int *)(iVar2 + 0x18);" (assignment_expression "iVar1 = *(int *)(iVar2 + 0x18)" identifier = (pointer_expression "*(int *)(iVar2 + 0x18)" * (cast_expression "(int *)(iVar2 + 0x18)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar2 + 0x18)" ( (binary_expression "iVar2 + 0x18" identifier + number_literal) ))))) ;) (if_statement "if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }" if (parenthesized_expression "(*(code **)(iVar1 + 0x124) == (code *)0x0)" ( (binary_expression "*(code **)(iVar1 + 0x124) == (code *)0x0" (pointer_expression "*(code **)(iVar1 + 0x124)" * (cast_expression "(code **)(iVar1 + 0x124)" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(iVar1 + 0x124)" ( (binary_expression "iVar1 + 0x124" identifier + number_literal) )))) == (cast_expression "(code *)0x0" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }" { (expression_statement "uVar3 = 0xffffffff;" (assignment_expression "uVar3 = 0xffffffff" identifier = number_literal) ;) (expression_statement "FUN_00020aa0(iVar1,"PSK not supported by this server.\n");" (call_expression "FUN_00020aa0(iVar1,"PSK not supported by this server.\n")" identifier (argument_list "(iVar1,"PSK not supported by this server.\n")" ( identifier , (string_literal ""PSK not supported by this server.\n"" " string_content escape_sequence ") ))) ;) }) (else_clause "else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }" else (compound_statement "{\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }" { (expression_statement "iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);" (assignment_expression "iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24)" identifier = (call_expression "(**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24)" (parenthesized_expression "(**(code **)(iVar1 + 0x124))" ( (pointer_expression "**(code **)(iVar1 + 0x124)" * (pointer_expression "*(code **)(iVar1 + 0x124)" * (cast_expression "(code **)(iVar1 + 0x124)" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(iVar1 + 0x124)" ( (binary_expression "iVar1 + 0x124" identifier + number_literal) ))))) )) (argument_list "(*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24)" ( (pointer_expression "*(undefined4 *)(iVar1 + 0x128)" * (cast_expression "(undefined4 *)(iVar1 + 0x128)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar1 + 0x128)" ( (binary_expression "iVar1 + 0x128" identifier + number_literal) )))) , identifier , identifier , (pointer_expression "&local_28" & identifier) , (pointer_expression "&local_24" & identifier) )))) ;) (if_statement "if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }" { (expression_statement "__dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);" (assignment_expression "__dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24)" identifier = (cast_expression "(void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "(**(code **)PTR_gnutls_malloc_00033fdc)(local_24)" (parenthesized_expression "(**(code **)PTR_gnutls_malloc_00033fdc)" ( (pointer_expression "**(code **)PTR_gnutls_malloc_00033fdc" * (pointer_expression "*(code **)PTR_gnutls_malloc_00033fdc" * (cast_expression "(code **)PTR_gnutls_malloc_00033fdc" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) identifier))) )) (argument_list "(local_24)" ( identifier ))))) ;) (expression_statement "*param_3 = __dest;" (assignment_expression "*param_3 = __dest" (pointer_expression "*param_3" * identifier) = identifier) ;) (if_statement "if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }" if (parenthesized_expression "(__dest == (void *)0x0)" ( (binary_expression "__dest == (void *)0x0" identifier == (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }" { (expression_statement "uVar3 = 0xffffffff;" (assignment_expression "uVar3 = 0xffffffff" identifier = number_literal) ;) (expression_statement "FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");" (call_expression "FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n")" identifier (argument_list "(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n")" ( identifier , (string_literal ""PSK authentication failed: gnutls_malloc failed to allocate memory\n"" " string_content escape_sequence ") ))) ;) (expression_statement "free(local_28);" (call_expression "free(local_28)" identifier (argument_list "(local_28)" ( identifier ))) ;) }) (else_clause "else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }" else (compound_statement "{\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }" { (expression_statement "param_3[1] = local_24;" (assignment_expression "param_3[1] = local_24" (subscript_expression "param_3[1]" identifier [ number_literal ]) = identifier) ;) (expression_statement "memcpy(__dest,local_28,local_24);" (call_expression "memcpy(__dest,local_28,local_24)" identifier (argument_list "(__dest,local_28,local_24)" ( identifier , identifier , identifier ))) ;) (expression_statement "free(local_28);" (call_expression "free(local_28)" identifier (argument_list "(local_28)" ( identifier ))) ;) (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" identifier = number_literal) ;) }))) }) (else_clause "else {\n      uVar3 = 0xffffffff;\n    }" else (compound_statement "{\n      uVar3 = 0xffffffff;\n    }" { (expression_statement "uVar3 = 0xffffffff;" (assignment_expression "uVar3 = 0xffffffff" identifier = number_literal) ;) }))) }))) (if_statement "if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }" if (parenthesized_expression "(local_20 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_20 == *(int *)(in_GS_OFFSET + 0x14)" identifier == (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n    return uVar3;\n  }" { (return_statement "return uVar3;" return identifier ;) })) comment (expression_statement "FUN_00028540();" (call_expression "FUN_00028540()" identifier (argument_list "()" ( ))) ;) })))
(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\nint psk_gnutls_adapter(gnutls_session_t session,char *username,gnutls_datum_t *key)\n\n{\n  MHD_Daemon *daemon;\n  MHD_Connection *pMVar1;\n  int iVar2;\n  uchar *__dest;\n  size_t sVar3;\n  int in_GS_OFFSET;\n  char *val;\n  void *app_psk;\n  size_t app_psk_size;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  pMVar1 = (MHD_Connection *)gnutls_session_get_ptr(session);\n  if (pMVar1 == (MHD_Connection *)0x0) {\n    val = "Internal server error. This should be impossible.\n";\n    (*mhd_panic)(mhd_panic_cls,"daemon.c",0x896,\n                 "Internal server error. This should be impossible.\n");\n    sVar3 = MHD_http_unescape(val);\n    return sVar3;\n  }\n  daemon = pMVar1->daemon;\n  if (daemon->cred_callback == (MHD_PskServerCredentialsCallback)0x0) {\n    iVar2 = -1;\n    MHD_DLOG(daemon,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (*daemon->cred_callback)\n                      (daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size);\n    if (iVar2 == 0) {\n      __dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size);\n      key->data = __dest;\n      if (__dest == (uchar *)0x0) {\n        iVar2 = -1;\n        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(app_psk);\n      }\n      else {\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }\n    }\n    else {\n      iVar2 = -1;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar2;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}\n\n" comment comment comment comment comment (function_definition "int psk_gnutls_adapter(gnutls_session_t session,char *username,gnutls_datum_t *key)\n\n{\n  MHD_Daemon *daemon;\n  MHD_Connection *pMVar1;\n  int iVar2;\n  uchar *__dest;\n  size_t sVar3;\n  int in_GS_OFFSET;\n  char *val;\n  void *app_psk;\n  size_t app_psk_size;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  pMVar1 = (MHD_Connection *)gnutls_session_get_ptr(session);\n  if (pMVar1 == (MHD_Connection *)0x0) {\n    val = "Internal server error. This should be impossible.\n";\n    (*mhd_panic)(mhd_panic_cls,"daemon.c",0x896,\n                 "Internal server error. This should be impossible.\n");\n    sVar3 = MHD_http_unescape(val);\n    return sVar3;\n  }\n  daemon = pMVar1->daemon;\n  if (daemon->cred_callback == (MHD_PskServerCredentialsCallback)0x0) {\n    iVar2 = -1;\n    MHD_DLOG(daemon,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (*daemon->cred_callback)\n                      (daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size);\n    if (iVar2 == 0) {\n      __dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size);\n      key->data = __dest;\n      if (__dest == (uchar *)0x0) {\n        iVar2 = -1;\n        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(app_psk);\n      }\n      else {\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }\n    }\n    else {\n      iVar2 = -1;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar2;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}" primitive_type (function_declarator "psk_gnutls_adapter(gnutls_session_t session,char *username,gnutls_datum_t *key)" identifier (parameter_list "(gnutls_session_t session,char *username,gnutls_datum_t *key)" ( (parameter_declaration "gnutls_session_t session" type_identifier identifier) , (parameter_declaration "char *username" primitive_type (pointer_declarator "*username" * identifier)) , (parameter_declaration "gnutls_datum_t *key" type_identifier (pointer_declarator "*key" * identifier)) ))) (compound_statement "{\n  MHD_Daemon *daemon;\n  MHD_Connection *pMVar1;\n  int iVar2;\n  uchar *__dest;\n  size_t sVar3;\n  int in_GS_OFFSET;\n  char *val;\n  void *app_psk;\n  size_t app_psk_size;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  pMVar1 = (MHD_Connection *)gnutls_session_get_ptr(session);\n  if (pMVar1 == (MHD_Connection *)0x0) {\n    val = "Internal server error. This should be impossible.\n";\n    (*mhd_panic)(mhd_panic_cls,"daemon.c",0x896,\n                 "Internal server error. This should be impossible.\n");\n    sVar3 = MHD_http_unescape(val);\n    return sVar3;\n  }\n  daemon = pMVar1->daemon;\n  if (daemon->cred_callback == (MHD_PskServerCredentialsCallback)0x0) {\n    iVar2 = -1;\n    MHD_DLOG(daemon,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (*daemon->cred_callback)\n                      (daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size);\n    if (iVar2 == 0) {\n      __dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size);\n      key->data = __dest;\n      if (__dest == (uchar *)0x0) {\n        iVar2 = -1;\n        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(app_psk);\n      }\n      else {\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }\n    }\n    else {\n      iVar2 = -1;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar2;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}" { (declaration "MHD_Daemon *daemon;" type_identifier (pointer_declarator "*daemon" * identifier) ;) (declaration "MHD_Connection *pMVar1;" type_identifier (pointer_declarator "*pMVar1" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "uchar *__dest;" type_identifier (pointer_declarator "*__dest" * identifier) ;) (declaration "size_t sVar3;" primitive_type identifier ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "char *val;" primitive_type (pointer_declarator "*val" * identifier) ;) (declaration "void *app_psk;" primitive_type (pointer_declarator "*app_psk" * identifier) ;) (declaration "size_t app_psk_size;" primitive_type identifier ;) (declaration "int local_20;" primitive_type identifier ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x19939;" (assignment_expression "uStack_14 = 0x19939" identifier = number_literal) ;) (expression_statement "local_20 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_20 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "pMVar1 = (MHD_Connection *)gnutls_session_get_ptr(session);" (assignment_expression "pMVar1 = (MHD_Connection *)gnutls_session_get_ptr(session)" identifier = (cast_expression "(MHD_Connection *)gnutls_session_get_ptr(session)" ( (type_descriptor "MHD_Connection *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "gnutls_session_get_ptr(session)" identifier (argument_list "(session)" ( identifier ))))) ;) (if_statement "if (pMVar1 == (MHD_Connection *)0x0) {\n    val = "Internal server error. This should be impossible.\n";\n    (*mhd_panic)(mhd_panic_cls,"daemon.c",0x896,\n                 "Internal server error. This should be impossible.\n");\n    sVar3 = MHD_http_unescape(val);\n    return sVar3;\n  }" if (parenthesized_expression "(pMVar1 == (MHD_Connection *)0x0)" ( (binary_expression "pMVar1 == (MHD_Connection *)0x0" identifier == (cast_expression "(MHD_Connection *)0x0" ( (type_descriptor "MHD_Connection *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    val = "Internal server error. This should be impossible.\n";\n    (*mhd_panic)(mhd_panic_cls,"daemon.c",0x896,\n                 "Internal server error. This should be impossible.\n");\n    sVar3 = MHD_http_unescape(val);\n    return sVar3;\n  }" { (expression_statement "val = "Internal server error. This should be impossible.\n";" (assignment_expression "val = "Internal server error. This should be impossible.\n"" identifier = (string_literal ""Internal server error. This should be impossible.\n"" " string_content escape_sequence ")) ;) (expression_statement "(*mhd_panic)(mhd_panic_cls,"daemon.c",0x896,\n                 "Internal server error. This should be impossible.\n");" (call_expression "(*mhd_panic)(mhd_panic_cls,"daemon.c",0x896,\n                 "Internal server error. This should be impossible.\n")" (parenthesized_expression "(*mhd_panic)" ( (pointer_expression "*mhd_panic" * identifier) )) (argument_list "(mhd_panic_cls,"daemon.c",0x896,\n                 "Internal server error. This should be impossible.\n")" ( identifier , (string_literal ""daemon.c"" " string_content ") , number_literal , (string_literal ""Internal server error. This should be impossible.\n"" " string_content escape_sequence ") ))) ;) (expression_statement "sVar3 = MHD_http_unescape(val);" (assignment_expression "sVar3 = MHD_http_unescape(val)" identifier = (call_expression "MHD_http_unescape(val)" identifier (argument_list "(val)" ( identifier )))) ;) (return_statement "return sVar3;" return identifier ;) })) (expression_statement "daemon = pMVar1->daemon;" (assignment_expression "daemon = pMVar1->daemon" identifier = (field_expression "pMVar1->daemon" identifier -> field_identifier)) ;) (if_statement "if (daemon->cred_callback == (MHD_PskServerCredentialsCallback)0x0) {\n    iVar2 = -1;\n    MHD_DLOG(daemon,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (*daemon->cred_callback)\n                      (daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size);\n    if (iVar2 == 0) {\n      __dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size);\n      key->data = __dest;\n      if (__dest == (uchar *)0x0) {\n        iVar2 = -1;\n        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(app_psk);\n      }\n      else {\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }\n    }\n    else {\n      iVar2 = -1;\n    }\n  }" if (parenthesized_expression "(daemon->cred_callback == (MHD_PskServerCredentialsCallback)0x0)" ( (binary_expression "daemon->cred_callback == (MHD_PskServerCredentialsCallback)0x0" (field_expression "daemon->cred_callback" identifier -> field_identifier) == (cast_expression "(MHD_PskServerCredentialsCallback)0x0" ( (type_descriptor "MHD_PskServerCredentialsCallback" type_identifier) ) number_literal)) )) (compound_statement "{\n    iVar2 = -1;\n    MHD_DLOG(daemon,"PSK not supported by this server.\n");\n  }" { (expression_statement "iVar2 = -1;" (assignment_expression "iVar2 = -1" identifier = number_literal) ;) (expression_statement "MHD_DLOG(daemon,"PSK not supported by this server.\n");" (call_expression "MHD_DLOG(daemon,"PSK not supported by this server.\n")" identifier (argument_list "(daemon,"PSK not supported by this server.\n")" ( identifier , (string_literal ""PSK not supported by this server.\n"" " string_content escape_sequence ") ))) ;) }) (else_clause "else {\n    iVar2 = (*daemon->cred_callback)\n                      (daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size);\n    if (iVar2 == 0) {\n      __dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size);\n      key->data = __dest;\n      if (__dest == (uchar *)0x0) {\n        iVar2 = -1;\n        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(app_psk);\n      }\n      else {\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }\n    }\n    else {\n      iVar2 = -1;\n    }\n  }" else (compound_statement "{\n    iVar2 = (*daemon->cred_callback)\n                      (daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size);\n    if (iVar2 == 0) {\n      __dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size);\n      key->data = __dest;\n      if (__dest == (uchar *)0x0) {\n        iVar2 = -1;\n        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(app_psk);\n      }\n      else {\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }\n    }\n    else {\n      iVar2 = -1;\n    }\n  }" { (expression_statement "iVar2 = (*daemon->cred_callback)\n                      (daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size);" (assignment_expression "iVar2 = (*daemon->cred_callback)\n                      (daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size)" identifier = (call_expression "(*daemon->cred_callback)\n                      (daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size)" (parenthesized_expression "(*daemon->cred_callback)" ( (pointer_expression "*daemon->cred_callback" * (field_expression "daemon->cred_callback" identifier -> field_identifier)) )) (argument_list "(daemon->cred_callback_cls,pMVar1,username,&app_psk,&app_psk_size)" ( (field_expression "daemon->cred_callback_cls" identifier -> field_identifier) , identifier , identifier , (pointer_expression "&app_psk" & identifier) , (pointer_expression "&app_psk_size" & identifier) )))) ;) (if_statement "if (iVar2 == 0) {\n      __dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size);\n      key->data = __dest;\n      if (__dest == (uchar *)0x0) {\n        iVar2 = -1;\n        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(app_psk);\n      }\n      else {\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }\n    }\n    else {\n      iVar2 = -1;\n    }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n      __dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size);\n      key->data = __dest;\n      if (__dest == (uchar *)0x0) {\n        iVar2 = -1;\n        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(app_psk);\n      }\n      else {\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }\n    }" { (expression_statement "__dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size);" (assignment_expression "__dest = (uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size)" identifier = (cast_expression "(uchar *)(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size)" ( (type_descriptor "uchar *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "(**(code **)PTR_gnutls_malloc_00033fdc)(app_psk_size)" (parenthesized_expression "(**(code **)PTR_gnutls_malloc_00033fdc)" ( (pointer_expression "**(code **)PTR_gnutls_malloc_00033fdc" * (pointer_expression "*(code **)PTR_gnutls_malloc_00033fdc" * (cast_expression "(code **)PTR_gnutls_malloc_00033fdc" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) identifier))) )) (argument_list "(app_psk_size)" ( identifier ))))) ;) (expression_statement "key->data = __dest;" (assignment_expression "key->data = __dest" (field_expression "key->data" identifier -> field_identifier) = identifier) ;) (if_statement "if (__dest == (uchar *)0x0) {\n        iVar2 = -1;\n        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(app_psk);\n      }\n      else {\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }" if (parenthesized_expression "(__dest == (uchar *)0x0)" ( (binary_expression "__dest == (uchar *)0x0" identifier == (cast_expression "(uchar *)0x0" ( (type_descriptor "uchar *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        iVar2 = -1;\n        MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(app_psk);\n      }" { (expression_statement "iVar2 = -1;" (assignment_expression "iVar2 = -1" identifier = number_literal) ;) (expression_statement "MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");" (call_expression "MHD_DLOG(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n")" identifier (argument_list "(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n")" ( identifier , (string_literal ""PSK authentication failed: gnutls_malloc failed to allocate memory\n"" " string_content escape_sequence ") ))) ;) (expression_statement "free(app_psk);" (call_expression "free(app_psk)" identifier (argument_list "(app_psk)" ( identifier ))) ;) }) (else_clause "else {\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }" else (compound_statement "{\n        key->size = app_psk_size;\n        memcpy(__dest,app_psk,app_psk_size);\n        free(app_psk);\n        iVar2 = 0;\n      }" { (expression_statement "key->size = app_psk_size;" (assignment_expression "key->size = app_psk_size" (field_expression "key->size" identifier -> field_identifier) = identifier) ;) (expression_statement "memcpy(__dest,app_psk,app_psk_size);" (call_expression "memcpy(__dest,app_psk,app_psk_size)" identifier (argument_list "(__dest,app_psk,app_psk_size)" ( identifier , identifier , identifier ))) ;) (expression_statement "free(app_psk);" (call_expression "free(app_psk)" identifier (argument_list "(app_psk)" ( identifier ))) ;) (expression_statement "iVar2 = 0;" (assignment_expression "iVar2 = 0" identifier = number_literal) ;) }))) }) (else_clause "else {\n      iVar2 = -1;\n    }" else (compound_statement "{\n      iVar2 = -1;\n    }" { (expression_statement "iVar2 = -1;" (assignment_expression "iVar2 = -1" identifier = number_literal) ;) }))) }))) (if_statement "if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return iVar2;\n  }" if (parenthesized_expression "(local_20 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_20 == *(int *)(in_GS_OFFSET + 0x14)" identifier == (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n    return iVar2;\n  }" { (return_statement "return iVar2;" return identifier ;) })) comment (expression_statement "__stack_chk_fail_local();" (call_expression "__stack_chk_fail_local()" identifier (argument_list "()" ( ))) ;) })))
(translation_unit "undefined4 FUN_00019930(undefined4 param_1,undefined4 param_2,undefined4 *param_3)\n\n{\n  int iVar1;\n  int iVar2;\n  void *__dest;\n  undefined4 uVar3;\n  int in_GS_OFFSET;\n  char *pcVar4;\n  void *local_28;\n  size_t local_24;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  iVar2 = gnutls_session_get_ptr(param_1);\n  if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }\n  iVar1 = *(int *)(iVar2 + 0x18);\n  if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }\n                    \n  FUN_00028540();\n}\n\n" (function_definition "undefined4 FUN_00019930(undefined4 param_1,undefined4 param_2,undefined4 *param_3)\n\n{\n  int iVar1;\n  int iVar2;\n  void *__dest;\n  undefined4 uVar3;\n  int in_GS_OFFSET;\n  char *pcVar4;\n  void *local_28;\n  size_t local_24;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  iVar2 = gnutls_session_get_ptr(param_1);\n  if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }\n  iVar1 = *(int *)(iVar2 + 0x18);\n  if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }\n                    \n  FUN_00028540();\n}" type_identifier (function_declarator "FUN_00019930(undefined4 param_1,undefined4 param_2,undefined4 *param_3)" identifier (parameter_list "(undefined4 param_1,undefined4 param_2,undefined4 *param_3)" ( (parameter_declaration "undefined4 param_1" type_identifier identifier) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "undefined4 *param_3" type_identifier (pointer_declarator "*param_3" * identifier)) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  void *__dest;\n  undefined4 uVar3;\n  int in_GS_OFFSET;\n  char *pcVar4;\n  void *local_28;\n  size_t local_24;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  iVar2 = gnutls_session_get_ptr(param_1);\n  if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }\n  iVar1 = *(int *)(iVar2 + 0x18);\n  if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }\n                    \n  FUN_00028540();\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "void *__dest;" primitive_type (pointer_declarator "*__dest" * identifier) ;) (declaration "undefined4 uVar3;" type_identifier identifier ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "char *pcVar4;" primitive_type (pointer_declarator "*pcVar4" * identifier) ;) (declaration "void *local_28;" primitive_type (pointer_declarator "*local_28" * identifier) ;) (declaration "size_t local_24;" primitive_type identifier ;) (declaration "int local_20;" primitive_type identifier ;) (declaration "undefined4 uStack_14;" type_identifier identifier ;) (expression_statement "uStack_14 = 0x19939;" (assignment_expression "uStack_14 = 0x19939" identifier = number_literal) ;) (expression_statement "local_20 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_20 = *(int *)(in_GS_OFFSET + 0x14)" identifier = (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) ;) (expression_statement "iVar2 = gnutls_session_get_ptr(param_1);" (assignment_expression "iVar2 = gnutls_session_get_ptr(param_1)" identifier = (call_expression "gnutls_session_get_ptr(param_1)" identifier (argument_list "(param_1)" ( identifier )))) ;) (if_statement "if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }" { (expression_statement "pcVar4 = "Internal server error. This should be impossible.\n";" (assignment_expression "pcVar4 = "Internal server error. This should be impossible.\n"" identifier = (string_literal ""Internal server error. This should be impossible.\n"" " string_content escape_sequence ")) ;) (expression_statement "(*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");" (call_expression "(*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n")" (parenthesized_expression "(*DAT_0003406c)" ( (pointer_expression "*DAT_0003406c" * identifier) )) (argument_list "(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n")" ( identifier , (string_literal ""daemon.c"" " string_content ") , number_literal , (string_literal ""Internal server error. This should be impossible.\n"" " string_content escape_sequence ") ))) ;) (expression_statement "uVar3 = MHD_http_unescape(pcVar4);" (assignment_expression "uVar3 = MHD_http_unescape(pcVar4)" identifier = (call_expression "MHD_http_unescape(pcVar4)" identifier (argument_list "(pcVar4)" ( identifier )))) ;) (return_statement "return uVar3;" return identifier ;) })) (expression_statement "iVar1 = *(int *)(iVar2 + 0x18);" (assignment_expression "iVar1 = *(int *)(iVar2 + 0x18)" identifier = (pointer_expression "*(int *)(iVar2 + 0x18)" * (cast_expression "(int *)(iVar2 + 0x18)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar2 + 0x18)" ( (binary_expression "iVar2 + 0x18" identifier + number_literal) ))))) ;) (if_statement "if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }" if (parenthesized_expression "(*(code **)(iVar1 + 0x124) == (code *)0x0)" ( (binary_expression "*(code **)(iVar1 + 0x124) == (code *)0x0" (pointer_expression "*(code **)(iVar1 + 0x124)" * (cast_expression "(code **)(iVar1 + 0x124)" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(iVar1 + 0x124)" ( (binary_expression "iVar1 + 0x124" identifier + number_literal) )))) == (cast_expression "(code *)0x0" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }" { (expression_statement "uVar3 = 0xffffffff;" (assignment_expression "uVar3 = 0xffffffff" identifier = number_literal) ;) (expression_statement "FUN_00020aa0(iVar1,"PSK not supported by this server.\n");" (call_expression "FUN_00020aa0(iVar1,"PSK not supported by this server.\n")" identifier (argument_list "(iVar1,"PSK not supported by this server.\n")" ( identifier , (string_literal ""PSK not supported by this server.\n"" " string_content escape_sequence ") ))) ;) }) (else_clause "else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }" else (compound_statement "{\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }" { (expression_statement "iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);" (assignment_expression "iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24)" identifier = (call_expression "(**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24)" (parenthesized_expression "(**(code **)(iVar1 + 0x124))" ( (pointer_expression "**(code **)(iVar1 + 0x124)" * (pointer_expression "*(code **)(iVar1 + 0x124)" * (cast_expression "(code **)(iVar1 + 0x124)" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(iVar1 + 0x124)" ( (binary_expression "iVar1 + 0x124" identifier + number_literal) ))))) )) (argument_list "(*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24)" ( (pointer_expression "*(undefined4 *)(iVar1 + 0x128)" * (cast_expression "(undefined4 *)(iVar1 + 0x128)" ( (type_descriptor "undefined4 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar1 + 0x128)" ( (binary_expression "iVar1 + 0x128" identifier + number_literal) )))) , identifier , identifier , (pointer_expression "&local_28" & identifier) , (pointer_expression "&local_24" & identifier) )))) ;) (if_statement "if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }" if (parenthesized_expression "(iVar2 == 0)" ( (binary_expression "iVar2 == 0" identifier == number_literal) )) (compound_statement "{\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }" { (expression_statement "__dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);" (assignment_expression "__dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24)" identifier = (cast_expression "(void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "(**(code **)PTR_gnutls_malloc_00033fdc)(local_24)" (parenthesized_expression "(**(code **)PTR_gnutls_malloc_00033fdc)" ( (pointer_expression "**(code **)PTR_gnutls_malloc_00033fdc" * (pointer_expression "*(code **)PTR_gnutls_malloc_00033fdc" * (cast_expression "(code **)PTR_gnutls_malloc_00033fdc" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) identifier))) )) (argument_list "(local_24)" ( identifier ))))) ;) (expression_statement "*param_3 = __dest;" (assignment_expression "*param_3 = __dest" (pointer_expression "*param_3" * identifier) = identifier) ;) (if_statement "if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }" if (parenthesized_expression "(__dest == (void *)0x0)" ( (binary_expression "__dest == (void *)0x0" identifier == (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }" { (expression_statement "uVar3 = 0xffffffff;" (assignment_expression "uVar3 = 0xffffffff" identifier = number_literal) ;) (expression_statement "FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");" (call_expression "FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n")" identifier (argument_list "(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n")" ( identifier , (string_literal ""PSK authentication failed: gnutls_malloc failed to allocate memory\n"" " string_content escape_sequence ") ))) ;) (expression_statement "free(local_28);" (call_expression "free(local_28)" identifier (argument_list "(local_28)" ( identifier ))) ;) }) (else_clause "else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }" else (compound_statement "{\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }" { (expression_statement "param_3[1] = local_24;" (assignment_expression "param_3[1] = local_24" (subscript_expression "param_3[1]" identifier [ number_literal ]) = identifier) ;) (expression_statement "memcpy(__dest,local_28,local_24);" (call_expression "memcpy(__dest,local_28,local_24)" identifier (argument_list "(__dest,local_28,local_24)" ( identifier , identifier , identifier ))) ;) (expression_statement "free(local_28);" (call_expression "free(local_28)" identifier (argument_list "(local_28)" ( identifier ))) ;) (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" identifier = number_literal) ;) }))) }) (else_clause "else {\n      uVar3 = 0xffffffff;\n    }" else (compound_statement "{\n      uVar3 = 0xffffffff;\n    }" { (expression_statement "uVar3 = 0xffffffff;" (assignment_expression "uVar3 = 0xffffffff" identifier = number_literal) ;) }))) }))) (if_statement "if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }" if (parenthesized_expression "(local_20 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_20 == *(int *)(in_GS_OFFSET + 0x14)" identifier == (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" * (cast_expression "(int *)(in_GS_OFFSET + 0x14)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(in_GS_OFFSET + 0x14)" ( (binary_expression "in_GS_OFFSET + 0x14" identifier + number_literal) ))))) )) (compound_statement "{\n    return uVar3;\n  }" { (return_statement "return uVar3;" return identifier ;) })) (expression_statement "FUN_00028540();" (call_expression "FUN_00028540()" identifier (argument_list "()" ( ))) ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE (pointer_declarator * IDENT)) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (string_literal " string_content escape_sequence ")) ;) (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * IDENT) )) (argument_list ( IDENT , (string_literal " string_content ") , LIT , (string_literal " string_content escape_sequence ") ))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT )))) ;) (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , (string_literal " string_content escape_sequence ") ))) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) )) (argument_list ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) , IDENT , IDENT , (pointer_expression & IDENT) , (pointer_expression & IDENT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression (parenthesized_expression ( (pointer_expression * (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) IDENT))) )) (argument_list ( IDENT ))))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , (string_literal " string_content escape_sequence ") ))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = IDENT) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT ))) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) }))) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) }))) }))) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (call_expression IDENT (argument_list ( ))) ;) })))
(function_definition "undefined4 FUN_00019930(undefined4 param_1,undefined4 param_2,undefined4 *param_3)\n\n{\n  int iVar1;\n  int iVar2;\n  void *__dest;\n  undefined4 uVar3;\n  int in_GS_OFFSET;\n  char *pcVar4;\n  void *local_28;\n  size_t local_24;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  iVar2 = gnutls_session_get_ptr(param_1);\n  if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }\n  iVar1 = *(int *)(iVar2 + 0x18);\n  if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }\n                    \n  FUN_00028540();\n}" (type_identifier "undefined4") (function_declarator "FUN_00019930(undefined4 param_1,undefined4 param_2,undefined4 *param_3)" (identifier "FUN_00019930") (parameter_list "(undefined4 param_1,undefined4 param_2,undefined4 *param_3)" (( "(") (parameter_declaration "undefined4 param_1" (type_identifier "undefined4") (identifier "param_1")) (, ",") (parameter_declaration "undefined4 param_2" (type_identifier "undefined4") (identifier "param_2")) (, ",") (parameter_declaration "undefined4 *param_3" (type_identifier "undefined4") (pointer_declarator "*param_3" (* "*") (identifier "param_3"))) () ")"))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  void *__dest;\n  undefined4 uVar3;\n  int in_GS_OFFSET;\n  char *pcVar4;\n  void *local_28;\n  size_t local_24;\n  int local_20;\n  undefined4 uStack_14;\n  \n  uStack_14 = 0x19939;\n  local_20 = *(int *)(in_GS_OFFSET + 0x14);\n  iVar2 = gnutls_session_get_ptr(param_1);\n  if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }\n  iVar1 = *(int *)(iVar2 + 0x18);\n  if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }\n  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }\n                    \n  FUN_00028540();\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "void *__dest;" (primitive_type "void") (pointer_declarator "*__dest" (* "*") (identifier "__dest")) (; ";")) (declaration "undefined4 uVar3;" (type_identifier "undefined4") (identifier "uVar3") (; ";")) (declaration "int in_GS_OFFSET;" (primitive_type "int") (identifier "in_GS_OFFSET") (; ";")) (declaration "char *pcVar4;" (primitive_type "char") (pointer_declarator "*pcVar4" (* "*") (identifier "pcVar4")) (; ";")) (declaration "void *local_28;" (primitive_type "void") (pointer_declarator "*local_28" (* "*") (identifier "local_28")) (; ";")) (declaration "size_t local_24;" (primitive_type "size_t") (identifier "local_24") (; ";")) (declaration "int local_20;" (primitive_type "int") (identifier "local_20") (; ";")) (declaration "undefined4 uStack_14;" (type_identifier "undefined4") (identifier "uStack_14") (; ";")) (expression_statement "uStack_14 = 0x19939;" (assignment_expression "uStack_14 = 0x19939" (identifier "uStack_14") (= "=") (number_literal "0x19939")) (; ";")) (expression_statement "local_20 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_20 = *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_20") (= "=") (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" (* "*") (cast_expression "(int *)(in_GS_OFFSET + 0x14)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_GS_OFFSET + 0x14)" (( "(") (binary_expression "in_GS_OFFSET + 0x14" (identifier "in_GS_OFFSET") (+ "+") (number_literal "0x14")) () ")"))))) (; ";")) (expression_statement "iVar2 = gnutls_session_get_ptr(param_1);" (assignment_expression "iVar2 = gnutls_session_get_ptr(param_1)" (identifier "iVar2") (= "=") (call_expression "gnutls_session_get_ptr(param_1)" (identifier "gnutls_session_get_ptr") (argument_list "(param_1)" (( "(") (identifier "param_1") () ")")))) (; ";")) (if_statement "if (iVar2 == 0) {\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }" (if "if") (parenthesized_expression "(iVar2 == 0)" (( "(") (binary_expression "iVar2 == 0" (identifier "iVar2") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n    pcVar4 = "Internal server error. This should be impossible.\n";\n    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");\n    uVar3 = MHD_http_unescape(pcVar4);\n    return uVar3;\n  }" ({ "{") (expression_statement "pcVar4 = "Internal server error. This should be impossible.\n";" (assignment_expression "pcVar4 = "Internal server error. This should be impossible.\n"" (identifier "pcVar4") (= "=") (string_literal ""Internal server error. This should be impossible.\n"" (" """) (string_content "Internal server error. This should be impossible.") (escape_sequence "\n") (" """))) (; ";")) (expression_statement "(*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n");" (call_expression "(*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n")" (parenthesized_expression "(*DAT_0003406c)" (( "(") (pointer_expression "*DAT_0003406c" (* "*") (identifier "DAT_0003406c")) () ")")) (argument_list "(DAT_00034068,"daemon.c",0x896,\n                    "Internal server error. This should be impossible.\n")" (( "(") (identifier "DAT_00034068") (, ",") (string_literal ""daemon.c"" (" """) (string_content "daemon.c") (" """)) (, ",") (number_literal "0x896") (, ",") (string_literal ""Internal server error. This should be impossible.\n"" (" """) (string_content "Internal server error. This should be impossible.") (escape_sequence "\n") (" """)) () ")"))) (; ";")) (expression_statement "uVar3 = MHD_http_unescape(pcVar4);" (assignment_expression "uVar3 = MHD_http_unescape(pcVar4)" (identifier "uVar3") (= "=") (call_expression "MHD_http_unescape(pcVar4)" (identifier "MHD_http_unescape") (argument_list "(pcVar4)" (( "(") (identifier "pcVar4") () ")")))) (; ";")) (return_statement "return uVar3;" (return "return") (identifier "uVar3") (; ";")) (} "}"))) (expression_statement "iVar1 = *(int *)(iVar2 + 0x18);" (assignment_expression "iVar1 = *(int *)(iVar2 + 0x18)" (identifier "iVar1") (= "=") (pointer_expression "*(int *)(iVar2 + 0x18)" (* "*") (cast_expression "(int *)(iVar2 + 0x18)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(iVar2 + 0x18)" (( "(") (binary_expression "iVar2 + 0x18" (identifier "iVar2") (+ "+") (number_literal "0x18")) () ")"))))) (; ";")) (if_statement "if (*(code **)(iVar1 + 0x124) == (code *)0x0) {\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }\n  else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }" (if "if") (parenthesized_expression "(*(code **)(iVar1 + 0x124) == (code *)0x0)" (( "(") (binary_expression "*(code **)(iVar1 + 0x124) == (code *)0x0" (pointer_expression "*(code **)(iVar1 + 0x124)" (* "*") (cast_expression "(code **)(iVar1 + 0x124)" (( "(") (type_descriptor "code **" (type_identifier "code") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (parenthesized_expression "(iVar1 + 0x124)" (( "(") (binary_expression "iVar1 + 0x124" (identifier "iVar1") (+ "+") (number_literal "0x124")) () ")")))) (== "==") (cast_expression "(code *)0x0" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n    uVar3 = 0xffffffff;\n    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");\n  }" ({ "{") (expression_statement "uVar3 = 0xffffffff;" (assignment_expression "uVar3 = 0xffffffff" (identifier "uVar3") (= "=") (number_literal "0xffffffff")) (; ";")) (expression_statement "FUN_00020aa0(iVar1,"PSK not supported by this server.\n");" (call_expression "FUN_00020aa0(iVar1,"PSK not supported by this server.\n")" (identifier "FUN_00020aa0") (argument_list "(iVar1,"PSK not supported by this server.\n")" (( "(") (identifier "iVar1") (, ",") (string_literal ""PSK not supported by this server.\n"" (" """) (string_content "PSK not supported by this server.") (escape_sequence "\n") (" """)) () ")"))) (; ";")) (} "}")) (else_clause "else {\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }" (else "else") (compound_statement "{\n    iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);\n    if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }\n  }" ({ "{") (expression_statement "iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);" (assignment_expression "iVar2 = (**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24)" (identifier "iVar2") (= "=") (call_expression "(**(code **)(iVar1 + 0x124))\n                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24)" (parenthesized_expression "(**(code **)(iVar1 + 0x124))" (( "(") (pointer_expression "**(code **)(iVar1 + 0x124)" (* "*") (pointer_expression "*(code **)(iVar1 + 0x124)" (* "*") (cast_expression "(code **)(iVar1 + 0x124)" (( "(") (type_descriptor "code **" (type_identifier "code") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (parenthesized_expression "(iVar1 + 0x124)" (( "(") (binary_expression "iVar1 + 0x124" (identifier "iVar1") (+ "+") (number_literal "0x124")) () ")"))))) () ")")) (argument_list "(*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24)" (( "(") (pointer_expression "*(undefined4 *)(iVar1 + 0x128)" (* "*") (cast_expression "(undefined4 *)(iVar1 + 0x128)" (( "(") (type_descriptor "undefined4 *" (type_identifier "undefined4") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(iVar1 + 0x128)" (( "(") (binary_expression "iVar1 + 0x128" (identifier "iVar1") (+ "+") (number_literal "0x128")) () ")")))) (, ",") (identifier "iVar2") (, ",") (identifier "param_2") (, ",") (pointer_expression "&local_28" (& "&") (identifier "local_28")) (, ",") (pointer_expression "&local_24" (& "&") (identifier "local_24")) () ")")))) (; ";")) (if_statement "if (iVar2 == 0) {\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }\n    else {\n      uVar3 = 0xffffffff;\n    }" (if "if") (parenthesized_expression "(iVar2 == 0)" (( "(") (binary_expression "iVar2 == 0" (identifier "iVar2") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);\n      *param_3 = __dest;\n      if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }\n    }" ({ "{") (expression_statement "__dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);" (assignment_expression "__dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24)" (identifier "__dest") (= "=") (cast_expression "(void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24)" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "(**(code **)PTR_gnutls_malloc_00033fdc)(local_24)" (parenthesized_expression "(**(code **)PTR_gnutls_malloc_00033fdc)" (( "(") (pointer_expression "**(code **)PTR_gnutls_malloc_00033fdc" (* "*") (pointer_expression "*(code **)PTR_gnutls_malloc_00033fdc" (* "*") (cast_expression "(code **)PTR_gnutls_malloc_00033fdc" (( "(") (type_descriptor "code **" (type_identifier "code") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (identifier "PTR_gnutls_malloc_00033fdc")))) () ")")) (argument_list "(local_24)" (( "(") (identifier "local_24") () ")"))))) (; ";")) (expression_statement "*param_3 = __dest;" (assignment_expression "*param_3 = __dest" (pointer_expression "*param_3" (* "*") (identifier "param_3")) (= "=") (identifier "__dest")) (; ";")) (if_statement "if (__dest == (void *)0x0) {\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }\n      else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }" (if "if") (parenthesized_expression "(__dest == (void *)0x0)" (( "(") (binary_expression "__dest == (void *)0x0" (identifier "__dest") (== "==") (cast_expression "(void *)0x0" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n        uVar3 = 0xffffffff;\n        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");\n        free(local_28);\n      }" ({ "{") (expression_statement "uVar3 = 0xffffffff;" (assignment_expression "uVar3 = 0xffffffff" (identifier "uVar3") (= "=") (number_literal "0xffffffff")) (; ";")) (expression_statement "FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");" (call_expression "FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n")" (identifier "FUN_00020aa0") (argument_list "(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n")" (( "(") (identifier "iVar1") (, ",") (string_literal ""PSK authentication failed: gnutls_malloc failed to allocate memory\n"" (" """) (string_content "PSK authentication failed: gnutls_malloc failed to allocate memory") (escape_sequence "\n") (" """)) () ")"))) (; ";")) (expression_statement "free(local_28);" (call_expression "free(local_28)" (identifier "free") (argument_list "(local_28)" (( "(") (identifier "local_28") () ")"))) (; ";")) (} "}")) (else_clause "else {\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }" (else "else") (compound_statement "{\n        param_3[1] = local_24;\n        memcpy(__dest,local_28,local_24);\n        free(local_28);\n        uVar3 = 0;\n      }" ({ "{") (expression_statement "param_3[1] = local_24;" (assignment_expression "param_3[1] = local_24" (subscript_expression "param_3[1]" (identifier "param_3") ([ "[") (number_literal "1") (] "]")) (= "=") (identifier "local_24")) (; ";")) (expression_statement "memcpy(__dest,local_28,local_24);" (call_expression "memcpy(__dest,local_28,local_24)" (identifier "memcpy") (argument_list "(__dest,local_28,local_24)" (( "(") (identifier "__dest") (, ",") (identifier "local_28") (, ",") (identifier "local_24") () ")"))) (; ";")) (expression_statement "free(local_28);" (call_expression "free(local_28)" (identifier "free") (argument_list "(local_28)" (( "(") (identifier "local_28") () ")"))) (; ";")) (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" (identifier "uVar3") (= "=") (number_literal "0")) (; ";")) (} "}")))) (} "}")) (else_clause "else {\n      uVar3 = 0xffffffff;\n    }" (else "else") (compound_statement "{\n      uVar3 = 0xffffffff;\n    }" ({ "{") (expression_statement "uVar3 = 0xffffffff;" (assignment_expression "uVar3 = 0xffffffff" (identifier "uVar3") (= "=") (number_literal "0xffffffff")) (; ";")) (} "}")))) (} "}")))) (if_statement "if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return uVar3;\n  }" (if "if") (parenthesized_expression "(local_20 == *(int *)(in_GS_OFFSET + 0x14))" (( "(") (binary_expression "local_20 == *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_20") (== "==") (pointer_expression "*(int *)(in_GS_OFFSET + 0x14)" (* "*") (cast_expression "(int *)(in_GS_OFFSET + 0x14)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(in_GS_OFFSET + 0x14)" (( "(") (binary_expression "in_GS_OFFSET + 0x14" (identifier "in_GS_OFFSET") (+ "+") (number_literal "0x14")) () ")"))))) () ")")) (compound_statement "{\n    return uVar3;\n  }" ({ "{") (return_statement "return uVar3;" (return "return") (identifier "uVar3") (; ";")) (} "}"))) (expression_statement "FUN_00028540();" (call_expression "FUN_00028540()" (identifier "FUN_00028540") (argument_list "()" (( "(") () ")"))) (; ";")) (} "}")))

/* 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 */

int function_1(type_1 session,char *username,type_2 *key)

{
  type_3 *daemon;
  type_4 *var_3;
  int var_6;
  type_5 *var_7;
  size_t sVar3;
  int var_1;
  char *val;
  void *app_psk;
  size_t app_psk_size;
  int var_10;
  type_6 uStack_14;
  
  uStack_14 = 0x19939;
  var_10 = *(int *)(var_1 + 0x14);
  var_3 = (type_4 *)var_2(session);
  if (var_3 == (type_4 *)0x0) {
    val = "Internal server error. This should be impossible.\n";
    (*mhd_panic)(mhd_panic_cls,"daemon.c",0x896,
                 "Internal server error. This should be impossible.\n");
    sVar3 = var_4(val);
    return sVar3;
  }
  daemon = var_3->daemon;
  if (daemon->cred_callback == (type_7)0x0) {
    var_6 = -1;
    var_5(daemon,"PSK not supported by this server.\n");
  }
  else {
    var_6 = (*daemon->cred_callback)
                      (daemon->cred_callback_cls,var_3,username,&app_psk,&app_psk_size);
    if (var_6 == 0) {
      var_7 = (type_5 *)(**(type_8 **)PTR_gnutls_malloc_00033fdc)(app_psk_size);
      key->data = var_7;
      if (var_7 == (type_5 *)0x0) {
        var_6 = -1;
        var_5(daemon,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");
        var_8(app_psk);
      }
      else {
        key->size = app_psk_size;
        var_9(var_7,app_psk,app_psk_size);
        var_8(app_psk);
        var_6 = 0;
      }
    }
    else {
      var_6 = -1;
    }
  }
  if (var_10 == *(int *)(var_1 + 0x14)) {
    return var_6;
  }
                    /* WARNING: Subroutine does not return */
  var_11();
}


(translation_unit (function_definition type: (type_identifier) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (string_literal (string_content) (escape_sequence)))) (expression_statement (call_expression function: (parenthesized_expression (pointer_expression argument: (identifier))) arguments: (argument_list (identifier) (string_literal (string_content)) (number_literal) (string_literal (string_content) (escape_sequence))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier))))) (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator declarator: (abstract_pointer_declarator))) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (number_literal)))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (string_literal (string_content) (escape_sequence)))))) alternative: (else_clause (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (parenthesized_expression (pointer_expression argument: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator declarator: (abstract_pointer_declarator))) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))))) arguments: (argument_list (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))) (identifier) (identifier) (pointer_expression argument: (identifier)) (pointer_expression argument: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (call_expression function: (parenthesized_expression (pointer_expression argument: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator declarator: (abstract_pointer_declarator))) value: (identifier))))) arguments: (argument_list (identifier)))))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (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: (number_literal))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (string_literal (string_content) (escape_sequence))))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier))))) alternative: (else_clause (compound_statement (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (identifier))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))))))) alternative: (else_clause (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list))))))

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

undefined4 MASKED(undefined4 param_1,undefined4 param_2,undefined4 *param_3)

{
  int iVar1;
  int iVar2;
  void *__dest;
  undefined4 uVar3;
  int in_GS_OFFSET;
  char *pcVar4;
  void *local_28;
  size_t local_24;
  int local_20;
  undefined4 uStack_14;
  
  uStack_14 = 0x19939;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iVar2 = gnutls_session_get_ptr(param_1);
  if (iVar2 == 0) {
    pcVar4 = "Internal server error. This should be impossible.\n";
    (*DAT_0003406c)(DAT_00034068,"daemon.c",0x896,
                    "Internal server error. This should be impossible.\n");
    uVar3 = MHD_http_unescape(pcVar4);
    return uVar3;
  }
  iVar1 = *(int *)(iVar2 + 0x18);
  if (*(code **)(iVar1 + 0x124) == (code *)0x0) {
    uVar3 = 0xffffffff;
    FUN_00020aa0(iVar1,"PSK not supported by this server.\n");
  }
  else {
    iVar2 = (**(code **)(iVar1 + 0x124))
                      (*(undefined4 *)(iVar1 + 0x128),iVar2,param_2,&local_28,&local_24);
    if (iVar2 == 0) {
      __dest = (void *)(**(code **)PTR_gnutls_malloc_00033fdc)(local_24);
      *param_3 = __dest;
      if (__dest == (void *)0x0) {
        uVar3 = 0xffffffff;
        FUN_00020aa0(iVar1,"PSK authentication failed: gnutls_malloc failed to allocate memory\n");
        free(local_28);
      }
      else {
        param_3[1] = local_24;
        memcpy(__dest,local_28,local_24);
        free(local_28);
        uVar3 = 0;
      }
    }
    else {
      uVar3 = 0xffffffff;
    }
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return uVar3;
  }
                    /* WARNING: Subroutine does not return */
  FUN_00028540();
}

