
/* std::wstring::replace(__normal_iterator<wchar_t*, std::wstring >, __normal_iterator<wchar_t*,
   std::wstring >, wchar_t*, wchar_t*) */

void __thiscall
std::wstring::replace(wstring *this,long param_2,long param_3,wchar_t *param_4,long param_5)

{
  ulong uVar1;
  ulong uVar2;
  ulong uVar3;
  ulong uVar4;
  
  uVar1 = *(ulong *)(this + 8);
  uVar2 = param_2 - *(long *)this >> 2;
  uVar3 = param_3 - param_2 >> 2;
  uVar4 = param_5 - (long)param_4 >> 2;
  if (uVar1 - uVar2 < uVar3) {
    uVar3 = uVar1 - uVar2;
  }
  if (uVar2 <= uVar1) {
    _M_replace(this,uVar2,uVar3,param_4,uVar4);
    return;
  }
                    /* WARNING: Subroutine does not return */
  __throw_out_of_range_fmt
            ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",uVar2,
             uVar1,uVar4,uVar1,uVar3);
}



void FUN_00365250(long *param_1,long param_2,long param_3,long param_4,long param_5)

{
  ulong uVar1;
  ulong uVar2;
  ulong uVar3;
  
  uVar1 = param_1[1];
  uVar2 = param_2 - *param_1 >> 2;
  uVar3 = param_3 - param_2 >> 2;
  if (uVar1 - uVar2 < uVar3) {
    uVar3 = uVar1 - uVar2;
  }
  if (uVar2 <= uVar1) {
    FUN_002df740(param_1,uVar2);
    return;
  }
                    /* WARNING: Subroutine does not return */
  FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",
               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);
}


