
/* std::string::replace(unsigned int, unsigned int, char const*, unsigned int) */

void __thiscall
std::string::replace(string *this,uint param_1,uint param_2,char *param_3,uint param_4)

{
  uint uVar1;
  
  uVar1 = *(uint *)(this + 4);
  if (param_1 <= uVar1) {
    if (uVar1 - param_1 <= param_2) {
      param_2 = uVar1 - param_1;
    }
    _M_replace(this,param_1,param_2,param_3,param_4);
    return;
  }
  (*(code *)PTR___throw_out_of_range_fmt_004c225c)
            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_1,uVar1);
  return;
}



void FUN_0033c388(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)

{
  uint uVar1;
  
  uVar1 = *(uint *)(param_1 + 4);
  if (param_2 <= uVar1) {
    if (uVar1 - param_2 <= param_3) {
      param_3 = uVar1 - param_2;
    }
    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);
    return;
  }
  (*(code *)PTR___throw_out_of_range_fmt_004c225c)
            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);
  return;
}


lui gp,0x19
addiu gp,gp,-0x3148
addu gp,gp,t9
addiu sp,sp,-0x20
sw gp,0x10(sp)
sw ra,0x1c(sp)
lw v0,0x4(a0)
sltu t0,v0,a1
bne t0,zero,0x0033c3c8
_lw ra,0x1c(sp)
subu v0,v0,a1
lw t9,-0x71a0(gp)
addiu sp,sp,0x20
sltu v1,a2,v0
b 0x0033bed4
_movz a2,v0,v1
or a2,a1,zero
lw a0,-0x77f0(gp)
lw a1,-0x7f64(gp)
or a3,v0,zero
lw t9,-0x6fe4(gp)
addiu a0,a0,-0xe00
jalr t9
_addiu a1,a1,-0x3aec
(translation_unit "void FUN_0033c388(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)\n\n{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(param_1 + 4);\n  if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);\n  return;\n}\n\n" (function_definition "void FUN_0033c388(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)\n\n{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(param_1 + 4);\n  if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);\n  return;\n}" primitive_type (function_declarator "FUN_0033c388(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)" identifier (parameter_list "(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)" ( (parameter_declaration "string *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "uint param_2" type_identifier identifier) , (parameter_declaration "uint param_3" type_identifier identifier) , (parameter_declaration "char *param_4" primitive_type (pointer_declarator "*param_4" * identifier)) , (parameter_declaration "uint param_5" type_identifier identifier) ))) (compound_statement "{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(param_1 + 4);\n  if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);\n  return;\n}" { (declaration "uint uVar1;" type_identifier identifier ;) (expression_statement "uVar1 = *(uint *)(param_1 + 4);" (assignment_expression "uVar1 = *(uint *)(param_1 + 4)" identifier = (pointer_expression "*(uint *)(param_1 + 4)" * (cast_expression "(uint *)(param_1 + 4)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 4)" ( (binary_expression "param_1 + 4" identifier + number_literal) ))))) ;) (if_statement "if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }" if (parenthesized_expression "(param_2 <= uVar1)" ( (binary_expression "param_2 <= uVar1" identifier <= identifier) )) (compound_statement "{\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }" { (if_statement "if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }" if (parenthesized_expression "(uVar1 - param_2 <= param_3)" ( (binary_expression "uVar1 - param_2 <= param_3" (binary_expression "uVar1 - param_2" identifier - identifier) <= identifier) )) (compound_statement "{\n      param_3 = uVar1 - param_2;\n    }" { (expression_statement "param_3 = uVar1 - param_2;" (assignment_expression "param_3 = uVar1 - param_2" identifier = (binary_expression "uVar1 - param_2" identifier - identifier)) ;) })) (labeled_statement "std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);" statement_identifier : (ERROR ":" :) (labeled_statement "string::_M_replace(param_1,param_2,param_3,param_4,param_5);" statement_identifier : (ERROR ":" :) (expression_statement "_M_replace(param_1,param_2,param_3,param_4,param_5);" (call_expression "_M_replace(param_1,param_2,param_3,param_4,param_5)" identifier (argument_list "(param_1,param_2,param_3,param_4,param_5)" ( identifier , identifier , identifier , identifier , identifier ))) ;))) (return_statement "return;" return ;) })) (expression_statement "(*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);" (call_expression "(*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1)" (parenthesized_expression "(*(code *)PTR___throw_out_of_range_fmt_004c225c)" ( (pointer_expression "*(code *)PTR___throw_out_of_range_fmt_004c225c" * (cast_expression "(code *)PTR___throw_out_of_range_fmt_004c225c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1)" ( (binary_expression "PTR_s__s_004c1a50 + -0xe00" identifier + number_literal) , (binary_expression "PTR_UINT_004c12dc + -0x3aec" identifier + number_literal) , identifier , identifier ))) ;) (return_statement "return;" return ;) })))
(translation_unit "/* std::string::replace(unsigned int, unsigned int, char const*, unsigned int) */\n\nvoid __thiscall\nstd::string::replace(string *this,uint param_1,uint param_2,char *param_3,uint param_4)\n\n{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(this + 4);\n  if (param_1 <= uVar1) {\n    if (uVar1 - param_1 <= param_2) {\n      param_2 = uVar1 - param_1;\n    }\n    _M_replace(this,param_1,param_2,param_3,param_4);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_1,uVar1);\n  return;\n}\n\n" comment (function_definition "void __thiscall\nstd::string::replace(string *this,uint param_1,uint param_2,char *param_3,uint param_4)\n\n{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(this + 4);\n  if (param_1 <= uVar1) {\n    if (uVar1 - param_1 <= param_2) {\n      param_2 = uVar1 - param_1;\n    }\n    _M_replace(this,param_1,param_2,param_3,param_4);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_1,uVar1);\n  return;\n}" primitive_type (ms_call_modifier "__thiscall" __thiscall) (ERROR "std::string::" identifier : : identifier : :) (function_declarator "replace(string *this,uint param_1,uint param_2,char *param_3,uint param_4)" identifier (parameter_list "(string *this,uint param_1,uint param_2,char *param_3,uint param_4)" ( (parameter_declaration "string *this" type_identifier (pointer_declarator "*this" * identifier)) , (parameter_declaration "uint param_1" type_identifier identifier) , (parameter_declaration "uint param_2" type_identifier identifier) , (parameter_declaration "char *param_3" primitive_type (pointer_declarator "*param_3" * identifier)) , (parameter_declaration "uint param_4" type_identifier identifier) ))) (compound_statement "{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(this + 4);\n  if (param_1 <= uVar1) {\n    if (uVar1 - param_1 <= param_2) {\n      param_2 = uVar1 - param_1;\n    }\n    _M_replace(this,param_1,param_2,param_3,param_4);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_1,uVar1);\n  return;\n}" { (declaration "uint uVar1;" type_identifier identifier ;) (expression_statement "uVar1 = *(uint *)(this + 4);" (assignment_expression "uVar1 = *(uint *)(this + 4)" identifier = (pointer_expression "*(uint *)(this + 4)" * (cast_expression "(uint *)(this + 4)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(this + 4)" ( (binary_expression "this + 4" identifier + number_literal) ))))) ;) (if_statement "if (param_1 <= uVar1) {\n    if (uVar1 - param_1 <= param_2) {\n      param_2 = uVar1 - param_1;\n    }\n    _M_replace(this,param_1,param_2,param_3,param_4);\n    return;\n  }" if (parenthesized_expression "(param_1 <= uVar1)" ( (binary_expression "param_1 <= uVar1" identifier <= identifier) )) (compound_statement "{\n    if (uVar1 - param_1 <= param_2) {\n      param_2 = uVar1 - param_1;\n    }\n    _M_replace(this,param_1,param_2,param_3,param_4);\n    return;\n  }" { (if_statement "if (uVar1 - param_1 <= param_2) {\n      param_2 = uVar1 - param_1;\n    }" if (parenthesized_expression "(uVar1 - param_1 <= param_2)" ( (binary_expression "uVar1 - param_1 <= param_2" (binary_expression "uVar1 - param_1" identifier - identifier) <= identifier) )) (compound_statement "{\n      param_2 = uVar1 - param_1;\n    }" { (expression_statement "param_2 = uVar1 - param_1;" (assignment_expression "param_2 = uVar1 - param_1" identifier = (binary_expression "uVar1 - param_1" identifier - identifier)) ;) })) (expression_statement "_M_replace(this,param_1,param_2,param_3,param_4);" (call_expression "_M_replace(this,param_1,param_2,param_3,param_4)" identifier (argument_list "(this,param_1,param_2,param_3,param_4)" ( identifier , identifier , identifier , identifier , identifier ))) ;) (return_statement "return;" return ;) })) (expression_statement "(*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_1,uVar1);" (call_expression "(*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_1,uVar1)" (parenthesized_expression "(*(code *)PTR___throw_out_of_range_fmt_004c225c)" ( (pointer_expression "*(code *)PTR___throw_out_of_range_fmt_004c225c" * (cast_expression "(code *)PTR___throw_out_of_range_fmt_004c225c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_1,uVar1)" ( (binary_expression "PTR_s__s_004c1a50 + -0xe00" identifier + number_literal) , (binary_expression "PTR_UINT_004c12dc + -0x3aec" identifier + number_literal) , identifier , identifier ))) ;) (return_statement "return;" return ;) })))
(translation_unit "void FUN_0033c388(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)\n\n{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(param_1 + 4);\n  if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);\n  return;\n}\n\n" (function_definition "void FUN_0033c388(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)\n\n{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(param_1 + 4);\n  if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);\n  return;\n}" primitive_type (function_declarator "FUN_0033c388(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)" identifier (parameter_list "(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)" ( (parameter_declaration "string *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "uint param_2" type_identifier identifier) , (parameter_declaration "uint param_3" type_identifier identifier) , (parameter_declaration "char *param_4" primitive_type (pointer_declarator "*param_4" * identifier)) , (parameter_declaration "uint param_5" type_identifier identifier) ))) (compound_statement "{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(param_1 + 4);\n  if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);\n  return;\n}" { (declaration "uint uVar1;" type_identifier identifier ;) (expression_statement "uVar1 = *(uint *)(param_1 + 4);" (assignment_expression "uVar1 = *(uint *)(param_1 + 4)" identifier = (pointer_expression "*(uint *)(param_1 + 4)" * (cast_expression "(uint *)(param_1 + 4)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 4)" ( (binary_expression "param_1 + 4" identifier + number_literal) ))))) ;) (if_statement "if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }" if (parenthesized_expression "(param_2 <= uVar1)" ( (binary_expression "param_2 <= uVar1" identifier <= identifier) )) (compound_statement "{\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }" { (if_statement "if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }" if (parenthesized_expression "(uVar1 - param_2 <= param_3)" ( (binary_expression "uVar1 - param_2 <= param_3" (binary_expression "uVar1 - param_2" identifier - identifier) <= identifier) )) (compound_statement "{\n      param_3 = uVar1 - param_2;\n    }" { (expression_statement "param_3 = uVar1 - param_2;" (assignment_expression "param_3 = uVar1 - param_2" identifier = (binary_expression "uVar1 - param_2" identifier - identifier)) ;) })) (labeled_statement "std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);" statement_identifier : (ERROR ":" :) (labeled_statement "string::_M_replace(param_1,param_2,param_3,param_4,param_5);" statement_identifier : (ERROR ":" :) (expression_statement "_M_replace(param_1,param_2,param_3,param_4,param_5);" (call_expression "_M_replace(param_1,param_2,param_3,param_4,param_5)" identifier (argument_list "(param_1,param_2,param_3,param_4,param_5)" ( identifier , identifier , identifier , identifier , identifier ))) ;))) (return_statement "return;" return ;) })) (expression_statement "(*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);" (call_expression "(*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1)" (parenthesized_expression "(*(code *)PTR___throw_out_of_range_fmt_004c225c)" ( (pointer_expression "*(code *)PTR___throw_out_of_range_fmt_004c225c" * (cast_expression "(code *)PTR___throw_out_of_range_fmt_004c225c" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1)" ( (binary_expression "PTR_s__s_004c1a50 + -0xe00" identifier + number_literal) , (binary_expression "PTR_UINT_004c12dc + -0x3aec" identifier + number_literal) , identifier , identifier ))) ;) (return_statement "return;" return ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT <= IDENT) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression (binary_expression IDENT - IDENT) <= IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) })) (labeled_statement statement_identifier : (ERROR :) (labeled_statement statement_identifier : (ERROR :) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT , IDENT , IDENT ))) ;))) (return_statement return ;) })) (expression_statement (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( (binary_expression IDENT + LIT) , (binary_expression IDENT + LIT) , IDENT , IDENT ))) ;) (return_statement return ;) })))
(function_definition "void FUN_0033c388(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)\n\n{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(param_1 + 4);\n  if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);\n  return;\n}" (primitive_type "void") (function_declarator "FUN_0033c388(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)" (identifier "FUN_0033c388") (parameter_list "(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)" (( "(") (parameter_declaration "string *param_1" (type_identifier "string") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "uint param_2" (type_identifier "uint") (identifier "param_2")) (, ",") (parameter_declaration "uint param_3" (type_identifier "uint") (identifier "param_3")) (, ",") (parameter_declaration "char *param_4" (primitive_type "char") (pointer_declarator "*param_4" (* "*") (identifier "param_4"))) (, ",") (parameter_declaration "uint param_5" (type_identifier "uint") (identifier "param_5")) () ")"))) (compound_statement "{\n  uint uVar1;\n  \n  uVar1 = *(uint *)(param_1 + 4);\n  if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }\n  (*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);\n  return;\n}" ({ "{") (declaration "uint uVar1;" (type_identifier "uint") (identifier "uVar1") (; ";")) (expression_statement "uVar1 = *(uint *)(param_1 + 4);" (assignment_expression "uVar1 = *(uint *)(param_1 + 4)" (identifier "uVar1") (= "=") (pointer_expression "*(uint *)(param_1 + 4)" (* "*") (cast_expression "(uint *)(param_1 + 4)" (( "(") (type_descriptor "uint *" (type_identifier "uint") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 4)" (( "(") (binary_expression "param_1 + 4" (identifier "param_1") (+ "+") (number_literal "4")) () ")"))))) (; ";")) (if_statement "if (param_2 <= uVar1) {\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }" (if "if") (parenthesized_expression "(param_2 <= uVar1)" (( "(") (binary_expression "param_2 <= uVar1" (identifier "param_2") (<= "<=") (identifier "uVar1")) () ")")) (compound_statement "{\n    if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }\n    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);\n    return;\n  }" ({ "{") (if_statement "if (uVar1 - param_2 <= param_3) {\n      param_3 = uVar1 - param_2;\n    }" (if "if") (parenthesized_expression "(uVar1 - param_2 <= param_3)" (( "(") (binary_expression "uVar1 - param_2 <= param_3" (binary_expression "uVar1 - param_2" (identifier "uVar1") (- "-") (identifier "param_2")) (<= "<=") (identifier "param_3")) () ")")) (compound_statement "{\n      param_3 = uVar1 - param_2;\n    }" ({ "{") (expression_statement "param_3 = uVar1 - param_2;" (assignment_expression "param_3 = uVar1 - param_2" (identifier "param_3") (= "=") (binary_expression "uVar1 - param_2" (identifier "uVar1") (- "-") (identifier "param_2"))) (; ";")) (} "}"))) (labeled_statement "std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);" (statement_identifier "std") (: ":") (ERROR ":" (: ":")) (labeled_statement "string::_M_replace(param_1,param_2,param_3,param_4,param_5);" (statement_identifier "string") (: ":") (ERROR ":" (: ":")) (expression_statement "_M_replace(param_1,param_2,param_3,param_4,param_5);" (call_expression "_M_replace(param_1,param_2,param_3,param_4,param_5)" (identifier "_M_replace") (argument_list "(param_1,param_2,param_3,param_4,param_5)" (( "(") (identifier "param_1") (, ",") (identifier "param_2") (, ",") (identifier "param_3") (, ",") (identifier "param_4") (, ",") (identifier "param_5") () ")"))) (; ";")))) (return_statement "return;" (return "return") (; ";")) (} "}"))) (expression_statement "(*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);" (call_expression "(*(code *)PTR___throw_out_of_range_fmt_004c225c)\n            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1)" (parenthesized_expression "(*(code *)PTR___throw_out_of_range_fmt_004c225c)" (( "(") (pointer_expression "*(code *)PTR___throw_out_of_range_fmt_004c225c" (* "*") (cast_expression "(code *)PTR___throw_out_of_range_fmt_004c225c" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR___throw_out_of_range_fmt_004c225c"))) () ")")) (argument_list "(PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1)" (( "(") (binary_expression "PTR_s__s_004c1a50 + -0xe00" (identifier "PTR_s__s_004c1a50") (+ "+") (number_literal "-0xe00")) (, ",") (binary_expression "PTR_UINT_004c12dc + -0x3aec" (identifier "PTR_UINT_004c12dc") (+ "+") (number_literal "-0x3aec")) (, ",") (identifier "param_2") (, ",") (identifier "uVar1") () ")"))) (; ";")) (return_statement "return;" (return "return") (; ";")) (} "}")))

