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

long __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,
          ulong param_4)

{
  unsigned_char *puVar1;
  uint uVar2;
  uint uVar3;
  unsigned_char *puVar4;
  char *local_38;
  char *local_30;
  
  puVar1 = *(unsigned_char **)(this + 0x10);
  puVar4 = puVar1;
  local_38 = param_2;
  local_30 = param_3;
  if (((byte)this[0x18] & 4) != 0) {
    (anonymous_namespace)::read_bom<char_const,true,3ul>((range *)&local_38,puVar1);
  }
  uVar3 = (uint)puVar1;
  if (0xfffe < (uint)puVar4) {
    uVar3 = 0xffff;
  }
  if (param_4 != 0) {
    do {
      param_4 = param_4 - 1;
      uVar2 = (anonymous_namespace)::read_utf8_code_point((range *)&local_38,(ulong)uVar3);
    } while (param_4 != 0 && uVar2 <= uVar3);
  }
  return (long)local_38 - (long)param_2;
}



long FUN_003b8320(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)

{
  uint uVar1;
  uint uVar2;
  long local_38;
  undefined8 local_30;
  
  uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);
  local_38 = param_3;
  local_30 = param_4;
  uVar1 = uVar2;
  if ((*(byte *)(param_1 + 0x18) & 4) != 0) {
    FUN_003b8070(&local_38);
  }
  if (0xfffe < uVar1) {
    uVar2 = 0xffff;
  }
  if (param_5 != 0) {
    do {
      param_5 = param_5 + -1;
      uVar1 = FUN_003b6cd0(&local_38,uVar2);
    } while (param_5 != 0 && uVar1 <= uVar2);
  }
  return local_38 - param_3;
}


