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

uint __thiscall std::string::rfind(string *this,char *param_1,uint param_2,uint param_3)

{
  bool bVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  
  uVar2 = *(uint *)(this + 4) - param_3;
  if (param_3 <= *(uint *)(this + 4)) {
    iVar4 = *(int *)this;
    if (uVar2 <= param_2) {
      param_2 = uVar2;
    }
    do {
      if (param_3 == 0) {
        return param_2;
      }
      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);
      if (iVar3 == 0) {
        return param_2;
      }
      bVar1 = param_2 != 0;
      param_2 = param_2 - 1;
    } while (bVar1);
  }
  return 0xffffffff;
}



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

uint __thiscall std::string::rfind(string *this,char *param_1,uint param_2,uint param_3)

{
  bool bVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  
  uVar2 = *(uint *)(this + 4) - param_3;
  if (param_3 <= *(uint *)(this + 4)) {
    iVar4 = *(int *)this;
    if (uVar2 <= param_2) {
      param_2 = uVar2;
    }
    do {
      if (param_3 == 0) {
        return param_2;
      }
      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);
      if (iVar3 == 0) {
        return param_2;
      }
      bVar1 = param_2 != 0;
      param_2 = param_2 - 1;
    } while (bVar1);
  }
  return 0xffffffff;
}


