
/* std::__codecvt_utf8_base<char16_t>::do_length(__mbstate_t&, char const*, char const*, unsigned
   int) const */

int __thiscall
std::__codecvt_utf8_base<char16_t>::do_length
          (__codecvt_utf8_base<char16_t> *this,__mbstate_t *param_1,char *param_2,char *param_3,
          uint param_4)

{
  uint uVar1;
  uint uVar2;
  range *in_stack_ffffffe0;
  unsigned_char *in_stack_ffffffe4;
  char *local_18;
  char *local_14;
  
  uVar2 = *(uint *)(this + 8);
  local_18 = param_2;
  local_14 = param_3;
  if (((byte)this[0xc] & 4) != 0) {
    (anonymous_namespace)::read_bom<char_const,true,3u>(in_stack_ffffffe0,in_stack_ffffffe4);
  }
  if (0xfffe < uVar2) {
    uVar2 = 0xffff;
  }
  if (param_4 != 0) {
    do {
      param_4 = param_4 - 1;
      uVar1 = (anonymous_namespace)::read_utf8_code_point((range *)&local_18,uVar2);
    } while (param_4 != 0 && uVar1 <= uVar2);
  }
  return (int)local_18 - (int)param_2;
}



undefined4 FUN_002d0400(int param_1)

{
  uint uVar1;
  uint uVar2;
  int in_stack_00000014;
  
  uVar2 = *(uint *)(param_1 + 8);
  if ((*(byte *)(param_1 + 0xc) & 4) != 0) {
    FUN_002d0190();
  }
  if (0xfffe < uVar2) {
    uVar2 = 0xffff;
  }
  if (in_stack_00000014 != 0) {
    do {
      in_stack_00000014 = in_stack_00000014 + -1;
      uVar1 = FUN_002ced50();
    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);
  }
  return 0;
}


