
void sb_check(sb *ptr,size_t len)

{
  char *pcVar1;
  ulong uVar2;
  long lVar3;
  
  uVar2 = len + ptr->len;
  if (uVar2 <= ptr->max) {
    return;
  }
  uVar2 = uVar2 + 0x11;
  if (-1 < (long)uVar2) {
    lVar3 = 0x3f;
    if (uVar2 != 0) {
      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {
      }
    }
    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);
    ptr->max = lVar3 - 0x11;
    pcVar1 = (char *)xrealloc(ptr->ptr,lVar3 + -0x10);
    ptr->ptr = pcVar1;
    return;
  }
                    /* WARNING: Subroutine does not return */
  as_fatal("string buffer overflow");
}



void FUN_00124d50(undefined8 *param_1,long param_2)

{
  undefined8 uVar1;
  ulong uVar2;
  long lVar3;
  
  if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {
    return;
  }
  uVar2 = param_2 + param_1[1] + 0x11;
  if (-1 < (long)uVar2) {
    lVar3 = 0x3f;
    if (uVar2 != 0) {
      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {
      }
    }
    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);
    param_1[2] = lVar3 + -0x11;
    uVar1 = xrealloc(*param_1,lVar3 + -0x10);
    *param_1 = uVar1;
    return;
  }
                    /* WARNING: Subroutine does not return */
  FUN_0011c770("string buffer overflow");
}


