
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Unknown calling convention */

int rpl_vasprintf(char **resultp,char *format,va_list args)

{
  char *__ptr;
  int *piVar1;
  int in_GS_OFFSET;
  size_t length;
  int local_10;
  undefined4 uStack_c;
  
  uStack_c = 0x16737;
  local_10 = *(int *)(in_GS_OFFSET + 0x14);
  __ptr = vasnprintf((char *)0x0,&length,format,args);
  if (__ptr == (char *)0x0) {
    length = 0xffffffff;
  }
  else if ((int)length < 0) {
    free(__ptr);
    piVar1 = __errno_location();
    length = 0xffffffff;
    *piVar1 = 0x4b;
  }
  else {
    *resultp = __ptr;
  }
  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {
    return length;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail_local();
}



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

int FUN_00016730(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  void *__ptr;
  int *piVar1;
  int in_GS_OFFSET;
  int local_14;
  int local_10;
  undefined4 uStack_c;
  
  uStack_c = 0x16737;
  local_10 = *(int *)(in_GS_OFFSET + 0x14);
  __ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);
  if (__ptr == (void *)0x0) {
    local_14 = -1;
  }
  else if (local_14 < 0) {
    free(__ptr);
    piVar1 = __errno_location();
    local_14 = -1;
    *piVar1 = 0x4b;
  }
  else {
    *param_1 = __ptr;
  }
  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {
    return local_14;
  }
                    /* WARNING: Subroutine does not return */
  FUN_000195e0();
}


