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

void __regparm3 sb_check(sb *ptr,size_t len)

{
  int iVar1;
  char *pcVar2;
  uint uVar3;
  
  uVar3 = len + ptr->len;
  if (ptr->max < uVar3) {
    uVar3 = uVar3 + 9;
    if ((int)uVar3 < 0) {
                    /* WARNING: Subroutine does not return */
      as_fatal("string buffer overflow");
    }
    iVar1 = 0x1f;
    if (uVar3 != 0) {
      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {
      }
    }
    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);
    ptr->max = iVar1 - 9;
    pcVar2 = (char *)xrealloc(ptr->ptr,iVar1 + -8);
    ptr->ptr = pcVar2;
  }
  return;
}



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

void __regparm3 FUN_000356e0(undefined4 *param_1,int param_2)

{
  int iVar1;
  undefined4 uVar2;
  uint uVar3;
  
  if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {
    uVar3 = param_2 + param_1[1] + 9;
    if ((int)uVar3 < 0) {
                    /* WARNING: Subroutine does not return */
      FUN_0002be00("string buffer overflow");
    }
    iVar1 = 0x1f;
    if (uVar3 != 0) {
      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {
      }
    }
    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);
    param_1[2] = iVar1 + -9;
    uVar2 = xrealloc(*param_1,iVar1 + -8);
    *param_1 = uVar2;
  }
  return;
}