ADD RSI,qword ptr [RDI + 0x8]
CMP qword ptr [RDI + 0x10],RSI
JNC 0x00124d98
PUSH RBX
MOV RBX,RDI
ADD RSI,0x11
JS 0x00124d99
BSR RSI,RSI
MOV ECX,0x40
XOR RSI,0x3f
SUB ECX,ESI
MOV ESI,0x1
SHL RSI,CL
LEA RAX,[RSI + -0x11]
SUB RSI,0x10
MOV qword ptr [RDI + 0x10],RAX
MOV RDI,qword ptr [RDI]
CALL 0x00107250
MOV qword ptr [RBX],RAX
POP RBX
RET
RET
LEA RDI,[0x13edec]
XOR EAX,EAX
CALL 0x0011c770
(translation_unit "void FUN_00124d50(undefined8 *param_1,long param_2)\n\n{\n  undefined8 uVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }\n  uVar2 = param_2 + param_1[1] + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_0011c770("string buffer overflow");\n}\n\n" (function_definition "void FUN_00124d50(undefined8 *param_1,long param_2)\n\n{\n  undefined8 uVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }\n  uVar2 = param_2 + param_1[1] + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_0011c770("string buffer overflow");\n}" primitive_type (function_declarator "FUN_00124d50(undefined8 *param_1,long param_2)" identifier (parameter_list "(undefined8 *param_1,long param_2)" ( (parameter_declaration "undefined8 *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "long param_2" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  undefined8 uVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }\n  uVar2 = param_2 + param_1[1] + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_0011c770("string buffer overflow");\n}" { (declaration "undefined8 uVar1;" type_identifier identifier ;) (declaration "ulong uVar2;" type_identifier identifier ;) (declaration "long lVar3;" (sized_type_specifier "long" long) identifier ;) (if_statement "if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }" if (parenthesized_expression "((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2])" ( (binary_expression "(ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]" (call_expression "(ulong)(param_2 + param_1[1])" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(param_2 + param_1[1])" ( (binary_expression "param_2 + param_1[1]" identifier + (subscript_expression "param_1[1]" identifier [ number_literal ])) ))) <= (cast_expression "(ulong)param_1[2]" ( (type_descriptor "ulong" type_identifier) ) (subscript_expression "param_1[2]" identifier [ number_literal ]))) )) (compound_statement "{\n    return;\n  }" { (return_statement "return;" return ;) })) (expression_statement "uVar2 = param_2 + param_1[1] + 0x11;" (assignment_expression "uVar2 = param_2 + param_1[1] + 0x11" identifier = (binary_expression "param_2 + param_1[1] + 0x11" (binary_expression "param_2 + param_1[1]" identifier + (subscript_expression "param_1[1]" identifier [ number_literal ])) + number_literal)) ;) (if_statement "if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }" if (parenthesized_expression "(-1 < (long)uVar2)" ( (binary_expression "-1 < (long)uVar2" number_literal < (cast_expression "(long)uVar2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )) (compound_statement "{\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }" { (expression_statement "lVar3 = 0x3f;" (assignment_expression "lVar3 = 0x3f" identifier = number_literal) ;) (if_statement "if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }" if (parenthesized_expression "(uVar2 != 0)" ( (binary_expression "uVar2 != 0" identifier != number_literal) )) (compound_statement "{\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }" { (for_statement "for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }" for ( ; (binary_expression "uVar2 >> lVar3 == 0" (binary_expression "uVar2 >> lVar3" identifier >> identifier) == number_literal) ; (assignment_expression "lVar3 = lVar3 + -1" identifier = (binary_expression "lVar3 + -1" identifier + number_literal)) ) (compound_statement "{\n      }" { })) })) (expression_statement "lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);" (assignment_expression "lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" identifier = (binary_expression "1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" number_literal << (parenthesized_expression "(0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" ( (binary_expression "0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f" (binary_expression "0x40 - ((byte)lVar3 ^ 0x3f)" number_literal - (parenthesized_expression "((byte)lVar3 ^ 0x3f)" ( (binary_expression "(byte)lVar3 ^ 0x3f" (cast_expression "(byte)lVar3" ( (type_descriptor "byte" type_identifier) ) identifier) ^ number_literal) ))) & number_literal) )))) ;) (expression_statement "param_1[2] = lVar3 + -0x11;" (assignment_expression "param_1[2] = lVar3 + -0x11" (subscript_expression "param_1[2]" identifier [ number_literal ]) = (binary_expression "lVar3 + -0x11" identifier + number_literal)) ;) (expression_statement "uVar1 = xrealloc(*param_1,lVar3 + -0x10);" (assignment_expression "uVar1 = xrealloc(*param_1,lVar3 + -0x10)" identifier = (call_expression "xrealloc(*param_1,lVar3 + -0x10)" identifier (argument_list "(*param_1,lVar3 + -0x10)" ( (pointer_expression "*param_1" * identifier) , (binary_expression "lVar3 + -0x10" identifier + number_literal) )))) ;) (expression_statement "*param_1 = uVar1;" (assignment_expression "*param_1 = uVar1" (pointer_expression "*param_1" * identifier) = identifier) ;) (return_statement "return;" return ;) })) comment (expression_statement "FUN_0011c770("string buffer overflow");" (call_expression "FUN_0011c770("string buffer overflow")" identifier (argument_list "("string buffer overflow")" ( (string_literal ""string buffer overflow"" " string_content ") ))) ;) })))
(translation_unit "void sb_check(sb *ptr,size_t len)\n\n{\n  char *pcVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  uVar2 = len + ptr->len;\n  if (uVar2 <= ptr->max) {\n    return;\n  }\n  uVar2 = uVar2 + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    ptr->max = lVar3 - 0x11;\n    pcVar1 = (char *)xrealloc(ptr->ptr,lVar3 + -0x10);\n    ptr->ptr = pcVar1;\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  as_fatal("string buffer overflow");\n}\n\n" (function_definition "void sb_check(sb *ptr,size_t len)\n\n{\n  char *pcVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  uVar2 = len + ptr->len;\n  if (uVar2 <= ptr->max) {\n    return;\n  }\n  uVar2 = uVar2 + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    ptr->max = lVar3 - 0x11;\n    pcVar1 = (char *)xrealloc(ptr->ptr,lVar3 + -0x10);\n    ptr->ptr = pcVar1;\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  as_fatal("string buffer overflow");\n}" primitive_type (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  char *pcVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  uVar2 = len + ptr->len;\n  if (uVar2 <= ptr->max) {\n    return;\n  }\n  uVar2 = uVar2 + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    ptr->max = lVar3 - 0x11;\n    pcVar1 = (char *)xrealloc(ptr->ptr,lVar3 + -0x10);\n    ptr->ptr = pcVar1;\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  as_fatal("string buffer overflow");\n}" { (declaration "char *pcVar1;" primitive_type (pointer_declarator "*pcVar1" * identifier) ;) (declaration "ulong uVar2;" type_identifier identifier ;) (declaration "long lVar3;" (sized_type_specifier "long" long) identifier ;) (expression_statement "uVar2 = len + ptr->len;" (assignment_expression "uVar2 = len + ptr->len" identifier = (binary_expression "len + ptr->len" identifier + (field_expression "ptr->len" identifier -> field_identifier))) ;) (if_statement "if (uVar2 <= ptr->max) {\n    return;\n  }" if (parenthesized_expression "(uVar2 <= ptr->max)" ( (binary_expression "uVar2 <= ptr->max" identifier <= (field_expression "ptr->max" identifier -> field_identifier)) )) (compound_statement "{\n    return;\n  }" { (return_statement "return;" return ;) })) (expression_statement "uVar2 = uVar2 + 0x11;" (assignment_expression "uVar2 = uVar2 + 0x11" identifier = (binary_expression "uVar2 + 0x11" identifier + number_literal)) ;) (if_statement "if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    ptr->max = lVar3 - 0x11;\n    pcVar1 = (char *)xrealloc(ptr->ptr,lVar3 + -0x10);\n    ptr->ptr = pcVar1;\n    return;\n  }" if (parenthesized_expression "(-1 < (long)uVar2)" ( (binary_expression "-1 < (long)uVar2" number_literal < (cast_expression "(long)uVar2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )) (compound_statement "{\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    ptr->max = lVar3 - 0x11;\n    pcVar1 = (char *)xrealloc(ptr->ptr,lVar3 + -0x10);\n    ptr->ptr = pcVar1;\n    return;\n  }" { (expression_statement "lVar3 = 0x3f;" (assignment_expression "lVar3 = 0x3f" identifier = number_literal) ;) (if_statement "if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }" if (parenthesized_expression "(uVar2 != 0)" ( (binary_expression "uVar2 != 0" identifier != number_literal) )) (compound_statement "{\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }" { (for_statement "for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }" for ( ; (binary_expression "uVar2 >> lVar3 == 0" (binary_expression "uVar2 >> lVar3" identifier >> identifier) == number_literal) ; (assignment_expression "lVar3 = lVar3 + -1" identifier = (binary_expression "lVar3 + -1" identifier + number_literal)) ) (compound_statement "{\n      }" { })) })) (expression_statement "lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);" (assignment_expression "lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" identifier = (binary_expression "1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" number_literal << (parenthesized_expression "(0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" ( (binary_expression "0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f" (binary_expression "0x40 - ((byte)lVar3 ^ 0x3f)" number_literal - (parenthesized_expression "((byte)lVar3 ^ 0x3f)" ( (binary_expression "(byte)lVar3 ^ 0x3f" (cast_expression "(byte)lVar3" ( (type_descriptor "byte" type_identifier) ) identifier) ^ number_literal) ))) & number_literal) )))) ;) (expression_statement "ptr->max = lVar3 - 0x11;" (assignment_expression "ptr->max = lVar3 - 0x11" (field_expression "ptr->max" identifier -> field_identifier) = (binary_expression "lVar3 - 0x11" identifier - number_literal)) ;) (expression_statement "pcVar1 = (char *)xrealloc(ptr->ptr,lVar3 + -0x10);" (assignment_expression "pcVar1 = (char *)xrealloc(ptr->ptr,lVar3 + -0x10)" identifier = (cast_expression "(char *)xrealloc(ptr->ptr,lVar3 + -0x10)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (call_expression "xrealloc(ptr->ptr,lVar3 + -0x10)" identifier (argument_list "(ptr->ptr,lVar3 + -0x10)" ( (field_expression "ptr->ptr" identifier -> field_identifier) , (binary_expression "lVar3 + -0x10" identifier + number_literal) ))))) ;) (expression_statement "ptr->ptr = pcVar1;" (assignment_expression "ptr->ptr = pcVar1" (field_expression "ptr->ptr" identifier -> field_identifier) = identifier) ;) (return_statement "return;" return ;) })) 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 ") ))) ;) })))
(translation_unit "void FUN_00124d50(undefined8 *param_1,long param_2)\n\n{\n  undefined8 uVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }\n  uVar2 = param_2 + param_1[1] + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }\n                    \n  FUN_0011c770("string buffer overflow");\n}\n\n" (function_definition "void FUN_00124d50(undefined8 *param_1,long param_2)\n\n{\n  undefined8 uVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }\n  uVar2 = param_2 + param_1[1] + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }\n                    \n  FUN_0011c770("string buffer overflow");\n}" primitive_type (function_declarator "FUN_00124d50(undefined8 *param_1,long param_2)" identifier (parameter_list "(undefined8 *param_1,long param_2)" ( (parameter_declaration "undefined8 *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "long param_2" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  undefined8 uVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }\n  uVar2 = param_2 + param_1[1] + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }\n                    \n  FUN_0011c770("string buffer overflow");\n}" { (declaration "undefined8 uVar1;" type_identifier identifier ;) (declaration "ulong uVar2;" type_identifier identifier ;) (declaration "long lVar3;" (sized_type_specifier "long" long) identifier ;) (if_statement "if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }" if (parenthesized_expression "((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2])" ( (binary_expression "(ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]" (call_expression "(ulong)(param_2 + param_1[1])" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(param_2 + param_1[1])" ( (binary_expression "param_2 + param_1[1]" identifier + (subscript_expression "param_1[1]" identifier [ number_literal ])) ))) <= (cast_expression "(ulong)param_1[2]" ( (type_descriptor "ulong" type_identifier) ) (subscript_expression "param_1[2]" identifier [ number_literal ]))) )) (compound_statement "{\n    return;\n  }" { (return_statement "return;" return ;) })) (expression_statement "uVar2 = param_2 + param_1[1] + 0x11;" (assignment_expression "uVar2 = param_2 + param_1[1] + 0x11" identifier = (binary_expression "param_2 + param_1[1] + 0x11" (binary_expression "param_2 + param_1[1]" identifier + (subscript_expression "param_1[1]" identifier [ number_literal ])) + number_literal)) ;) (if_statement "if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }" if (parenthesized_expression "(-1 < (long)uVar2)" ( (binary_expression "-1 < (long)uVar2" number_literal < (cast_expression "(long)uVar2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) )) (compound_statement "{\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }" { (expression_statement "lVar3 = 0x3f;" (assignment_expression "lVar3 = 0x3f" identifier = number_literal) ;) (if_statement "if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }" if (parenthesized_expression "(uVar2 != 0)" ( (binary_expression "uVar2 != 0" identifier != number_literal) )) (compound_statement "{\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }" { (for_statement "for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }" for ( ; (binary_expression "uVar2 >> lVar3 == 0" (binary_expression "uVar2 >> lVar3" identifier >> identifier) == number_literal) ; (assignment_expression "lVar3 = lVar3 + -1" identifier = (binary_expression "lVar3 + -1" identifier + number_literal)) ) (compound_statement "{\n      }" { })) })) (expression_statement "lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);" (assignment_expression "lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" identifier = (binary_expression "1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" number_literal << (parenthesized_expression "(0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" ( (binary_expression "0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f" (binary_expression "0x40 - ((byte)lVar3 ^ 0x3f)" number_literal - (parenthesized_expression "((byte)lVar3 ^ 0x3f)" ( (binary_expression "(byte)lVar3 ^ 0x3f" (cast_expression "(byte)lVar3" ( (type_descriptor "byte" type_identifier) ) identifier) ^ number_literal) ))) & number_literal) )))) ;) (expression_statement "param_1[2] = lVar3 + -0x11;" (assignment_expression "param_1[2] = lVar3 + -0x11" (subscript_expression "param_1[2]" identifier [ number_literal ]) = (binary_expression "lVar3 + -0x11" identifier + number_literal)) ;) (expression_statement "uVar1 = xrealloc(*param_1,lVar3 + -0x10);" (assignment_expression "uVar1 = xrealloc(*param_1,lVar3 + -0x10)" identifier = (call_expression "xrealloc(*param_1,lVar3 + -0x10)" identifier (argument_list "(*param_1,lVar3 + -0x10)" ( (pointer_expression "*param_1" * identifier) , (binary_expression "lVar3 + -0x10" identifier + number_literal) )))) ;) (expression_statement "*param_1 = uVar1;" (assignment_expression "*param_1 = uVar1" (pointer_expression "*param_1" * identifier) = identifier) ;) (return_statement "return;" return ;) })) (expression_statement "FUN_0011c770("string buffer overflow");" (call_expression "FUN_0011c770("string buffer overflow")" identifier (argument_list "("string buffer overflow")" ( (string_literal ""string buffer overflow"" " string_content ") ))) ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration (sized_type_specifier long) IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration (sized_type_specifier long) IDENT ;) (if_statement if (parenthesized_expression ( (binary_expression (call_expression (parenthesized_expression ( IDENT )) (argument_list ( (binary_expression IDENT + (subscript_expression IDENT [ LIT ])) ))) <= (cast_expression ( (type_descriptor TYPE) ) (subscript_expression IDENT [ LIT ]))) )) (compound_statement { (return_statement return ;) })) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT + (subscript_expression IDENT [ LIT ])) + LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression LIT < (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) )) (compound_statement { (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 ;) })) (expression_statement (call_expression IDENT (argument_list ( (string_literal " string_content ") ))) ;) })))
(function_definition "void FUN_00124d50(undefined8 *param_1,long param_2)\n\n{\n  undefined8 uVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }\n  uVar2 = param_2 + param_1[1] + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }\n                    \n  FUN_0011c770("string buffer overflow");\n}" (primitive_type "void") (function_declarator "FUN_00124d50(undefined8 *param_1,long param_2)" (identifier "FUN_00124d50") (parameter_list "(undefined8 *param_1,long param_2)" (( "(") (parameter_declaration "undefined8 *param_1" (type_identifier "undefined8") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "long param_2" (sized_type_specifier "long" (long "long")) (identifier "param_2")) () ")"))) (compound_statement "{\n  undefined8 uVar1;\n  ulong uVar2;\n  long lVar3;\n  \n  if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }\n  uVar2 = param_2 + param_1[1] + 0x11;\n  if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }\n                    \n  FUN_0011c770("string buffer overflow");\n}" ({ "{") (declaration "undefined8 uVar1;" (type_identifier "undefined8") (identifier "uVar1") (; ";")) (declaration "ulong uVar2;" (type_identifier "ulong") (identifier "uVar2") (; ";")) (declaration "long lVar3;" (sized_type_specifier "long" (long "long")) (identifier "lVar3") (; ";")) (if_statement "if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {\n    return;\n  }" (if "if") (parenthesized_expression "((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2])" (( "(") (binary_expression "(ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]" (call_expression "(ulong)(param_2 + param_1[1])" (parenthesized_expression "(ulong)" (( "(") (identifier "ulong") () ")")) (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") (] "]"))) () ")"))) (<= "<=") (cast_expression "(ulong)param_1[2]" (( "(") (type_descriptor "ulong" (type_identifier "ulong")) () ")") (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]")))) () ")")) (compound_statement "{\n    return;\n  }" ({ "{") (return_statement "return;" (return "return") (; ";")) (} "}"))) (expression_statement "uVar2 = param_2 + param_1[1] + 0x11;" (assignment_expression "uVar2 = param_2 + param_1[1] + 0x11" (identifier "uVar2") (= "=") (binary_expression "param_2 + param_1[1] + 0x11" (binary_expression "param_2 + param_1[1]" (identifier "param_2") (+ "+") (subscript_expression "param_1[1]" (identifier "param_1") ([ "[") (number_literal "1") (] "]"))) (+ "+") (number_literal "0x11"))) (; ";")) (if_statement "if (-1 < (long)uVar2) {\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }" (if "if") (parenthesized_expression "(-1 < (long)uVar2)" (( "(") (binary_expression "-1 < (long)uVar2" (number_literal "-1") (< "<") (cast_expression "(long)uVar2" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "uVar2"))) () ")")) (compound_statement "{\n    lVar3 = 0x3f;\n    if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }\n    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);\n    param_1[2] = lVar3 + -0x11;\n    uVar1 = xrealloc(*param_1,lVar3 + -0x10);\n    *param_1 = uVar1;\n    return;\n  }" ({ "{") (expression_statement "lVar3 = 0x3f;" (assignment_expression "lVar3 = 0x3f" (identifier "lVar3") (= "=") (number_literal "0x3f")) (; ";")) (if_statement "if (uVar2 != 0) {\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }" (if "if") (parenthesized_expression "(uVar2 != 0)" (( "(") (binary_expression "uVar2 != 0" (identifier "uVar2") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }\n    }" ({ "{") (for_statement "for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {\n      }" (for "for") (( "(") (; ";") (binary_expression "uVar2 >> lVar3 == 0" (binary_expression "uVar2 >> lVar3" (identifier "uVar2") (>> ">>") (identifier "lVar3")) (== "==") (number_literal "0")) (; ";") (assignment_expression "lVar3 = lVar3 + -1" (identifier "lVar3") (= "=") (binary_expression "lVar3 + -1" (identifier "lVar3") (+ "+") (number_literal "-1"))) () ")") (compound_statement "{\n      }" ({ "{") (} "}"))) (} "}"))) (expression_statement "lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);" (assignment_expression "lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" (identifier "lVar3") (= "=") (binary_expression "1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" (number_literal "1L") (<< "<<") (parenthesized_expression "(0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f)" (( "(") (binary_expression "0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f" (binary_expression "0x40 - ((byte)lVar3 ^ 0x3f)" (number_literal "0x40") (- "-") (parenthesized_expression "((byte)lVar3 ^ 0x3f)" (( "(") (binary_expression "(byte)lVar3 ^ 0x3f" (cast_expression "(byte)lVar3" (( "(") (type_descriptor "byte" (type_identifier "byte")) () ")") (identifier "lVar3")) (^ "^") (number_literal "0x3f")) () ")"))) (& "&") (number_literal "0x3f")) () ")")))) (; ";")) (expression_statement "param_1[2] = lVar3 + -0x11;" (assignment_expression "param_1[2] = lVar3 + -0x11" (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]")) (= "=") (binary_expression "lVar3 + -0x11" (identifier "lVar3") (+ "+") (number_literal "-0x11"))) (; ";")) (expression_statement "uVar1 = xrealloc(*param_1,lVar3 + -0x10);" (assignment_expression "uVar1 = xrealloc(*param_1,lVar3 + -0x10)" (identifier "uVar1") (= "=") (call_expression "xrealloc(*param_1,lVar3 + -0x10)" (identifier "xrealloc") (argument_list "(*param_1,lVar3 + -0x10)" (( "(") (pointer_expression "*param_1" (* "*") (identifier "param_1")) (, ",") (binary_expression "lVar3 + -0x10" (identifier "lVar3") (+ "+") (number_literal "-0x10")) () ")")))) (; ";")) (expression_statement "*param_1 = uVar1;" (assignment_expression "*param_1 = uVar1" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (= "=") (identifier "uVar1")) (; ";")) (return_statement "return;" (return "return") (; ";")) (} "}"))) (expression_statement "FUN_0011c770("string buffer overflow");" (call_expression "FUN_0011c770("string buffer overflow")" (identifier "FUN_0011c770") (argument_list "("string buffer overflow")" (( "(") (string_literal ""string buffer overflow"" (" """) (string_content "string buffer overflow") (" """)) () ")"))) (; ";")) (} "}")))