/* std::string::replace(unsigned int, unsigned int, char const*, unsigned int) */

void __thiscall
std::type_1::function_1(type_1 *var_1,type_2 var_2,type_2 var_4,char *param_3,type_2 param_4)

{
  type_2 var_3;
  
  var_3 = *(type_2 *)(var_1 + 4);
  if (var_2 <= var_3) {
    if (var_3 - var_2 <= var_4) {
      var_4 = var_3 - var_2;
    }
    var_5(var_1,var_2,var_4,param_3,param_4);
    return;
  }
  (*(type_3 *)PTR___throw_out_of_range_fmt_004c225c)
            (var_6 + -0xe00,var_7 + -0x3aec,var_2,var_3);
  return;
}


(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)) (parameter_declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (identifier)))) body: (compound_statement (declaration type: (type_identifier) declarator: (identifier)) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (compound_statement (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))))) (labeled_statement label: (statement_identifier) (ERROR) (labeled_statement label: (statement_identifier) (ERROR) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (identifier) (identifier)))))) (return_statement))) (expression_statement (call_expression function: (parenthesized_expression (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (identifier)))) arguments: (argument_list (binary_expression left: (identifier) right: (number_literal)) (binary_expression left: (identifier) right: (number_literal)) (identifier) (identifier)))) (return_statement))))

void MASKED(string *param_1,uint param_2,uint param_3,char *param_4,uint param_5)

{
  uint uVar1;
  
  uVar1 = *(uint *)(param_1 + 4);
  if (param_2 <= uVar1) {
    if (uVar1 - param_2 <= param_3) {
      param_3 = uVar1 - param_2;
    }
    std::string::_M_replace(param_1,param_2,param_3,param_4,param_5);
    return;
  }
  (*(code *)PTR___throw_out_of_range_fmt_004c225c)
            (PTR_s__s_004c1a50 + -0xe00,PTR_UINT_004c12dc + -0x3aec,param_2,uVar1);
  return;
}