lui gp,0x19
addiu gp,gp,-0x4350
addu gp,gp,t9
addiu sp,sp,-0x30
sw gp,0x10(sp)
sw ra,0x2c(sp)
sw s3,0x28(sp)
sw s2,0x24(sp)
sw s1,0x20(sp)
sw s0,0x1c(sp)
lw v0,0x4(a0)
sltu v1,v0,a3
bne v1,zero,0x0033d63c
_subu v0,v0,a3
lw s3,0x0(a0)
or s1,a3,zero
lw t9,-0x354c(gp)
sltu s0,a2,v0
movz a2,v0,s0
or s2,a1,zero
or s0,a2,zero
addu a0,s3,s0
beq s1,zero,0x0033d61c
_or a2,s1,zero
jalr t9
_or a1,s2,zero
addiu v1,s0,-0x1
beq v0,zero,0x0033d61c
_lw gp,0x10(sp)
beq s0,zero,0x0033d63c
_or s0,v1,zero
lw t9,-0x354c(gp)
addu a0,s3,s0
bne s1,zero,0x0033d5f0
_or a2,s1,zero
lw ra,0x2c(sp)
or v0,s0,zero
lw s3,0x28(sp)
lw s2,0x24(sp)
lw s1,0x20(sp)
lw s0,0x1c(sp)
jr ra
_addiu sp,sp,0x30
lw ra,0x2c(sp)
li s0,-0x1
lw s3,0x28(sp)
or v0,s0,zero
lw s2,0x24(sp)
lw s1,0x20(sp)
lw s0,0x1c(sp)
jr ra
_addiu sp,sp,0x30
(translation_unit "/* std::string::rfind(char const*, unsigned int, unsigned int) const */\n\nuint __thiscall std::string::rfind(string *this,char *param_1,uint param_2,uint param_3)\n\n{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}\n\n" comment (function_definition "uint __thiscall std::string::rfind(string *this,char *param_1,uint param_2,uint param_3)\n\n{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}" type_identifier (ms_call_modifier "__thiscall" __thiscall) (ERROR "std::string::" identifier : : identifier : :) (function_declarator "rfind(string *this,char *param_1,uint param_2,uint param_3)" identifier (parameter_list "(string *this,char *param_1,uint param_2,uint param_3)" ( (parameter_declaration "string *this" type_identifier (pointer_declarator "*this" * identifier)) , (parameter_declaration "char *param_1" primitive_type (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "uint param_2" type_identifier identifier) , (parameter_declaration "uint param_3" type_identifier identifier) ))) (compound_statement "{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}" { (declaration "bool bVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (expression_statement "uVar2 = *(uint *)(this + 4) - param_3;" (assignment_expression "uVar2 = *(uint *)(this + 4) - param_3" identifier = (binary_expression "*(uint *)(this + 4) - param_3" (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) )))) - identifier)) ;) (if_statement "if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }" if (parenthesized_expression "(param_3 <= *(uint *)(this + 4))" ( (binary_expression "param_3 <= *(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) ))))) )) (compound_statement "{\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }" { (expression_statement "iVar4 = *(int *)this;" (assignment_expression "iVar4 = *(int *)this" identifier = (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier))) ;) (if_statement "if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }" if (parenthesized_expression "(uVar2 <= param_2)" ( (binary_expression "uVar2 <= param_2" identifier <= identifier) )) (compound_statement "{\n      param_2 = uVar2;\n    }" { (expression_statement "param_2 = uVar2;" (assignment_expression "param_2 = uVar2" identifier = identifier) ;) })) (do_statement "do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);" do (compound_statement "{\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    }" { (if_statement "if (param_3 == 0) {\n        return param_2;\n      }" if (parenthesized_expression "(param_3 == 0)" ( (binary_expression "param_3 == 0" identifier == number_literal) )) (compound_statement "{\n        return param_2;\n      }" { (return_statement "return param_2;" return identifier ;) })) (expression_statement "iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);" (assignment_expression "iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3)" identifier = (call_expression "(*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3)" (parenthesized_expression "(*(code *)PTR_memcmp_004c5cf4)" ( (pointer_expression "*(code *)PTR_memcmp_004c5cf4" * (cast_expression "(code *)PTR_memcmp_004c5cf4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar4 + param_2,param_1,param_3)" ( (binary_expression "iVar4 + param_2" identifier + identifier) , identifier , identifier )))) ;) (if_statement "if (iVar3 == 0) {\n        return param_2;\n      }" if (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) )) (compound_statement "{\n        return param_2;\n      }" { (return_statement "return param_2;" return identifier ;) })) (expression_statement "bVar1 = param_2 != 0;" (assignment_expression "bVar1 = param_2 != 0" identifier = (binary_expression "param_2 != 0" identifier != number_literal)) ;) (expression_statement "param_2 = param_2 - 1;" (assignment_expression "param_2 = param_2 - 1" identifier = (binary_expression "param_2 - 1" identifier - number_literal)) ;) }) while (parenthesized_expression "(bVar1)" ( identifier )) ;) })) (return_statement "return 0xffffffff;" return number_literal ;) })))
(translation_unit "/* std::string::rfind(char const*, unsigned int, unsigned int) const */\n\nuint __thiscall std::string::rfind(string *this,char *param_1,uint param_2,uint param_3)\n\n{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}\n\n" comment (function_definition "uint __thiscall std::string::rfind(string *this,char *param_1,uint param_2,uint param_3)\n\n{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}" type_identifier (ms_call_modifier "__thiscall" __thiscall) (ERROR "std::string::" identifier : : identifier : :) (function_declarator "rfind(string *this,char *param_1,uint param_2,uint param_3)" identifier (parameter_list "(string *this,char *param_1,uint param_2,uint param_3)" ( (parameter_declaration "string *this" type_identifier (pointer_declarator "*this" * identifier)) , (parameter_declaration "char *param_1" primitive_type (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "uint param_2" type_identifier identifier) , (parameter_declaration "uint param_3" type_identifier identifier) ))) (compound_statement "{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}" { (declaration "bool bVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (expression_statement "uVar2 = *(uint *)(this + 4) - param_3;" (assignment_expression "uVar2 = *(uint *)(this + 4) - param_3" identifier = (binary_expression "*(uint *)(this + 4) - param_3" (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) )))) - identifier)) ;) (if_statement "if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }" if (parenthesized_expression "(param_3 <= *(uint *)(this + 4))" ( (binary_expression "param_3 <= *(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) ))))) )) (compound_statement "{\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }" { (expression_statement "iVar4 = *(int *)this;" (assignment_expression "iVar4 = *(int *)this" identifier = (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier))) ;) (if_statement "if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }" if (parenthesized_expression "(uVar2 <= param_2)" ( (binary_expression "uVar2 <= param_2" identifier <= identifier) )) (compound_statement "{\n      param_2 = uVar2;\n    }" { (expression_statement "param_2 = uVar2;" (assignment_expression "param_2 = uVar2" identifier = identifier) ;) })) (do_statement "do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);" do (compound_statement "{\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    }" { (if_statement "if (param_3 == 0) {\n        return param_2;\n      }" if (parenthesized_expression "(param_3 == 0)" ( (binary_expression "param_3 == 0" identifier == number_literal) )) (compound_statement "{\n        return param_2;\n      }" { (return_statement "return param_2;" return identifier ;) })) (expression_statement "iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);" (assignment_expression "iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3)" identifier = (call_expression "(*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3)" (parenthesized_expression "(*(code *)PTR_memcmp_004c5cf4)" ( (pointer_expression "*(code *)PTR_memcmp_004c5cf4" * (cast_expression "(code *)PTR_memcmp_004c5cf4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar4 + param_2,param_1,param_3)" ( (binary_expression "iVar4 + param_2" identifier + identifier) , identifier , identifier )))) ;) (if_statement "if (iVar3 == 0) {\n        return param_2;\n      }" if (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) )) (compound_statement "{\n        return param_2;\n      }" { (return_statement "return param_2;" return identifier ;) })) (expression_statement "bVar1 = param_2 != 0;" (assignment_expression "bVar1 = param_2 != 0" identifier = (binary_expression "param_2 != 0" identifier != number_literal)) ;) (expression_statement "param_2 = param_2 - 1;" (assignment_expression "param_2 = param_2 - 1" identifier = (binary_expression "param_2 - 1" identifier - number_literal)) ;) }) while (parenthesized_expression "(bVar1)" ( identifier )) ;) })) (return_statement "return 0xffffffff;" return number_literal ;) })))
(translation_unit "uint __thiscall std::string::rfind(string *this,char *param_1,uint param_2,uint param_3)\n\n{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}\n\n" (function_definition "uint __thiscall std::string::rfind(string *this,char *param_1,uint param_2,uint param_3)\n\n{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}" type_identifier (ms_call_modifier "__thiscall" __thiscall) (ERROR "std::string::" identifier : : identifier : :) (function_declarator "rfind(string *this,char *param_1,uint param_2,uint param_3)" identifier (parameter_list "(string *this,char *param_1,uint param_2,uint param_3)" ( (parameter_declaration "string *this" type_identifier (pointer_declarator "*this" * identifier)) , (parameter_declaration "char *param_1" primitive_type (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "uint param_2" type_identifier identifier) , (parameter_declaration "uint param_3" type_identifier identifier) ))) (compound_statement "{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}" { (declaration "bool bVar1;" primitive_type identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "int iVar4;" primitive_type identifier ;) (expression_statement "uVar2 = *(uint *)(this + 4) - param_3;" (assignment_expression "uVar2 = *(uint *)(this + 4) - param_3" identifier = (binary_expression "*(uint *)(this + 4) - param_3" (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) )))) - identifier)) ;) (if_statement "if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }" if (parenthesized_expression "(param_3 <= *(uint *)(this + 4))" ( (binary_expression "param_3 <= *(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) ))))) )) (compound_statement "{\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }" { (expression_statement "iVar4 = *(int *)this;" (assignment_expression "iVar4 = *(int *)this" identifier = (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier))) ;) (if_statement "if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }" if (parenthesized_expression "(uVar2 <= param_2)" ( (binary_expression "uVar2 <= param_2" identifier <= identifier) )) (compound_statement "{\n      param_2 = uVar2;\n    }" { (expression_statement "param_2 = uVar2;" (assignment_expression "param_2 = uVar2" identifier = identifier) ;) })) (do_statement "do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);" do (compound_statement "{\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    }" { (if_statement "if (param_3 == 0) {\n        return param_2;\n      }" if (parenthesized_expression "(param_3 == 0)" ( (binary_expression "param_3 == 0" identifier == number_literal) )) (compound_statement "{\n        return param_2;\n      }" { (return_statement "return param_2;" return identifier ;) })) (expression_statement "iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);" (assignment_expression "iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3)" identifier = (call_expression "(*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3)" (parenthesized_expression "(*(code *)PTR_memcmp_004c5cf4)" ( (pointer_expression "*(code *)PTR_memcmp_004c5cf4" * (cast_expression "(code *)PTR_memcmp_004c5cf4" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (argument_list "(iVar4 + param_2,param_1,param_3)" ( (binary_expression "iVar4 + param_2" identifier + identifier) , identifier , identifier )))) ;) (if_statement "if (iVar3 == 0) {\n        return param_2;\n      }" if (parenthesized_expression "(iVar3 == 0)" ( (binary_expression "iVar3 == 0" identifier == number_literal) )) (compound_statement "{\n        return param_2;\n      }" { (return_statement "return param_2;" return identifier ;) })) (expression_statement "bVar1 = param_2 != 0;" (assignment_expression "bVar1 = param_2 != 0" identifier = (binary_expression "param_2 != 0" identifier != number_literal)) ;) (expression_statement "param_2 = param_2 - 1;" (assignment_expression "param_2 = param_2 - 1" identifier = (binary_expression "param_2 - 1" identifier - number_literal)) ;) }) while (parenthesized_expression "(bVar1)" ( identifier )) ;) })) (return_statement "return 0xffffffff;" return number_literal ;) })))
(translation_unit (function_definition TYPE (ms_call_modifier __thiscall) (ERROR IDENT : : IDENT : :) (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = (binary_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) - IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT <= (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT <= IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) })) (do_statement do (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (argument_list ( (binary_expression IDENT + IDENT) , IDENT , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT != LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - LIT)) ;) }) while (parenthesized_expression ( IDENT )) ;) })) (return_statement return LIT ;) })))
(function_definition "uint __thiscall std::string::rfind(string *this,char *param_1,uint param_2,uint param_3)\n\n{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}" (type_identifier "uint") (ms_call_modifier "__thiscall" (__thiscall "__thiscall")) (ERROR "std::string::" (identifier "std") (: ":") (: ":") (identifier "string") (: ":") (: ":")) (function_declarator "rfind(string *this,char *param_1,uint param_2,uint param_3)" (identifier "rfind") (parameter_list "(string *this,char *param_1,uint param_2,uint param_3)" (( "(") (parameter_declaration "string *this" (type_identifier "string") (pointer_declarator "*this" (* "*") (identifier "this"))) (, ",") (parameter_declaration "char *param_1" (primitive_type "char") (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")) () ")"))) (compound_statement "{\n  bool bVar1;\n  uint uVar2;\n  int iVar3;\n  int iVar4;\n  \n  uVar2 = *(uint *)(this + 4) - param_3;\n  if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }\n  return 0xffffffff;\n}" ({ "{") (declaration "bool bVar1;" (primitive_type "bool") (identifier "bVar1") (; ";")) (declaration "uint uVar2;" (type_identifier "uint") (identifier "uVar2") (; ";")) (declaration "int iVar3;" (primitive_type "int") (identifier "iVar3") (; ";")) (declaration "int iVar4;" (primitive_type "int") (identifier "iVar4") (; ";")) (expression_statement "uVar2 = *(uint *)(this + 4) - param_3;" (assignment_expression "uVar2 = *(uint *)(this + 4) - param_3" (identifier "uVar2") (= "=") (binary_expression "*(uint *)(this + 4) - param_3" (pointer_expression "*(uint *)(this + 4)" (* "*") (cast_expression "(uint *)(this + 4)" (( "(") (type_descriptor "uint *" (type_identifier "uint") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(this + 4)" (( "(") (binary_expression "this + 4" (identifier "this") (+ "+") (number_literal "4")) () ")")))) (- "-") (identifier "param_3"))) (; ";")) (if_statement "if (param_3 <= *(uint *)(this + 4)) {\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }" (if "if") (parenthesized_expression "(param_3 <= *(uint *)(this + 4))" (( "(") (binary_expression "param_3 <= *(uint *)(this + 4)" (identifier "param_3") (<= "<=") (pointer_expression "*(uint *)(this + 4)" (* "*") (cast_expression "(uint *)(this + 4)" (( "(") (type_descriptor "uint *" (type_identifier "uint") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(this + 4)" (( "(") (binary_expression "this + 4" (identifier "this") (+ "+") (number_literal "4")) () ")"))))) () ")")) (compound_statement "{\n    iVar4 = *(int *)this;\n    if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);\n  }" ({ "{") (expression_statement "iVar4 = *(int *)this;" (assignment_expression "iVar4 = *(int *)this" (identifier "iVar4") (= "=") (pointer_expression "*(int *)this" (* "*") (cast_expression "(int *)this" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "this")))) (; ";")) (if_statement "if (uVar2 <= param_2) {\n      param_2 = uVar2;\n    }" (if "if") (parenthesized_expression "(uVar2 <= param_2)" (( "(") (binary_expression "uVar2 <= param_2" (identifier "uVar2") (<= "<=") (identifier "param_2")) () ")")) (compound_statement "{\n      param_2 = uVar2;\n    }" ({ "{") (expression_statement "param_2 = uVar2;" (assignment_expression "param_2 = uVar2" (identifier "param_2") (= "=") (identifier "uVar2")) (; ";")) (} "}"))) (do_statement "do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    } while (bVar1);" (do "do") (compound_statement "{\n      if (param_3 == 0) {\n        return param_2;\n      }\n      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);\n      if (iVar3 == 0) {\n        return param_2;\n      }\n      bVar1 = param_2 != 0;\n      param_2 = param_2 - 1;\n    }" ({ "{") (if_statement "if (param_3 == 0) {\n        return param_2;\n      }" (if "if") (parenthesized_expression "(param_3 == 0)" (( "(") (binary_expression "param_3 == 0" (identifier "param_3") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        return param_2;\n      }" ({ "{") (return_statement "return param_2;" (return "return") (identifier "param_2") (; ";")) (} "}"))) (expression_statement "iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);" (assignment_expression "iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3)" (identifier "iVar3") (= "=") (call_expression "(*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3)" (parenthesized_expression "(*(code *)PTR_memcmp_004c5cf4)" (( "(") (pointer_expression "*(code *)PTR_memcmp_004c5cf4" (* "*") (cast_expression "(code *)PTR_memcmp_004c5cf4" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_memcmp_004c5cf4"))) () ")")) (argument_list "(iVar4 + param_2,param_1,param_3)" (( "(") (binary_expression "iVar4 + param_2" (identifier "iVar4") (+ "+") (identifier "param_2")) (, ",") (identifier "param_1") (, ",") (identifier "param_3") () ")")))) (; ";")) (if_statement "if (iVar3 == 0) {\n        return param_2;\n      }" (if "if") (parenthesized_expression "(iVar3 == 0)" (( "(") (binary_expression "iVar3 == 0" (identifier "iVar3") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        return param_2;\n      }" ({ "{") (return_statement "return param_2;" (return "return") (identifier "param_2") (; ";")) (} "}"))) (expression_statement "bVar1 = param_2 != 0;" (assignment_expression "bVar1 = param_2 != 0" (identifier "bVar1") (= "=") (binary_expression "param_2 != 0" (identifier "param_2") (!= "!=") (number_literal "0"))) (; ";")) (expression_statement "param_2 = param_2 - 1;" (assignment_expression "param_2 = param_2 - 1" (identifier "param_2") (= "=") (binary_expression "param_2 - 1" (identifier "param_2") (- "-") (number_literal "1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(bVar1)" (( "(") (identifier "bVar1") () ")")) (; ";")) (} "}"))) (return_statement "return 0xffffffff;" (return "return") (number_literal "0xffffffff") (; ";")) (} "}")))

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

type_1 __thiscall std::type_2::function_1(type_2 *var_1,char *param_1,type_1 var_4,type_1 var_2)

{
  bool bVar1;
  type_1 var_3;
  int var_6;
  int var_5;
  
  var_3 = *(type_1 *)(var_1 + 4) - var_2;
  if (var_2 <= *(type_1 *)(var_1 + 4)) {
    var_5 = *(int *)var_1;
    if (var_3 <= var_4) {
      var_4 = var_3;
    }
    do {
      if (var_2 == 0) {
        return var_4;
      }
      var_6 = (*(type_3 *)PTR_memcmp_004c5cf4)(var_5 + var_4,param_1,var_2);
      if (var_6 == 0) {
        return var_4;
      }
      bVar1 = var_4 != 0;
      var_4 = var_4 - 1;
    } while (bVar1);
  }
  return 0xffffffff;
}


(translation_unit (function_definition type: (type_identifier) (ms_call_modifier) (ERROR (identifier) (identifier)) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (identifier)))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (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))))) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_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))))))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (do_statement body: (compound_statement (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (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: (identifier)) (identifier) (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal))))) condition: (parenthesized_expression (identifier))))) (return_statement (number_literal)))))

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

uint __thiscall std::string::MASKED(string *this,char *param_1,uint param_2,uint param_3)

{
  bool bVar1;
  uint uVar2;
  int iVar3;
  int iVar4;
  
  uVar2 = *(uint *)(this + 4) - param_3;
  if (param_3 <= *(uint *)(this + 4)) {
    iVar4 = *(int *)this;
    if (uVar2 <= param_2) {
      param_2 = uVar2;
    }
    do {
      if (param_3 == 0) {
        return param_2;
      }
      iVar3 = (*(code *)PTR_memcmp_004c5cf4)(iVar4 + param_2,param_1,param_3);
      if (iVar3 == 0) {
        return param_2;
      }
      bVar1 = param_2 != 0;
      param_2 = param_2 - 1;
    } while (bVar1);
  }
  return 0xffffffff;
}

