
/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* std::string::find_last_not_of(char const*, unsigned int, unsigned int) const */

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

{
  int iVar1;
  int iVar2;
  void *pvVar3;
  uint uVar4;
  
  uVar4 = 0xffffffff;
  iVar1 = *(int *)this;
  iVar2 = *(int *)(iVar1 + -0xc);
  if (iVar2 != 0) {
    uVar4 = iVar2 - 1;
    if (uVar4 <= param_2) {
      param_2 = uVar4;
    }
    do {
      if (param_3 == 0) {
        return param_2;
      }
      pvVar3 = memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3);
      if (pvVar3 == (void *)0x0) {
        return param_2;
      }
      uVar4 = param_2 - 1;
      param_2 = uVar4;
    } while (uVar4 != 0xffffffff);
  }
  return uVar4;
}



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

uint FUN_0021e2c0(int *param_1,void *param_2,uint param_3,size_t param_4)

{
  int iVar1;
  int iVar2;
  void *pvVar3;
  uint uVar4;
  
  uVar4 = 0xffffffff;
  iVar1 = *param_1;
  iVar2 = *(int *)(iVar1 + -0xc);
  if (iVar2 != 0) {
    uVar4 = iVar2 - 1;
    if (uVar4 <= param_3) {
      param_3 = uVar4;
    }
    do {
      if (param_4 == 0) {
        return param_3;
      }
      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);
      if (pvVar3 == (void *)0x0) {
        return param_3;
      }
      uVar4 = param_3 - 1;
      param_3 = uVar4;
    } while (uVar4 != 0xffffffff);
  }
  return uVar4;
}