PUSH R14
PUSH R13
PUSH R12
MOV R12,RDX
PUSH RBP
PUSH RBX
SUB RSP,0x10
MOV RSI,qword ptr [RDI + 0x10]
MOV qword ptr [RSP],RDX
MOV EBX,ESI
MOV qword ptr [RSP + 0x8],RCX
TEST byte ptr [RDI + 0x18],0x4
JNZ 0x003b83a0
CMP ESI,0xffff
MOV EAX,0xffff
LEA RBP,[R8 + -0x1]
MOV R13,RSP
CMOVNC EBX,EAX
MOV R14D,EBX
TEST R8,R8
JZ 0x003b8386
NOP dword ptr [RAX]
MOV RSI,R14
MOV RDI,R13
CALL 0x003b6cd0
TEST RBP,RBP
SETNZ DL
CMP EBX,EAX
SETNC AL
SUB RBP,0x1
TEST DL,AL
JNZ 0x003b8368
MOV RAX,qword ptr [RSP]
ADD RSP,0x10
POP RBX
POP RBP
SUB RAX,R12
POP R12
POP R13
POP R14
RET
MOV R13,RSP
MOV RDI,R13
CALL 0x003b8070
JMP 0x003b8344
(translation_unit "long FUN_003b8320(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)\n\n{\n  uint uVar1;\n  uint uVar2;\n  long local_38;\n  undefined8 local_30;\n  \n  uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);\n  local_38 = param_3;\n  local_30 = param_4;\n  uVar1 = uVar2;\n  if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }\n  if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }\n  if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }\n  return local_38 - param_3;\n}\n\n" (function_definition "long FUN_003b8320(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)\n\n{\n  uint uVar1;\n  uint uVar2;\n  long local_38;\n  undefined8 local_30;\n  \n  uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);\n  local_38 = param_3;\n  local_30 = param_4;\n  uVar1 = uVar2;\n  if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }\n  if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }\n  if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }\n  return local_38 - param_3;\n}" (sized_type_specifier "long" long) (function_declarator "FUN_003b8320(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)" identifier (parameter_list "(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "undefined8 param_2" type_identifier identifier) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) , (parameter_declaration "undefined8 param_4" type_identifier identifier) , (parameter_declaration "long param_5" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  uint uVar1;\n  uint uVar2;\n  long local_38;\n  undefined8 local_30;\n  \n  uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);\n  local_38 = param_3;\n  local_30 = param_4;\n  uVar1 = uVar2;\n  if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }\n  if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }\n  if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }\n  return local_38 - param_3;\n}" { (declaration "uint uVar1;" type_identifier identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "long local_38;" (sized_type_specifier "long" long) identifier ;) (declaration "undefined8 local_30;" type_identifier identifier ;) (expression_statement "uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);" (assignment_expression "uVar2 = (uint)*(undefined8 *)(param_1 + 0x10)" identifier = (binary_expression "(uint)*(undefined8 *)(param_1 + 0x10)" (parenthesized_expression "(uint)" ( identifier )) * (cast_expression "(undefined8 *)(param_1 + 0x10)" ( (type_descriptor "undefined8 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x10)" ( (binary_expression "param_1 + 0x10" identifier + number_literal) ))))) ;) (expression_statement "local_38 = param_3;" (assignment_expression "local_38 = param_3" identifier = identifier) ;) (expression_statement "local_30 = param_4;" (assignment_expression "local_30 = param_4" identifier = identifier) ;) (expression_statement "uVar1 = uVar2;" (assignment_expression "uVar1 = uVar2" identifier = identifier) ;) (if_statement "if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }" if (parenthesized_expression "((*(byte *)(param_1 + 0x18) & 4) != 0)" ( (binary_expression "(*(byte *)(param_1 + 0x18) & 4) != 0" (parenthesized_expression "(*(byte *)(param_1 + 0x18) & 4)" ( (binary_expression "*(byte *)(param_1 + 0x18) & 4" (pointer_expression "*(byte *)(param_1 + 0x18)" * (cast_expression "(byte *)(param_1 + 0x18)" ( (type_descriptor "byte *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x18)" ( (binary_expression "param_1 + 0x18" identifier + number_literal) )))) & number_literal) )) != number_literal) )) (compound_statement "{\n    FUN_003b8070(&local_38);\n  }" { (expression_statement "FUN_003b8070(&local_38);" (call_expression "FUN_003b8070(&local_38)" identifier (argument_list "(&local_38)" ( (pointer_expression "&local_38" & identifier) ))) ;) })) (if_statement "if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }" if (parenthesized_expression "(0xfffe < uVar1)" ( (binary_expression "0xfffe < uVar1" number_literal < identifier) )) (compound_statement "{\n    uVar2 = 0xffff;\n  }" { (expression_statement "uVar2 = 0xffff;" (assignment_expression "uVar2 = 0xffff" identifier = number_literal) ;) })) (if_statement "if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }" if (parenthesized_expression "(param_5 != 0)" ( (binary_expression "param_5 != 0" identifier != number_literal) )) (compound_statement "{\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }" { (do_statement "do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);" do (compound_statement "{\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    }" { (expression_statement "param_5 = param_5 + -1;" (assignment_expression "param_5 = param_5 + -1" identifier = (binary_expression "param_5 + -1" identifier + number_literal)) ;) (expression_statement "uVar1 = FUN_003b6cd0(&local_38,uVar2);" (assignment_expression "uVar1 = FUN_003b6cd0(&local_38,uVar2)" identifier = (call_expression "FUN_003b6cd0(&local_38,uVar2)" identifier (argument_list "(&local_38,uVar2)" ( (pointer_expression "&local_38" & identifier) , identifier )))) ;) }) while (parenthesized_expression "(param_5 != 0 && uVar1 <= uVar2)" ( (binary_expression "param_5 != 0 && uVar1 <= uVar2" (binary_expression "param_5 != 0" identifier != number_literal) && (binary_expression "uVar1 <= uVar2" identifier <= identifier)) )) ;) })) (return_statement "return local_38 - param_3;" return (binary_expression "local_38 - param_3" identifier - identifier) ;) })))
(translation_unit "/* std::__codecvt_utf8_base<char16_t>::do_length(__mbstate_t&, char const*, char const*, unsigned\n   long) const */\n\nlong __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          ulong param_4)\n\n{\n  unsigned_char *puVar1;\n  uint uVar2;\n  uint uVar3;\n  unsigned_char *puVar4;\n  char *local_38;\n  char *local_30;\n  \n  puVar1 = *(unsigned_char **)(this + 0x10);\n  puVar4 = puVar1;\n  local_38 = param_2;\n  local_30 = param_3;\n  if (((byte)this[0x18] & 4) != 0) {\n    (anonymous_namespace)::read_bom<char_const,true,3ul>((range *)&local_38,puVar1);\n  }\n  uVar3 = (uint)puVar1;\n  if (0xfffe < (uint)puVar4) {\n    uVar3 = 0xffff;\n  }\n  if (param_4 != 0) {\n    do {\n      param_4 = param_4 - 1;\n      uVar2 = (anonymous_namespace)::read_utf8_code_point((range *)&local_38,(ulong)uVar3);\n    } while (param_4 != 0 && uVar2 <= uVar3);\n  }\n  return (long)local_38 - (long)param_2;\n}\n\n" comment (function_definition "long __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          ulong param_4)\n\n{\n  unsigned_char *puVar1;\n  uint uVar2;\n  uint uVar3;\n  unsigned_char *puVar4;\n  char *local_38;\n  char *local_30;\n  \n  puVar1 = *(unsigned_char **)(this + 0x10);\n  puVar4 = puVar1;\n  local_38 = param_2;\n  local_30 = param_3;\n  if (((byte)this[0x18] & 4) != 0) {\n    (anonymous_namespace)::read_bom<char_const,true,3ul>((range *)&local_38,puVar1);\n  }\n  uVar3 = (uint)puVar1;\n  if (0xfffe < (uint)puVar4) {\n    uVar3 = 0xffff;\n  }\n  if (param_4 != 0) {\n    do {\n      param_4 = param_4 - 1;\n      uVar2 = (anonymous_namespace)::read_utf8_code_point((range *)&local_38,(ulong)uVar3);\n    } while (param_4 != 0 && uVar2 <= uVar3);\n  }\n  return (long)local_38 - (long)param_2;\n}" (sized_type_specifier "long" long) (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          ulong param_4)" identifier (parameter_list "(__codecvt_utf8_base<char16_t> *this,__mbstate_t *param_1,char *param_2,char *param_3,\n          ulong 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 "ulong param_4" type_identifier identifier) ))) (compound_statement "{\n  unsigned_char *puVar1;\n  uint uVar2;\n  uint uVar3;\n  unsigned_char *puVar4;\n  char *local_38;\n  char *local_30;\n  \n  puVar1 = *(unsigned_char **)(this + 0x10);\n  puVar4 = puVar1;\n  local_38 = param_2;\n  local_30 = param_3;\n  if (((byte)this[0x18] & 4) != 0) {\n    (anonymous_namespace)::read_bom<char_const,true,3ul>((range *)&local_38,puVar1);\n  }\n  uVar3 = (uint)puVar1;\n  if (0xfffe < (uint)puVar4) {\n    uVar3 = 0xffff;\n  }\n  if (param_4 != 0) {\n    do {\n      param_4 = param_4 - 1;\n      uVar2 = (anonymous_namespace)::read_utf8_code_point((range *)&local_38,(ulong)uVar3);\n    } while (param_4 != 0 && uVar2 <= uVar3);\n  }\n  return (long)local_38 - (long)param_2;\n}" { (declaration "unsigned_char *puVar1;" type_identifier (pointer_declarator "*puVar1" * identifier) ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (declaration "unsigned_char *puVar4;" type_identifier (pointer_declarator "*puVar4" * identifier) ;) (declaration "char *local_38;" primitive_type (pointer_declarator "*local_38" * identifier) ;) (declaration "char *local_30;" primitive_type (pointer_declarator "*local_30" * identifier) ;) (expression_statement "puVar1 = *(unsigned_char **)(this + 0x10);" (assignment_expression "puVar1 = *(unsigned_char **)(this + 0x10)" identifier = (pointer_expression "*(unsigned_char **)(this + 0x10)" * (cast_expression "(unsigned_char **)(this + 0x10)" ( (type_descriptor "unsigned_char **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(this + 0x10)" ( (binary_expression "this + 0x10" identifier + number_literal) ))))) ;) (expression_statement "puVar4 = puVar1;" (assignment_expression "puVar4 = puVar1" identifier = identifier) ;) (expression_statement "local_38 = param_2;" (assignment_expression "local_38 = param_2" identifier = identifier) ;) (expression_statement "local_30 = param_3;" (assignment_expression "local_30 = param_3" identifier = identifier) ;) (if_statement "if (((byte)this[0x18] & 4) != 0) {\n    (anonymous_namespace)::read_bom<char_const,true,3ul>((range *)&local_38,puVar1);\n  }" if (parenthesized_expression "(((byte)this[0x18] & 4) != 0)" ( (binary_expression "((byte)this[0x18] & 4) != 0" (parenthesized_expression "((byte)this[0x18] & 4)" ( (binary_expression "(byte)this[0x18] & 4" (cast_expression "(byte)this[0x18]" ( (type_descriptor "byte" type_identifier) ) (subscript_expression "this[0x18]" identifier [ number_literal ])) & number_literal) )) != number_literal) )) (compound_statement "{\n    (anonymous_namespace)::read_bom<char_const,true,3ul>((range *)&local_38,puVar1);\n  }" { (expression_statement "(anonymous_namespace)::read_bom<char_const,true,3ul>((range *)&local_38,puVar1);" (comma_expression "(anonymous_namespace)::read_bom<char_const,true,3ul>((range *)&local_38,puVar1)" (binary_expression "(anonymous_namespace)::read_bom<char_const" (parenthesized_expression "(anonymous_namespace)" ( identifier )) (ERROR "::read_bom" : : identifier) < identifier) , (comma_expression "true,3ul>((range *)&local_38,puVar1)" true , (binary_expression "3ul>((range *)&local_38,puVar1)" number_literal > (parenthesized_expression "((range *)&local_38,puVar1)" ( (comma_expression "(range *)&local_38,puVar1" (cast_expression "(range *)&local_38" ( (type_descriptor "range *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&local_38" & identifier)) , identifier) ))))) ;) })) (expression_statement "uVar3 = (uint)puVar1;" (assignment_expression "uVar3 = (uint)puVar1" identifier = (cast_expression "(uint)puVar1" ( (type_descriptor "uint" type_identifier) ) identifier)) ;) (if_statement "if (0xfffe < (uint)puVar4) {\n    uVar3 = 0xffff;\n  }" if (parenthesized_expression "(0xfffe < (uint)puVar4)" ( (binary_expression "0xfffe < (uint)puVar4" number_literal < (cast_expression "(uint)puVar4" ( (type_descriptor "uint" type_identifier) ) identifier)) )) (compound_statement "{\n    uVar3 = 0xffff;\n  }" { (expression_statement "uVar3 = 0xffff;" (assignment_expression "uVar3 = 0xffff" identifier = number_literal) ;) })) (if_statement "if (param_4 != 0) {\n    do {\n      param_4 = param_4 - 1;\n      uVar2 = (anonymous_namespace)::read_utf8_code_point((range *)&local_38,(ulong)uVar3);\n    } while (param_4 != 0 && uVar2 <= uVar3);\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      uVar2 = (anonymous_namespace)::read_utf8_code_point((range *)&local_38,(ulong)uVar3);\n    } while (param_4 != 0 && uVar2 <= uVar3);\n  }" { (do_statement "do {\n      param_4 = param_4 - 1;\n      uVar2 = (anonymous_namespace)::read_utf8_code_point((range *)&local_38,(ulong)uVar3);\n    } while (param_4 != 0 && uVar2 <= uVar3);" do (compound_statement "{\n      param_4 = param_4 - 1;\n      uVar2 = (anonymous_namespace)::read_utf8_code_point((range *)&local_38,(ulong)uVar3);\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 "uVar2 = (anonymous_namespace)::" (assignment_expression "uVar2 = (anonymous_namespace)" identifier = (parenthesized_expression "(anonymous_namespace)" ( identifier ))) : :) (expression_statement "read_utf8_code_point((range *)&local_38,(ulong)uVar3);" (call_expression "read_utf8_code_point((range *)&local_38,(ulong)uVar3)" identifier (argument_list "((range *)&local_38,(ulong)uVar3)" ( (cast_expression "(range *)&local_38" ( (type_descriptor "range *" type_identifier (abstract_pointer_declarator "*" *)) ) (pointer_expression "&local_38" & identifier)) , (cast_expression "(ulong)uVar3" ( (type_descriptor "ulong" type_identifier) ) identifier) ))) ;) }) while (parenthesized_expression "(param_4 != 0 && uVar2 <= uVar3)" ( (binary_expression "param_4 != 0 && uVar2 <= uVar3" (binary_expression "param_4 != 0" identifier != number_literal) && (binary_expression "uVar2 <= uVar3" identifier <= identifier)) )) ;) })) (return_statement "return (long)local_38 - (long)param_2;" return (binary_expression "(long)local_38 - (long)param_2" (cast_expression "(long)local_38" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)param_2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ;) })))
(translation_unit "long FUN_003b8320(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)\n\n{\n  uint uVar1;\n  uint uVar2;\n  long local_38;\n  undefined8 local_30;\n  \n  uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);\n  local_38 = param_3;\n  local_30 = param_4;\n  uVar1 = uVar2;\n  if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }\n  if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }\n  if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }\n  return local_38 - param_3;\n}\n\n" (function_definition "long FUN_003b8320(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)\n\n{\n  uint uVar1;\n  uint uVar2;\n  long local_38;\n  undefined8 local_30;\n  \n  uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);\n  local_38 = param_3;\n  local_30 = param_4;\n  uVar1 = uVar2;\n  if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }\n  if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }\n  if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }\n  return local_38 - param_3;\n}" (sized_type_specifier "long" long) (function_declarator "FUN_003b8320(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)" identifier (parameter_list "(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "undefined8 param_2" type_identifier identifier) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) , (parameter_declaration "undefined8 param_4" type_identifier identifier) , (parameter_declaration "long param_5" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  uint uVar1;\n  uint uVar2;\n  long local_38;\n  undefined8 local_30;\n  \n  uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);\n  local_38 = param_3;\n  local_30 = param_4;\n  uVar1 = uVar2;\n  if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }\n  if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }\n  if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }\n  return local_38 - param_3;\n}" { (declaration "uint uVar1;" type_identifier identifier ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "long local_38;" (sized_type_specifier "long" long) identifier ;) (declaration "undefined8 local_30;" type_identifier identifier ;) (expression_statement "uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);" (assignment_expression "uVar2 = (uint)*(undefined8 *)(param_1 + 0x10)" identifier = (binary_expression "(uint)*(undefined8 *)(param_1 + 0x10)" (parenthesized_expression "(uint)" ( identifier )) * (cast_expression "(undefined8 *)(param_1 + 0x10)" ( (type_descriptor "undefined8 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x10)" ( (binary_expression "param_1 + 0x10" identifier + number_literal) ))))) ;) (expression_statement "local_38 = param_3;" (assignment_expression "local_38 = param_3" identifier = identifier) ;) (expression_statement "local_30 = param_4;" (assignment_expression "local_30 = param_4" identifier = identifier) ;) (expression_statement "uVar1 = uVar2;" (assignment_expression "uVar1 = uVar2" identifier = identifier) ;) (if_statement "if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }" if (parenthesized_expression "((*(byte *)(param_1 + 0x18) & 4) != 0)" ( (binary_expression "(*(byte *)(param_1 + 0x18) & 4) != 0" (parenthesized_expression "(*(byte *)(param_1 + 0x18) & 4)" ( (binary_expression "*(byte *)(param_1 + 0x18) & 4" (pointer_expression "*(byte *)(param_1 + 0x18)" * (cast_expression "(byte *)(param_1 + 0x18)" ( (type_descriptor "byte *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x18)" ( (binary_expression "param_1 + 0x18" identifier + number_literal) )))) & number_literal) )) != number_literal) )) (compound_statement "{\n    FUN_003b8070(&local_38);\n  }" { (expression_statement "FUN_003b8070(&local_38);" (call_expression "FUN_003b8070(&local_38)" identifier (argument_list "(&local_38)" ( (pointer_expression "&local_38" & identifier) ))) ;) })) (if_statement "if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }" if (parenthesized_expression "(0xfffe < uVar1)" ( (binary_expression "0xfffe < uVar1" number_literal < identifier) )) (compound_statement "{\n    uVar2 = 0xffff;\n  }" { (expression_statement "uVar2 = 0xffff;" (assignment_expression "uVar2 = 0xffff" identifier = number_literal) ;) })) (if_statement "if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }" if (parenthesized_expression "(param_5 != 0)" ( (binary_expression "param_5 != 0" identifier != number_literal) )) (compound_statement "{\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }" { (do_statement "do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);" do (compound_statement "{\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    }" { (expression_statement "param_5 = param_5 + -1;" (assignment_expression "param_5 = param_5 + -1" identifier = (binary_expression "param_5 + -1" identifier + number_literal)) ;) (expression_statement "uVar1 = FUN_003b6cd0(&local_38,uVar2);" (assignment_expression "uVar1 = FUN_003b6cd0(&local_38,uVar2)" identifier = (call_expression "FUN_003b6cd0(&local_38,uVar2)" identifier (argument_list "(&local_38,uVar2)" ( (pointer_expression "&local_38" & identifier) , identifier )))) ;) }) while (parenthesized_expression "(param_5 != 0 && uVar1 <= uVar2)" ( (binary_expression "param_5 != 0 && uVar1 <= uVar2" (binary_expression "param_5 != 0" identifier != number_literal) && (binary_expression "uVar1 <= uVar2" identifier <= identifier)) )) ;) })) (return_statement "return local_38 - param_3;" return (binary_expression "local_38 - param_3" identifier - identifier) ;) })))
(translation_unit (function_definition (sized_type_specifier long) (function_declarator IDENT (parameter_list ( (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration (sized_type_specifier long) IDENT) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration (sized_type_specifier long) IDENT ;) (declaration TYPE IDENT ;) (expression_statement (assignment_expression IDENT = (binary_expression (parenthesized_expression ( IDENT )) * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (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 ( (pointer_expression & IDENT) ))) ;) })) (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 ( (pointer_expression & IDENT) , IDENT )))) ;) }) while (parenthesized_expression ( (binary_expression (binary_expression IDENT != LIT) && (binary_expression IDENT <= IDENT)) )) ;) })) (return_statement return (binary_expression IDENT - IDENT) ;) })))
(function_definition "long FUN_003b8320(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)\n\n{\n  uint uVar1;\n  uint uVar2;\n  long local_38;\n  undefined8 local_30;\n  \n  uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);\n  local_38 = param_3;\n  local_30 = param_4;\n  uVar1 = uVar2;\n  if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }\n  if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }\n  if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }\n  return local_38 - param_3;\n}" (sized_type_specifier "long" (long "long")) (function_declarator "FUN_003b8320(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)" (identifier "FUN_003b8320") (parameter_list "(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)" (( "(") (parameter_declaration "long param_1" (sized_type_specifier "long" (long "long")) (identifier "param_1")) (, ",") (parameter_declaration "undefined8 param_2" (type_identifier "undefined8") (identifier "param_2")) (, ",") (parameter_declaration "long param_3" (sized_type_specifier "long" (long "long")) (identifier "param_3")) (, ",") (parameter_declaration "undefined8 param_4" (type_identifier "undefined8") (identifier "param_4")) (, ",") (parameter_declaration "long param_5" (sized_type_specifier "long" (long "long")) (identifier "param_5")) () ")"))) (compound_statement "{\n  uint uVar1;\n  uint uVar2;\n  long local_38;\n  undefined8 local_30;\n  \n  uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);\n  local_38 = param_3;\n  local_30 = param_4;\n  uVar1 = uVar2;\n  if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }\n  if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }\n  if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }\n  return local_38 - param_3;\n}" ({ "{") (declaration "uint uVar1;" (type_identifier "uint") (identifier "uVar1") (; ";")) (declaration "uint uVar2;" (type_identifier "uint") (identifier "uVar2") (; ";")) (declaration "long local_38;" (sized_type_specifier "long" (long "long")) (identifier "local_38") (; ";")) (declaration "undefined8 local_30;" (type_identifier "undefined8") (identifier "local_30") (; ";")) (expression_statement "uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);" (assignment_expression "uVar2 = (uint)*(undefined8 *)(param_1 + 0x10)" (identifier "uVar2") (= "=") (binary_expression "(uint)*(undefined8 *)(param_1 + 0x10)" (parenthesized_expression "(uint)" (( "(") (identifier "uint") () ")")) (* "*") (cast_expression "(undefined8 *)(param_1 + 0x10)" (( "(") (type_descriptor "undefined8 *" (type_identifier "undefined8") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0x10)" (( "(") (binary_expression "param_1 + 0x10" (identifier "param_1") (+ "+") (number_literal "0x10")) () ")"))))) (; ";")) (expression_statement "local_38 = param_3;" (assignment_expression "local_38 = param_3" (identifier "local_38") (= "=") (identifier "param_3")) (; ";")) (expression_statement "local_30 = param_4;" (assignment_expression "local_30 = param_4" (identifier "local_30") (= "=") (identifier "param_4")) (; ";")) (expression_statement "uVar1 = uVar2;" (assignment_expression "uVar1 = uVar2" (identifier "uVar1") (= "=") (identifier "uVar2")) (; ";")) (if_statement "if ((*(byte *)(param_1 + 0x18) & 4) != 0) {\n    FUN_003b8070(&local_38);\n  }" (if "if") (parenthesized_expression "((*(byte *)(param_1 + 0x18) & 4) != 0)" (( "(") (binary_expression "(*(byte *)(param_1 + 0x18) & 4) != 0" (parenthesized_expression "(*(byte *)(param_1 + 0x18) & 4)" (( "(") (binary_expression "*(byte *)(param_1 + 0x18) & 4" (pointer_expression "*(byte *)(param_1 + 0x18)" (* "*") (cast_expression "(byte *)(param_1 + 0x18)" (( "(") (type_descriptor "byte *" (type_identifier "byte") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0x18)" (( "(") (binary_expression "param_1 + 0x18" (identifier "param_1") (+ "+") (number_literal "0x18")) () ")")))) (& "&") (number_literal "4")) () ")")) (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    FUN_003b8070(&local_38);\n  }" ({ "{") (expression_statement "FUN_003b8070(&local_38);" (call_expression "FUN_003b8070(&local_38)" (identifier "FUN_003b8070") (argument_list "(&local_38)" (( "(") (pointer_expression "&local_38" (& "&") (identifier "local_38")) () ")"))) (; ";")) (} "}"))) (if_statement "if (0xfffe < uVar1) {\n    uVar2 = 0xffff;\n  }" (if "if") (parenthesized_expression "(0xfffe < uVar1)" (( "(") (binary_expression "0xfffe < uVar1" (number_literal "0xfffe") (< "<") (identifier "uVar1")) () ")")) (compound_statement "{\n    uVar2 = 0xffff;\n  }" ({ "{") (expression_statement "uVar2 = 0xffff;" (assignment_expression "uVar2 = 0xffff" (identifier "uVar2") (= "=") (number_literal "0xffff")) (; ";")) (} "}"))) (if_statement "if (param_5 != 0) {\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }" (if "if") (parenthesized_expression "(param_5 != 0)" (( "(") (binary_expression "param_5 != 0" (identifier "param_5") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n    do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);\n  }" ({ "{") (do_statement "do {\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    } while (param_5 != 0 && uVar1 <= uVar2);" (do "do") (compound_statement "{\n      param_5 = param_5 + -1;\n      uVar1 = FUN_003b6cd0(&local_38,uVar2);\n    }" ({ "{") (expression_statement "param_5 = param_5 + -1;" (assignment_expression "param_5 = param_5 + -1" (identifier "param_5") (= "=") (binary_expression "param_5 + -1" (identifier "param_5") (+ "+") (number_literal "-1"))) (; ";")) (expression_statement "uVar1 = FUN_003b6cd0(&local_38,uVar2);" (assignment_expression "uVar1 = FUN_003b6cd0(&local_38,uVar2)" (identifier "uVar1") (= "=") (call_expression "FUN_003b6cd0(&local_38,uVar2)" (identifier "FUN_003b6cd0") (argument_list "(&local_38,uVar2)" (( "(") (pointer_expression "&local_38" (& "&") (identifier "local_38")) (, ",") (identifier "uVar2") () ")")))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(param_5 != 0 && uVar1 <= uVar2)" (( "(") (binary_expression "param_5 != 0 && uVar1 <= uVar2" (binary_expression "param_5 != 0" (identifier "param_5") (!= "!=") (number_literal "0")) (&& "&&") (binary_expression "uVar1 <= uVar2" (identifier "uVar1") (<= "<=") (identifier "uVar2"))) () ")")) (; ";")) (} "}"))) (return_statement "return local_38 - param_3;" (return "return") (binary_expression "local_38 - param_3" (identifier "local_38") (- "-") (identifier "param_3")) (; ";")) (} "}")))

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

long __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_3)

{
  type_4 *puVar1;
  type_5 var_5;
  type_5 var_6;
  type_4 *puVar4;
  char *local_38;
  char *local_30;
  
  puVar1 = *(type_4 **)(var_1 + 0x10);
  puVar4 = puVar1;
  local_38 = param_2;
  local_30 = param_3;
  if (((type_6)var_1[0x18] & 4) != 0) {
    (anonymous_namespace)::read_bom<var_2,true,3ul>((type_7 *)&local_38,puVar1);
  }
  var_6 = (type_5)puVar1;
  if (0xfffe < (type_5)puVar4) {
    var_6 = 0xffff;
  }
  if (var_3 != 0) {
    do {
      var_3 = var_3 - 1;
      var_5 = (anonymous_namespace)::var_4((type_7 *)&local_38,(type_3)var_6);
    } while (var_3 != 0 && var_5 <= var_6);
  }
  return (long)local_38 - (long)param_2;
}


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

long MASKED(long param_1,undefined8 param_2,long param_3,undefined8 param_4,long param_5)

{
  uint uVar1;
  uint uVar2;
  long local_38;
  undefined8 local_30;
  
  uVar2 = (uint)*(undefined8 *)(param_1 + 0x10);
  local_38 = param_3;
  local_30 = param_4;
  uVar1 = uVar2;
  if ((*(byte *)(param_1 + 0x18) & 4) != 0) {
    FUN_003b8070(&local_38);
  }
  if (0xfffe < uVar1) {
    uVar2 = 0xffff;
  }
  if (param_5 != 0) {
    do {
      param_5 = param_5 + -1;
      uVar1 = FUN_003b6cd0(&local_38,uVar2);
    } while (param_5 != 0 && uVar1 <= uVar2);
  }
  return local_38 - param_3;
}