MOV R9,qword ptr [RDI + 0x8]
MOV RAX,RSI
SUB RAX,qword ptr [RDI]
SUB RDX,RSI
SAR RAX,0x2
SUB R8,RCX
SAR RDX,0x2
MOV RSI,R9
SAR R8,0x2
SUB RSI,RAX
CMP RDX,RSI
CMOVA RDX,RSI
CMP RAX,R9
JA 0x00365286
MOV RSI,RAX
JMP 0x002df740
PUSH RDX
MOV RCX,R9
MOV RDX,RAX
XOR EAX,EAX
LEA RSI,[0x391166]
LEA RDI,[0x376b80]
CALL 0x00319620
(translation_unit "void FUN_00365250(long *param_1,long param_2,long param_3,long param_4,long param_5)\n\n{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  \n  uVar1 = param_1[1];\n  uVar2 = param_2 - *param_1 >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);\n}\n\n" (function_definition "void FUN_00365250(long *param_1,long param_2,long param_3,long param_4,long param_5)\n\n{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  \n  uVar1 = param_1[1];\n  uVar2 = param_2 - *param_1 >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);\n}" primitive_type (function_declarator "FUN_00365250(long *param_1,long param_2,long param_3,long param_4,long param_5)" identifier (parameter_list "(long *param_1,long param_2,long param_3,long param_4,long param_5)" ( (parameter_declaration "long *param_1" (sized_type_specifier "long" long) (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "long param_2" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_4" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_5" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  \n  uVar1 = param_1[1];\n  uVar2 = param_2 - *param_1 >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);\n}" { (declaration "ulong uVar1;" type_identifier identifier ;) (declaration "ulong uVar2;" type_identifier identifier ;) (declaration "ulong uVar3;" type_identifier identifier ;) (expression_statement "uVar1 = param_1[1];" (assignment_expression "uVar1 = param_1[1]" identifier = (subscript_expression "param_1[1]" identifier [ number_literal ])) ;) (expression_statement "uVar2 = param_2 - *param_1 >> 2;" (assignment_expression "uVar2 = param_2 - *param_1 >> 2" identifier = (binary_expression "param_2 - *param_1 >> 2" (binary_expression "param_2 - *param_1" identifier - (pointer_expression "*param_1" * identifier)) >> number_literal)) ;) (expression_statement "uVar3 = param_3 - param_2 >> 2;" (assignment_expression "uVar3 = param_3 - param_2 >> 2" identifier = (binary_expression "param_3 - param_2 >> 2" (binary_expression "param_3 - param_2" identifier - identifier) >> number_literal)) ;) (if_statement "if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }" if (parenthesized_expression "(uVar1 - uVar2 < uVar3)" ( (binary_expression "uVar1 - uVar2 < uVar3" (binary_expression "uVar1 - uVar2" identifier - identifier) < identifier) )) (compound_statement "{\n    uVar3 = uVar1 - uVar2;\n  }" { (expression_statement "uVar3 = uVar1 - uVar2;" (assignment_expression "uVar3 = uVar1 - uVar2" identifier = (binary_expression "uVar1 - uVar2" identifier - identifier)) ;) })) (if_statement "if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }" if (parenthesized_expression "(uVar2 <= uVar1)" ( (binary_expression "uVar2 <= uVar1" identifier <= identifier) )) (compound_statement "{\n    FUN_002df740(param_1,uVar2);\n    return;\n  }" { (expression_statement "FUN_002df740(param_1,uVar2);" (call_expression "FUN_002df740(param_1,uVar2)" identifier (argument_list "(param_1,uVar2)" ( identifier , identifier ))) ;) (return_statement "return;" return ;) })) comment (expression_statement "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);" (call_expression "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3)" identifier (argument_list "("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3)" ( (string_literal ""%s: __pos (which is %zu) > this->size() (which is %zu)"" " string_content ") , (string_literal ""basic_string::replace"" " string_content ") , identifier , identifier , (binary_expression "param_5 - param_4 >> 2" (binary_expression "param_5 - param_4" identifier - identifier) >> number_literal) , identifier , identifier ))) ;) })))
(translation_unit "/* std::wstring::replace(__normal_iterator<wchar_t*, std::wstring >, __normal_iterator<wchar_t*,\n   std::wstring >, wchar_t*, wchar_t*) */\n\nvoid __thiscall\nstd::wstring::replace(wstring *this,long param_2,long param_3,wchar_t *param_4,long param_5)\n\n{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  ulong uVar4;\n  \n  uVar1 = *(ulong *)(this + 8);\n  uVar2 = param_2 - *(long *)this >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  uVar4 = param_5 - (long)param_4 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    _M_replace(this,uVar2,uVar3,param_4,uVar4);\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  __throw_out_of_range_fmt\n            ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",uVar2,\n             uVar1,uVar4,uVar1,uVar3);\n}\n\n" comment (function_definition "void __thiscall\nstd::wstring::replace(wstring *this,long param_2,long param_3,wchar_t *param_4,long param_5)\n\n{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  ulong uVar4;\n  \n  uVar1 = *(ulong *)(this + 8);\n  uVar2 = param_2 - *(long *)this >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  uVar4 = param_5 - (long)param_4 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    _M_replace(this,uVar2,uVar3,param_4,uVar4);\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  __throw_out_of_range_fmt\n            ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",uVar2,\n             uVar1,uVar4,uVar1,uVar3);\n}" primitive_type (ms_call_modifier "__thiscall" __thiscall) (ERROR "std::wstring::" identifier : : identifier : :) (function_declarator "replace(wstring *this,long param_2,long param_3,wchar_t *param_4,long param_5)" identifier (parameter_list "(wstring *this,long param_2,long param_3,wchar_t *param_4,long param_5)" ( (parameter_declaration "wstring *this" type_identifier (pointer_declarator "*this" * identifier)) , (parameter_declaration "long param_2" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) , (parameter_declaration "wchar_t *param_4" type_identifier (pointer_declarator "*param_4" * identifier)) , (parameter_declaration "long param_5" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  ulong uVar4;\n  \n  uVar1 = *(ulong *)(this + 8);\n  uVar2 = param_2 - *(long *)this >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  uVar4 = param_5 - (long)param_4 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    _M_replace(this,uVar2,uVar3,param_4,uVar4);\n    return;\n  }\n                    /* WARNING: Subroutine does not return */\n  __throw_out_of_range_fmt\n            ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",uVar2,\n             uVar1,uVar4,uVar1,uVar3);\n}" { (declaration "ulong uVar1;" type_identifier identifier ;) (declaration "ulong uVar2;" type_identifier identifier ;) (declaration "ulong uVar3;" type_identifier identifier ;) (declaration "ulong uVar4;" type_identifier identifier ;) (expression_statement "uVar1 = *(ulong *)(this + 8);" (assignment_expression "uVar1 = *(ulong *)(this + 8)" identifier = (pointer_expression "*(ulong *)(this + 8)" * (cast_expression "(ulong *)(this + 8)" ( (type_descriptor "ulong *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(this + 8)" ( (binary_expression "this + 8" identifier + number_literal) ))))) ;) (expression_statement "uVar2 = param_2 - *(long *)this >> 2;" (assignment_expression "uVar2 = param_2 - *(long *)this >> 2" identifier = (binary_expression "param_2 - *(long *)this >> 2" (binary_expression "param_2 - *(long *)this" identifier - (pointer_expression "*(long *)this" * (cast_expression "(long *)this" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) identifier))) >> number_literal)) ;) (expression_statement "uVar3 = param_3 - param_2 >> 2;" (assignment_expression "uVar3 = param_3 - param_2 >> 2" identifier = (binary_expression "param_3 - param_2 >> 2" (binary_expression "param_3 - param_2" identifier - identifier) >> number_literal)) ;) (expression_statement "uVar4 = param_5 - (long)param_4 >> 2;" (assignment_expression "uVar4 = param_5 - (long)param_4 >> 2" identifier = (binary_expression "param_5 - (long)param_4 >> 2" (binary_expression "param_5 - (long)param_4" identifier - (cast_expression "(long)param_4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) >> number_literal)) ;) (if_statement "if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }" if (parenthesized_expression "(uVar1 - uVar2 < uVar3)" ( (binary_expression "uVar1 - uVar2 < uVar3" (binary_expression "uVar1 - uVar2" identifier - identifier) < identifier) )) (compound_statement "{\n    uVar3 = uVar1 - uVar2;\n  }" { (expression_statement "uVar3 = uVar1 - uVar2;" (assignment_expression "uVar3 = uVar1 - uVar2" identifier = (binary_expression "uVar1 - uVar2" identifier - identifier)) ;) })) (if_statement "if (uVar2 <= uVar1) {\n    _M_replace(this,uVar2,uVar3,param_4,uVar4);\n    return;\n  }" if (parenthesized_expression "(uVar2 <= uVar1)" ( (binary_expression "uVar2 <= uVar1" identifier <= identifier) )) (compound_statement "{\n    _M_replace(this,uVar2,uVar3,param_4,uVar4);\n    return;\n  }" { (expression_statement "_M_replace(this,uVar2,uVar3,param_4,uVar4);" (call_expression "_M_replace(this,uVar2,uVar3,param_4,uVar4)" identifier (argument_list "(this,uVar2,uVar3,param_4,uVar4)" ( identifier , identifier , identifier , identifier , identifier ))) ;) (return_statement "return;" return ;) })) comment (expression_statement "__throw_out_of_range_fmt\n            ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",uVar2,\n             uVar1,uVar4,uVar1,uVar3);" (call_expression "__throw_out_of_range_fmt\n            ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",uVar2,\n             uVar1,uVar4,uVar1,uVar3)" identifier (argument_list "("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",uVar2,\n             uVar1,uVar4,uVar1,uVar3)" ( (string_literal ""%s: __pos (which is %zu) > this->size() (which is %zu)"" " string_content ") , (string_literal ""basic_string::replace"" " string_content ") , identifier , identifier , identifier , identifier , identifier ))) ;) })))
(translation_unit "void FUN_00365250(long *param_1,long param_2,long param_3,long param_4,long param_5)\n\n{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  \n  uVar1 = param_1[1];\n  uVar2 = param_2 - *param_1 >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }\n                    \n  FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);\n}\n\n" (function_definition "void FUN_00365250(long *param_1,long param_2,long param_3,long param_4,long param_5)\n\n{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  \n  uVar1 = param_1[1];\n  uVar2 = param_2 - *param_1 >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }\n                    \n  FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);\n}" primitive_type (function_declarator "FUN_00365250(long *param_1,long param_2,long param_3,long param_4,long param_5)" identifier (parameter_list "(long *param_1,long param_2,long param_3,long param_4,long param_5)" ( (parameter_declaration "long *param_1" (sized_type_specifier "long" long) (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "long param_2" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_4" (sized_type_specifier "long" long) identifier) , (parameter_declaration "long param_5" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  \n  uVar1 = param_1[1];\n  uVar2 = param_2 - *param_1 >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }\n                    \n  FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);\n}" { (declaration "ulong uVar1;" type_identifier identifier ;) (declaration "ulong uVar2;" type_identifier identifier ;) (declaration "ulong uVar3;" type_identifier identifier ;) (expression_statement "uVar1 = param_1[1];" (assignment_expression "uVar1 = param_1[1]" identifier = (subscript_expression "param_1[1]" identifier [ number_literal ])) ;) (expression_statement "uVar2 = param_2 - *param_1 >> 2;" (assignment_expression "uVar2 = param_2 - *param_1 >> 2" identifier = (binary_expression "param_2 - *param_1 >> 2" (binary_expression "param_2 - *param_1" identifier - (pointer_expression "*param_1" * identifier)) >> number_literal)) ;) (expression_statement "uVar3 = param_3 - param_2 >> 2;" (assignment_expression "uVar3 = param_3 - param_2 >> 2" identifier = (binary_expression "param_3 - param_2 >> 2" (binary_expression "param_3 - param_2" identifier - identifier) >> number_literal)) ;) (if_statement "if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }" if (parenthesized_expression "(uVar1 - uVar2 < uVar3)" ( (binary_expression "uVar1 - uVar2 < uVar3" (binary_expression "uVar1 - uVar2" identifier - identifier) < identifier) )) (compound_statement "{\n    uVar3 = uVar1 - uVar2;\n  }" { (expression_statement "uVar3 = uVar1 - uVar2;" (assignment_expression "uVar3 = uVar1 - uVar2" identifier = (binary_expression "uVar1 - uVar2" identifier - identifier)) ;) })) (if_statement "if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }" if (parenthesized_expression "(uVar2 <= uVar1)" ( (binary_expression "uVar2 <= uVar1" identifier <= identifier) )) (compound_statement "{\n    FUN_002df740(param_1,uVar2);\n    return;\n  }" { (expression_statement "FUN_002df740(param_1,uVar2);" (call_expression "FUN_002df740(param_1,uVar2)" identifier (argument_list "(param_1,uVar2)" ( identifier , identifier ))) ;) (return_statement "return;" return ;) })) (expression_statement "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);" (call_expression "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3)" identifier (argument_list "("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3)" ( (string_literal ""%s: __pos (which is %zu) > this->size() (which is %zu)"" " string_content ") , (string_literal ""basic_string::replace"" " string_content ") , identifier , identifier , (binary_expression "param_5 - param_4 >> 2" (binary_expression "param_5 - param_4" identifier - identifier) >> number_literal) , identifier , identifier ))) ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration (sized_type_specifier long) (pointer_declarator * IDENT)) , (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration (sized_type_specifier long) IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = (subscript_expression IDENT [ LIT ])) ;) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT - (pointer_expression * IDENT)) >> LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression IDENT - IDENT) >> LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (binary_expression IDENT - IDENT) < IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT <= IDENT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT ))) ;) (return_statement return ;) })) (expression_statement (call_expression IDENT (argument_list ( (string_literal " string_content ") , (string_literal " string_content ") , IDENT , IDENT , (binary_expression (binary_expression IDENT - IDENT) >> LIT) , IDENT , IDENT ))) ;) })))
(function_definition "void FUN_00365250(long *param_1,long param_2,long param_3,long param_4,long param_5)\n\n{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  \n  uVar1 = param_1[1];\n  uVar2 = param_2 - *param_1 >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }\n                    \n  FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);\n}" (primitive_type "void") (function_declarator "FUN_00365250(long *param_1,long param_2,long param_3,long param_4,long param_5)" (identifier "FUN_00365250") (parameter_list "(long *param_1,long param_2,long param_3,long param_4,long param_5)" (( "(") (parameter_declaration "long *param_1" (sized_type_specifier "long" (long "long")) (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "long param_2" (sized_type_specifier "long" (long "long")) (identifier "param_2")) (, ",") (parameter_declaration "long param_3" (sized_type_specifier "long" (long "long")) (identifier "param_3")) (, ",") (parameter_declaration "long param_4" (sized_type_specifier "long" (long "long")) (identifier "param_4")) (, ",") (parameter_declaration "long param_5" (sized_type_specifier "long" (long "long")) (identifier "param_5")) () ")"))) (compound_statement "{\n  ulong uVar1;\n  ulong uVar2;\n  ulong uVar3;\n  \n  uVar1 = param_1[1];\n  uVar2 = param_2 - *param_1 >> 2;\n  uVar3 = param_3 - param_2 >> 2;\n  if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }\n  if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }\n                    \n  FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);\n}" ({ "{") (declaration "ulong uVar1;" (type_identifier "ulong") (identifier "uVar1") (; ";")) (declaration "ulong uVar2;" (type_identifier "ulong") (identifier "uVar2") (; ";")) (declaration "ulong uVar3;" (type_identifier "ulong") (identifier "uVar3") (; ";")) (expression_statement "uVar1 = param_1[1];" (assignment_expression "uVar1 = param_1[1]" (identifier "uVar1") (= "=") (subscript_expression "param_1[1]" (identifier "param_1") ([ "[") (number_literal "1") (] "]"))) (; ";")) (expression_statement "uVar2 = param_2 - *param_1 >> 2;" (assignment_expression "uVar2 = param_2 - *param_1 >> 2" (identifier "uVar2") (= "=") (binary_expression "param_2 - *param_1 >> 2" (binary_expression "param_2 - *param_1" (identifier "param_2") (- "-") (pointer_expression "*param_1" (* "*") (identifier "param_1"))) (>> ">>") (number_literal "2"))) (; ";")) (expression_statement "uVar3 = param_3 - param_2 >> 2;" (assignment_expression "uVar3 = param_3 - param_2 >> 2" (identifier "uVar3") (= "=") (binary_expression "param_3 - param_2 >> 2" (binary_expression "param_3 - param_2" (identifier "param_3") (- "-") (identifier "param_2")) (>> ">>") (number_literal "2"))) (; ";")) (if_statement "if (uVar1 - uVar2 < uVar3) {\n    uVar3 = uVar1 - uVar2;\n  }" (if "if") (parenthesized_expression "(uVar1 - uVar2 < uVar3)" (( "(") (binary_expression "uVar1 - uVar2 < uVar3" (binary_expression "uVar1 - uVar2" (identifier "uVar1") (- "-") (identifier "uVar2")) (< "<") (identifier "uVar3")) () ")")) (compound_statement "{\n    uVar3 = uVar1 - uVar2;\n  }" ({ "{") (expression_statement "uVar3 = uVar1 - uVar2;" (assignment_expression "uVar3 = uVar1 - uVar2" (identifier "uVar3") (= "=") (binary_expression "uVar1 - uVar2" (identifier "uVar1") (- "-") (identifier "uVar2"))) (; ";")) (} "}"))) (if_statement "if (uVar2 <= uVar1) {\n    FUN_002df740(param_1,uVar2);\n    return;\n  }" (if "if") (parenthesized_expression "(uVar2 <= uVar1)" (( "(") (binary_expression "uVar2 <= uVar1" (identifier "uVar2") (<= "<=") (identifier "uVar1")) () ")")) (compound_statement "{\n    FUN_002df740(param_1,uVar2);\n    return;\n  }" ({ "{") (expression_statement "FUN_002df740(param_1,uVar2);" (call_expression "FUN_002df740(param_1,uVar2)" (identifier "FUN_002df740") (argument_list "(param_1,uVar2)" (( "(") (identifier "param_1") (, ",") (identifier "uVar2") () ")"))) (; ";")) (return_statement "return;" (return "return") (; ";")) (} "}"))) (expression_statement "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);" (call_expression "FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3)" (identifier "FUN_00319620") (argument_list "("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",\n               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3)" (( "(") (string_literal ""%s: __pos (which is %zu) > this->size() (which is %zu)"" (" """) (string_content "%s: __pos (which is %zu) > this->size() (which is %zu)") (" """)) (, ",") (string_literal ""basic_string::replace"" (" """) (string_content "basic_string::replace") (" """)) (, ",") (identifier "uVar2") (, ",") (identifier "uVar1") (, ",") (binary_expression "param_5 - param_4 >> 2" (binary_expression "param_5 - param_4" (identifier "param_5") (- "-") (identifier "param_4")) (>> ">>") (number_literal "2")) (, ",") (identifier "uVar1") (, ",") (identifier "uVar3") () ")"))) (; ";")) (} "}")))

/* std::wstring::replace(__normal_iterator<wchar_t*, std::wstring >, __normal_iterator<wchar_t*,
   std::wstring >, wchar_t*, wchar_t*) */

void __thiscall
std::type_1::function_1(type_1 *var_1,long var_2,long var_3,type_2 *param_4,long var_4)

{
  type_3 var_5;
  type_3 var_6;
  type_3 var_7;
  type_3 uVar4;
  
  var_5 = *(type_3 *)(var_1 + 8);
  var_6 = var_2 - *(long *)var_1 >> 2;
  var_7 = var_3 - var_2 >> 2;
  uVar4 = var_4 - (long)param_4 >> 2;
  if (var_5 - var_6 < var_7) {
    var_7 = var_5 - var_6;
  }
  if (var_6 <= var_5) {
    var_8(var_1,var_6,var_7,param_4,uVar4);
    return;
  }
                    /* WARNING: Subroutine does not return */
  var_9
            ("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",var_6,
             var_5,uVar4,var_5,var_7);
}


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

void MASKED(long *param_1,long param_2,long param_3,long param_4,long param_5)

{
  ulong uVar1;
  ulong uVar2;
  ulong uVar3;
  
  uVar1 = param_1[1];
  uVar2 = param_2 - *param_1 >> 2;
  uVar3 = param_3 - param_2 >> 2;
  if (uVar1 - uVar2 < uVar3) {
    uVar3 = uVar1 - uVar2;
  }
  if (uVar2 <= uVar1) {
    FUN_002df740(param_1,uVar2);
    return;
  }
                    /* WARNING: Subroutine does not return */
  FUN_00319620("%s: __pos (which is %zu) > this->size() (which is %zu)","basic_string::replace",
               uVar2,uVar1,param_5 - param_4 >> 2,uVar1,uVar3);
}