void function_1(type_1 *ptr,size_t var_1)

{
  char *pcVar1;
  type_2 var_2;
  long var_3;
  
  var_2 = var_1 + ptr->var_1;
  if (var_2 <= ptr->max) {
    return;
  }
  var_2 = var_2 + 0x11;
  if (-1 < (long)var_2) {
    var_3 = 0x3f;
    if (var_2 != 0) {
      for (; var_2 >> var_3 == 0; var_3 = var_3 + -1) {
      }
    }
    var_3 = 1L << (0x40 - ((type_3)var_3 ^ 0x3f) & 0x3f);
    ptr->max = var_3 - 0x11;
    pcVar1 = (char *)var_4(ptr->ptr,var_3 + -0x10);
    ptr->ptr = pcVar1;
    return;
  }
                    /* WARNING: Subroutine does not return */
  var_5("string buffer overflow");
}


(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: (sized_type_specifier) declarator: (identifier)))) body: (compound_statement (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (sized_type_specifier) declarator: (identifier)) (if_statement condition: (parenthesized_expression (binary_expression left: (call_expression function: (parenthesized_expression (identifier)) arguments: (argument_list (binary_expression left: (identifier) right: (subscript_expression argument: (identifier) index: (number_literal))))) right: (cast_expression type: (type_descriptor type: (type_identifier)) value: (subscript_expression argument: (identifier) index: (number_literal))))) consequence: (compound_statement (return_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: (number_literal) right: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier)))) consequence: (compound_statement (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))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (string_literal (string_content))))))))

void MASKED(undefined8 *param_1,long param_2)

{
  undefined8 uVar1;
  ulong uVar2;
  long lVar3;
  
  if ((ulong)(param_2 + param_1[1]) <= (ulong)param_1[2]) {
    return;
  }
  uVar2 = param_2 + param_1[1] + 0x11;
  if (-1 < (long)uVar2) {
    lVar3 = 0x3f;
    if (uVar2 != 0) {
      for (; uVar2 >> lVar3 == 0; lVar3 = lVar3 + -1) {
      }
    }
    lVar3 = 1L << (0x40 - ((byte)lVar3 ^ 0x3f) & 0x3f);
    param_1[2] = lVar3 + -0x11;
    uVar1 = xrealloc(*param_1,lVar3 + -0x10);
    *param_1 = uVar1;
    return;
  }
                    /* WARNING: Subroutine does not return */
  FUN_0011c770("string buffer overflow");
}

