
size_t move_mbleft(char *buf,size_t pos)

{
  wchar_t wVar1;
  long lVar2;
  ulong uVar3;
  
  if (!use_utf8) {
    return (pos - 1) + (ulong)(pos == 0);
  }
  if (pos < 4) {
    uVar3 = 0;
LAB_001079c4:
    lVar2 = 0;
    if (pos <= uVar3) goto LAB_001079ec;
  }
  else {
    uVar3 = pos - 1;
    if (buf[pos - 1] < -0x40) {
      uVar3 = pos - 2;
      if (((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||
         (uVar3 = pos - 4, -0x41 < buf[pos - 4])) goto LAB_001079c4;
      uVar3 = pos - 1;
    }
  }
  do {
    wVar1 = parse_mbchar(buf + uVar3,(char *)0x0,(size_t *)0x0);
    lVar2 = (long)wVar1;
    uVar3 = uVar3 + lVar2;
  } while (uVar3 < pos);
LAB_001079ec:
  return uVar3 - lVar2;
}



long FUN_00107974(long param_1,ulong param_2)

{
  int iVar1;
  long lVar2;
  ulong uVar3;
  
  if (DAT_0013b9f8 == '\0') {
    return (param_2 - 1) + (ulong)(param_2 == 0);
  }
  if (param_2 < 4) {
    uVar3 = 0;
LAB_001079c4:
    lVar2 = 0;
    if (param_2 <= uVar3) goto LAB_001079ec;
  }
  else {
    lVar2 = param_1 + param_2;
    uVar3 = param_2 - 1;
    if (*(char *)(lVar2 + -1) < -0x40) {
      uVar3 = param_2 - 2;
      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))
         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;
      uVar3 = param_2 - 1;
    }
  }
  do {
    iVar1 = FUN_00107814(param_1 + uVar3,0,0);
    lVar2 = (long)iVar1;
    uVar3 = uVar3 + lVar2;
  } while (uVar3 < param_2);
LAB_001079ec:
  return uVar3 - lVar2;
}