PUSH EBP
PUSH EDI
PUSH ESI
PUSH EBX
SUB ESP,0x10
MOV EAX,dword ptr [ESP + 0x24]
MOV ECX,dword ptr [ESP + 0x2c]
MOV EDX,dword ptr [ESP + 0x30]
MOV EBP,dword ptr [ESP + 0x34]
MOV EBX,dword ptr [EAX + 0x8]
MOV dword ptr [ESP + 0x8],ECX
MOV dword ptr [ESP + 0xc],EDX
TEST byte ptr [EAX + 0xc],0x4
JNZ 0x002d0478
CMP EBX,0xffff
MOV EAX,0xffff
LEA ESI,[EBP + -0x1]
CMOVNC EBX,EAX
TEST EBP,EBP
JZ 0x002d0462
LEA EDI,[ESP + 0x8]
LEA ESI,[ESI]
MOV EDX,EBX
MOV EAX,EDI
CALL 0x002ced50
TEST ESI,ESI
SETNZ DL
CMP EBX,EAX
SETNC AL
SUB ESI,0x1
TEST DL,AL
JNZ 0x002d0448
MOV EAX,dword ptr [ESP + 0x8]
SUB EAX,dword ptr [ESP + 0x2c]
ADD ESP,0x10
POP EBX
POP ESI
POP EDI
POP EBP
RET
LEA EDI,[ESP + 0x8]
MOV EAX,EDI
CALL 0x002d0190
JMP 0x002d0428
(translation_unit "undefined4 FUN_002d0400(int param_1)\n\n{\n  uint uVar1;\n  uint uVar2;\n  int in_stack_00000014;\n  \n  uVar2 = *(uint *)(param_1 + 8);\n  if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }\n  return 0;\n}\n\n" (function_definition "undefined4 FUN_002d0400(int param_1)\n\n{\n  uint uVar1;\n  uint uVar2;\n  int in_stack_00000014;\n  \n  uVar2 = *(uint *)(param_1 + 8);\n  if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }\n  return 0;\n}" type_identifier (function_declarator "FUN_002d0400(int param_1)" identifier (parameter_list "(int param_1)" ( (parameter_declaration "int param_1" primitive_type identifier) ))) (compound_statement "{\n  uint uVar1;\n  uint uVar2;\n  int in_stack_00000014;\n  \n  uVar2 = *(uint *)(param_1 + 8);\n  if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }\n  return 0;\n}" { (declaration "uint uVar1;" type_identifier identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int in_stack_00000014;" primitive_type identifier ;) (expression_statement "uVar2 = *(uint *)(param_1 + 8);" (assignment_expression "uVar2 = *(uint *)(param_1 + 8)" identifier = (pointer_expression "*(uint *)(param_1 + 8)" * (cast_expression "(uint *)(param_1 + 8)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 8)" ( (binary_expression "param_1 + 8" identifier + number_literal) ))))) ;) (if_statement "if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }" if (parenthesized_expression "((*(byte *)(param_1 + 0xc) & 4) != 0)" ( (binary_expression "(*(byte *)(param_1 + 0xc) & 4) != 0" (parenthesized_expression "(*(byte *)(param_1 + 0xc) & 4)" ( (binary_expression "*(byte *)(param_1 + 0xc) & 4" (pointer_expression "*(byte *)(param_1 + 0xc)" * (cast_expression "(byte *)(param_1 + 0xc)" ( (type_descriptor "byte *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0xc)" ( (binary_expression "param_1 + 0xc" identifier + number_literal) )))) & number_literal) )) != number_literal) )) (compound_statement "{\n    FUN_002d0190();\n  }" { (expression_statement "FUN_002d0190();" (call_expression "FUN_002d0190()" identifier (argument_list "()" ( ))) ;) })) (if_statement "if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }" if (parenthesized_expression "(0xfffe < uVar2)" ( (binary_expression "0xfffe < uVar2" number_literal < identifier) )) (compound_statement "{\n    uVar2 = 0xffff;\n  }" { (expression_statement "uVar2 = 0xffff;" (assignment_expression "uVar2 = 0xffff" identifier = number_literal) ;) })) (if_statement "if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }" if (parenthesized_expression "(in_stack_00000014 != 0)" ( (binary_expression "in_stack_00000014 != 0" identifier != number_literal) )) (compound_statement "{\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }" { (do_statement "do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);" do (compound_statement "{\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    }" { (expression_statement "in_stack_00000014 = in_stack_00000014 + -1;" (assignment_expression "in_stack_00000014 = in_stack_00000014 + -1" identifier = (binary_expression "in_stack_00000014 + -1" identifier + number_literal)) ;) (expression_statement "uVar1 = FUN_002ced50();" (assignment_expression "uVar1 = FUN_002ced50()" identifier = (call_expression "FUN_002ced50()" identifier (argument_list "()" ( )))) ;) }) while (parenthesized_expression "(in_stack_00000014 != 0 && uVar1 <= uVar2)" ( (binary_expression "in_stack_00000014 != 0 && uVar1 <= uVar2" (binary_expression "in_stack_00000014 != 0" identifier != number_literal) && (binary_expression "uVar1 <= uVar2" identifier <= identifier)) )) ;) })) (return_statement "return 0;" return number_literal ;) })))
(translation_unit "/* std::__codecvt_utf8_base<char16_t>::do_length(__mbstate_t&, char const*, char const*, unsigned\n   int) const */\n\nint __thiscall\nstd::__codecvt_utf8_base<char16_t>::do_length\n          (__codecvt_utf8_base<char16_t> *this,__mbstate_t *param_1,char *param_2,char *param_3,\n          uint param_4)\n\n{\n  uint uVar1;\n  uint uVar2;\n  range *in_stack_ffffffe0;\n  unsigned_char *in_stack_ffffffe4;\n  char *local_18;\n  char *local_14;\n  \n  uVar2 = *(uint *)(this + 8);\n  local_18 = param_2;\n  local_14 = param_3;\n  if (((byte)this[0xc] & 4) != 0) {\n    (anonymous_namespace)::read_bom<char_const,true,3u>(in_stack_ffffffe0,in_stack_ffffffe4);\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (param_4 != 0) {\n    do {\n      param_4 = param_4 - 1;\n      uVar1 = (anonymous_namespace)::read_utf8_code_point((range *)&local_18,uVar2);\n    } while (param_4 != 0 && uVar1 <= uVar2);\n  }\n  return (int)local_18 - (int)param_2;\n}\n\n" comment (function_definition "int __thiscall\nstd::__codecvt_utf8_base<char16_t>::do_length\n          (__codecvt_utf8_base<char16_t> *this,__mbstate_t *param_1,char *param_2,char *param_3,\n          uint param_4)\n\n{\n  uint uVar1;\n  uint uVar2;\n  range *in_stack_ffffffe0;\n  unsigned_char *in_stack_ffffffe4;\n  char *local_18;\n  char *local_14;\n  \n  uVar2 = *(uint *)(this + 8);\n  local_18 = param_2;\n  local_14 = param_3;\n  if (((byte)this[0xc] & 4) != 0) {\n    (anonymous_namespace)::read_bom<char_const,true,3u>(in_stack_ffffffe0,in_stack_ffffffe4);\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (param_4 != 0) {\n    do {\n      param_4 = param_4 - 1;\n      uVar1 = (anonymous_namespace)::read_utf8_code_point((range *)&local_18,uVar2);\n    } while (param_4 != 0 && uVar1 <= uVar2);\n  }\n  return (int)local_18 - (int)param_2;\n}" primitive_type (ms_call_modifier "__thiscall" __thiscall) (ERROR "std::__codecvt_utf8_base<char16_t>::" identifier : : identifier < primitive_type > : :) (function_declarator "do_length\n          (__codecvt_utf8_base<char16_t> *this,__mbstate_t *param_1,char *param_2,char *param_3,\n          uint param_4)" identifier (parameter_list "(__codecvt_utf8_base<char16_t> *this,__mbstate_t *param_1,char *param_2,char *param_3,\n          uint param_4)" ( (parameter_declaration "__codecvt_utf8_base<char16_t> *this" type_identifier (ERROR "<char16_t>" < primitive_type >) (pointer_declarator "*this" * identifier)) , (parameter_declaration "__mbstate_t *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "char *param_2" primitive_type (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "char *param_3" primitive_type (pointer_declarator "*param_3" * identifier)) , (parameter_declaration "uint param_4" type_identifier identifier) ))) (compound_statement "{\n  uint uVar1;\n  uint uVar2;\n  range *in_stack_ffffffe0;\n  unsigned_char *in_stack_ffffffe4;\n  char *local_18;\n  char *local_14;\n  \n  uVar2 = *(uint *)(this + 8);\n  local_18 = param_2;\n  local_14 = param_3;\n  if (((byte)this[0xc] & 4) != 0) {\n    (anonymous_namespace)::read_bom<char_const,true,3u>(in_stack_ffffffe0,in_stack_ffffffe4);\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (param_4 != 0) {\n    do {\n      param_4 = param_4 - 1;\n      uVar1 = (anonymous_namespace)::read_utf8_code_point((range *)&local_18,uVar2);\n    } while (param_4 != 0 && uVar1 <= uVar2);\n  }\n  return (int)local_18 - (int)param_2;\n}" { (declaration "uint uVar1;" type_identifier identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "range *in_stack_ffffffe0;" type_identifier (pointer_declarator "*in_stack_ffffffe0" * identifier) ;) (declaration "unsigned_char *in_stack_ffffffe4;" type_identifier (pointer_declarator "*in_stack_ffffffe4" * identifier) ;) (declaration "char *local_18;" primitive_type (pointer_declarator "*local_18" * identifier) ;) (declaration "char *local_14;" primitive_type (pointer_declarator "*local_14" * identifier) ;) (expression_statement "uVar2 = *(uint *)(this + 8);" (assignment_expression "uVar2 = *(uint *)(this + 8)" identifier = (pointer_expression "*(uint *)(this + 8)" * (cast_expression "(uint *)(this + 8)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(this + 8)" ( (binary_expression "this + 8" identifier + number_literal) ))))) ;) (expression_statement "local_18 = param_2;" (assignment_expression "local_18 = param_2" identifier = identifier) ;) (expression_statement "local_14 = param_3;" (assignment_expression "local_14 = param_3" identifier = identifier) ;) (if_statement "if (((byte)this[0xc] & 4) != 0) {\n    (anonymous_namespace)::read_bom<char_const,true,3u>(in_stack_ffffffe0,in_stack_ffffffe4);\n  }" if (parenthesized_expression "(((byte)this[0xc] & 4) != 0)" ( (binary_expression "((byte)this[0xc] & 4) != 0" (parenthesized_expression "((byte)this[0xc] & 4)" ( (binary_expression "(byte)this[0xc] & 4" (cast_expression "(byte)this[0xc]" ( (type_descriptor "byte" type_identifier) ) (subscript_expression "this[0xc]" identifier [ number_literal ])) & number_literal) )) != number_literal) )) (compound_statement "{\n    (anonymous_namespace)::read_bom<char_const,true,3u>(in_stack_ffffffe0,in_stack_ffffffe4);\n  }" { (expression_statement "(anonymous_namespace)::read_bom<char_const,true,3u>(in_stack_ffffffe0,in_stack_ffffffe4);" (comma_expression "(anonymous_namespace)::read_bom<char_const,true,3u>(in_stack_ffffffe0,in_stack_ffffffe4)" (binary_expression "(anonymous_namespace)::read_bom<char_const" (parenthesized_expression "(anonymous_namespace)" ( identifier )) (ERROR "::read_bom" : : identifier) < identifier) , (comma_expression "true,3u>(in_stack_ffffffe0,in_stack_ffffffe4)" true , (binary_expression "3u>(in_stack_ffffffe0,in_stack_ffffffe4)" number_literal > (parenthesized_expression "(in_stack_ffffffe0,in_stack_ffffffe4)" ( (comma_expression "in_stack_ffffffe0,in_stack_ffffffe4" identifier , identifier) ))))) ;) })) (if_statement "if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }" if (parenthesized_expression "(0xfffe < uVar2)" ( (binary_expression "0xfffe < uVar2" number_literal < identifier) )) (compound_statement "{\n    uVar2 = 0xffff;\n  }" { (expression_statement "uVar2 = 0xffff;" (assignment_expression "uVar2 = 0xffff" identifier = number_literal) ;) })) (if_statement "if (param_4 != 0) {\n    do {\n      param_4 = param_4 - 1;\n      uVar1 = (anonymous_namespace)::read_utf8_code_point((range *)&local_18,uVar2);\n    } while (param_4 != 0 && uVar1 <= uVar2);\n  }" if (parenthesized_expression "(param_4 != 0)" ( (binary_expression "param_4 != 0" identifier != number_literal) )) (compound_statement "{\n    do {\n      param_4 = param_4 - 1;\n      uVar1 = (anonymous_namespace)::read_utf8_code_point((range *)&local_18,uVar2);\n    } while (param_4 != 0 && uVar1 <= uVar2);\n  }" { (do_statement "do {\n      param_4 = param_4 - 1;\n      uVar1 = (anonymous_namespace)::read_utf8_code_point((range *)&local_18,uVar2);\n    } while (param_4 != 0 && uVar1 <= uVar2);" do (compound_statement "{\n      param_4 = param_4 - 1;\n      uVar1 = (anonymous_namespace)::read_utf8_code_point((range *)&local_18,uVar2);\n    }" { (expression_statement "param_4 = param_4 - 1;" (assignment_expression "param_4 = param_4 - 1" identifier = (binary_expression "param_4 - 1" identifier - number_literal)) ;) (ERROR "uVar1 = (anonymous_namespace)::" (assignment_expression "uVar1 = (anonymous_namespace)" identifier = (parenthesized_expression "(anonymous_namespace)" ( identifier ))) : :) (expression_statement "read_utf8_code_point((range *)&local_18,uVar2);" (call_expression "read_utf8_code_point((range *)&local_18,uVar2)" identifier (argument_list "((range *)&local_18,uVar2)" ( (cast_expression "(range *)&local_18" ( (type_descriptor "range *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&local_18" & identifier)) , identifier ))) ;) }) while (parenthesized_expression "(param_4 != 0 && uVar1 <= uVar2)" ( (binary_expression "param_4 != 0 && uVar1 <= uVar2" (binary_expression "param_4 != 0" identifier != number_literal) && (binary_expression "uVar1 <= uVar2" identifier <= identifier)) )) ;) })) (return_statement "return (int)local_18 - (int)param_2;" return (binary_expression "(int)local_18 - (int)param_2" (cast_expression "(int)local_18" ( (type_descriptor "int" primitive_type) ) identifier) - (cast_expression "(int)param_2" ( (type_descriptor "int" primitive_type) ) identifier)) ;) })))
(translation_unit "undefined4 FUN_002d0400(int param_1)\n\n{\n  uint uVar1;\n  uint uVar2;\n  int in_stack_00000014;\n  \n  uVar2 = *(uint *)(param_1 + 8);\n  if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }\n  return 0;\n}\n\n" (function_definition "undefined4 FUN_002d0400(int param_1)\n\n{\n  uint uVar1;\n  uint uVar2;\n  int in_stack_00000014;\n  \n  uVar2 = *(uint *)(param_1 + 8);\n  if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }\n  return 0;\n}" type_identifier (function_declarator "FUN_002d0400(int param_1)" identifier (parameter_list "(int param_1)" ( (parameter_declaration "int param_1" primitive_type identifier) ))) (compound_statement "{\n  uint uVar1;\n  uint uVar2;\n  int in_stack_00000014;\n  \n  uVar2 = *(uint *)(param_1 + 8);\n  if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }\n  return 0;\n}" { (declaration "uint uVar1;" type_identifier identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "int in_stack_00000014;" primitive_type identifier ;) (expression_statement "uVar2 = *(uint *)(param_1 + 8);" (assignment_expression "uVar2 = *(uint *)(param_1 + 8)" identifier = (pointer_expression "*(uint *)(param_1 + 8)" * (cast_expression "(uint *)(param_1 + 8)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 8)" ( (binary_expression "param_1 + 8" identifier + number_literal) ))))) ;) (if_statement "if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }" if (parenthesized_expression "((*(byte *)(param_1 + 0xc) & 4) != 0)" ( (binary_expression "(*(byte *)(param_1 + 0xc) & 4) != 0" (parenthesized_expression "(*(byte *)(param_1 + 0xc) & 4)" ( (binary_expression "*(byte *)(param_1 + 0xc) & 4" (pointer_expression "*(byte *)(param_1 + 0xc)" * (cast_expression "(byte *)(param_1 + 0xc)" ( (type_descriptor "byte *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0xc)" ( (binary_expression "param_1 + 0xc" identifier + number_literal) )))) & number_literal) )) != number_literal) )) (compound_statement "{\n    FUN_002d0190();\n  }" { (expression_statement "FUN_002d0190();" (call_expression "FUN_002d0190()" identifier (argument_list "()" ( ))) ;) })) (if_statement "if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }" if (parenthesized_expression "(0xfffe < uVar2)" ( (binary_expression "0xfffe < uVar2" number_literal < identifier) )) (compound_statement "{\n    uVar2 = 0xffff;\n  }" { (expression_statement "uVar2 = 0xffff;" (assignment_expression "uVar2 = 0xffff" identifier = number_literal) ;) })) (if_statement "if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }" if (parenthesized_expression "(in_stack_00000014 != 0)" ( (binary_expression "in_stack_00000014 != 0" identifier != number_literal) )) (compound_statement "{\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }" { (do_statement "do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);" do (compound_statement "{\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    }" { (expression_statement "in_stack_00000014 = in_stack_00000014 + -1;" (assignment_expression "in_stack_00000014 = in_stack_00000014 + -1" identifier = (binary_expression "in_stack_00000014 + -1" identifier + number_literal)) ;) (expression_statement "uVar1 = FUN_002ced50();" (assignment_expression "uVar1 = FUN_002ced50()" identifier = (call_expression "FUN_002ced50()" identifier (argument_list "()" ( )))) ;) }) while (parenthesized_expression "(in_stack_00000014 != 0 && uVar1 <= uVar2)" ( (binary_expression "in_stack_00000014 != 0 && uVar1 <= uVar2" (binary_expression "in_stack_00000014 != 0" identifier != number_literal) && (binary_expression "uVar1 <= uVar2" identifier <= identifier)) )) ;) })) (return_statement "return 0;" return number_literal ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) & LIT) )) != LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( ))) ;) })) (if_statement if (parenthesized_expression ( (binary_expression LIT < IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( )))) ;) }) while (parenthesized_expression ( (binary_expression (binary_expression IDENT != LIT) && (binary_expression IDENT <= IDENT)) )) ;) })) (return_statement return LIT ;) })))
(function_definition "undefined4 FUN_002d0400(int param_1)\n\n{\n  uint uVar1;\n  uint uVar2;\n  int in_stack_00000014;\n  \n  uVar2 = *(uint *)(param_1 + 8);\n  if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }\n  return 0;\n}" (type_identifier "undefined4") (function_declarator "FUN_002d0400(int param_1)" (identifier "FUN_002d0400") (parameter_list "(int param_1)" (( "(") (parameter_declaration "int param_1" (primitive_type "int") (identifier "param_1")) () ")"))) (compound_statement "{\n  uint uVar1;\n  uint uVar2;\n  int in_stack_00000014;\n  \n  uVar2 = *(uint *)(param_1 + 8);\n  if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }\n  if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }\n  if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }\n  return 0;\n}" ({ "{") (declaration "uint uVar1;" (type_identifier "uint") (identifier "uVar1") (; ";")) (declaration "uint uVar2;" (type_identifier "uint") (identifier "uVar2") (; ";")) (declaration "int in_stack_00000014;" (primitive_type "int") (identifier "in_stack_00000014") (; ";")) (expression_statement "uVar2 = *(uint *)(param_1 + 8);" (assignment_expression "uVar2 = *(uint *)(param_1 + 8)" (identifier "uVar2") (= "=") (pointer_expression "*(uint *)(param_1 + 8)" (* "*") (cast_expression "(uint *)(param_1 + 8)" (( "(") (type_descriptor "uint *" (type_identifier "uint") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 8)" (( "(") (binary_expression "param_1 + 8" (identifier "param_1") (+ "+") (number_literal "8")) () ")"))))) (; ";")) (if_statement "if ((*(byte *)(param_1 + 0xc) & 4) != 0) {\n    FUN_002d0190();\n  }" (if "if") (parenthesized_expression "((*(byte *)(param_1 + 0xc) & 4) != 0)" (( "(") (binary_expression "(*(byte *)(param_1 + 0xc) & 4) != 0" (parenthesized_expression "(*(byte *)(param_1 + 0xc) & 4)" (( "(") (binary_expression "*(byte *)(param_1 + 0xc) & 4" (pointer_expression "*(byte *)(param_1 + 0xc)" (* "*") (cast_expression "(byte *)(param_1 + 0xc)" (( "(") (type_descriptor "byte *" (type_identifier "byte") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0xc)" (( "(") (binary_expression "param_1 + 0xc" (identifier "param_1") (+ "+") (number_literal "0xc")) () ")")))) (& "&") (number_literal "4")) () ")")) (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    FUN_002d0190();\n  }" ({ "{") (expression_statement "FUN_002d0190();" (call_expression "FUN_002d0190()" (identifier "FUN_002d0190") (argument_list "()" (( "(") () ")"))) (; ";")) (} "}"))) (if_statement "if (0xfffe < uVar2) {\n    uVar2 = 0xffff;\n  }" (if "if") (parenthesized_expression "(0xfffe < uVar2)" (( "(") (binary_expression "0xfffe < uVar2" (number_literal "0xfffe") (< "<") (identifier "uVar2")) () ")")) (compound_statement "{\n    uVar2 = 0xffff;\n  }" ({ "{") (expression_statement "uVar2 = 0xffff;" (assignment_expression "uVar2 = 0xffff" (identifier "uVar2") (= "=") (number_literal "0xffff")) (; ";")) (} "}"))) (if_statement "if (in_stack_00000014 != 0) {\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }" (if "if") (parenthesized_expression "(in_stack_00000014 != 0)" (( "(") (binary_expression "in_stack_00000014 != 0" (identifier "in_stack_00000014") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);\n  }" ({ "{") (do_statement "do {\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);" (do "do") (compound_statement "{\n      in_stack_00000014 = in_stack_00000014 + -1;\n      uVar1 = FUN_002ced50();\n    }" ({ "{") (expression_statement "in_stack_00000014 = in_stack_00000014 + -1;" (assignment_expression "in_stack_00000014 = in_stack_00000014 + -1" (identifier "in_stack_00000014") (= "=") (binary_expression "in_stack_00000014 + -1" (identifier "in_stack_00000014") (+ "+") (number_literal "-1"))) (; ";")) (expression_statement "uVar1 = FUN_002ced50();" (assignment_expression "uVar1 = FUN_002ced50()" (identifier "uVar1") (= "=") (call_expression "FUN_002ced50()" (identifier "FUN_002ced50") (argument_list "()" (( "(") () ")")))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(in_stack_00000014 != 0 && uVar1 <= uVar2)" (( "(") (binary_expression "in_stack_00000014 != 0 && uVar1 <= uVar2" (binary_expression "in_stack_00000014 != 0" (identifier "in_stack_00000014") (!= "!=") (number_literal "0")) (&& "&&") (binary_expression "uVar1 <= uVar2" (identifier "uVar1") (<= "<=") (identifier "uVar2"))) () ")")) (; ";")) (} "}"))) (return_statement "return 0;" (return "return") (number_literal "0") (; ";")) (} "}")))

/* std::__codecvt_utf8_base<char16_t>::do_length(__mbstate_t&, char const*, char const*, unsigned
   int) const */

int __thiscall
std::type_1<char16_t>::function_1
          (type_1<char16_t> *var_1,type_2 *param_1,char *param_2,char *param_3,
          type_3 var_4)

{
  type_3 var_6;
  type_3 var_3;
  type_4 *in_stack_ffffffe0;
  type_5 *in_stack_ffffffe4;
  char *local_18;
  char *local_14;
  
  var_3 = *(type_3 *)(var_1 + 8);
  local_18 = param_2;
  local_14 = param_3;
  if (((type_6)var_1[0xc] & 4) != 0) {
    (anonymous_namespace)::read_bom<var_2,true,3u>(in_stack_ffffffe0,in_stack_ffffffe4);
  }
  if (0xfffe < var_3) {
    var_3 = 0xffff;
  }
  if (var_4 != 0) {
    do {
      var_4 = var_4 - 1;
      var_6 = (anonymous_namespace)::var_5((type_4 *)&local_18,var_3);
    } while (var_4 != 0 && var_6 <= var_3);
  }
  return (int)local_18 - (int)param_2;
}


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

undefined4 MASKED(int param_1)

{
  uint uVar1;
  uint uVar2;
  int in_stack_00000014;
  
  uVar2 = *(uint *)(param_1 + 8);
  if ((*(byte *)(param_1 + 0xc) & 4) != 0) {
    FUN_002d0190();
  }
  if (0xfffe < uVar2) {
    uVar2 = 0xffff;
  }
  if (in_stack_00000014 != 0) {
    do {
      in_stack_00000014 = in_stack_00000014 + -1;
      uVar1 = FUN_002ced50();
    } while (in_stack_00000014 != 0 && uVar1 <= uVar2);
  }
  return 0;
}