PUSH ESI
PUSH EBX
CALL 0x00016000
ADD EBX,0x4a919
SUB ESP,0x4
ADD EDX,dword ptr [EAX + 0x4]
CMP dword ptr [EAX + 0x8],EDX
JNC 0x0003572c
MOV ESI,EAX
ADD EDX,0x9
JS 0x00035732
BSR EDX,EDX
MOV ECX,0x20
MOV EAX,0x1
SUB ESP,0x8
XOR EDX,0x1f
SUB ECX,EDX
SHL EAX,CL
LEA EDX,[EAX + -0x9]
SUB EAX,0x8
MOV dword ptr [ESI + 0x8],EDX
PUSH EAX
PUSH dword ptr [ESI]
CALL 0x00014210
ADD ESP,0x10
MOV dword ptr [ESI],EAX
ADD ESP,0x4
POP EBX
POP ESI
RET
SUB ESP,0xc
LEA EAX,[EBX + 0xfffe0d2c]
PUSH EAX
CALL 0x0002be00
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nvoid __regparm3 FUN_000356e0(undefined4 *param_1,int param_2)\n\n{\n  int iVar1;\n  undefined4 uVar2;\n  uint uVar3;\n  \n  if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }\n  return;\n}\n\n" comment (function_definition "void __regparm3 FUN_000356e0(undefined4 *param_1,int param_2)\n\n{\n  int iVar1;\n  undefined4 uVar2;\n  uint uVar3;\n  \n  if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }\n  return;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "FUN_000356e0(undefined4 *param_1,int param_2)" identifier (parameter_list "(undefined4 *param_1,int param_2)" ( (parameter_declaration "undefined4 *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "int param_2" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  undefined4 uVar2;\n  uint uVar3;\n  \n  if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }\n  return;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "undefined4 uVar2;" type_identifier identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (if_statement "if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }" if (parenthesized_expression "((uint)param_1[2] < (uint)(param_2 + param_1[1]))" ( (binary_expression "(uint)param_1[2] < (uint)(param_2 + param_1[1])" (cast_expression "(uint)param_1[2]" ( (type_descriptor "uint" type_identifier) ) (subscript_expression "param_1[2]" identifier [ number_literal ])) < (call_expression "(uint)(param_2 + param_1[1])" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(param_2 + param_1[1])" ( (binary_expression "param_2 + param_1[1]" identifier + (subscript_expression "param_1[1]" identifier [ number_literal ])) )))) )) (compound_statement "{\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }" { (expression_statement "uVar3 = param_2 + param_1[1] + 9;" (assignment_expression "uVar3 = param_2 + param_1[1] + 9" identifier = (binary_expression "param_2 + param_1[1] + 9" (binary_expression "param_2 + param_1[1]" identifier + (subscript_expression "param_1[1]" identifier [ number_literal ])) + number_literal)) ;) (if_statement "if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      FUN_0002be00("string buffer overflow");\n    }" if (parenthesized_expression "((int)uVar3 < 0)" ( (binary_expression "(int)uVar3 < 0" (cast_expression "(int)uVar3" ( (type_descriptor "int" primitive_type) ) identifier) < number_literal) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n      FUN_0002be00("string buffer overflow");\n    }" { comment (expression_statement "FUN_0002be00("string buffer overflow");" (call_expression "FUN_0002be00("string buffer overflow")" identifier (argument_list "("string buffer overflow")" ( (string_literal ""string buffer overflow"" " string_content ") ))) ;) })) (expression_statement "iVar1 = 0x1f;" (assignment_expression "iVar1 = 0x1f" identifier = number_literal) ;) (if_statement "if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }" if (parenthesized_expression "(uVar3 != 0)" ( (binary_expression "uVar3 != 0" identifier != number_literal) )) (compound_statement "{\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }" { (for_statement "for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }" for ( ; (binary_expression "uVar3 >> iVar1 == 0" (binary_expression "uVar3 >> iVar1" identifier >> identifier) == number_literal) ; (assignment_expression "iVar1 = iVar1 + -1" identifier = (binary_expression "iVar1 + -1" identifier + number_literal)) ) (compound_statement "{\n      }" { })) })) (expression_statement "iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);" (assignment_expression "iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" identifier = (binary_expression "1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" number_literal << (parenthesized_expression "(0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" ( (binary_expression "0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f" (binary_expression "0x20 - ((byte)iVar1 ^ 0x1f)" number_literal - (parenthesized_expression "((byte)iVar1 ^ 0x1f)" ( (binary_expression "(byte)iVar1 ^ 0x1f" (cast_expression "(byte)iVar1" ( (type_descriptor "byte" type_identifier) ) identifier) ^ number_literal) ))) & number_literal) )))) ;) (expression_statement "param_1[2] = iVar1 + -9;" (assignment_expression "param_1[2] = iVar1 + -9" (subscript_expression "param_1[2]" identifier [ number_literal ]) = (binary_expression "iVar1 + -9" identifier + number_literal)) ;) (expression_statement "uVar2 = xrealloc(*param_1,iVar1 + -8);" (assignment_expression "uVar2 = xrealloc(*param_1,iVar1 + -8)" identifier = (call_expression "xrealloc(*param_1,iVar1 + -8)" identifier (argument_list "(*param_1,iVar1 + -8)" ( (pointer_expression "*param_1" * identifier) , (binary_expression "iVar1 + -8" identifier + number_literal) )))) ;) (expression_statement "*param_1 = uVar2;" (assignment_expression "*param_1 = uVar2" (pointer_expression "*param_1" * identifier) = identifier) ;) })) (return_statement "return;" return ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nvoid __regparm3 sb_check(sb *ptr,size_t len)\n\n{\n  int iVar1;\n  char *pcVar2;\n  uint uVar3;\n  \n  uVar3 = len + ptr->len;\n  if (ptr->max < uVar3) {\n    uVar3 = uVar3 + 9;\n    if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      as_fatal("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    ptr->max = iVar1 - 9;\n    pcVar2 = (char *)xrealloc(ptr->ptr,iVar1 + -8);\n    ptr->ptr = pcVar2;\n  }\n  return;\n}\n\n" comment (function_definition "void __regparm3 sb_check(sb *ptr,size_t len)\n\n{\n  int iVar1;\n  char *pcVar2;\n  uint uVar3;\n  \n  uVar3 = len + ptr->len;\n  if (ptr->max < uVar3) {\n    uVar3 = uVar3 + 9;\n    if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      as_fatal("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    ptr->max = iVar1 - 9;\n    pcVar2 = (char *)xrealloc(ptr->ptr,iVar1 + -8);\n    ptr->ptr = pcVar2;\n  }\n  return;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "sb_check(sb *ptr,size_t len)" identifier (parameter_list "(sb *ptr,size_t len)" ( (parameter_declaration "sb *ptr" type_identifier (pointer_declarator "*ptr" * identifier)) , (parameter_declaration "size_t len" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  char *pcVar2;\n  uint uVar3;\n  \n  uVar3 = len + ptr->len;\n  if (ptr->max < uVar3) {\n    uVar3 = uVar3 + 9;\n    if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      as_fatal("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    ptr->max = iVar1 - 9;\n    pcVar2 = (char *)xrealloc(ptr->ptr,iVar1 + -8);\n    ptr->ptr = pcVar2;\n  }\n  return;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "char *pcVar2;" primitive_type (pointer_declarator "*pcVar2" * identifier) ;) (declaration "uint uVar3;" type_identifier identifier ;) (expression_statement "uVar3 = len + ptr->len;" (assignment_expression "uVar3 = len + ptr->len" identifier = (binary_expression "len + ptr->len" identifier + (field_expression "ptr->len" identifier -> field_identifier))) ;) (if_statement "if (ptr->max < uVar3) {\n    uVar3 = uVar3 + 9;\n    if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      as_fatal("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    ptr->max = iVar1 - 9;\n    pcVar2 = (char *)xrealloc(ptr->ptr,iVar1 + -8);\n    ptr->ptr = pcVar2;\n  }" if (parenthesized_expression "(ptr->max < uVar3)" ( (binary_expression "ptr->max < uVar3" (field_expression "ptr->max" identifier -> field_identifier) < identifier) )) (compound_statement "{\n    uVar3 = uVar3 + 9;\n    if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      as_fatal("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    ptr->max = iVar1 - 9;\n    pcVar2 = (char *)xrealloc(ptr->ptr,iVar1 + -8);\n    ptr->ptr = pcVar2;\n  }" { (expression_statement "uVar3 = uVar3 + 9;" (assignment_expression "uVar3 = uVar3 + 9" identifier = (binary_expression "uVar3 + 9" identifier + number_literal)) ;) (if_statement "if ((int)uVar3 < 0) {\n                    /* WARNING: Subroutine does not return */\n      as_fatal("string buffer overflow");\n    }" if (parenthesized_expression "((int)uVar3 < 0)" ( (binary_expression "(int)uVar3 < 0" (cast_expression "(int)uVar3" ( (type_descriptor "int" primitive_type) ) identifier) < number_literal) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n      as_fatal("string buffer overflow");\n    }" { comment (expression_statement "as_fatal("string buffer overflow");" (call_expression "as_fatal("string buffer overflow")" identifier (argument_list "("string buffer overflow")" ( (string_literal ""string buffer overflow"" " string_content ") ))) ;) })) (expression_statement "iVar1 = 0x1f;" (assignment_expression "iVar1 = 0x1f" identifier = number_literal) ;) (if_statement "if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }" if (parenthesized_expression "(uVar3 != 0)" ( (binary_expression "uVar3 != 0" identifier != number_literal) )) (compound_statement "{\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }" { (for_statement "for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }" for ( ; (binary_expression "uVar3 >> iVar1 == 0" (binary_expression "uVar3 >> iVar1" identifier >> identifier) == number_literal) ; (assignment_expression "iVar1 = iVar1 + -1" identifier = (binary_expression "iVar1 + -1" identifier + number_literal)) ) (compound_statement "{\n      }" { })) })) (expression_statement "iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);" (assignment_expression "iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" identifier = (binary_expression "1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" number_literal << (parenthesized_expression "(0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" ( (binary_expression "0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f" (binary_expression "0x20 - ((byte)iVar1 ^ 0x1f)" number_literal - (parenthesized_expression "((byte)iVar1 ^ 0x1f)" ( (binary_expression "(byte)iVar1 ^ 0x1f" (cast_expression "(byte)iVar1" ( (type_descriptor "byte" type_identifier) ) identifier) ^ number_literal) ))) & number_literal) )))) ;) (expression_statement "ptr->max = iVar1 - 9;" (assignment_expression "ptr->max = iVar1 - 9" (field_expression "ptr->max" identifier -> field_identifier) = (binary_expression "iVar1 - 9" identifier - number_literal)) ;) (expression_statement "pcVar2 = (char *)xrealloc(ptr->ptr,iVar1 + -8);" (assignment_expression "pcVar2 = (char *)xrealloc(ptr->ptr,iVar1 + -8)" identifier = (cast_expression "(char *)xrealloc(ptr->ptr,iVar1 + -8)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "xrealloc(ptr->ptr,iVar1 + -8)" identifier (argument_list "(ptr->ptr,iVar1 + -8)" ( (field_expression "ptr->ptr" identifier -> field_identifier) , (binary_expression "iVar1 + -8" identifier + number_literal) ))))) ;) (expression_statement "ptr->ptr = pcVar2;" (assignment_expression "ptr->ptr = pcVar2" (field_expression "ptr->ptr" identifier -> field_identifier) = identifier) ;) })) (return_statement "return;" return ;) })))
(translation_unit "void __regparm3 FUN_000356e0(undefined4 *param_1,int param_2)\n\n{\n  int iVar1;\n  undefined4 uVar2;\n  uint uVar3;\n  \n  if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }\n  return;\n}\n\n" (function_definition "void __regparm3 FUN_000356e0(undefined4 *param_1,int param_2)\n\n{\n  int iVar1;\n  undefined4 uVar2;\n  uint uVar3;\n  \n  if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }\n  return;\n}" primitive_type (ERROR "__regparm3" identifier) (function_declarator "FUN_000356e0(undefined4 *param_1,int param_2)" identifier (parameter_list "(undefined4 *param_1,int param_2)" ( (parameter_declaration "undefined4 *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "int param_2" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  undefined4 uVar2;\n  uint uVar3;\n  \n  if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }\n  return;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "undefined4 uVar2;" type_identifier identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (if_statement "if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }" if (parenthesized_expression "((uint)param_1[2] < (uint)(param_2 + param_1[1]))" ( (binary_expression "(uint)param_1[2] < (uint)(param_2 + param_1[1])" (cast_expression "(uint)param_1[2]" ( (type_descriptor "uint" type_identifier) ) (subscript_expression "param_1[2]" identifier [ number_literal ])) < (call_expression "(uint)(param_2 + param_1[1])" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(param_2 + param_1[1])" ( (binary_expression "param_2 + param_1[1]" identifier + (subscript_expression "param_1[1]" identifier [ number_literal ])) )))) )) (compound_statement "{\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }" { (expression_statement "uVar3 = param_2 + param_1[1] + 9;" (assignment_expression "uVar3 = param_2 + param_1[1] + 9" identifier = (binary_expression "param_2 + param_1[1] + 9" (binary_expression "param_2 + param_1[1]" identifier + (subscript_expression "param_1[1]" identifier [ number_literal ])) + number_literal)) ;) (if_statement "if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }" if (parenthesized_expression "((int)uVar3 < 0)" ( (binary_expression "(int)uVar3 < 0" (cast_expression "(int)uVar3" ( (type_descriptor "int" primitive_type) ) identifier) < number_literal) )) (compound_statement "{\n                    \n      FUN_0002be00("string buffer overflow");\n    }" { (expression_statement "FUN_0002be00("string buffer overflow");" (call_expression "FUN_0002be00("string buffer overflow")" identifier (argument_list "("string buffer overflow")" ( (string_literal ""string buffer overflow"" " string_content ") ))) ;) })) (expression_statement "iVar1 = 0x1f;" (assignment_expression "iVar1 = 0x1f" identifier = number_literal) ;) (if_statement "if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }" if (parenthesized_expression "(uVar3 != 0)" ( (binary_expression "uVar3 != 0" identifier != number_literal) )) (compound_statement "{\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }" { (for_statement "for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }" for ( ; (binary_expression "uVar3 >> iVar1 == 0" (binary_expression "uVar3 >> iVar1" identifier >> identifier) == number_literal) ; (assignment_expression "iVar1 = iVar1 + -1" identifier = (binary_expression "iVar1 + -1" identifier + number_literal)) ) (compound_statement "{\n      }" { })) })) (expression_statement "iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);" (assignment_expression "iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" identifier = (binary_expression "1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" number_literal << (parenthesized_expression "(0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" ( (binary_expression "0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f" (binary_expression "0x20 - ((byte)iVar1 ^ 0x1f)" number_literal - (parenthesized_expression "((byte)iVar1 ^ 0x1f)" ( (binary_expression "(byte)iVar1 ^ 0x1f" (cast_expression "(byte)iVar1" ( (type_descriptor "byte" type_identifier) ) identifier) ^ number_literal) ))) & number_literal) )))) ;) (expression_statement "param_1[2] = iVar1 + -9;" (assignment_expression "param_1[2] = iVar1 + -9" (subscript_expression "param_1[2]" identifier [ number_literal ]) = (binary_expression "iVar1 + -9" identifier + number_literal)) ;) (expression_statement "uVar2 = xrealloc(*param_1,iVar1 + -8);" (assignment_expression "uVar2 = xrealloc(*param_1,iVar1 + -8)" identifier = (call_expression "xrealloc(*param_1,iVar1 + -8)" identifier (argument_list "(*param_1,iVar1 + -8)" ( (pointer_expression "*param_1" * identifier) , (binary_expression "iVar1 + -8" identifier + number_literal) )))) ;) (expression_statement "*param_1 = uVar2;" (assignment_expression "*param_1 = uVar2" (pointer_expression "*param_1" * identifier) = identifier) ;) })) (return_statement "return;" return ;) })))
(translation_unit (function_definition TYPE (ERROR IDENT) (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (if_statement if (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) (subscript_expression IDENT [ LIT ])) < (call_expression (parenthesized_expression ( IDENT )) (argument_list ( (binary_expression IDENT + (subscript_expression IDENT [ LIT ])) )))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT + (subscript_expression IDENT [ LIT ])) + LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) < LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (string_literal " string_content ") ))) ;) })) (expression_statement (assignment_expression IDENT = LIT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (for_statement for ( ; (binary_expression (binary_expression IDENT >> IDENT) == LIT) ; (assignment_expression IDENT = (binary_expression IDENT + LIT)) ) (compound_statement { })) })) (expression_statement (assignment_expression IDENT = (binary_expression LIT << (parenthesized_expression ( (binary_expression (binary_expression LIT - (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) IDENT) ^ LIT) ))) & LIT) )))) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (pointer_expression * IDENT) , (binary_expression IDENT + LIT) )))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) })) (return_statement return ;) })))
(function_definition "void __regparm3 FUN_000356e0(undefined4 *param_1,int param_2)\n\n{\n  int iVar1;\n  undefined4 uVar2;\n  uint uVar3;\n  \n  if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }\n  return;\n}" (primitive_type "void") (ERROR "__regparm3" (identifier "__regparm3")) (function_declarator "FUN_000356e0(undefined4 *param_1,int param_2)" (identifier "FUN_000356e0") (parameter_list "(undefined4 *param_1,int param_2)" (( "(") (parameter_declaration "undefined4 *param_1" (type_identifier "undefined4") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "int param_2" (primitive_type "int") (identifier "param_2")) () ")"))) (compound_statement "{\n  int iVar1;\n  undefined4 uVar2;\n  uint uVar3;\n  \n  if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }\n  return;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "undefined4 uVar2;" (type_identifier "undefined4") (identifier "uVar2") (; ";")) (declaration "uint uVar3;" (type_identifier "uint") (identifier "uVar3") (; ";")) (if_statement "if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }" (if "if") (parenthesized_expression "((uint)param_1[2] < (uint)(param_2 + param_1[1]))" (( "(") (binary_expression "(uint)param_1[2] < (uint)(param_2 + param_1[1])" (cast_expression "(uint)param_1[2]" (( "(") (type_descriptor "uint" (type_identifier "uint")) () ")") (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]"))) (< "<") (call_expression "(uint)(param_2 + param_1[1])" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (argument_list "(param_2 + param_1[1])" (( "(") (binary_expression "param_2 + param_1[1]" (identifier "param_2") (+ "+") (subscript_expression "param_1[1]" (identifier "param_1") ([ "[") (number_literal "1") (] "]"))) () ")")))) () ")")) (compound_statement "{\n    uVar3 = param_2 + param_1[1] + 9;\n    if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }\n    iVar1 = 0x1f;\n    if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }\n    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);\n    param_1[2] = iVar1 + -9;\n    uVar2 = xrealloc(*param_1,iVar1 + -8);\n    *param_1 = uVar2;\n  }" ({ "{") (expression_statement "uVar3 = param_2 + param_1[1] + 9;" (assignment_expression "uVar3 = param_2 + param_1[1] + 9" (identifier "uVar3") (= "=") (binary_expression "param_2 + param_1[1] + 9" (binary_expression "param_2 + param_1[1]" (identifier "param_2") (+ "+") (subscript_expression "param_1[1]" (identifier "param_1") ([ "[") (number_literal "1") (] "]"))) (+ "+") (number_literal "9"))) (; ";")) (if_statement "if ((int)uVar3 < 0) {\n                    \n      FUN_0002be00("string buffer overflow");\n    }" (if "if") (parenthesized_expression "((int)uVar3 < 0)" (( "(") (binary_expression "(int)uVar3 < 0" (cast_expression "(int)uVar3" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (identifier "uVar3")) (< "<") (number_literal "0")) () ")")) (compound_statement "{\n                    \n      FUN_0002be00("string buffer overflow");\n    }" ({ "{") (expression_statement "FUN_0002be00("string buffer overflow");" (call_expression "FUN_0002be00("string buffer overflow")" (identifier "FUN_0002be00") (argument_list "("string buffer overflow")" (( "(") (string_literal ""string buffer overflow"" (" """) (string_content "string buffer overflow") (" """)) () ")"))) (; ";")) (} "}"))) (expression_statement "iVar1 = 0x1f;" (assignment_expression "iVar1 = 0x1f" (identifier "iVar1") (= "=") (number_literal "0x1f")) (; ";")) (if_statement "if (uVar3 != 0) {\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }" (if "if") (parenthesized_expression "(uVar3 != 0)" (( "(") (binary_expression "uVar3 != 0" (identifier "uVar3") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }\n    }" ({ "{") (for_statement "for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {\n      }" (for "for") (( "(") (; ";") (binary_expression "uVar3 >> iVar1 == 0" (binary_expression "uVar3 >> iVar1" (identifier "uVar3") (>> ">>") (identifier "iVar1")) (== "==") (number_literal "0")) (; ";") (assignment_expression "iVar1 = iVar1 + -1" (identifier "iVar1") (= "=") (binary_expression "iVar1 + -1" (identifier "iVar1") (+ "+") (number_literal "-1"))) () ")") (compound_statement "{\n      }" ({ "{") (} "}"))) (} "}"))) (expression_statement "iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);" (assignment_expression "iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" (identifier "iVar1") (= "=") (binary_expression "1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" (number_literal "1") (<< "<<") (parenthesized_expression "(0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f)" (( "(") (binary_expression "0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f" (binary_expression "0x20 - ((byte)iVar1 ^ 0x1f)" (number_literal "0x20") (- "-") (parenthesized_expression "((byte)iVar1 ^ 0x1f)" (( "(") (binary_expression "(byte)iVar1 ^ 0x1f" (cast_expression "(byte)iVar1" (( "(") (type_descriptor "byte" (type_identifier "byte")) () ")") (identifier "iVar1")) (^ "^") (number_literal "0x1f")) () ")"))) (& "&") (number_literal "0x1f")) () ")")))) (; ";")) (expression_statement "param_1[2] = iVar1 + -9;" (assignment_expression "param_1[2] = iVar1 + -9" (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]")) (= "=") (binary_expression "iVar1 + -9" (identifier "iVar1") (+ "+") (number_literal "-9"))) (; ";")) (expression_statement "uVar2 = xrealloc(*param_1,iVar1 + -8);" (assignment_expression "uVar2 = xrealloc(*param_1,iVar1 + -8)" (identifier "uVar2") (= "=") (call_expression "xrealloc(*param_1,iVar1 + -8)" (identifier "xrealloc") (argument_list "(*param_1,iVar1 + -8)" (( "(") (pointer_expression "*param_1" (* "*") (identifier "param_1")) (, ",") (binary_expression "iVar1 + -8" (identifier "iVar1") (+ "+") (number_literal "-8")) () ")")))) (; ";")) (expression_statement "*param_1 = uVar2;" (assignment_expression "*param_1 = uVar2" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (= "=") (identifier "uVar2")) (; ";")) (} "}"))) (return_statement "return;" (return "return") (; ";")) (} "}")))

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