PUSH ESI
PUSH EBX
CALL 0x00012060
ADD EBX,0x88c9
SUB ESP,0x14
MOV EAX,GS:[0x14]
MOV dword ptr [ESP + 0xc],EAX
XOR EAX,EAX
MOV ESI,dword ptr [ESP + 0x20]
PUSH dword ptr [ESP + 0x28]
PUSH dword ptr [ESP + 0x28]
LEA EAX,[ESP + 0x10]
PUSH EAX
PUSH 0x0
CALL 0x00016aa0
ADD ESP,0x10
TEST EAX,EAX
JZ 0x0001678a
MOV EDX,dword ptr [ESP + 0x8]
TEST EDX,EDX
JS 0x00016791
MOV dword ptr [ESI],EAX
MOV ECX,dword ptr [ESP + 0xc]
XOR ECX,dword ptr GS:[0x14]
MOV EAX,EDX
JNZ 0x000167af
ADD ESP,0x14
POP EBX
POP ESI
RET
MOV EDX,0xffffffff
JMP 0x00016775
SUB ESP,0xc
PUSH EAX
CALL 0x000110a0
CALL 0x00011270
ADD ESP,0x10
MOV EDX,0xffffffff
MOV dword ptr [EAX],0x4b
JMP 0x00016775
CALL 0x000195e0
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nint FUN_00016730(undefined4 *param_1,undefined4 param_2,undefined4 param_3)\n\n{\n  void *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  int local_14;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);\n  if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_000195e0();\n}\n\n" comment (function_definition "int FUN_00016730(undefined4 *param_1,undefined4 param_2,undefined4 param_3)\n\n{\n  void *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  int local_14;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);\n  if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_000195e0();\n}" primitive_type (function_declarator "FUN_00016730(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 (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) ))) (compound_statement "{\n  void *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  int local_14;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);\n  if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_000195e0();\n}" { (declaration "void *__ptr;" primitive_type (pointer_declarator "*__ptr" * identifier) ;) (declaration "int *piVar1;" primitive_type (pointer_declarator "*piVar1" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "int local_14;" primitive_type identifier ;) (declaration "int local_10;" primitive_type identifier ;) (declaration "undefined4 uStack_c;" type_identifier identifier ;) (expression_statement "uStack_c = 0x16737;" (assignment_expression "uStack_c = 0x16737" identifier = number_literal) ;) (expression_statement "local_10 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_10 = *(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 "__ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);" (assignment_expression "__ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3)" identifier = (cast_expression "(void *)FUN_00016aa0(0,&local_14,param_2,param_3)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_00016aa0(0,&local_14,param_2,param_3)" identifier (argument_list "(0,&local_14,param_2,param_3)" ( number_literal , (pointer_expression "&local_14" & identifier) , identifier , identifier ))))) ;) (if_statement "if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }" if (parenthesized_expression "(__ptr == (void *)0x0)" ( (binary_expression "__ptr == (void *)0x0" identifier == (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    local_14 = -1;\n  }" { (expression_statement "local_14 = -1;" (assignment_expression "local_14 = -1" identifier = number_literal) ;) }) (else_clause "else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }" else (if_statement "if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }" if (parenthesized_expression "(local_14 < 0)" ( (binary_expression "local_14 < 0" identifier < number_literal) )) (compound_statement "{\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }" { (expression_statement "free(__ptr);" (call_expression "free(__ptr)" identifier (argument_list "(__ptr)" ( identifier ))) ;) (expression_statement "piVar1 = __errno_location();" (assignment_expression "piVar1 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "local_14 = -1;" (assignment_expression "local_14 = -1" identifier = number_literal) ;) (expression_statement "*piVar1 = 0x4b;" (assignment_expression "*piVar1 = 0x4b" (pointer_expression "*piVar1" * identifier) = number_literal) ;) }) (else_clause "else {\n    *param_1 = __ptr;\n  }" else (compound_statement "{\n    *param_1 = __ptr;\n  }" { (expression_statement "*param_1 = __ptr;" (assignment_expression "*param_1 = __ptr" (pointer_expression "*param_1" * identifier) = identifier) ;) }))))) (if_statement "if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }" if (parenthesized_expression "(local_10 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_10 == *(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 local_14;\n  }" { (return_statement "return local_14;" return identifier ;) })) comment (expression_statement "FUN_000195e0();" (call_expression "FUN_000195e0()" 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\nint rpl_vasprintf(char **resultp,char *format,va_list args)\n\n{\n  char *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  size_t length;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = vasnprintf((char *)0x0,&length,format,args);\n  if (__ptr == (char *)0x0) {\n    length = 0xffffffff;\n  }\n  else if ((int)length < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    length = 0xffffffff;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *resultp = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return length;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}\n\n" comment comment (function_definition "int rpl_vasprintf(char **resultp,char *format,va_list args)\n\n{\n  char *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  size_t length;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = vasnprintf((char *)0x0,&length,format,args);\n  if (__ptr == (char *)0x0) {\n    length = 0xffffffff;\n  }\n  else if ((int)length < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    length = 0xffffffff;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *resultp = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return length;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}" primitive_type (function_declarator "rpl_vasprintf(char **resultp,char *format,va_list args)" identifier (parameter_list "(char **resultp,char *format,va_list args)" ( (parameter_declaration "char **resultp" primitive_type (pointer_declarator "**resultp" * (pointer_declarator "*resultp" * identifier))) , (parameter_declaration "char *format" primitive_type (pointer_declarator "*format" * identifier)) , (parameter_declaration "va_list args" type_identifier identifier) ))) (compound_statement "{\n  char *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  size_t length;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = vasnprintf((char *)0x0,&length,format,args);\n  if (__ptr == (char *)0x0) {\n    length = 0xffffffff;\n  }\n  else if ((int)length < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    length = 0xffffffff;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *resultp = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return length;\n  }\n                    /* WARNING: Subroutine does not return */\n  __stack_chk_fail_local();\n}" { (declaration "char *__ptr;" primitive_type (pointer_declarator "*__ptr" * identifier) ;) (declaration "int *piVar1;" primitive_type (pointer_declarator "*piVar1" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "size_t length;" primitive_type identifier ;) (declaration "int local_10;" primitive_type identifier ;) (declaration "undefined4 uStack_c;" type_identifier identifier ;) (expression_statement "uStack_c = 0x16737;" (assignment_expression "uStack_c = 0x16737" identifier = number_literal) ;) (expression_statement "local_10 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_10 = *(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 "__ptr = vasnprintf((char *)0x0,&length,format,args);" (assignment_expression "__ptr = vasnprintf((char *)0x0,&length,format,args)" identifier = (call_expression "vasnprintf((char *)0x0,&length,format,args)" identifier (argument_list "((char *)0x0,&length,format,args)" ( (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) , (pointer_expression "&length" & identifier) , identifier , identifier )))) ;) (if_statement "if (__ptr == (char *)0x0) {\n    length = 0xffffffff;\n  }\n  else if ((int)length < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    length = 0xffffffff;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *resultp = __ptr;\n  }" if (parenthesized_expression "(__ptr == (char *)0x0)" ( (binary_expression "__ptr == (char *)0x0" identifier == (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    length = 0xffffffff;\n  }" { (expression_statement "length = 0xffffffff;" (assignment_expression "length = 0xffffffff" identifier = number_literal) ;) }) (else_clause "else if ((int)length < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    length = 0xffffffff;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *resultp = __ptr;\n  }" else (if_statement "if ((int)length < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    length = 0xffffffff;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *resultp = __ptr;\n  }" if (parenthesized_expression "((int)length < 0)" ( (binary_expression "(int)length < 0" (cast_expression "(int)length" ( (type_descriptor "int" primitive_type) ) identifier) < number_literal) )) (compound_statement "{\n    free(__ptr);\n    piVar1 = __errno_location();\n    length = 0xffffffff;\n    *piVar1 = 0x4b;\n  }" { (expression_statement "free(__ptr);" (call_expression "free(__ptr)" identifier (argument_list "(__ptr)" ( identifier ))) ;) (expression_statement "piVar1 = __errno_location();" (assignment_expression "piVar1 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "length = 0xffffffff;" (assignment_expression "length = 0xffffffff" identifier = number_literal) ;) (expression_statement "*piVar1 = 0x4b;" (assignment_expression "*piVar1 = 0x4b" (pointer_expression "*piVar1" * identifier) = number_literal) ;) }) (else_clause "else {\n    *resultp = __ptr;\n  }" else (compound_statement "{\n    *resultp = __ptr;\n  }" { (expression_statement "*resultp = __ptr;" (assignment_expression "*resultp = __ptr" (pointer_expression "*resultp" * identifier) = identifier) ;) }))))) (if_statement "if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return length;\n  }" if (parenthesized_expression "(local_10 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_10 == *(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 length;\n  }" { (return_statement "return length;" return identifier ;) })) comment (expression_statement "__stack_chk_fail_local();" (call_expression "__stack_chk_fail_local()" identifier (argument_list "()" ( ))) ;) })))
(translation_unit "int FUN_00016730(undefined4 *param_1,undefined4 param_2,undefined4 param_3)\n\n{\n  void *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  int local_14;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);\n  if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }\n                    \n  FUN_000195e0();\n}\n\n" (function_definition "int FUN_00016730(undefined4 *param_1,undefined4 param_2,undefined4 param_3)\n\n{\n  void *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  int local_14;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);\n  if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }\n                    \n  FUN_000195e0();\n}" primitive_type (function_declarator "FUN_00016730(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 (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "undefined4 param_2" type_identifier identifier) , (parameter_declaration "undefined4 param_3" type_identifier identifier) ))) (compound_statement "{\n  void *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  int local_14;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);\n  if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }\n                    \n  FUN_000195e0();\n}" { (declaration "void *__ptr;" primitive_type (pointer_declarator "*__ptr" * identifier) ;) (declaration "int *piVar1;" primitive_type (pointer_declarator "*piVar1" * identifier) ;) (declaration "int in_GS_OFFSET;" primitive_type identifier ;) (declaration "int local_14;" primitive_type identifier ;) (declaration "int local_10;" primitive_type identifier ;) (declaration "undefined4 uStack_c;" type_identifier identifier ;) (expression_statement "uStack_c = 0x16737;" (assignment_expression "uStack_c = 0x16737" identifier = number_literal) ;) (expression_statement "local_10 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_10 = *(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 "__ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);" (assignment_expression "__ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3)" identifier = (cast_expression "(void *)FUN_00016aa0(0,&local_14,param_2,param_3)" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_00016aa0(0,&local_14,param_2,param_3)" identifier (argument_list "(0,&local_14,param_2,param_3)" ( number_literal , (pointer_expression "&local_14" & identifier) , identifier , identifier ))))) ;) (if_statement "if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }" if (parenthesized_expression "(__ptr == (void *)0x0)" ( (binary_expression "__ptr == (void *)0x0" identifier == (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n    local_14 = -1;\n  }" { (expression_statement "local_14 = -1;" (assignment_expression "local_14 = -1" identifier = number_literal) ;) }) (else_clause "else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }" else (if_statement "if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }" if (parenthesized_expression "(local_14 < 0)" ( (binary_expression "local_14 < 0" identifier < number_literal) )) (compound_statement "{\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }" { (expression_statement "free(__ptr);" (call_expression "free(__ptr)" identifier (argument_list "(__ptr)" ( identifier ))) ;) (expression_statement "piVar1 = __errno_location();" (assignment_expression "piVar1 = __errno_location()" identifier = (call_expression "__errno_location()" identifier (argument_list "()" ( )))) ;) (expression_statement "local_14 = -1;" (assignment_expression "local_14 = -1" identifier = number_literal) ;) (expression_statement "*piVar1 = 0x4b;" (assignment_expression "*piVar1 = 0x4b" (pointer_expression "*piVar1" * identifier) = number_literal) ;) }) (else_clause "else {\n    *param_1 = __ptr;\n  }" else (compound_statement "{\n    *param_1 = __ptr;\n  }" { (expression_statement "*param_1 = __ptr;" (assignment_expression "*param_1 = __ptr" (pointer_expression "*param_1" * identifier) = identifier) ;) }))))) (if_statement "if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }" if (parenthesized_expression "(local_10 == *(int *)(in_GS_OFFSET + 0x14))" ( (binary_expression "local_10 == *(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 local_14;\n  }" { (return_statement "return local_14;" return identifier ;) })) (expression_statement "FUN_000195e0();" (call_expression "FUN_000195e0()" identifier (argument_list "()" ( ))) ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE 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 = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( LIT , (pointer_expression & IDENT) , 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) ;) }) (else_clause else (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = LIT) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) }))))) (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 "int FUN_00016730(undefined4 *param_1,undefined4 param_2,undefined4 param_3)\n\n{\n  void *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  int local_14;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);\n  if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }\n                    \n  FUN_000195e0();\n}" (primitive_type "int") (function_declarator "FUN_00016730(undefined4 *param_1,undefined4 param_2,undefined4 param_3)" (identifier "FUN_00016730") (parameter_list "(undefined4 *param_1,undefined4 param_2,undefined4 param_3)" (( "(") (parameter_declaration "undefined4 *param_1" (type_identifier "undefined4") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "undefined4 param_2" (type_identifier "undefined4") (identifier "param_2")) (, ",") (parameter_declaration "undefined4 param_3" (type_identifier "undefined4") (identifier "param_3")) () ")"))) (compound_statement "{\n  void *__ptr;\n  int *piVar1;\n  int in_GS_OFFSET;\n  int local_14;\n  int local_10;\n  undefined4 uStack_c;\n  \n  uStack_c = 0x16737;\n  local_10 = *(int *)(in_GS_OFFSET + 0x14);\n  __ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);\n  if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }\n  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }\n                    \n  FUN_000195e0();\n}" ({ "{") (declaration "void *__ptr;" (primitive_type "void") (pointer_declarator "*__ptr" (* "*") (identifier "__ptr")) (; ";")) (declaration "int *piVar1;" (primitive_type "int") (pointer_declarator "*piVar1" (* "*") (identifier "piVar1")) (; ";")) (declaration "int in_GS_OFFSET;" (primitive_type "int") (identifier "in_GS_OFFSET") (; ";")) (declaration "int local_14;" (primitive_type "int") (identifier "local_14") (; ";")) (declaration "int local_10;" (primitive_type "int") (identifier "local_10") (; ";")) (declaration "undefined4 uStack_c;" (type_identifier "undefined4") (identifier "uStack_c") (; ";")) (expression_statement "uStack_c = 0x16737;" (assignment_expression "uStack_c = 0x16737" (identifier "uStack_c") (= "=") (number_literal "0x16737")) (; ";")) (expression_statement "local_10 = *(int *)(in_GS_OFFSET + 0x14);" (assignment_expression "local_10 = *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_10") (= "=") (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 "__ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);" (assignment_expression "__ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3)" (identifier "__ptr") (= "=") (cast_expression "(void *)FUN_00016aa0(0,&local_14,param_2,param_3)" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "FUN_00016aa0(0,&local_14,param_2,param_3)" (identifier "FUN_00016aa0") (argument_list "(0,&local_14,param_2,param_3)" (( "(") (number_literal "0") (, ",") (pointer_expression "&local_14" (& "&") (identifier "local_14")) (, ",") (identifier "param_2") (, ",") (identifier "param_3") () ")"))))) (; ";")) (if_statement "if (__ptr == (void *)0x0) {\n    local_14 = -1;\n  }\n  else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }" (if "if") (parenthesized_expression "(__ptr == (void *)0x0)" (( "(") (binary_expression "__ptr == (void *)0x0" (identifier "__ptr") (== "==") (cast_expression "(void *)0x0" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n    local_14 = -1;\n  }" ({ "{") (expression_statement "local_14 = -1;" (assignment_expression "local_14 = -1" (identifier "local_14") (= "=") (number_literal "-1")) (; ";")) (} "}")) (else_clause "else if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }" (else "else") (if_statement "if (local_14 < 0) {\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }\n  else {\n    *param_1 = __ptr;\n  }" (if "if") (parenthesized_expression "(local_14 < 0)" (( "(") (binary_expression "local_14 < 0" (identifier "local_14") (< "<") (number_literal "0")) () ")")) (compound_statement "{\n    free(__ptr);\n    piVar1 = __errno_location();\n    local_14 = -1;\n    *piVar1 = 0x4b;\n  }" ({ "{") (expression_statement "free(__ptr);" (call_expression "free(__ptr)" (identifier "free") (argument_list "(__ptr)" (( "(") (identifier "__ptr") () ")"))) (; ";")) (expression_statement "piVar1 = __errno_location();" (assignment_expression "piVar1 = __errno_location()" (identifier "piVar1") (= "=") (call_expression "__errno_location()" (identifier "__errno_location") (argument_list "()" (( "(") () ")")))) (; ";")) (expression_statement "local_14 = -1;" (assignment_expression "local_14 = -1" (identifier "local_14") (= "=") (number_literal "-1")) (; ";")) (expression_statement "*piVar1 = 0x4b;" (assignment_expression "*piVar1 = 0x4b" (pointer_expression "*piVar1" (* "*") (identifier "piVar1")) (= "=") (number_literal "0x4b")) (; ";")) (} "}")) (else_clause "else {\n    *param_1 = __ptr;\n  }" (else "else") (compound_statement "{\n    *param_1 = __ptr;\n  }" ({ "{") (expression_statement "*param_1 = __ptr;" (assignment_expression "*param_1 = __ptr" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (= "=") (identifier "__ptr")) (; ";")) (} "}")))))) (if_statement "if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {\n    return local_14;\n  }" (if "if") (parenthesized_expression "(local_10 == *(int *)(in_GS_OFFSET + 0x14))" (( "(") (binary_expression "local_10 == *(int *)(in_GS_OFFSET + 0x14)" (identifier "local_10") (== "==") (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 local_14;\n  }" ({ "{") (return_statement "return local_14;" (return "return") (identifier "local_14") (; ";")) (} "}"))) (expression_statement "FUN_000195e0();" (call_expression "FUN_000195e0()" (identifier "FUN_000195e0") (argument_list "()" (( "(") () ")"))) (; ";")) (} "}")))

/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* WARNING: Unknown calling convention */

int function_1(char **resultp,char *format,type_1 args)

{
  char *var_3;
  int *piVar1;
  int var_1;
  size_t length;
  int var_6;
  type_2 uStack_c;
  
  uStack_c = 0x16737;
  var_6 = *(int *)(var_1 + 0x14);
  var_3 = var_2((char *)0x0,&length,format,args);
  if (var_3 == (char *)0x0) {
    length = 0xffffffff;
  }
  else if ((int)length < 0) {
    var_4(var_3);
    piVar1 = var_5();
    length = 0xffffffff;
    *piVar1 = 0x4b;
  }
  else {
    *resultp = var_3;
  }
  if (var_6 == *(int *)(var_1 + 0x14)) {
    return length;
  }
                    /* WARNING: Subroutine does not return */
  var_7();
}


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

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

{
  void *__ptr;
  int *piVar1;
  int in_GS_OFFSET;
  int local_14;
  int local_10;
  undefined4 uStack_c;
  
  uStack_c = 0x16737;
  local_10 = *(int *)(in_GS_OFFSET + 0x14);
  __ptr = (void *)FUN_00016aa0(0,&local_14,param_2,param_3);
  if (__ptr == (void *)0x0) {
    local_14 = -1;
  }
  else if (local_14 < 0) {
    free(__ptr);
    piVar1 = __errno_location();
    local_14 = -1;
    *piVar1 = 0x4b;
  }
  else {
    *param_1 = __ptr;
  }
  if (local_10 == *(int *)(in_GS_OFFSET + 0x14)) {
    return local_14;
  }
                    /* WARNING: Subroutine does not return */
  FUN_000195e0();
}