CMP byte ptr [0x0013b9f8],0x0
JZ 0x001079f7
PUSH R12
PUSH RBP
PUSH RBX
MOV R12,RSI
MOV RBP,RDI
CMP RSI,0x3
JBE 0x001079bf
LEA RAX,[RDI + RSI*0x1]
LEA RBX,[RSI + -0x1]
CMP byte ptr [RAX + -0x1],0xc0
JGE 0x001079ce
LEA RBX,[RSI + -0x2]
CMP byte ptr [RAX + -0x2],0xc0
JGE 0x001079c4
LEA RBX,[RSI + -0x3]
CMP byte ptr [RAX + -0x3],0xc0
JGE 0x001079c4
LEA RBX,[RSI + -0x4]
CMP byte ptr [RAX + -0x4],0xc0
JGE 0x001079c4
LEA RBX,[RSI + -0x1]
JMP 0x001079ce
MOV EBX,0x0
MOV EAX,0x0
CMP RBX,R12
JNC 0x001079ec
LEA RDI,[RBP + RBX*0x1]
MOV EDX,0x0
MOV ESI,0x0
CALL 0x00107814
CDQE
ADD RBX,RAX
CMP R12,RBX
JA 0x001079ce
SUB RBX,RAX
MOV RAX,RBX
POP RBX
POP RBP
POP R12
RET
CMP RSI,0x1
MOV RAX,RSI
ADC RAX,-0x1
RET
(translation_unit "long FUN_00107974(long param_1,ulong param_2)\n\n{\n  int iVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }\n  if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }\n  do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}\n\n" (function_definition "long FUN_00107974(long param_1,ulong param_2)\n\n{\n  int iVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }\n  if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }\n  do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}" (sized_type_specifier "long" long) (function_declarator "FUN_00107974(long param_1,ulong param_2)" identifier (parameter_list "(long param_1,ulong param_2)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "ulong param_2" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }\n  if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }\n  do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "long lVar2;" (sized_type_specifier "long" long) identifier ;) (declaration "ulong uVar3;" type_identifier identifier ;) (if_statement "if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }" if (parenthesized_expression "(DAT_0013b9f8 == '\0')" ( (binary_expression "DAT_0013b9f8 == '\0'" identifier == (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }" { (return_statement "return (param_2 - 1) + (ulong)(param_2 == 0);" return (binary_expression "(param_2 - 1) + (ulong)(param_2 == 0)" (parenthesized_expression "(param_2 - 1)" ( (binary_expression "param_2 - 1" identifier - number_literal) )) + (call_expression "(ulong)(param_2 == 0)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(param_2 == 0)" ( (binary_expression "param_2 == 0" identifier == number_literal) )))) ;) })) (if_statement "if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }" if (parenthesized_expression "(param_2 < 4)" ( (binary_expression "param_2 < 4" identifier < number_literal) )) (compound_statement "{\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }" { (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" identifier = number_literal) ;) (labeled_statement "LAB_001079c4:\n    lVar2 = 0;" statement_identifier : (expression_statement "lVar2 = 0;" (assignment_expression "lVar2 = 0" identifier = number_literal) ;)) (if_statement "if (param_2 <= uVar3) goto LAB_001079ec;" if (parenthesized_expression "(param_2 <= uVar3)" ( (binary_expression "param_2 <= uVar3" identifier <= identifier) )) (goto_statement "goto LAB_001079ec;" goto statement_identifier ;)) }) (else_clause "else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }" else (compound_statement "{\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }" { (expression_statement "lVar2 = param_1 + param_2;" (assignment_expression "lVar2 = param_1 + param_2" identifier = (binary_expression "param_1 + param_2" identifier + identifier)) ;) (expression_statement "uVar3 = param_2 - 1;" (assignment_expression "uVar3 = param_2 - 1" identifier = (binary_expression "param_2 - 1" identifier - number_literal)) ;) (if_statement "if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }" if (parenthesized_expression "(*(char *)(lVar2 + -1) < -0x40)" ( (binary_expression "*(char *)(lVar2 + -1) < -0x40" (pointer_expression "*(char *)(lVar2 + -1)" * (cast_expression "(char *)(lVar2 + -1)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar2 + -1)" ( (binary_expression "lVar2 + -1" identifier + number_literal) )))) < number_literal) )) (compound_statement "{\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }" { (expression_statement "uVar3 = param_2 - 2;" (assignment_expression "uVar3 = param_2 - 2" identifier = (binary_expression "param_2 - 2" identifier - number_literal)) ;) (if_statement "if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;" if (parenthesized_expression "(((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4)))" ( (binary_expression "((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))" (parenthesized_expression "((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))" ( (binary_expression "(-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3))" (parenthesized_expression "(-0x41 < *(char *)(lVar2 + -2))" ( (binary_expression "-0x41 < *(char *)(lVar2 + -2)" number_literal < (pointer_expression "*(char *)(lVar2 + -2)" * (cast_expression "(char *)(lVar2 + -2)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar2 + -2)" ( (binary_expression "lVar2 + -2" identifier + number_literal) ))))) )) || (parenthesized_expression "(uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3))" ( (comma_expression "uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)" (assignment_expression "uVar3 = param_2 - 3" identifier = (binary_expression "param_2 - 3" identifier - number_literal)) , (binary_expression "-0x41 < *(char *)(lVar2 + -3)" number_literal < (pointer_expression "*(char *)(lVar2 + -3)" * (cast_expression "(char *)(lVar2 + -3)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar2 + -3)" ( (binary_expression "lVar2 + -3" identifier + number_literal) )))))) ))) )) || (parenthesized_expression "(uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))" ( (comma_expression "uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4)" (assignment_expression "uVar3 = param_2 - 4" identifier = (binary_expression "param_2 - 4" identifier - number_literal)) , (binary_expression "-0x41 < *(char *)(lVar2 + -4)" number_literal < (pointer_expression "*(char *)(lVar2 + -4)" * (cast_expression "(char *)(lVar2 + -4)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar2 + -4)" ( (binary_expression "lVar2 + -4" identifier + number_literal) )))))) ))) )) (goto_statement "goto LAB_001079c4;" goto statement_identifier ;)) (expression_statement "uVar3 = param_2 - 1;" (assignment_expression "uVar3 = param_2 - 1" identifier = (binary_expression "param_2 - 1" identifier - number_literal)) ;) })) }))) (do_statement "do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);" do (compound_statement "{\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  }" { (expression_statement "iVar1 = FUN_00107814(param_1 + uVar3,0,0);" (assignment_expression "iVar1 = FUN_00107814(param_1 + uVar3,0,0)" identifier = (call_expression "FUN_00107814(param_1 + uVar3,0,0)" identifier (argument_list "(param_1 + uVar3,0,0)" ( (binary_expression "param_1 + uVar3" identifier + identifier) , number_literal , number_literal )))) ;) (expression_statement "lVar2 = (long)iVar1;" (assignment_expression "lVar2 = (long)iVar1" identifier = (cast_expression "(long)iVar1" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ;) (expression_statement "uVar3 = uVar3 + lVar2;" (assignment_expression "uVar3 = uVar3 + lVar2" identifier = (binary_expression "uVar3 + lVar2" identifier + identifier)) ;) }) while (parenthesized_expression "(uVar3 < param_2)" ( (binary_expression "uVar3 < param_2" identifier < identifier) )) ;) (labeled_statement "LAB_001079ec:\n  return uVar3 - lVar2;" statement_identifier : (return_statement "return uVar3 - lVar2;" return (binary_expression "uVar3 - lVar2" identifier - identifier) ;)) })))
(translation_unit "size_t move_mbleft(char *buf,size_t pos)\n\n{\n  wchar_t wVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (!use_utf8) {\n    return (pos - 1) + (ulong)(pos == 0);\n  }\n  if (pos < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (pos <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    uVar3 = pos - 1;\n    if (buf[pos - 1] < -0x40) {\n      uVar3 = pos - 2;\n      if (((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4])) goto LAB_001079c4;\n      uVar3 = pos - 1;\n    }\n  }\n  do {\n    wVar1 = parse_mbchar(buf + uVar3,(char *)0x0,(size_t *)0x0);\n    lVar2 = (long)wVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < pos);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}\n\n" (function_definition "size_t move_mbleft(char *buf,size_t pos)\n\n{\n  wchar_t wVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (!use_utf8) {\n    return (pos - 1) + (ulong)(pos == 0);\n  }\n  if (pos < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (pos <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    uVar3 = pos - 1;\n    if (buf[pos - 1] < -0x40) {\n      uVar3 = pos - 2;\n      if (((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4])) goto LAB_001079c4;\n      uVar3 = pos - 1;\n    }\n  }\n  do {\n    wVar1 = parse_mbchar(buf + uVar3,(char *)0x0,(size_t *)0x0);\n    lVar2 = (long)wVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < pos);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}" primitive_type (function_declarator "move_mbleft(char *buf,size_t pos)" identifier (parameter_list "(char *buf,size_t pos)" ( (parameter_declaration "char *buf" primitive_type (pointer_declarator "*buf" * identifier)) , (parameter_declaration "size_t pos" primitive_type identifier) ))) (compound_statement "{\n  wchar_t wVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (!use_utf8) {\n    return (pos - 1) + (ulong)(pos == 0);\n  }\n  if (pos < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (pos <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    uVar3 = pos - 1;\n    if (buf[pos - 1] < -0x40) {\n      uVar3 = pos - 2;\n      if (((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4])) goto LAB_001079c4;\n      uVar3 = pos - 1;\n    }\n  }\n  do {\n    wVar1 = parse_mbchar(buf + uVar3,(char *)0x0,(size_t *)0x0);\n    lVar2 = (long)wVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < pos);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}" { (declaration "wchar_t wVar1;" type_identifier identifier ;) (declaration "long lVar2;" (sized_type_specifier "long" long) identifier ;) (declaration "ulong uVar3;" type_identifier identifier ;) (if_statement "if (!use_utf8) {\n    return (pos - 1) + (ulong)(pos == 0);\n  }" if (parenthesized_expression "(!use_utf8)" ( (unary_expression "!use_utf8" ! identifier) )) (compound_statement "{\n    return (pos - 1) + (ulong)(pos == 0);\n  }" { (return_statement "return (pos - 1) + (ulong)(pos == 0);" return (binary_expression "(pos - 1) + (ulong)(pos == 0)" (parenthesized_expression "(pos - 1)" ( (binary_expression "pos - 1" identifier - number_literal) )) + (call_expression "(ulong)(pos == 0)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(pos == 0)" ( (binary_expression "pos == 0" identifier == number_literal) )))) ;) })) (if_statement "if (pos < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (pos <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    uVar3 = pos - 1;\n    if (buf[pos - 1] < -0x40) {\n      uVar3 = pos - 2;\n      if (((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4])) goto LAB_001079c4;\n      uVar3 = pos - 1;\n    }\n  }" if (parenthesized_expression "(pos < 4)" ( (binary_expression "pos < 4" identifier < number_literal) )) (compound_statement "{\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (pos <= uVar3) goto LAB_001079ec;\n  }" { (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" identifier = number_literal) ;) (labeled_statement "LAB_001079c4:\n    lVar2 = 0;" statement_identifier : (expression_statement "lVar2 = 0;" (assignment_expression "lVar2 = 0" identifier = number_literal) ;)) (if_statement "if (pos <= uVar3) goto LAB_001079ec;" if (parenthesized_expression "(pos <= uVar3)" ( (binary_expression "pos <= uVar3" identifier <= identifier) )) (goto_statement "goto LAB_001079ec;" goto statement_identifier ;)) }) (else_clause "else {\n    uVar3 = pos - 1;\n    if (buf[pos - 1] < -0x40) {\n      uVar3 = pos - 2;\n      if (((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4])) goto LAB_001079c4;\n      uVar3 = pos - 1;\n    }\n  }" else (compound_statement "{\n    uVar3 = pos - 1;\n    if (buf[pos - 1] < -0x40) {\n      uVar3 = pos - 2;\n      if (((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4])) goto LAB_001079c4;\n      uVar3 = pos - 1;\n    }\n  }" { (expression_statement "uVar3 = pos - 1;" (assignment_expression "uVar3 = pos - 1" identifier = (binary_expression "pos - 1" identifier - number_literal)) ;) (if_statement "if (buf[pos - 1] < -0x40) {\n      uVar3 = pos - 2;\n      if (((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4])) goto LAB_001079c4;\n      uVar3 = pos - 1;\n    }" if (parenthesized_expression "(buf[pos - 1] < -0x40)" ( (binary_expression "buf[pos - 1] < -0x40" (subscript_expression "buf[pos - 1]" identifier [ (binary_expression "pos - 1" identifier - number_literal) ]) < number_literal) )) (compound_statement "{\n      uVar3 = pos - 2;\n      if (((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4])) goto LAB_001079c4;\n      uVar3 = pos - 1;\n    }" { (expression_statement "uVar3 = pos - 2;" (assignment_expression "uVar3 = pos - 2" identifier = (binary_expression "pos - 2" identifier - number_literal)) ;) (if_statement "if (((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4])) goto LAB_001079c4;" if (parenthesized_expression "(((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4]))" ( (binary_expression "((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])) ||\n         (uVar3 = pos - 4, -0x41 < buf[pos - 4])" (parenthesized_expression "((-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3]))" ( (binary_expression "(-0x41 < buf[pos - 2]) || (uVar3 = pos - 3, -0x41 < buf[pos - 3])" (parenthesized_expression "(-0x41 < buf[pos - 2])" ( (binary_expression "-0x41 < buf[pos - 2]" number_literal < (subscript_expression "buf[pos - 2]" identifier [ (binary_expression "pos - 2" identifier - number_literal) ])) )) || (parenthesized_expression "(uVar3 = pos - 3, -0x41 < buf[pos - 3])" ( (comma_expression "uVar3 = pos - 3, -0x41 < buf[pos - 3]" (assignment_expression "uVar3 = pos - 3" identifier = (binary_expression "pos - 3" identifier - number_literal)) , (binary_expression "-0x41 < buf[pos - 3]" number_literal < (subscript_expression "buf[pos - 3]" identifier [ (binary_expression "pos - 3" identifier - number_literal) ]))) ))) )) || (parenthesized_expression "(uVar3 = pos - 4, -0x41 < buf[pos - 4])" ( (comma_expression "uVar3 = pos - 4, -0x41 < buf[pos - 4]" (assignment_expression "uVar3 = pos - 4" identifier = (binary_expression "pos - 4" identifier - number_literal)) , (binary_expression "-0x41 < buf[pos - 4]" number_literal < (subscript_expression "buf[pos - 4]" identifier [ (binary_expression "pos - 4" identifier - number_literal) ]))) ))) )) (goto_statement "goto LAB_001079c4;" goto statement_identifier ;)) (expression_statement "uVar3 = pos - 1;" (assignment_expression "uVar3 = pos - 1" identifier = (binary_expression "pos - 1" identifier - number_literal)) ;) })) }))) (do_statement "do {\n    wVar1 = parse_mbchar(buf + uVar3,(char *)0x0,(size_t *)0x0);\n    lVar2 = (long)wVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < pos);" do (compound_statement "{\n    wVar1 = parse_mbchar(buf + uVar3,(char *)0x0,(size_t *)0x0);\n    lVar2 = (long)wVar1;\n    uVar3 = uVar3 + lVar2;\n  }" { (expression_statement "wVar1 = parse_mbchar(buf + uVar3,(char *)0x0,(size_t *)0x0);" (assignment_expression "wVar1 = parse_mbchar(buf + uVar3,(char *)0x0,(size_t *)0x0)" identifier = (call_expression "parse_mbchar(buf + uVar3,(char *)0x0,(size_t *)0x0)" identifier (argument_list "(buf + uVar3,(char *)0x0,(size_t *)0x0)" ( (binary_expression "buf + uVar3" identifier + identifier) , (cast_expression "(char *)0x0" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) , (cast_expression "(size_t *)0x0" ( (type_descriptor "size_t *" primitive_type (abstract_pointer_declarator "*" *)) ) number_literal) )))) ;) (expression_statement "lVar2 = (long)wVar1;" (assignment_expression "lVar2 = (long)wVar1" identifier = (cast_expression "(long)wVar1" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ;) (expression_statement "uVar3 = uVar3 + lVar2;" (assignment_expression "uVar3 = uVar3 + lVar2" identifier = (binary_expression "uVar3 + lVar2" identifier + identifier)) ;) }) while (parenthesized_expression "(uVar3 < pos)" ( (binary_expression "uVar3 < pos" identifier < identifier) )) ;) (labeled_statement "LAB_001079ec:\n  return uVar3 - lVar2;" statement_identifier : (return_statement "return uVar3 - lVar2;" return (binary_expression "uVar3 - lVar2" identifier - identifier) ;)) })))
(translation_unit "long FUN_00107974(long param_1,ulong param_2)\n\n{\n  int iVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }\n  if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }\n  do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}\n\n" (function_definition "long FUN_00107974(long param_1,ulong param_2)\n\n{\n  int iVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }\n  if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }\n  do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}" (sized_type_specifier "long" long) (function_declarator "FUN_00107974(long param_1,ulong param_2)" identifier (parameter_list "(long param_1,ulong param_2)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "ulong param_2" type_identifier identifier) ))) (compound_statement "{\n  int iVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }\n  if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }\n  do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}" { (declaration "int iVar1;" primitive_type identifier ;) (declaration "long lVar2;" (sized_type_specifier "long" long) identifier ;) (declaration "ulong uVar3;" type_identifier identifier ;) (if_statement "if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }" if (parenthesized_expression "(DAT_0013b9f8 == '\0')" ( (binary_expression "DAT_0013b9f8 == '\0'" identifier == (char_literal "'\0'" ' escape_sequence ')) )) (compound_statement "{\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }" { (return_statement "return (param_2 - 1) + (ulong)(param_2 == 0);" return (binary_expression "(param_2 - 1) + (ulong)(param_2 == 0)" (parenthesized_expression "(param_2 - 1)" ( (binary_expression "param_2 - 1" identifier - number_literal) )) + (call_expression "(ulong)(param_2 == 0)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "(param_2 == 0)" ( (binary_expression "param_2 == 0" identifier == number_literal) )))) ;) })) (if_statement "if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }" if (parenthesized_expression "(param_2 < 4)" ( (binary_expression "param_2 < 4" identifier < number_literal) )) (compound_statement "{\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }" { (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" identifier = number_literal) ;) (labeled_statement "LAB_001079c4:\n    lVar2 = 0;" statement_identifier : (expression_statement "lVar2 = 0;" (assignment_expression "lVar2 = 0" identifier = number_literal) ;)) (if_statement "if (param_2 <= uVar3) goto LAB_001079ec;" if (parenthesized_expression "(param_2 <= uVar3)" ( (binary_expression "param_2 <= uVar3" identifier <= identifier) )) (goto_statement "goto LAB_001079ec;" goto statement_identifier ;)) }) (else_clause "else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }" else (compound_statement "{\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }" { (expression_statement "lVar2 = param_1 + param_2;" (assignment_expression "lVar2 = param_1 + param_2" identifier = (binary_expression "param_1 + param_2" identifier + identifier)) ;) (expression_statement "uVar3 = param_2 - 1;" (assignment_expression "uVar3 = param_2 - 1" identifier = (binary_expression "param_2 - 1" identifier - number_literal)) ;) (if_statement "if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }" if (parenthesized_expression "(*(char *)(lVar2 + -1) < -0x40)" ( (binary_expression "*(char *)(lVar2 + -1) < -0x40" (pointer_expression "*(char *)(lVar2 + -1)" * (cast_expression "(char *)(lVar2 + -1)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar2 + -1)" ( (binary_expression "lVar2 + -1" identifier + number_literal) )))) < number_literal) )) (compound_statement "{\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }" { (expression_statement "uVar3 = param_2 - 2;" (assignment_expression "uVar3 = param_2 - 2" identifier = (binary_expression "param_2 - 2" identifier - number_literal)) ;) (if_statement "if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;" if (parenthesized_expression "(((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4)))" ( (binary_expression "((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))" (parenthesized_expression "((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))" ( (binary_expression "(-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3))" (parenthesized_expression "(-0x41 < *(char *)(lVar2 + -2))" ( (binary_expression "-0x41 < *(char *)(lVar2 + -2)" number_literal < (pointer_expression "*(char *)(lVar2 + -2)" * (cast_expression "(char *)(lVar2 + -2)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar2 + -2)" ( (binary_expression "lVar2 + -2" identifier + number_literal) ))))) )) || (parenthesized_expression "(uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3))" ( (comma_expression "uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)" (assignment_expression "uVar3 = param_2 - 3" identifier = (binary_expression "param_2 - 3" identifier - number_literal)) , (binary_expression "-0x41 < *(char *)(lVar2 + -3)" number_literal < (pointer_expression "*(char *)(lVar2 + -3)" * (cast_expression "(char *)(lVar2 + -3)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar2 + -3)" ( (binary_expression "lVar2 + -3" identifier + number_literal) )))))) ))) )) || (parenthesized_expression "(uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))" ( (comma_expression "uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4)" (assignment_expression "uVar3 = param_2 - 4" identifier = (binary_expression "param_2 - 4" identifier - number_literal)) , (binary_expression "-0x41 < *(char *)(lVar2 + -4)" number_literal < (pointer_expression "*(char *)(lVar2 + -4)" * (cast_expression "(char *)(lVar2 + -4)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(lVar2 + -4)" ( (binary_expression "lVar2 + -4" identifier + number_literal) )))))) ))) )) (goto_statement "goto LAB_001079c4;" goto statement_identifier ;)) (expression_statement "uVar3 = param_2 - 1;" (assignment_expression "uVar3 = param_2 - 1" identifier = (binary_expression "param_2 - 1" identifier - number_literal)) ;) })) }))) (do_statement "do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);" do (compound_statement "{\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  }" { (expression_statement "iVar1 = FUN_00107814(param_1 + uVar3,0,0);" (assignment_expression "iVar1 = FUN_00107814(param_1 + uVar3,0,0)" identifier = (call_expression "FUN_00107814(param_1 + uVar3,0,0)" identifier (argument_list "(param_1 + uVar3,0,0)" ( (binary_expression "param_1 + uVar3" identifier + identifier) , number_literal , number_literal )))) ;) (expression_statement "lVar2 = (long)iVar1;" (assignment_expression "lVar2 = (long)iVar1" identifier = (cast_expression "(long)iVar1" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) ;) (expression_statement "uVar3 = uVar3 + lVar2;" (assignment_expression "uVar3 = uVar3 + lVar2" identifier = (binary_expression "uVar3 + lVar2" identifier + identifier)) ;) }) while (parenthesized_expression "(uVar3 < param_2)" ( (binary_expression "uVar3 < param_2" identifier < identifier) )) ;) (labeled_statement "LAB_001079ec:\n  return uVar3 - lVar2;" statement_identifier : (return_statement "return uVar3 - lVar2;" return (binary_expression "uVar3 - lVar2" 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) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration (sized_type_specifier long) IDENT ;) (declaration TYPE IDENT ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (char_literal ' escape_sequence ')) )) (compound_statement { (return_statement return (binary_expression (parenthesized_expression ( (binary_expression IDENT - LIT) )) + (call_expression (parenthesized_expression ( IDENT )) (argument_list ( (binary_expression IDENT == LIT) )))) ;) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (labeled_statement statement_identifier : (expression_statement (assignment_expression IDENT = LIT) ;)) (if_statement if (parenthesized_expression ( (binary_expression IDENT <= IDENT) )) (goto_statement goto statement_identifier ;)) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) < LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT - LIT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression LIT < (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) )) || (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (binary_expression IDENT - LIT)) , (binary_expression LIT < (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))))) ))) )) || (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (binary_expression IDENT - LIT)) , (binary_expression LIT < (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))))) ))) )) (goto_statement goto statement_identifier ;)) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - LIT)) ;) })) }))) (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (binary_expression IDENT + IDENT) , LIT , LIT )))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT < IDENT) )) ;) (labeled_statement statement_identifier : (return_statement return (binary_expression IDENT - IDENT) ;)) })))
(function_definition "long FUN_00107974(long param_1,ulong param_2)\n\n{\n  int iVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }\n  if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }\n  do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}" (sized_type_specifier "long" (long "long")) (function_declarator "FUN_00107974(long param_1,ulong param_2)" (identifier "FUN_00107974") (parameter_list "(long param_1,ulong param_2)" (( "(") (parameter_declaration "long param_1" (sized_type_specifier "long" (long "long")) (identifier "param_1")) (, ",") (parameter_declaration "ulong param_2" (type_identifier "ulong") (identifier "param_2")) () ")"))) (compound_statement "{\n  int iVar1;\n  long lVar2;\n  ulong uVar3;\n  \n  if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }\n  if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }\n  do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);\nLAB_001079ec:\n  return uVar3 - lVar2;\n}" ({ "{") (declaration "int iVar1;" (primitive_type "int") (identifier "iVar1") (; ";")) (declaration "long lVar2;" (sized_type_specifier "long" (long "long")) (identifier "lVar2") (; ";")) (declaration "ulong uVar3;" (type_identifier "ulong") (identifier "uVar3") (; ";")) (if_statement "if (DAT_0013b9f8 == '\0') {\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }" (if "if") (parenthesized_expression "(DAT_0013b9f8 == '\0')" (( "(") (binary_expression "DAT_0013b9f8 == '\0'" (identifier "DAT_0013b9f8") (== "==") (char_literal "'\0'" (' "'") (escape_sequence "\0") (' "'"))) () ")")) (compound_statement "{\n    return (param_2 - 1) + (ulong)(param_2 == 0);\n  }" ({ "{") (return_statement "return (param_2 - 1) + (ulong)(param_2 == 0);" (return "return") (binary_expression "(param_2 - 1) + (ulong)(param_2 == 0)" (parenthesized_expression "(param_2 - 1)" (( "(") (binary_expression "param_2 - 1" (identifier "param_2") (- "-") (number_literal "1")) () ")")) (+ "+") (call_expression "(ulong)(param_2 == 0)" (parenthesized_expression "(ulong)" (( "(") (identifier "ulong") () ")")) (argument_list "(param_2 == 0)" (( "(") (binary_expression "param_2 == 0" (identifier "param_2") (== "==") (number_literal "0")) () ")")))) (; ";")) (} "}"))) (if_statement "if (param_2 < 4) {\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }\n  else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }" (if "if") (parenthesized_expression "(param_2 < 4)" (( "(") (binary_expression "param_2 < 4" (identifier "param_2") (< "<") (number_literal "4")) () ")")) (compound_statement "{\n    uVar3 = 0;\nLAB_001079c4:\n    lVar2 = 0;\n    if (param_2 <= uVar3) goto LAB_001079ec;\n  }" ({ "{") (expression_statement "uVar3 = 0;" (assignment_expression "uVar3 = 0" (identifier "uVar3") (= "=") (number_literal "0")) (; ";")) (labeled_statement "LAB_001079c4:\n    lVar2 = 0;" (statement_identifier "LAB_001079c4") (: ":") (expression_statement "lVar2 = 0;" (assignment_expression "lVar2 = 0" (identifier "lVar2") (= "=") (number_literal "0")) (; ";"))) (if_statement "if (param_2 <= uVar3) goto LAB_001079ec;" (if "if") (parenthesized_expression "(param_2 <= uVar3)" (( "(") (binary_expression "param_2 <= uVar3" (identifier "param_2") (<= "<=") (identifier "uVar3")) () ")")) (goto_statement "goto LAB_001079ec;" (goto "goto") (statement_identifier "LAB_001079ec") (; ";"))) (} "}")) (else_clause "else {\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }" (else "else") (compound_statement "{\n    lVar2 = param_1 + param_2;\n    uVar3 = param_2 - 1;\n    if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }\n  }" ({ "{") (expression_statement "lVar2 = param_1 + param_2;" (assignment_expression "lVar2 = param_1 + param_2" (identifier "lVar2") (= "=") (binary_expression "param_1 + param_2" (identifier "param_1") (+ "+") (identifier "param_2"))) (; ";")) (expression_statement "uVar3 = param_2 - 1;" (assignment_expression "uVar3 = param_2 - 1" (identifier "uVar3") (= "=") (binary_expression "param_2 - 1" (identifier "param_2") (- "-") (number_literal "1"))) (; ";")) (if_statement "if (*(char *)(lVar2 + -1) < -0x40) {\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }" (if "if") (parenthesized_expression "(*(char *)(lVar2 + -1) < -0x40)" (( "(") (binary_expression "*(char *)(lVar2 + -1) < -0x40" (pointer_expression "*(char *)(lVar2 + -1)" (* "*") (cast_expression "(char *)(lVar2 + -1)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(lVar2 + -1)" (( "(") (binary_expression "lVar2 + -1" (identifier "lVar2") (+ "+") (number_literal "-1")) () ")")))) (< "<") (number_literal "-0x40")) () ")")) (compound_statement "{\n      uVar3 = param_2 - 2;\n      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;\n      uVar3 = param_2 - 1;\n    }" ({ "{") (expression_statement "uVar3 = param_2 - 2;" (assignment_expression "uVar3 = param_2 - 2" (identifier "uVar3") (= "=") (binary_expression "param_2 - 2" (identifier "param_2") (- "-") (number_literal "2"))) (; ";")) (if_statement "if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;" (if "if") (parenthesized_expression "(((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4)))" (( "(") (binary_expression "((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))\n         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))" (parenthesized_expression "((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))" (( "(") (binary_expression "(-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3))" (parenthesized_expression "(-0x41 < *(char *)(lVar2 + -2))" (( "(") (binary_expression "-0x41 < *(char *)(lVar2 + -2)" (number_literal "-0x41") (< "<") (pointer_expression "*(char *)(lVar2 + -2)" (* "*") (cast_expression "(char *)(lVar2 + -2)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(lVar2 + -2)" (( "(") (binary_expression "lVar2 + -2" (identifier "lVar2") (+ "+") (number_literal "-2")) () ")"))))) () ")")) (|| "||") (parenthesized_expression "(uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3))" (( "(") (comma_expression "uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)" (assignment_expression "uVar3 = param_2 - 3" (identifier "uVar3") (= "=") (binary_expression "param_2 - 3" (identifier "param_2") (- "-") (number_literal "3"))) (, ",") (binary_expression "-0x41 < *(char *)(lVar2 + -3)" (number_literal "-0x41") (< "<") (pointer_expression "*(char *)(lVar2 + -3)" (* "*") (cast_expression "(char *)(lVar2 + -3)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(lVar2 + -3)" (( "(") (binary_expression "lVar2 + -3" (identifier "lVar2") (+ "+") (number_literal "-3")) () ")")))))) () ")"))) () ")")) (|| "||") (parenthesized_expression "(uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))" (( "(") (comma_expression "uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4)" (assignment_expression "uVar3 = param_2 - 4" (identifier "uVar3") (= "=") (binary_expression "param_2 - 4" (identifier "param_2") (- "-") (number_literal "4"))) (, ",") (binary_expression "-0x41 < *(char *)(lVar2 + -4)" (number_literal "-0x41") (< "<") (pointer_expression "*(char *)(lVar2 + -4)" (* "*") (cast_expression "(char *)(lVar2 + -4)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(lVar2 + -4)" (( "(") (binary_expression "lVar2 + -4" (identifier "lVar2") (+ "+") (number_literal "-4")) () ")")))))) () ")"))) () ")")) (goto_statement "goto LAB_001079c4;" (goto "goto") (statement_identifier "LAB_001079c4") (; ";"))) (expression_statement "uVar3 = param_2 - 1;" (assignment_expression "uVar3 = param_2 - 1" (identifier "uVar3") (= "=") (binary_expression "param_2 - 1" (identifier "param_2") (- "-") (number_literal "1"))) (; ";")) (} "}"))) (} "}")))) (do_statement "do {\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  } while (uVar3 < param_2);" (do "do") (compound_statement "{\n    iVar1 = FUN_00107814(param_1 + uVar3,0,0);\n    lVar2 = (long)iVar1;\n    uVar3 = uVar3 + lVar2;\n  }" ({ "{") (expression_statement "iVar1 = FUN_00107814(param_1 + uVar3,0,0);" (assignment_expression "iVar1 = FUN_00107814(param_1 + uVar3,0,0)" (identifier "iVar1") (= "=") (call_expression "FUN_00107814(param_1 + uVar3,0,0)" (identifier "FUN_00107814") (argument_list "(param_1 + uVar3,0,0)" (( "(") (binary_expression "param_1 + uVar3" (identifier "param_1") (+ "+") (identifier "uVar3")) (, ",") (number_literal "0") (, ",") (number_literal "0") () ")")))) (; ";")) (expression_statement "lVar2 = (long)iVar1;" (assignment_expression "lVar2 = (long)iVar1" (identifier "lVar2") (= "=") (cast_expression "(long)iVar1" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "iVar1"))) (; ";")) (expression_statement "uVar3 = uVar3 + lVar2;" (assignment_expression "uVar3 = uVar3 + lVar2" (identifier "uVar3") (= "=") (binary_expression "uVar3 + lVar2" (identifier "uVar3") (+ "+") (identifier "lVar2"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(uVar3 < param_2)" (( "(") (binary_expression "uVar3 < param_2" (identifier "uVar3") (< "<") (identifier "param_2")) () ")")) (; ";")) (labeled_statement "LAB_001079ec:\n  return uVar3 - lVar2;" (statement_identifier "LAB_001079ec") (: ":") (return_statement "return uVar3 - lVar2;" (return "return") (binary_expression "uVar3 - lVar2" (identifier "uVar3") (- "-") (identifier "lVar2")) (; ";"))) (} "}")))

size_t function_1(char *var_4,size_t var_1)

{
  type_1 wVar1;
  long var_5;
  type_2 var_2;
  
  if (!use_utf8) {
    return (var_1 - 1) + (type_2)(var_1 == 0);
  }
  if (var_1 < 4) {
    var_2 = 0;
LAB_001079c4:
    var_5 = 0;
    if (var_1 <= var_2) goto LAB_001079ec;
  }
  else {
    var_2 = var_1 - 1;
    if (var_4[var_1 - 1] < -0x40) {
      var_2 = var_1 - 2;
      if (((-0x41 < var_4[var_1 - 2]) || (var_2 = var_1 - 3, -0x41 < var_4[var_1 - 3])) ||
         (var_2 = var_1 - 4, -0x41 < var_4[var_1 - 4])) goto LAB_001079c4;
      var_2 = var_1 - 1;
    }
  }
  do {
    wVar1 = var_3(var_4 + var_2,(char *)0x0,(size_t *)0x0);
    var_5 = (long)wVar1;
    var_2 = var_2 + var_5;
  } while (var_2 < var_1);
LAB_001079ec:
  return var_2 - var_5;
}


(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)))) body: (compound_statement (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (sized_type_specifier) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (char_literal (escape_sequence)))) consequence: (compound_statement (return_statement (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) right: (call_expression function: (parenthesized_expression (identifier)) arguments: (argument_list (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: (number_literal))) (labeled_statement label: (statement_identifier) (expression_statement (assignment_expression left: (identifier) right: (number_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (goto_statement label: (statement_identifier)))) alternative: (else_clause (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (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))))) 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: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (number_literal) 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))))))) right: (parenthesized_expression (comma_expression left: (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal))) right: (binary_expression left: (number_literal) 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)))))))))) right: (parenthesized_expression (comma_expression left: (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal))) right: (binary_expression left: (number_literal) 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)))))))))) consequence: (goto_statement label: (statement_identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal))))))))) (do_statement body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (number_literal) (number_literal))))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))) condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) (labeled_statement label: (statement_identifier) (return_statement (binary_expression left: (identifier) right: (identifier)))))))

long MASKED(long param_1,ulong param_2)

{
  int iVar1;
  long lVar2;
  ulong uVar3;
  
  if (DAT_0013b9f8 == '\0') {
    return (param_2 - 1) + (ulong)(param_2 == 0);
  }
  if (param_2 < 4) {
    uVar3 = 0;
LAB_001079c4:
    lVar2 = 0;
    if (param_2 <= uVar3) goto LAB_001079ec;
  }
  else {
    lVar2 = param_1 + param_2;
    uVar3 = param_2 - 1;
    if (*(char *)(lVar2 + -1) < -0x40) {
      uVar3 = param_2 - 2;
      if (((-0x41 < *(char *)(lVar2 + -2)) || (uVar3 = param_2 - 3, -0x41 < *(char *)(lVar2 + -3)))
         || (uVar3 = param_2 - 4, -0x41 < *(char *)(lVar2 + -4))) goto LAB_001079c4;
      uVar3 = param_2 - 1;
    }
  }
  do {
    iVar1 = FUN_00107814(param_1 + uVar3,0,0);
    lVar2 = (long)iVar1;
    uVar3 = uVar3 + lVar2;
  } while (uVar3 < param_2);
LAB_001079ec:
  return uVar3 - lVar2;
}