PUSH EBP
MOV EBP,0xffffffff
PUSH EDI
PUSH ESI
PUSH EBX
CALL 0x00035840
ADD EBX,0x170d32
SUB ESP,0xc
MOV EAX,dword ptr [ESP + 0x20]
MOV ECX,dword ptr [ESP + 0x28]
MOV ESI,dword ptr [ESP + 0x2c]
MOV EDI,dword ptr [EAX]
MOV EAX,dword ptr [EDI + -0xc]
TEST EAX,EAX
JZ 0x0021e31b
LEA EDX,[EAX + -0x1]
CMP EDX,ECX
CMOVBE ECX,EDX
MOV EBP,ECX
TEST ESI,ESI
JZ 0x0021e31b
SUB ESP,0x4
PUSH ESI
MOVSX EAX,byte ptr [EDI + EBP*0x1]
PUSH EAX
PUSH dword ptr [ESP + 0x30]
CALL 0x00029970
ADD ESP,0x10
TEST EAX,EAX
JZ 0x0021e31b
SUB EBP,0x1
CMP EBP,-0x1
JNZ 0x0021e2f6
ADD ESP,0xc
MOV EAX,EBP
POP EBX
POP ESI
POP EDI
POP EBP
RET
(translation_unit "/* WARNING: Function: __i686.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n\nuint FUN_0021e2c0(int *param_1,void *param_2,uint param_3,size_t param_4)\n\n{\n  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *param_1;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}\n\n" comment (function_definition "uint FUN_0021e2c0(int *param_1,void *param_2,uint param_3,size_t param_4)\n\n{\n  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *param_1;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}" type_identifier (function_declarator "FUN_0021e2c0(int *param_1,void *param_2,uint param_3,size_t param_4)" identifier (parameter_list "(int *param_1,void *param_2,uint param_3,size_t param_4)" ( (parameter_declaration "int *param_1" primitive_type (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "void *param_2" primitive_type (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "uint param_3" type_identifier identifier) , (parameter_declaration "size_t param_4" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *param_1;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "void *pvVar3;" primitive_type (pointer_declarator "*pvVar3" * identifier) ;) (declaration "uint uVar4;" type_identifier identifier ;) (expression_statement "uVar4 = 0xffffffff;" (assignment_expression "uVar4 = 0xffffffff" identifier = number_literal) ;) (expression_statement "iVar1 = *param_1;" (assignment_expression "iVar1 = *param_1" identifier = (pointer_expression "*param_1" * identifier)) ;) (expression_statement "iVar2 = *(int *)(iVar1 + -0xc);" (assignment_expression "iVar2 = *(int *)(iVar1 + -0xc)" identifier = (pointer_expression "*(int *)(iVar1 + -0xc)" * (cast_expression "(int *)(iVar1 + -0xc)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar1 + -0xc)" ( (binary_expression "iVar1 + -0xc" identifier + number_literal) ))))) ;) (if_statement "if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }" if (parenthesized_expression "(iVar2 != 0)" ( (binary_expression "iVar2 != 0" identifier != number_literal) )) (compound_statement "{\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }" { (expression_statement "uVar4 = iVar2 - 1;" (assignment_expression "uVar4 = iVar2 - 1" identifier = (binary_expression "iVar2 - 1" identifier - number_literal)) ;) (if_statement "if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }" if (parenthesized_expression "(uVar4 <= param_3)" ( (binary_expression "uVar4 <= param_3" identifier <= identifier) )) (compound_statement "{\n      param_3 = uVar4;\n    }" { (expression_statement "param_3 = uVar4;" (assignment_expression "param_3 = uVar4" identifier = identifier) ;) })) (do_statement "do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);" do (compound_statement "{\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    }" { (if_statement "if (param_4 == 0) {\n        return param_3;\n      }" if (parenthesized_expression "(param_4 == 0)" ( (binary_expression "param_4 == 0" identifier == number_literal) )) (compound_statement "{\n        return param_3;\n      }" { (return_statement "return param_3;" return identifier ;) })) (expression_statement "pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);" (assignment_expression "pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4)" identifier = (call_expression "memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4)" identifier (argument_list "(param_2,(int)*(char *)(iVar1 + param_3),param_4)" ( identifier , (cast_expression "(int)*(char *)(iVar1 + param_3)" ( (type_descriptor "int" primitive_type) ) (pointer_expression "*(char *)(iVar1 + param_3)" * (cast_expression "(char *)(iVar1 + param_3)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar1 + param_3)" ( (binary_expression "iVar1 + param_3" identifier + identifier) ))))) , identifier )))) ;) (if_statement "if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }" if (parenthesized_expression "(pvVar3 == (void *)0x0)" ( (binary_expression "pvVar3 == (void *)0x0" identifier == (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        return param_3;\n      }" { (return_statement "return param_3;" return identifier ;) })) (expression_statement "uVar4 = param_3 - 1;" (assignment_expression "uVar4 = param_3 - 1" identifier = (binary_expression "param_3 - 1" identifier - number_literal)) ;) (expression_statement "param_3 = uVar4;" (assignment_expression "param_3 = uVar4" identifier = identifier) ;) }) while (parenthesized_expression "(uVar4 != 0xffffffff)" ( (binary_expression "uVar4 != 0xffffffff" identifier != number_literal) )) ;) })) (return_statement "return uVar4;" return identifier ;) })))
(translation_unit "/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */\n/* std::string::find_last_not_of(char const*, unsigned int, unsigned int) const */\n\nuint __thiscall std::string::find_last_not_of(string *this,char *param_1,uint param_2,uint param_3)\n\n{\n  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *(int *)this;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_2) {\n      param_2 = uVar4;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      pvVar3 = memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3);\n      if (pvVar3 == (void *)0x0) {\n        return param_2;\n      }\n      uVar4 = param_2 - 1;\n      param_2 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}\n\n" comment comment (function_definition "uint __thiscall std::string::find_last_not_of(string *this,char *param_1,uint param_2,uint param_3)\n\n{\n  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *(int *)this;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_2) {\n      param_2 = uVar4;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      pvVar3 = memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3);\n      if (pvVar3 == (void *)0x0) {\n        return param_2;\n      }\n      uVar4 = param_2 - 1;\n      param_2 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}" type_identifier (ms_call_modifier "__thiscall" __thiscall) (ERROR "std::string::" identifier : : identifier : :) (function_declarator "find_last_not_of(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  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *(int *)this;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_2) {\n      param_2 = uVar4;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      pvVar3 = memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3);\n      if (pvVar3 == (void *)0x0) {\n        return param_2;\n      }\n      uVar4 = param_2 - 1;\n      param_2 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "void *pvVar3;" primitive_type (pointer_declarator "*pvVar3" * identifier) ;) (declaration "uint uVar4;" type_identifier identifier ;) (expression_statement "uVar4 = 0xffffffff;" (assignment_expression "uVar4 = 0xffffffff" identifier = number_literal) ;) (expression_statement "iVar1 = *(int *)this;" (assignment_expression "iVar1 = *(int *)this" identifier = (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier))) ;) (expression_statement "iVar2 = *(int *)(iVar1 + -0xc);" (assignment_expression "iVar2 = *(int *)(iVar1 + -0xc)" identifier = (pointer_expression "*(int *)(iVar1 + -0xc)" * (cast_expression "(int *)(iVar1 + -0xc)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar1 + -0xc)" ( (binary_expression "iVar1 + -0xc" identifier + number_literal) ))))) ;) (if_statement "if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_2) {\n      param_2 = uVar4;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      pvVar3 = memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3);\n      if (pvVar3 == (void *)0x0) {\n        return param_2;\n      }\n      uVar4 = param_2 - 1;\n      param_2 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }" if (parenthesized_expression "(iVar2 != 0)" ( (binary_expression "iVar2 != 0" identifier != number_literal) )) (compound_statement "{\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_2) {\n      param_2 = uVar4;\n    }\n    do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      pvVar3 = memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3);\n      if (pvVar3 == (void *)0x0) {\n        return param_2;\n      }\n      uVar4 = param_2 - 1;\n      param_2 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }" { (expression_statement "uVar4 = iVar2 - 1;" (assignment_expression "uVar4 = iVar2 - 1" identifier = (binary_expression "iVar2 - 1" identifier - number_literal)) ;) (if_statement "if (uVar4 <= param_2) {\n      param_2 = uVar4;\n    }" if (parenthesized_expression "(uVar4 <= param_2)" ( (binary_expression "uVar4 <= param_2" identifier <= identifier) )) (compound_statement "{\n      param_2 = uVar4;\n    }" { (expression_statement "param_2 = uVar4;" (assignment_expression "param_2 = uVar4" identifier = identifier) ;) })) (do_statement "do {\n      if (param_3 == 0) {\n        return param_2;\n      }\n      pvVar3 = memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3);\n      if (pvVar3 == (void *)0x0) {\n        return param_2;\n      }\n      uVar4 = param_2 - 1;\n      param_2 = uVar4;\n    } while (uVar4 != 0xffffffff);" do (compound_statement "{\n      if (param_3 == 0) {\n        return param_2;\n      }\n      pvVar3 = memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3);\n      if (pvVar3 == (void *)0x0) {\n        return param_2;\n      }\n      uVar4 = param_2 - 1;\n      param_2 = uVar4;\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 "pvVar3 = memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3);" (assignment_expression "pvVar3 = memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3)" identifier = (call_expression "memchr(param_1,(int)*(char *)(iVar1 + param_2),param_3)" identifier (argument_list "(param_1,(int)*(char *)(iVar1 + param_2),param_3)" ( identifier , (cast_expression "(int)*(char *)(iVar1 + param_2)" ( (type_descriptor "int" primitive_type) ) (pointer_expression "*(char *)(iVar1 + param_2)" * (cast_expression "(char *)(iVar1 + param_2)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar1 + param_2)" ( (binary_expression "iVar1 + param_2" identifier + identifier) ))))) , identifier )))) ;) (if_statement "if (pvVar3 == (void *)0x0) {\n        return param_2;\n      }" if (parenthesized_expression "(pvVar3 == (void *)0x0)" ( (binary_expression "pvVar3 == (void *)0x0" identifier == (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        return param_2;\n      }" { (return_statement "return param_2;" return identifier ;) })) (expression_statement "uVar4 = param_2 - 1;" (assignment_expression "uVar4 = param_2 - 1" identifier = (binary_expression "param_2 - 1" identifier - number_literal)) ;) (expression_statement "param_2 = uVar4;" (assignment_expression "param_2 = uVar4" identifier = identifier) ;) }) while (parenthesized_expression "(uVar4 != 0xffffffff)" ( (binary_expression "uVar4 != 0xffffffff" identifier != number_literal) )) ;) })) (return_statement "return uVar4;" return identifier ;) })))
(translation_unit "uint FUN_0021e2c0(int *param_1,void *param_2,uint param_3,size_t param_4)\n\n{\n  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *param_1;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}\n\n" (function_definition "uint FUN_0021e2c0(int *param_1,void *param_2,uint param_3,size_t param_4)\n\n{\n  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *param_1;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}" type_identifier (function_declarator "FUN_0021e2c0(int *param_1,void *param_2,uint param_3,size_t param_4)" identifier (parameter_list "(int *param_1,void *param_2,uint param_3,size_t param_4)" ( (parameter_declaration "int *param_1" primitive_type (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "void *param_2" primitive_type (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "uint param_3" type_identifier identifier) , (parameter_declaration "size_t param_4" primitive_type identifier) ))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *param_1;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "void *pvVar3;" primitive_type (pointer_declarator "*pvVar3" * identifier) ;) (declaration "uint uVar4;" type_identifier identifier ;) (expression_statement "uVar4 = 0xffffffff;" (assignment_expression "uVar4 = 0xffffffff" identifier = number_literal) ;) (expression_statement "iVar1 = *param_1;" (assignment_expression "iVar1 = *param_1" identifier = (pointer_expression "*param_1" * identifier)) ;) (expression_statement "iVar2 = *(int *)(iVar1 + -0xc);" (assignment_expression "iVar2 = *(int *)(iVar1 + -0xc)" identifier = (pointer_expression "*(int *)(iVar1 + -0xc)" * (cast_expression "(int *)(iVar1 + -0xc)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar1 + -0xc)" ( (binary_expression "iVar1 + -0xc" identifier + number_literal) ))))) ;) (if_statement "if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }" if (parenthesized_expression "(iVar2 != 0)" ( (binary_expression "iVar2 != 0" identifier != number_literal) )) (compound_statement "{\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }" { (expression_statement "uVar4 = iVar2 - 1;" (assignment_expression "uVar4 = iVar2 - 1" identifier = (binary_expression "iVar2 - 1" identifier - number_literal)) ;) (if_statement "if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }" if (parenthesized_expression "(uVar4 <= param_3)" ( (binary_expression "uVar4 <= param_3" identifier <= identifier) )) (compound_statement "{\n      param_3 = uVar4;\n    }" { (expression_statement "param_3 = uVar4;" (assignment_expression "param_3 = uVar4" identifier = identifier) ;) })) (do_statement "do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);" do (compound_statement "{\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    }" { (if_statement "if (param_4 == 0) {\n        return param_3;\n      }" if (parenthesized_expression "(param_4 == 0)" ( (binary_expression "param_4 == 0" identifier == number_literal) )) (compound_statement "{\n        return param_3;\n      }" { (return_statement "return param_3;" return identifier ;) })) (expression_statement "pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);" (assignment_expression "pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4)" identifier = (call_expression "memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4)" identifier (argument_list "(param_2,(int)*(char *)(iVar1 + param_3),param_4)" ( identifier , (cast_expression "(int)*(char *)(iVar1 + param_3)" ( (type_descriptor "int" primitive_type) ) (pointer_expression "*(char *)(iVar1 + param_3)" * (cast_expression "(char *)(iVar1 + param_3)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar1 + param_3)" ( (binary_expression "iVar1 + param_3" identifier + identifier) ))))) , identifier )))) ;) (if_statement "if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }" if (parenthesized_expression "(pvVar3 == (void *)0x0)" ( (binary_expression "pvVar3 == (void *)0x0" identifier == (cast_expression "(void *)0x0" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        return param_3;\n      }" { (return_statement "return param_3;" return identifier ;) })) (expression_statement "uVar4 = param_3 - 1;" (assignment_expression "uVar4 = param_3 - 1" identifier = (binary_expression "param_3 - 1" identifier - number_literal)) ;) (expression_statement "param_3 = uVar4;" (assignment_expression "param_3 = uVar4" identifier = identifier) ;) }) while (parenthesized_expression "(uVar4 != 0xffffffff)" ( (binary_expression "uVar4 != 0xffffffff" identifier != number_literal) )) ;) })) (return_statement "return uVar4;" return identifier ;) })))
(translation_unit (function_definition TYPE (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 (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * 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 != LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT - LIT)) ;) (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 IDENT (argument_list ( IDENT , (cast_expression ( (type_descriptor TYPE) ) (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + IDENT) ))))) , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - LIT)) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) }) while (parenthesized_expression ( (binary_expression IDENT != LIT) )) ;) })) (return_statement return IDENT ;) })))
(function_definition "uint FUN_0021e2c0(int *param_1,void *param_2,uint param_3,size_t param_4)\n\n{\n  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *param_1;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}" (type_identifier "uint") (function_declarator "FUN_0021e2c0(int *param_1,void *param_2,uint param_3,size_t param_4)" (identifier "FUN_0021e2c0") (parameter_list "(int *param_1,void *param_2,uint param_3,size_t param_4)" (( "(") (parameter_declaration "int *param_1" (primitive_type "int") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "void *param_2" (primitive_type "void") (pointer_declarator "*param_2" (* "*") (identifier "param_2"))) (, ",") (parameter_declaration "uint param_3" (type_identifier "uint") (identifier "param_3")) (, ",") (parameter_declaration "size_t param_4" (primitive_type "size_t") (identifier "param_4")) () ")"))) (compound_statement "{\n  int iVar1;\n  int iVar2;\n  void *pvVar3;\n  uint uVar4;\n  \n  uVar4 = 0xffffffff;\n  iVar1 = *param_1;\n  iVar2 = *(int *)(iVar1 + -0xc);\n  if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }\n  return uVar4;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "void *pvVar3;" (primitive_type "void") (pointer_declarator "*pvVar3" (* "*") (identifier "pvVar3")) (; ";")) (declaration "uint uVar4;" (type_identifier "uint") (identifier "uVar4") (; ";")) (expression_statement "uVar4 = 0xffffffff;" (assignment_expression "uVar4 = 0xffffffff" (identifier "uVar4") (= "=") (number_literal "0xffffffff")) (; ";")) (expression_statement "iVar1 = *param_1;" (assignment_expression "iVar1 = *param_1" (identifier "iVar1") (= "=") (pointer_expression "*param_1" (* "*") (identifier "param_1"))) (; ";")) (expression_statement "iVar2 = *(int *)(iVar1 + -0xc);" (assignment_expression "iVar2 = *(int *)(iVar1 + -0xc)" (identifier "iVar2") (= "=") (pointer_expression "*(int *)(iVar1 + -0xc)" (* "*") (cast_expression "(int *)(iVar1 + -0xc)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(iVar1 + -0xc)" (( "(") (binary_expression "iVar1 + -0xc" (identifier "iVar1") (+ "+") (number_literal "-0xc")) () ")"))))) (; ";")) (if_statement "if (iVar2 != 0) {\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }" (if "if") (parenthesized_expression "(iVar2 != 0)" (( "(") (binary_expression "iVar2 != 0" (identifier "iVar2") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    uVar4 = iVar2 - 1;\n    if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }\n    do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);\n  }" ({ "{") (expression_statement "uVar4 = iVar2 - 1;" (assignment_expression "uVar4 = iVar2 - 1" (identifier "uVar4") (= "=") (binary_expression "iVar2 - 1" (identifier "iVar2") (- "-") (number_literal "1"))) (; ";")) (if_statement "if (uVar4 <= param_3) {\n      param_3 = uVar4;\n    }" (if "if") (parenthesized_expression "(uVar4 <= param_3)" (( "(") (binary_expression "uVar4 <= param_3" (identifier "uVar4") (<= "<=") (identifier "param_3")) () ")")) (compound_statement "{\n      param_3 = uVar4;\n    }" ({ "{") (expression_statement "param_3 = uVar4;" (assignment_expression "param_3 = uVar4" (identifier "param_3") (= "=") (identifier "uVar4")) (; ";")) (} "}"))) (do_statement "do {\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    } while (uVar4 != 0xffffffff);" (do "do") (compound_statement "{\n      if (param_4 == 0) {\n        return param_3;\n      }\n      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);\n      if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }\n      uVar4 = param_3 - 1;\n      param_3 = uVar4;\n    }" ({ "{") (if_statement "if (param_4 == 0) {\n        return param_3;\n      }" (if "if") (parenthesized_expression "(param_4 == 0)" (( "(") (binary_expression "param_4 == 0" (identifier "param_4") (== "==") (number_literal "0")) () ")")) (compound_statement "{\n        return param_3;\n      }" ({ "{") (return_statement "return param_3;" (return "return") (identifier "param_3") (; ";")) (} "}"))) (expression_statement "pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);" (assignment_expression "pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4)" (identifier "pvVar3") (= "=") (call_expression "memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4)" (identifier "memchr") (argument_list "(param_2,(int)*(char *)(iVar1 + param_3),param_4)" (( "(") (identifier "param_2") (, ",") (cast_expression "(int)*(char *)(iVar1 + param_3)" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (pointer_expression "*(char *)(iVar1 + param_3)" (* "*") (cast_expression "(char *)(iVar1 + param_3)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(iVar1 + param_3)" (( "(") (binary_expression "iVar1 + param_3" (identifier "iVar1") (+ "+") (identifier "param_3")) () ")"))))) (, ",") (identifier "param_4") () ")")))) (; ";")) (if_statement "if (pvVar3 == (void *)0x0) {\n        return param_3;\n      }" (if "if") (parenthesized_expression "(pvVar3 == (void *)0x0)" (( "(") (binary_expression "pvVar3 == (void *)0x0" (identifier "pvVar3") (== "==") (cast_expression "(void *)0x0" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n        return param_3;\n      }" ({ "{") (return_statement "return param_3;" (return "return") (identifier "param_3") (; ";")) (} "}"))) (expression_statement "uVar4 = param_3 - 1;" (assignment_expression "uVar4 = param_3 - 1" (identifier "uVar4") (= "=") (binary_expression "param_3 - 1" (identifier "param_3") (- "-") (number_literal "1"))) (; ";")) (expression_statement "param_3 = uVar4;" (assignment_expression "param_3 = uVar4" (identifier "param_3") (= "=") (identifier "uVar4")) (; ";")) (} "}")) (while "while") (parenthesized_expression "(uVar4 != 0xffffffff)" (( "(") (binary_expression "uVar4 != 0xffffffff" (identifier "uVar4") (!= "!=") (number_literal "0xffffffff")) () ")")) (; ";")) (} "}"))) (return_statement "return uVar4;" (return "return") (identifier "uVar4") (; ";")) (} "}")))

/* WARNING: Function: __x86.get_pc_thunk.bx replaced with injection: get_pc_thunk_bx */
/* std::string::find_last_not_of(char const*, unsigned int, unsigned int) const */

type_1 __thiscall std::type_2::function_1(type_2 *this,char *param_1,type_1 var_4,type_1 var_5)

{
  int var_1;
  int var_2;
  void *var_7;
  type_1 var_3;
  
  var_3 = 0xffffffff;
  var_1 = *(int *)this;
  var_2 = *(int *)(var_1 + -0xc);
  if (var_2 != 0) {
    var_3 = var_2 - 1;
    if (var_3 <= var_4) {
      var_4 = var_3;
    }
    do {
      if (var_5 == 0) {
        return var_4;
      }
      var_7 = var_6(param_1,(int)*(char *)(var_1 + var_4),var_5);
      if (var_7 == (void *)0x0) {
        return var_4;
      }
      var_3 = var_4 - 1;
      var_4 = var_3;
    } while (var_3 != 0xffffffff);
  }
  return var_3;
}


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

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

uint MASKED(int *param_1,void *param_2,uint param_3,size_t param_4)

{
  int iVar1;
  int iVar2;
  void *pvVar3;
  uint uVar4;
  
  uVar4 = 0xffffffff;
  iVar1 = *param_1;
  iVar2 = *(int *)(iVar1 + -0xc);
  if (iVar2 != 0) {
    uVar4 = iVar2 - 1;
    if (uVar4 <= param_3) {
      param_3 = uVar4;
    }
    do {
      if (param_4 == 0) {
        return param_3;
      }
      pvVar3 = memchr(param_2,(int)*(char *)(iVar1 + param_3),param_4);
      if (pvVar3 == (void *)0x0) {
        return param_3;
      }
      uVar4 = param_3 - 1;
      param_3 = uVar4;
    } while (uVar4 != 0xffffffff);
  }
  return uVar4;
}