void __regparm3 function_1(type_1 *ptr,size_t var_1)

{
  int var_4;
  char *pcVar2;
  type_2 var_2;
  
  var_2 = var_1 + ptr->var_1;
  if (ptr->max < var_2) {
    var_2 = var_2 + 9;
    if ((int)var_2 < 0) {
                    /* WARNING: Subroutine does not return */
      var_3("string buffer overflow");
    }
    var_4 = 0x1f;
    if (var_2 != 0) {
      for (; var_2 >> var_4 == 0; var_4 = var_4 + -1) {
      }
    }
    var_4 = 1 << (0x20 - ((type_3)var_4 ^ 0x1f) & 0x1f);
    ptr->max = var_4 - 9;
    pcVar2 = (char *)var_5(ptr->ptr,var_4 + -8);
    ptr->ptr = pcVar2;
  }
  return;
}


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

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

void __regparm3 MASKED(undefined4 *param_1,int param_2)

{
  int iVar1;
  undefined4 uVar2;
  uint uVar3;
  
  if ((uint)param_1[2] < (uint)(param_2 + param_1[1])) {
    uVar3 = param_2 + param_1[1] + 9;
    if ((int)uVar3 < 0) {
                    /* WARNING: Subroutine does not return */
      FUN_0002be00("string buffer overflow");
    }
    iVar1 = 0x1f;
    if (uVar3 != 0) {
      for (; uVar3 >> iVar1 == 0; iVar1 = iVar1 + -1) {
      }
    }
    iVar1 = 1 << (0x20 - ((byte)iVar1 ^ 0x1f) & 0x1f);
    param_1[2] = iVar1 + -9;
    uVar2 = xrealloc(*param_1,iVar1 + -8);
    *param_1 = uVar2;
  }
  return;
}

