
/* std::wstreambuf::xsgetn(wchar_t*, long) */

long __thiscall std::wstreambuf::xsgetn(wstreambuf *this,wchar_t *param_1,long param_2)

{
  wchar_t *__s2;
  code *pcVar1;
  int iVar2;
  wchar_t wVar3;
  size_t sVar4;
  size_t __n;
  long lVar5;
  
  if (param_2 < 1) {
    return 0;
  }
  lVar5 = 0;
  do {
    __s2 = *(wchar_t **)(this + 0x10);
    if (*(wchar_t **)(this + 0x18) != __s2) {
      sVar4 = (long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2;
      __n = param_2 - lVar5;
      if ((long)sVar4 <= param_2 - lVar5) {
        __n = sVar4;
      }
      lVar5 = lVar5 + __n;
      wmemcpy(param_1,__s2,__n);
      *(size_t *)(this + 0x10) = *(long *)(this + 0x10) + __n * 4;
      if (param_2 <= lVar5) {
        return lVar5;
      }
      param_1 = param_1 + __n;
    }
    pcVar1 = *(code **)(*(long *)this + 0x50);
    if (pcVar1 == (code *)PTR_uflow_003f7aa0) {
      pcVar1 = *(code **)(*(long *)this + 0x48);
      if (pcVar1 == (code *)PTR_underflow_003f7cf8) {
        return lVar5;
      }
      iVar2 = (*pcVar1)(this);
      if (iVar2 == -1) {
        return lVar5;
      }
      wVar3 = **(wchar_t **)(this + 0x10);
      *(wchar_t **)(this + 0x10) = *(wchar_t **)(this + 0x10) + 1;
    }
    else {
      wVar3 = (*pcVar1)(this);
    }
    if (wVar3 == L'\xffffffff') {
      return lVar5;
    }
    lVar5 = lVar5 + 1;
    *param_1 = wVar3;
    param_1 = param_1 + 1;
  } while (lVar5 < param_2);
  return lVar5;
}



long FUN_002ac210(long *param_1,wchar_t *param_2,long param_3)

{
  wchar_t *__s2;
  code *pcVar1;
  int iVar2;
  wchar_t wVar3;
  size_t sVar4;
  size_t __n;
  long lVar5;
  
  if (param_3 < 1) {
    return 0;
  }
  lVar5 = 0;
  do {
    __s2 = (wchar_t *)param_1[2];
    if ((wchar_t *)param_1[3] != __s2) {
      sVar4 = param_1[3] - (long)__s2 >> 2;
      __n = param_3 - lVar5;
      if ((long)sVar4 <= param_3 - lVar5) {
        __n = sVar4;
      }
      lVar5 = lVar5 + __n;
      wmemcpy(param_2,__s2,__n);
      param_1[2] = param_1[2] + __n * 4;
      if (param_3 <= lVar5) {
        return lVar5;
      }
      param_2 = param_2 + __n;
    }
    pcVar1 = *(code **)(*param_1 + 0x50);
    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {
      pcVar1 = *(code **)(*param_1 + 0x48);
      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {
        return lVar5;
      }
      iVar2 = (*pcVar1)(param_1);
      if (iVar2 == -1) {
        return lVar5;
      }
      wVar3 = *(wchar_t *)param_1[2];
      param_1[2] = (long)((wchar_t *)param_1[2] + 1);
    }
    else {
      wVar3 = (*pcVar1)(param_1);
    }
    if (wVar3 == L'\xffffffff') {
      return lVar5;
    }
    lVar5 = lVar5 + 1;
    *param_2 = wVar3;
    param_2 = param_2 + 1;
  } while (lVar5 < param_3);
  return lVar5;
}


PUSH R14
PUSH R13
PUSH R12
PUSH RBP
PUSH RBX
TEST RDX,RDX
JLE 0x002ac2df
MOV R12,RDI
MOV R14,RSI
MOV R13,RDX
XOR EBP,EBP
NOP dword ptr [RAX]
MOV RAX,qword ptr [R12 + 0x18]
MOV RSI,qword ptr [R12 + 0x10]
CMP RAX,RSI
JZ 0x002ac280
SUB RAX,RSI
MOV RBX,R13
MOV RDI,R14
SAR RAX,0x2
SUB RBX,RBP
CMP RAX,RBX
CMOVLE RBX,RAX
MOV RDX,RBX
ADD RBP,RBX
SHL RBX,0x2
CALL 0x001440f0
ADD qword ptr [R12 + 0x10],RBX
CMP R13,RBP
JG 0x002ac2e3
POP RBX
MOV RAX,RBP
POP RBP
POP R12
POP R13
POP R14
RET
MOV RBX,R14
MOV RAX,qword ptr [R12]
MOV RDX,qword ptr [RAX + 0x50]
CMP RDX,qword ptr [0x003f7aa0]
JNZ 0x002ac2d8
MOV RAX,qword ptr [RAX + 0x48]
CMP RAX,qword ptr [0x003f7cf8]
JZ 0x002ac26f
MOV RDI,R12
CALL RAX
CMP EAX,-0x1
JZ 0x002ac26f
MOV RDX,qword ptr [R12 + 0x10]
MOV EAX,dword ptr [RDX]
ADD RDX,0x4
MOV qword ptr [R12 + 0x10],RDX
CMP EAX,-0x1
JZ 0x002ac26f
ADD RBP,0x1
LEA R14,[RBX + 0x4]
MOV dword ptr [RBX],EAX
CMP R13,RBP
JG 0x002ac230
JMP 0x002ac26f
MOV RDI,R12
CALL RDX
JMP 0x002ac2bb
XOR EBP,EBP
JMP 0x002ac26f
ADD RBX,R14
JMP 0x002ac283
(translation_unit "long FUN_002ac210(long *param_1,wchar_t *param_2,long param_3)\n\n{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_3 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);\n  return lVar5;\n}\n\n" (function_definition "long FUN_002ac210(long *param_1,wchar_t *param_2,long param_3)\n\n{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_3 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);\n  return lVar5;\n}" (sized_type_specifier "long" long) (function_declarator "FUN_002ac210(long *param_1,wchar_t *param_2,long param_3)" identifier (parameter_list "(long *param_1,wchar_t *param_2,long param_3)" ( (parameter_declaration "long *param_1" (sized_type_specifier "long" long) (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "wchar_t *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_3 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);\n  return lVar5;\n}" { (declaration "wchar_t *__s2;" type_identifier (pointer_declarator "*__s2" * identifier) ;) (declaration "code *pcVar1;" type_identifier (pointer_declarator "*pcVar1" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "wchar_t wVar3;" type_identifier identifier ;) (declaration "size_t sVar4;" primitive_type identifier ;) (declaration "size_t __n;" primitive_type identifier ;) (declaration "long lVar5;" (sized_type_specifier "long" long) identifier ;) (if_statement "if (param_3 < 1) {\n    return 0;\n  }" if (parenthesized_expression "(param_3 < 1)" ( (binary_expression "param_3 < 1" identifier < number_literal) )) (compound_statement "{\n    return 0;\n  }" { (return_statement "return 0;" return number_literal ;) })) (expression_statement "lVar5 = 0;" (assignment_expression "lVar5 = 0" identifier = number_literal) ;) (do_statement "do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);" do (compound_statement "{\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  }" { (expression_statement "__s2 = (wchar_t *)param_1[2];" (assignment_expression "__s2 = (wchar_t *)param_1[2]" identifier = (cast_expression "(wchar_t *)param_1[2]" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (subscript_expression "param_1[2]" identifier [ number_literal ]))) ;) (if_statement "if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }" if (parenthesized_expression "((wchar_t *)param_1[3] != __s2)" ( (binary_expression "(wchar_t *)param_1[3] != __s2" (cast_expression "(wchar_t *)param_1[3]" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (subscript_expression "param_1[3]" identifier [ number_literal ])) != identifier) )) (compound_statement "{\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }" { (expression_statement "sVar4 = param_1[3] - (long)__s2 >> 2;" (assignment_expression "sVar4 = param_1[3] - (long)__s2 >> 2" identifier = (binary_expression "param_1[3] - (long)__s2 >> 2" (binary_expression "param_1[3] - (long)__s2" (subscript_expression "param_1[3]" identifier [ number_literal ]) - (cast_expression "(long)__s2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) >> number_literal)) ;) (expression_statement "__n = param_3 - lVar5;" (assignment_expression "__n = param_3 - lVar5" identifier = (binary_expression "param_3 - lVar5" identifier - identifier)) ;) (if_statement "if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }" if (parenthesized_expression "((long)sVar4 <= param_3 - lVar5)" ( (binary_expression "(long)sVar4 <= param_3 - lVar5" (cast_expression "(long)sVar4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) <= (binary_expression "param_3 - lVar5" identifier - identifier)) )) (compound_statement "{\n        __n = sVar4;\n      }" { (expression_statement "__n = sVar4;" (assignment_expression "__n = sVar4" identifier = identifier) ;) })) (expression_statement "lVar5 = lVar5 + __n;" (assignment_expression "lVar5 = lVar5 + __n" identifier = (binary_expression "lVar5 + __n" identifier + identifier)) ;) (expression_statement "wmemcpy(param_2,__s2,__n);" (call_expression "wmemcpy(param_2,__s2,__n)" identifier (argument_list "(param_2,__s2,__n)" ( identifier , identifier , identifier ))) ;) (expression_statement "param_1[2] = param_1[2] + __n * 4;" (assignment_expression "param_1[2] = param_1[2] + __n * 4" (subscript_expression "param_1[2]" identifier [ number_literal ]) = (binary_expression "param_1[2] + __n * 4" (subscript_expression "param_1[2]" identifier [ number_literal ]) + (binary_expression "__n * 4" identifier * number_literal))) ;) (if_statement "if (param_3 <= lVar5) {\n        return lVar5;\n      }" if (parenthesized_expression "(param_3 <= lVar5)" ( (binary_expression "param_3 <= lVar5" identifier <= identifier) )) (compound_statement "{\n        return lVar5;\n      }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "param_2 = param_2 + __n;" (assignment_expression "param_2 = param_2 + __n" identifier = (binary_expression "param_2 + __n" identifier + identifier)) ;) })) (expression_statement "pcVar1 = *(code **)(*param_1 + 0x50);" (assignment_expression "pcVar1 = *(code **)(*param_1 + 0x50)" identifier = (pointer_expression "*(code **)(*param_1 + 0x50)" * (cast_expression "(code **)(*param_1 + 0x50)" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*param_1 + 0x50)" ( (binary_expression "*param_1 + 0x50" (pointer_expression "*param_1" * identifier) + number_literal) ))))) ;) (if_statement "if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }" if (parenthesized_expression "(pcVar1 == (code *)PTR_FUN_003f7aa0)" ( (binary_expression "pcVar1 == (code *)PTR_FUN_003f7aa0" identifier == (cast_expression "(code *)PTR_FUN_003f7aa0" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (compound_statement "{\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }" { (expression_statement "pcVar1 = *(code **)(*param_1 + 0x48);" (assignment_expression "pcVar1 = *(code **)(*param_1 + 0x48)" identifier = (pointer_expression "*(code **)(*param_1 + 0x48)" * (cast_expression "(code **)(*param_1 + 0x48)" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*param_1 + 0x48)" ( (binary_expression "*param_1 + 0x48" (pointer_expression "*param_1" * identifier) + number_literal) ))))) ;) (if_statement "if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }" if (parenthesized_expression "(pcVar1 == (code *)PTR_FUN_003f7cf8)" ( (binary_expression "pcVar1 == (code *)PTR_FUN_003f7cf8" identifier == (cast_expression "(code *)PTR_FUN_003f7cf8" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (compound_statement "{\n        return lVar5;\n      }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "iVar2 = (*pcVar1)(param_1);" (assignment_expression "iVar2 = (*pcVar1)(param_1)" identifier = (call_expression "(*pcVar1)(param_1)" (parenthesized_expression "(*pcVar1)" ( (pointer_expression "*pcVar1" * identifier) )) (argument_list "(param_1)" ( identifier )))) ;) (if_statement "if (iVar2 == -1) {\n        return lVar5;\n      }" if (parenthesized_expression "(iVar2 == -1)" ( (binary_expression "iVar2 == -1" identifier == number_literal) )) (compound_statement "{\n        return lVar5;\n      }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "wVar3 = *(wchar_t *)param_1[2];" (assignment_expression "wVar3 = *(wchar_t *)param_1[2]" identifier = (pointer_expression "*(wchar_t *)param_1[2]" * (cast_expression "(wchar_t *)param_1[2]" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (subscript_expression "param_1[2]" identifier [ number_literal ])))) ;) (expression_statement "param_1[2] = (long)((wchar_t *)param_1[2] + 1);" (assignment_expression "param_1[2] = (long)((wchar_t *)param_1[2] + 1)" (subscript_expression "param_1[2]" identifier [ number_literal ]) = (cast_expression "(long)((wchar_t *)param_1[2] + 1)" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (parenthesized_expression "((wchar_t *)param_1[2] + 1)" ( (binary_expression "(wchar_t *)param_1[2] + 1" (cast_expression "(wchar_t *)param_1[2]" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (subscript_expression "param_1[2]" identifier [ number_literal ])) + number_literal) )))) ;) }) (else_clause "else {\n      wVar3 = (*pcVar1)(param_1);\n    }" else (compound_statement "{\n      wVar3 = (*pcVar1)(param_1);\n    }" { (expression_statement "wVar3 = (*pcVar1)(param_1);" (assignment_expression "wVar3 = (*pcVar1)(param_1)" identifier = (call_expression "(*pcVar1)(param_1)" (parenthesized_expression "(*pcVar1)" ( (pointer_expression "*pcVar1" * identifier) )) (argument_list "(param_1)" ( identifier )))) ;) }))) (if_statement "if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }" if (parenthesized_expression "(wVar3 == L'\xffffffff')" ( (binary_expression "wVar3 == L'\xffffffff'" identifier == (char_literal "L'\xffffffff'" L' escape_sequence character character character character ')) )) (compound_statement "{\n      return lVar5;\n    }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "lVar5 = lVar5 + 1;" (assignment_expression "lVar5 = lVar5 + 1" identifier = (binary_expression "lVar5 + 1" identifier + number_literal)) ;) (expression_statement "*param_2 = wVar3;" (assignment_expression "*param_2 = wVar3" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "param_2 = param_2 + 1;" (assignment_expression "param_2 = param_2 + 1" identifier = (binary_expression "param_2 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "(lVar5 < param_3)" ( (binary_expression "lVar5 < param_3" identifier < identifier) )) ;) (return_statement "return lVar5;" return identifier ;) })))
(translation_unit "/* std::wstreambuf::xsgetn(wchar_t*, long) */\n\nlong __thiscall std::wstreambuf::xsgetn(wstreambuf *this,wchar_t *param_1,long param_2)\n\n{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_2 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = *(wchar_t **)(this + 0x10);\n    if (*(wchar_t **)(this + 0x18) != __s2) {\n      sVar4 = (long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2;\n      __n = param_2 - lVar5;\n      if ((long)sVar4 <= param_2 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_1,__s2,__n);\n      *(size_t *)(this + 0x10) = *(long *)(this + 0x10) + __n * 4;\n      if (param_2 <= lVar5) {\n        return lVar5;\n      }\n      param_1 = param_1 + __n;\n    }\n    pcVar1 = *(code **)(*(long *)this + 0x50);\n    if (pcVar1 == (code *)PTR_uflow_003f7aa0) {\n      pcVar1 = *(code **)(*(long *)this + 0x48);\n      if (pcVar1 == (code *)PTR_underflow_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(this);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = **(wchar_t **)(this + 0x10);\n      *(wchar_t **)(this + 0x10) = *(wchar_t **)(this + 0x10) + 1;\n    }\n    else {\n      wVar3 = (*pcVar1)(this);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_1 = wVar3;\n    param_1 = param_1 + 1;\n  } while (lVar5 < param_2);\n  return lVar5;\n}\n\n" comment (function_definition "long __thiscall std::wstreambuf::xsgetn(wstreambuf *this,wchar_t *param_1,long param_2)\n\n{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_2 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = *(wchar_t **)(this + 0x10);\n    if (*(wchar_t **)(this + 0x18) != __s2) {\n      sVar4 = (long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2;\n      __n = param_2 - lVar5;\n      if ((long)sVar4 <= param_2 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_1,__s2,__n);\n      *(size_t *)(this + 0x10) = *(long *)(this + 0x10) + __n * 4;\n      if (param_2 <= lVar5) {\n        return lVar5;\n      }\n      param_1 = param_1 + __n;\n    }\n    pcVar1 = *(code **)(*(long *)this + 0x50);\n    if (pcVar1 == (code *)PTR_uflow_003f7aa0) {\n      pcVar1 = *(code **)(*(long *)this + 0x48);\n      if (pcVar1 == (code *)PTR_underflow_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(this);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = **(wchar_t **)(this + 0x10);\n      *(wchar_t **)(this + 0x10) = *(wchar_t **)(this + 0x10) + 1;\n    }\n    else {\n      wVar3 = (*pcVar1)(this);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_1 = wVar3;\n    param_1 = param_1 + 1;\n  } while (lVar5 < param_2);\n  return lVar5;\n}" (sized_type_specifier "long" long) (ms_call_modifier "__thiscall" __thiscall) (ERROR "std::wstreambuf::" identifier : : identifier : :) (function_declarator "xsgetn(wstreambuf *this,wchar_t *param_1,long param_2)" identifier (parameter_list "(wstreambuf *this,wchar_t *param_1,long param_2)" ( (parameter_declaration "wstreambuf *this" type_identifier (pointer_declarator "*this" * identifier)) , (parameter_declaration "wchar_t *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "long param_2" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_2 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = *(wchar_t **)(this + 0x10);\n    if (*(wchar_t **)(this + 0x18) != __s2) {\n      sVar4 = (long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2;\n      __n = param_2 - lVar5;\n      if ((long)sVar4 <= param_2 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_1,__s2,__n);\n      *(size_t *)(this + 0x10) = *(long *)(this + 0x10) + __n * 4;\n      if (param_2 <= lVar5) {\n        return lVar5;\n      }\n      param_1 = param_1 + __n;\n    }\n    pcVar1 = *(code **)(*(long *)this + 0x50);\n    if (pcVar1 == (code *)PTR_uflow_003f7aa0) {\n      pcVar1 = *(code **)(*(long *)this + 0x48);\n      if (pcVar1 == (code *)PTR_underflow_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(this);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = **(wchar_t **)(this + 0x10);\n      *(wchar_t **)(this + 0x10) = *(wchar_t **)(this + 0x10) + 1;\n    }\n    else {\n      wVar3 = (*pcVar1)(this);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_1 = wVar3;\n    param_1 = param_1 + 1;\n  } while (lVar5 < param_2);\n  return lVar5;\n}" { (declaration "wchar_t *__s2;" type_identifier (pointer_declarator "*__s2" * identifier) ;) (declaration "code *pcVar1;" type_identifier (pointer_declarator "*pcVar1" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "wchar_t wVar3;" type_identifier identifier ;) (declaration "size_t sVar4;" primitive_type identifier ;) (declaration "size_t __n;" primitive_type identifier ;) (declaration "long lVar5;" (sized_type_specifier "long" long) identifier ;) (if_statement "if (param_2 < 1) {\n    return 0;\n  }" if (parenthesized_expression "(param_2 < 1)" ( (binary_expression "param_2 < 1" identifier < number_literal) )) (compound_statement "{\n    return 0;\n  }" { (return_statement "return 0;" return number_literal ;) })) (expression_statement "lVar5 = 0;" (assignment_expression "lVar5 = 0" identifier = number_literal) ;) (do_statement "do {\n    __s2 = *(wchar_t **)(this + 0x10);\n    if (*(wchar_t **)(this + 0x18) != __s2) {\n      sVar4 = (long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2;\n      __n = param_2 - lVar5;\n      if ((long)sVar4 <= param_2 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_1,__s2,__n);\n      *(size_t *)(this + 0x10) = *(long *)(this + 0x10) + __n * 4;\n      if (param_2 <= lVar5) {\n        return lVar5;\n      }\n      param_1 = param_1 + __n;\n    }\n    pcVar1 = *(code **)(*(long *)this + 0x50);\n    if (pcVar1 == (code *)PTR_uflow_003f7aa0) {\n      pcVar1 = *(code **)(*(long *)this + 0x48);\n      if (pcVar1 == (code *)PTR_underflow_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(this);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = **(wchar_t **)(this + 0x10);\n      *(wchar_t **)(this + 0x10) = *(wchar_t **)(this + 0x10) + 1;\n    }\n    else {\n      wVar3 = (*pcVar1)(this);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_1 = wVar3;\n    param_1 = param_1 + 1;\n  } while (lVar5 < param_2);" do (compound_statement "{\n    __s2 = *(wchar_t **)(this + 0x10);\n    if (*(wchar_t **)(this + 0x18) != __s2) {\n      sVar4 = (long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2;\n      __n = param_2 - lVar5;\n      if ((long)sVar4 <= param_2 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_1,__s2,__n);\n      *(size_t *)(this + 0x10) = *(long *)(this + 0x10) + __n * 4;\n      if (param_2 <= lVar5) {\n        return lVar5;\n      }\n      param_1 = param_1 + __n;\n    }\n    pcVar1 = *(code **)(*(long *)this + 0x50);\n    if (pcVar1 == (code *)PTR_uflow_003f7aa0) {\n      pcVar1 = *(code **)(*(long *)this + 0x48);\n      if (pcVar1 == (code *)PTR_underflow_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(this);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = **(wchar_t **)(this + 0x10);\n      *(wchar_t **)(this + 0x10) = *(wchar_t **)(this + 0x10) + 1;\n    }\n    else {\n      wVar3 = (*pcVar1)(this);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_1 = wVar3;\n    param_1 = param_1 + 1;\n  }" { (expression_statement "__s2 = *(wchar_t **)(this + 0x10);" (assignment_expression "__s2 = *(wchar_t **)(this + 0x10)" identifier = (pointer_expression "*(wchar_t **)(this + 0x10)" * (cast_expression "(wchar_t **)(this + 0x10)" ( (type_descriptor "wchar_t **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(this + 0x10)" ( (binary_expression "this + 0x10" identifier + number_literal) ))))) ;) (if_statement "if (*(wchar_t **)(this + 0x18) != __s2) {\n      sVar4 = (long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2;\n      __n = param_2 - lVar5;\n      if ((long)sVar4 <= param_2 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_1,__s2,__n);\n      *(size_t *)(this + 0x10) = *(long *)(this + 0x10) + __n * 4;\n      if (param_2 <= lVar5) {\n        return lVar5;\n      }\n      param_1 = param_1 + __n;\n    }" if (parenthesized_expression "(*(wchar_t **)(this + 0x18) != __s2)" ( (binary_expression "*(wchar_t **)(this + 0x18) != __s2" (pointer_expression "*(wchar_t **)(this + 0x18)" * (cast_expression "(wchar_t **)(this + 0x18)" ( (type_descriptor "wchar_t **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(this + 0x18)" ( (binary_expression "this + 0x18" identifier + number_literal) )))) != identifier) )) (compound_statement "{\n      sVar4 = (long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2;\n      __n = param_2 - lVar5;\n      if ((long)sVar4 <= param_2 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_1,__s2,__n);\n      *(size_t *)(this + 0x10) = *(long *)(this + 0x10) + __n * 4;\n      if (param_2 <= lVar5) {\n        return lVar5;\n      }\n      param_1 = param_1 + __n;\n    }" { (expression_statement "sVar4 = (long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2;" (assignment_expression "sVar4 = (long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2" identifier = (binary_expression "(long)*(wchar_t **)(this + 0x18) - (long)__s2 >> 2" (binary_expression "(long)*(wchar_t **)(this + 0x18) - (long)__s2" (cast_expression "(long)*(wchar_t **)(this + 0x18)" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (pointer_expression "*(wchar_t **)(this + 0x18)" * (cast_expression "(wchar_t **)(this + 0x18)" ( (type_descriptor "wchar_t **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(this + 0x18)" ( (binary_expression "this + 0x18" identifier + number_literal) ))))) - (cast_expression "(long)__s2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) >> number_literal)) ;) (expression_statement "__n = param_2 - lVar5;" (assignment_expression "__n = param_2 - lVar5" identifier = (binary_expression "param_2 - lVar5" identifier - identifier)) ;) (if_statement "if ((long)sVar4 <= param_2 - lVar5) {\n        __n = sVar4;\n      }" if (parenthesized_expression "((long)sVar4 <= param_2 - lVar5)" ( (binary_expression "(long)sVar4 <= param_2 - lVar5" (cast_expression "(long)sVar4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) <= (binary_expression "param_2 - lVar5" identifier - identifier)) )) (compound_statement "{\n        __n = sVar4;\n      }" { (expression_statement "__n = sVar4;" (assignment_expression "__n = sVar4" identifier = identifier) ;) })) (expression_statement "lVar5 = lVar5 + __n;" (assignment_expression "lVar5 = lVar5 + __n" identifier = (binary_expression "lVar5 + __n" identifier + identifier)) ;) (expression_statement "wmemcpy(param_1,__s2,__n);" (call_expression "wmemcpy(param_1,__s2,__n)" identifier (argument_list "(param_1,__s2,__n)" ( identifier , identifier , identifier ))) ;) (expression_statement "*(size_t *)(this + 0x10) = *(long *)(this + 0x10) + __n * 4;" (assignment_expression "*(size_t *)(this + 0x10) = *(long *)(this + 0x10) + __n * 4" (pointer_expression "*(size_t *)(this + 0x10)" * (cast_expression "(size_t *)(this + 0x10)" ( (type_descriptor "size_t *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(this + 0x10)" ( (binary_expression "this + 0x10" identifier + number_literal) )))) = (binary_expression "*(long *)(this + 0x10) + __n * 4" (pointer_expression "*(long *)(this + 0x10)" * (cast_expression "(long *)(this + 0x10)" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(this + 0x10)" ( (binary_expression "this + 0x10" identifier + number_literal) )))) + (binary_expression "__n * 4" identifier * number_literal))) ;) (if_statement "if (param_2 <= lVar5) {\n        return lVar5;\n      }" if (parenthesized_expression "(param_2 <= lVar5)" ( (binary_expression "param_2 <= lVar5" identifier <= identifier) )) (compound_statement "{\n        return lVar5;\n      }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "param_1 = param_1 + __n;" (assignment_expression "param_1 = param_1 + __n" identifier = (binary_expression "param_1 + __n" identifier + identifier)) ;) })) (expression_statement "pcVar1 = *(code **)(*(long *)this + 0x50);" (assignment_expression "pcVar1 = *(code **)(*(long *)this + 0x50)" identifier = (pointer_expression "*(code **)(*(long *)this + 0x50)" * (cast_expression "(code **)(*(long *)this + 0x50)" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*(long *)this + 0x50)" ( (binary_expression "*(long *)this + 0x50" (pointer_expression "*(long *)this" * (cast_expression "(long *)this" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) identifier)) + number_literal) ))))) ;) (if_statement "if (pcVar1 == (code *)PTR_uflow_003f7aa0) {\n      pcVar1 = *(code **)(*(long *)this + 0x48);\n      if (pcVar1 == (code *)PTR_underflow_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(this);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = **(wchar_t **)(this + 0x10);\n      *(wchar_t **)(this + 0x10) = *(wchar_t **)(this + 0x10) + 1;\n    }\n    else {\n      wVar3 = (*pcVar1)(this);\n    }" if (parenthesized_expression "(pcVar1 == (code *)PTR_uflow_003f7aa0)" ( (binary_expression "pcVar1 == (code *)PTR_uflow_003f7aa0" identifier == (cast_expression "(code *)PTR_uflow_003f7aa0" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (compound_statement "{\n      pcVar1 = *(code **)(*(long *)this + 0x48);\n      if (pcVar1 == (code *)PTR_underflow_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(this);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = **(wchar_t **)(this + 0x10);\n      *(wchar_t **)(this + 0x10) = *(wchar_t **)(this + 0x10) + 1;\n    }" { (expression_statement "pcVar1 = *(code **)(*(long *)this + 0x48);" (assignment_expression "pcVar1 = *(code **)(*(long *)this + 0x48)" identifier = (pointer_expression "*(code **)(*(long *)this + 0x48)" * (cast_expression "(code **)(*(long *)this + 0x48)" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*(long *)this + 0x48)" ( (binary_expression "*(long *)this + 0x48" (pointer_expression "*(long *)this" * (cast_expression "(long *)this" ( (type_descriptor "long *" (sized_type_specifier "long" long) (abstract_pointer_declarator "*" *)) ) identifier)) + number_literal) ))))) ;) (if_statement "if (pcVar1 == (code *)PTR_underflow_003f7cf8) {\n        return lVar5;\n      }" if (parenthesized_expression "(pcVar1 == (code *)PTR_underflow_003f7cf8)" ( (binary_expression "pcVar1 == (code *)PTR_underflow_003f7cf8" identifier == (cast_expression "(code *)PTR_underflow_003f7cf8" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (compound_statement "{\n        return lVar5;\n      }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "iVar2 = (*pcVar1)(this);" (assignment_expression "iVar2 = (*pcVar1)(this)" identifier = (call_expression "(*pcVar1)(this)" (parenthesized_expression "(*pcVar1)" ( (pointer_expression "*pcVar1" * identifier) )) (argument_list "(this)" ( identifier )))) ;) (if_statement "if (iVar2 == -1) {\n        return lVar5;\n      }" if (parenthesized_expression "(iVar2 == -1)" ( (binary_expression "iVar2 == -1" identifier == number_literal) )) (compound_statement "{\n        return lVar5;\n      }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "wVar3 = **(wchar_t **)(this + 0x10);" (assignment_expression "wVar3 = **(wchar_t **)(this + 0x10)" identifier = (pointer_expression "**(wchar_t **)(this + 0x10)" * (pointer_expression "*(wchar_t **)(this + 0x10)" * (cast_expression "(wchar_t **)(this + 0x10)" ( (type_descriptor "wchar_t **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(this + 0x10)" ( (binary_expression "this + 0x10" identifier + number_literal) )))))) ;) (expression_statement "*(wchar_t **)(this + 0x10) = *(wchar_t **)(this + 0x10) + 1;" (assignment_expression "*(wchar_t **)(this + 0x10) = *(wchar_t **)(this + 0x10) + 1" (pointer_expression "*(wchar_t **)(this + 0x10)" * (cast_expression "(wchar_t **)(this + 0x10)" ( (type_descriptor "wchar_t **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(this + 0x10)" ( (binary_expression "this + 0x10" identifier + number_literal) )))) = (binary_expression "*(wchar_t **)(this + 0x10) + 1" (pointer_expression "*(wchar_t **)(this + 0x10)" * (cast_expression "(wchar_t **)(this + 0x10)" ( (type_descriptor "wchar_t **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(this + 0x10)" ( (binary_expression "this + 0x10" identifier + number_literal) )))) + number_literal)) ;) }) (else_clause "else {\n      wVar3 = (*pcVar1)(this);\n    }" else (compound_statement "{\n      wVar3 = (*pcVar1)(this);\n    }" { (expression_statement "wVar3 = (*pcVar1)(this);" (assignment_expression "wVar3 = (*pcVar1)(this)" identifier = (call_expression "(*pcVar1)(this)" (parenthesized_expression "(*pcVar1)" ( (pointer_expression "*pcVar1" * identifier) )) (argument_list "(this)" ( identifier )))) ;) }))) (if_statement "if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }" if (parenthesized_expression "(wVar3 == L'\xffffffff')" ( (binary_expression "wVar3 == L'\xffffffff'" identifier == (char_literal "L'\xffffffff'" L' escape_sequence character character character character ')) )) (compound_statement "{\n      return lVar5;\n    }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "lVar5 = lVar5 + 1;" (assignment_expression "lVar5 = lVar5 + 1" identifier = (binary_expression "lVar5 + 1" identifier + number_literal)) ;) (expression_statement "*param_1 = wVar3;" (assignment_expression "*param_1 = wVar3" (pointer_expression "*param_1" * identifier) = identifier) ;) (expression_statement "param_1 = param_1 + 1;" (assignment_expression "param_1 = param_1 + 1" identifier = (binary_expression "param_1 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "(lVar5 < param_2)" ( (binary_expression "lVar5 < param_2" identifier < identifier) )) ;) (return_statement "return lVar5;" return identifier ;) })))
(translation_unit "long FUN_002ac210(long *param_1,wchar_t *param_2,long param_3)\n\n{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_3 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);\n  return lVar5;\n}\n\n" (function_definition "long FUN_002ac210(long *param_1,wchar_t *param_2,long param_3)\n\n{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_3 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);\n  return lVar5;\n}" (sized_type_specifier "long" long) (function_declarator "FUN_002ac210(long *param_1,wchar_t *param_2,long param_3)" identifier (parameter_list "(long *param_1,wchar_t *param_2,long param_3)" ( (parameter_declaration "long *param_1" (sized_type_specifier "long" long) (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "wchar_t *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "long param_3" (sized_type_specifier "long" long) identifier) ))) (compound_statement "{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_3 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);\n  return lVar5;\n}" { (declaration "wchar_t *__s2;" type_identifier (pointer_declarator "*__s2" * identifier) ;) (declaration "code *pcVar1;" type_identifier (pointer_declarator "*pcVar1" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "wchar_t wVar3;" type_identifier identifier ;) (declaration "size_t sVar4;" primitive_type identifier ;) (declaration "size_t __n;" primitive_type identifier ;) (declaration "long lVar5;" (sized_type_specifier "long" long) identifier ;) (if_statement "if (param_3 < 1) {\n    return 0;\n  }" if (parenthesized_expression "(param_3 < 1)" ( (binary_expression "param_3 < 1" identifier < number_literal) )) (compound_statement "{\n    return 0;\n  }" { (return_statement "return 0;" return number_literal ;) })) (expression_statement "lVar5 = 0;" (assignment_expression "lVar5 = 0" identifier = number_literal) ;) (do_statement "do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);" do (compound_statement "{\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  }" { (expression_statement "__s2 = (wchar_t *)param_1[2];" (assignment_expression "__s2 = (wchar_t *)param_1[2]" identifier = (cast_expression "(wchar_t *)param_1[2]" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (subscript_expression "param_1[2]" identifier [ number_literal ]))) ;) (if_statement "if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }" if (parenthesized_expression "((wchar_t *)param_1[3] != __s2)" ( (binary_expression "(wchar_t *)param_1[3] != __s2" (cast_expression "(wchar_t *)param_1[3]" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (subscript_expression "param_1[3]" identifier [ number_literal ])) != identifier) )) (compound_statement "{\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }" { (expression_statement "sVar4 = param_1[3] - (long)__s2 >> 2;" (assignment_expression "sVar4 = param_1[3] - (long)__s2 >> 2" identifier = (binary_expression "param_1[3] - (long)__s2 >> 2" (binary_expression "param_1[3] - (long)__s2" (subscript_expression "param_1[3]" identifier [ number_literal ]) - (cast_expression "(long)__s2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) >> number_literal)) ;) (expression_statement "__n = param_3 - lVar5;" (assignment_expression "__n = param_3 - lVar5" identifier = (binary_expression "param_3 - lVar5" identifier - identifier)) ;) (if_statement "if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }" if (parenthesized_expression "((long)sVar4 <= param_3 - lVar5)" ( (binary_expression "(long)sVar4 <= param_3 - lVar5" (cast_expression "(long)sVar4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) <= (binary_expression "param_3 - lVar5" identifier - identifier)) )) (compound_statement "{\n        __n = sVar4;\n      }" { (expression_statement "__n = sVar4;" (assignment_expression "__n = sVar4" identifier = identifier) ;) })) (expression_statement "lVar5 = lVar5 + __n;" (assignment_expression "lVar5 = lVar5 + __n" identifier = (binary_expression "lVar5 + __n" identifier + identifier)) ;) (expression_statement "wmemcpy(param_2,__s2,__n);" (call_expression "wmemcpy(param_2,__s2,__n)" identifier (argument_list "(param_2,__s2,__n)" ( identifier , identifier , identifier ))) ;) (expression_statement "param_1[2] = param_1[2] + __n * 4;" (assignment_expression "param_1[2] = param_1[2] + __n * 4" (subscript_expression "param_1[2]" identifier [ number_literal ]) = (binary_expression "param_1[2] + __n * 4" (subscript_expression "param_1[2]" identifier [ number_literal ]) + (binary_expression "__n * 4" identifier * number_literal))) ;) (if_statement "if (param_3 <= lVar5) {\n        return lVar5;\n      }" if (parenthesized_expression "(param_3 <= lVar5)" ( (binary_expression "param_3 <= lVar5" identifier <= identifier) )) (compound_statement "{\n        return lVar5;\n      }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "param_2 = param_2 + __n;" (assignment_expression "param_2 = param_2 + __n" identifier = (binary_expression "param_2 + __n" identifier + identifier)) ;) })) (expression_statement "pcVar1 = *(code **)(*param_1 + 0x50);" (assignment_expression "pcVar1 = *(code **)(*param_1 + 0x50)" identifier = (pointer_expression "*(code **)(*param_1 + 0x50)" * (cast_expression "(code **)(*param_1 + 0x50)" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*param_1 + 0x50)" ( (binary_expression "*param_1 + 0x50" (pointer_expression "*param_1" * identifier) + number_literal) ))))) ;) (if_statement "if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }" if (parenthesized_expression "(pcVar1 == (code *)PTR_FUN_003f7aa0)" ( (binary_expression "pcVar1 == (code *)PTR_FUN_003f7aa0" identifier == (cast_expression "(code *)PTR_FUN_003f7aa0" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (compound_statement "{\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }" { (expression_statement "pcVar1 = *(code **)(*param_1 + 0x48);" (assignment_expression "pcVar1 = *(code **)(*param_1 + 0x48)" identifier = (pointer_expression "*(code **)(*param_1 + 0x48)" * (cast_expression "(code **)(*param_1 + 0x48)" ( (type_descriptor "code **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(*param_1 + 0x48)" ( (binary_expression "*param_1 + 0x48" (pointer_expression "*param_1" * identifier) + number_literal) ))))) ;) (if_statement "if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }" if (parenthesized_expression "(pcVar1 == (code *)PTR_FUN_003f7cf8)" ( (binary_expression "pcVar1 == (code *)PTR_FUN_003f7cf8" identifier == (cast_expression "(code *)PTR_FUN_003f7cf8" ( (type_descriptor "code *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier)) )) (compound_statement "{\n        return lVar5;\n      }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "iVar2 = (*pcVar1)(param_1);" (assignment_expression "iVar2 = (*pcVar1)(param_1)" identifier = (call_expression "(*pcVar1)(param_1)" (parenthesized_expression "(*pcVar1)" ( (pointer_expression "*pcVar1" * identifier) )) (argument_list "(param_1)" ( identifier )))) ;) (if_statement "if (iVar2 == -1) {\n        return lVar5;\n      }" if (parenthesized_expression "(iVar2 == -1)" ( (binary_expression "iVar2 == -1" identifier == number_literal) )) (compound_statement "{\n        return lVar5;\n      }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "wVar3 = *(wchar_t *)param_1[2];" (assignment_expression "wVar3 = *(wchar_t *)param_1[2]" identifier = (pointer_expression "*(wchar_t *)param_1[2]" * (cast_expression "(wchar_t *)param_1[2]" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (subscript_expression "param_1[2]" identifier [ number_literal ])))) ;) (expression_statement "param_1[2] = (long)((wchar_t *)param_1[2] + 1);" (assignment_expression "param_1[2] = (long)((wchar_t *)param_1[2] + 1)" (subscript_expression "param_1[2]" identifier [ number_literal ]) = (cast_expression "(long)((wchar_t *)param_1[2] + 1)" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (parenthesized_expression "((wchar_t *)param_1[2] + 1)" ( (binary_expression "(wchar_t *)param_1[2] + 1" (cast_expression "(wchar_t *)param_1[2]" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (subscript_expression "param_1[2]" identifier [ number_literal ])) + number_literal) )))) ;) }) (else_clause "else {\n      wVar3 = (*pcVar1)(param_1);\n    }" else (compound_statement "{\n      wVar3 = (*pcVar1)(param_1);\n    }" { (expression_statement "wVar3 = (*pcVar1)(param_1);" (assignment_expression "wVar3 = (*pcVar1)(param_1)" identifier = (call_expression "(*pcVar1)(param_1)" (parenthesized_expression "(*pcVar1)" ( (pointer_expression "*pcVar1" * identifier) )) (argument_list "(param_1)" ( identifier )))) ;) }))) (if_statement "if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }" if (parenthesized_expression "(wVar3 == L'\xffffffff')" ( (binary_expression "wVar3 == L'\xffffffff'" identifier == (char_literal "L'\xffffffff'" L' escape_sequence character character character character ')) )) (compound_statement "{\n      return lVar5;\n    }" { (return_statement "return lVar5;" return identifier ;) })) (expression_statement "lVar5 = lVar5 + 1;" (assignment_expression "lVar5 = lVar5 + 1" identifier = (binary_expression "lVar5 + 1" identifier + number_literal)) ;) (expression_statement "*param_2 = wVar3;" (assignment_expression "*param_2 = wVar3" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "param_2 = param_2 + 1;" (assignment_expression "param_2 = param_2 + 1" identifier = (binary_expression "param_2 + 1" identifier + number_literal)) ;) }) while (parenthesized_expression "(lVar5 < param_3)" ( (binary_expression "lVar5 < param_3" identifier < identifier) )) ;) (return_statement "return lVar5;" return identifier ;) })))
(translation_unit (function_definition (sized_type_specifier long) (function_declarator IDENT (parameter_list ( (parameter_declaration (sized_type_specifier long) (pointer_declarator * IDENT)) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration (sized_type_specifier long) IDENT) ))) (compound_statement { (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration (sized_type_specifier long) IDENT ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < LIT) )) (compound_statement { (return_statement return LIT ;) })) (expression_statement (assignment_expression IDENT = LIT) ;) (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (subscript_expression IDENT [ LIT ]))) ;) (if_statement if (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (subscript_expression IDENT [ LIT ])) != IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression (subscript_expression IDENT [ LIT ]) - (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) >> LIT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) <= (binary_expression IDENT - IDENT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = IDENT) ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT ))) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (binary_expression (subscript_expression IDENT [ LIT ]) + (binary_expression IDENT * LIT))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT <= IDENT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + IDENT)) ;) })) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) + LIT) ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator * (abstract_pointer_declarator *))) ) (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) + LIT) ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) IDENT)) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * IDENT) )) (argument_list ( IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (subscript_expression IDENT [ LIT ])))) ;) (expression_statement (assignment_expression (subscript_expression IDENT [ LIT ]) = (cast_expression ( (type_descriptor (sized_type_specifier long)) ) (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (subscript_expression IDENT [ LIT ])) + LIT) )))) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (call_expression (parenthesized_expression ( (pointer_expression * IDENT) )) (argument_list ( IDENT )))) ;) }))) (if_statement if (parenthesized_expression ( (binary_expression IDENT == (char_literal L' escape_sequence character character character character ')) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT < IDENT) )) ;) (return_statement return IDENT ;) })))
(function_definition "long FUN_002ac210(long *param_1,wchar_t *param_2,long param_3)\n\n{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_3 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);\n  return lVar5;\n}" (sized_type_specifier "long" (long "long")) (function_declarator "FUN_002ac210(long *param_1,wchar_t *param_2,long param_3)" (identifier "FUN_002ac210") (parameter_list "(long *param_1,wchar_t *param_2,long param_3)" (( "(") (parameter_declaration "long *param_1" (sized_type_specifier "long" (long "long")) (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "wchar_t *param_2" (type_identifier "wchar_t") (pointer_declarator "*param_2" (* "*") (identifier "param_2"))) (, ",") (parameter_declaration "long param_3" (sized_type_specifier "long" (long "long")) (identifier "param_3")) () ")"))) (compound_statement "{\n  wchar_t *__s2;\n  code *pcVar1;\n  int iVar2;\n  wchar_t wVar3;\n  size_t sVar4;\n  size_t __n;\n  long lVar5;\n  \n  if (param_3 < 1) {\n    return 0;\n  }\n  lVar5 = 0;\n  do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);\n  return lVar5;\n}" ({ "{") (declaration "wchar_t *__s2;" (type_identifier "wchar_t") (pointer_declarator "*__s2" (* "*") (identifier "__s2")) (; ";")) (declaration "code *pcVar1;" (type_identifier "code") (pointer_declarator "*pcVar1" (* "*") (identifier "pcVar1")) (; ";")) (declaration "int iVar2;" (primitive_type "int") (identifier "iVar2") (; ";")) (declaration "wchar_t wVar3;" (type_identifier "wchar_t") (identifier "wVar3") (; ";")) (declaration "size_t sVar4;" (primitive_type "size_t") (identifier "sVar4") (; ";")) (declaration "size_t __n;" (primitive_type "size_t") (identifier "__n") (; ";")) (declaration "long lVar5;" (sized_type_specifier "long" (long "long")) (identifier "lVar5") (; ";")) (if_statement "if (param_3 < 1) {\n    return 0;\n  }" (if "if") (parenthesized_expression "(param_3 < 1)" (( "(") (binary_expression "param_3 < 1" (identifier "param_3") (< "<") (number_literal "1")) () ")")) (compound_statement "{\n    return 0;\n  }" ({ "{") (return_statement "return 0;" (return "return") (number_literal "0") (; ";")) (} "}"))) (expression_statement "lVar5 = 0;" (assignment_expression "lVar5 = 0" (identifier "lVar5") (= "=") (number_literal "0")) (; ";")) (do_statement "do {\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  } while (lVar5 < param_3);" (do "do") (compound_statement "{\n    __s2 = (wchar_t *)param_1[2];\n    if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }\n    pcVar1 = *(code **)(*param_1 + 0x50);\n    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }\n    if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }\n    lVar5 = lVar5 + 1;\n    *param_2 = wVar3;\n    param_2 = param_2 + 1;\n  }" ({ "{") (expression_statement "__s2 = (wchar_t *)param_1[2];" (assignment_expression "__s2 = (wchar_t *)param_1[2]" (identifier "__s2") (= "=") (cast_expression "(wchar_t *)param_1[2]" (( "(") (type_descriptor "wchar_t *" (type_identifier "wchar_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]")))) (; ";")) (if_statement "if ((wchar_t *)param_1[3] != __s2) {\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }" (if "if") (parenthesized_expression "((wchar_t *)param_1[3] != __s2)" (( "(") (binary_expression "(wchar_t *)param_1[3] != __s2" (cast_expression "(wchar_t *)param_1[3]" (( "(") (type_descriptor "wchar_t *" (type_identifier "wchar_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (subscript_expression "param_1[3]" (identifier "param_1") ([ "[") (number_literal "3") (] "]"))) (!= "!=") (identifier "__s2")) () ")")) (compound_statement "{\n      sVar4 = param_1[3] - (long)__s2 >> 2;\n      __n = param_3 - lVar5;\n      if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }\n      lVar5 = lVar5 + __n;\n      wmemcpy(param_2,__s2,__n);\n      param_1[2] = param_1[2] + __n * 4;\n      if (param_3 <= lVar5) {\n        return lVar5;\n      }\n      param_2 = param_2 + __n;\n    }" ({ "{") (expression_statement "sVar4 = param_1[3] - (long)__s2 >> 2;" (assignment_expression "sVar4 = param_1[3] - (long)__s2 >> 2" (identifier "sVar4") (= "=") (binary_expression "param_1[3] - (long)__s2 >> 2" (binary_expression "param_1[3] - (long)__s2" (subscript_expression "param_1[3]" (identifier "param_1") ([ "[") (number_literal "3") (] "]")) (- "-") (cast_expression "(long)__s2" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "__s2"))) (>> ">>") (number_literal "2"))) (; ";")) (expression_statement "__n = param_3 - lVar5;" (assignment_expression "__n = param_3 - lVar5" (identifier "__n") (= "=") (binary_expression "param_3 - lVar5" (identifier "param_3") (- "-") (identifier "lVar5"))) (; ";")) (if_statement "if ((long)sVar4 <= param_3 - lVar5) {\n        __n = sVar4;\n      }" (if "if") (parenthesized_expression "((long)sVar4 <= param_3 - lVar5)" (( "(") (binary_expression "(long)sVar4 <= param_3 - lVar5" (cast_expression "(long)sVar4" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "sVar4")) (<= "<=") (binary_expression "param_3 - lVar5" (identifier "param_3") (- "-") (identifier "lVar5"))) () ")")) (compound_statement "{\n        __n = sVar4;\n      }" ({ "{") (expression_statement "__n = sVar4;" (assignment_expression "__n = sVar4" (identifier "__n") (= "=") (identifier "sVar4")) (; ";")) (} "}"))) (expression_statement "lVar5 = lVar5 + __n;" (assignment_expression "lVar5 = lVar5 + __n" (identifier "lVar5") (= "=") (binary_expression "lVar5 + __n" (identifier "lVar5") (+ "+") (identifier "__n"))) (; ";")) (expression_statement "wmemcpy(param_2,__s2,__n);" (call_expression "wmemcpy(param_2,__s2,__n)" (identifier "wmemcpy") (argument_list "(param_2,__s2,__n)" (( "(") (identifier "param_2") (, ",") (identifier "__s2") (, ",") (identifier "__n") () ")"))) (; ";")) (expression_statement "param_1[2] = param_1[2] + __n * 4;" (assignment_expression "param_1[2] = param_1[2] + __n * 4" (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]")) (= "=") (binary_expression "param_1[2] + __n * 4" (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]")) (+ "+") (binary_expression "__n * 4" (identifier "__n") (* "*") (number_literal "4")))) (; ";")) (if_statement "if (param_3 <= lVar5) {\n        return lVar5;\n      }" (if "if") (parenthesized_expression "(param_3 <= lVar5)" (( "(") (binary_expression "param_3 <= lVar5" (identifier "param_3") (<= "<=") (identifier "lVar5")) () ")")) (compound_statement "{\n        return lVar5;\n      }" ({ "{") (return_statement "return lVar5;" (return "return") (identifier "lVar5") (; ";")) (} "}"))) (expression_statement "param_2 = param_2 + __n;" (assignment_expression "param_2 = param_2 + __n" (identifier "param_2") (= "=") (binary_expression "param_2 + __n" (identifier "param_2") (+ "+") (identifier "__n"))) (; ";")) (} "}"))) (expression_statement "pcVar1 = *(code **)(*param_1 + 0x50);" (assignment_expression "pcVar1 = *(code **)(*param_1 + 0x50)" (identifier "pcVar1") (= "=") (pointer_expression "*(code **)(*param_1 + 0x50)" (* "*") (cast_expression "(code **)(*param_1 + 0x50)" (( "(") (type_descriptor "code **" (type_identifier "code") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (parenthesized_expression "(*param_1 + 0x50)" (( "(") (binary_expression "*param_1 + 0x50" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (+ "+") (number_literal "0x50")) () ")"))))) (; ";")) (if_statement "if (pcVar1 == (code *)PTR_FUN_003f7aa0) {\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }\n    else {\n      wVar3 = (*pcVar1)(param_1);\n    }" (if "if") (parenthesized_expression "(pcVar1 == (code *)PTR_FUN_003f7aa0)" (( "(") (binary_expression "pcVar1 == (code *)PTR_FUN_003f7aa0" (identifier "pcVar1") (== "==") (cast_expression "(code *)PTR_FUN_003f7aa0" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_FUN_003f7aa0"))) () ")")) (compound_statement "{\n      pcVar1 = *(code **)(*param_1 + 0x48);\n      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }\n      iVar2 = (*pcVar1)(param_1);\n      if (iVar2 == -1) {\n        return lVar5;\n      }\n      wVar3 = *(wchar_t *)param_1[2];\n      param_1[2] = (long)((wchar_t *)param_1[2] + 1);\n    }" ({ "{") (expression_statement "pcVar1 = *(code **)(*param_1 + 0x48);" (assignment_expression "pcVar1 = *(code **)(*param_1 + 0x48)" (identifier "pcVar1") (= "=") (pointer_expression "*(code **)(*param_1 + 0x48)" (* "*") (cast_expression "(code **)(*param_1 + 0x48)" (( "(") (type_descriptor "code **" (type_identifier "code") (abstract_pointer_declarator "**" (* "*") (abstract_pointer_declarator "*" (* "*")))) () ")") (parenthesized_expression "(*param_1 + 0x48)" (( "(") (binary_expression "*param_1 + 0x48" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (+ "+") (number_literal "0x48")) () ")"))))) (; ";")) (if_statement "if (pcVar1 == (code *)PTR_FUN_003f7cf8) {\n        return lVar5;\n      }" (if "if") (parenthesized_expression "(pcVar1 == (code *)PTR_FUN_003f7cf8)" (( "(") (binary_expression "pcVar1 == (code *)PTR_FUN_003f7cf8" (identifier "pcVar1") (== "==") (cast_expression "(code *)PTR_FUN_003f7cf8" (( "(") (type_descriptor "code *" (type_identifier "code") (abstract_pointer_declarator "*" (* "*"))) () ")") (identifier "PTR_FUN_003f7cf8"))) () ")")) (compound_statement "{\n        return lVar5;\n      }" ({ "{") (return_statement "return lVar5;" (return "return") (identifier "lVar5") (; ";")) (} "}"))) (expression_statement "iVar2 = (*pcVar1)(param_1);" (assignment_expression "iVar2 = (*pcVar1)(param_1)" (identifier "iVar2") (= "=") (call_expression "(*pcVar1)(param_1)" (parenthesized_expression "(*pcVar1)" (( "(") (pointer_expression "*pcVar1" (* "*") (identifier "pcVar1")) () ")")) (argument_list "(param_1)" (( "(") (identifier "param_1") () ")")))) (; ";")) (if_statement "if (iVar2 == -1) {\n        return lVar5;\n      }" (if "if") (parenthesized_expression "(iVar2 == -1)" (( "(") (binary_expression "iVar2 == -1" (identifier "iVar2") (== "==") (number_literal "-1")) () ")")) (compound_statement "{\n        return lVar5;\n      }" ({ "{") (return_statement "return lVar5;" (return "return") (identifier "lVar5") (; ";")) (} "}"))) (expression_statement "wVar3 = *(wchar_t *)param_1[2];" (assignment_expression "wVar3 = *(wchar_t *)param_1[2]" (identifier "wVar3") (= "=") (pointer_expression "*(wchar_t *)param_1[2]" (* "*") (cast_expression "(wchar_t *)param_1[2]" (( "(") (type_descriptor "wchar_t *" (type_identifier "wchar_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]"))))) (; ";")) (expression_statement "param_1[2] = (long)((wchar_t *)param_1[2] + 1);" (assignment_expression "param_1[2] = (long)((wchar_t *)param_1[2] + 1)" (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]")) (= "=") (cast_expression "(long)((wchar_t *)param_1[2] + 1)" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (parenthesized_expression "((wchar_t *)param_1[2] + 1)" (( "(") (binary_expression "(wchar_t *)param_1[2] + 1" (cast_expression "(wchar_t *)param_1[2]" (( "(") (type_descriptor "wchar_t *" (type_identifier "wchar_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (subscript_expression "param_1[2]" (identifier "param_1") ([ "[") (number_literal "2") (] "]"))) (+ "+") (number_literal "1")) () ")")))) (; ";")) (} "}")) (else_clause "else {\n      wVar3 = (*pcVar1)(param_1);\n    }" (else "else") (compound_statement "{\n      wVar3 = (*pcVar1)(param_1);\n    }" ({ "{") (expression_statement "wVar3 = (*pcVar1)(param_1);" (assignment_expression "wVar3 = (*pcVar1)(param_1)" (identifier "wVar3") (= "=") (call_expression "(*pcVar1)(param_1)" (parenthesized_expression "(*pcVar1)" (( "(") (pointer_expression "*pcVar1" (* "*") (identifier "pcVar1")) () ")")) (argument_list "(param_1)" (( "(") (identifier "param_1") () ")")))) (; ";")) (} "}")))) (if_statement "if (wVar3 == L'\xffffffff') {\n      return lVar5;\n    }" (if "if") (parenthesized_expression "(wVar3 == L'\xffffffff')" (( "(") (binary_expression "wVar3 == L'\xffffffff'" (identifier "wVar3") (== "==") (char_literal "L'\xffffffff'" (L' "L'") (escape_sequence "\xffff") (character "f") (character "f") (character "f") (character "f") (' "'"))) () ")")) (compound_statement "{\n      return lVar5;\n    }" ({ "{") (return_statement "return lVar5;" (return "return") (identifier "lVar5") (; ";")) (} "}"))) (expression_statement "lVar5 = lVar5 + 1;" (assignment_expression "lVar5 = lVar5 + 1" (identifier "lVar5") (= "=") (binary_expression "lVar5 + 1" (identifier "lVar5") (+ "+") (number_literal "1"))) (; ";")) (expression_statement "*param_2 = wVar3;" (assignment_expression "*param_2 = wVar3" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (identifier "wVar3")) (; ";")) (expression_statement "param_2 = param_2 + 1;" (assignment_expression "param_2 = param_2 + 1" (identifier "param_2") (= "=") (binary_expression "param_2 + 1" (identifier "param_2") (+ "+") (number_literal "1"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(lVar5 < param_3)" (( "(") (binary_expression "lVar5 < param_3" (identifier "lVar5") (< "<") (identifier "param_3")) () ")")) (; ";")) (return_statement "return lVar5;" (return "return") (identifier "lVar5") (; ";")) (} "}")))

/* std::wstreambuf::xsgetn(wchar_t*, long) */

long __thiscall std::type_1::function_1(type_1 *var_2,type_2 *var_7,long var_1)

{
  type_2 *var_3;
  type_3 *var_8;
  int var_9;
  type_2 var_10;
  size_t sVar4;
  size_t var_5;
  long var_4;
  
  if (var_1 < 1) {
    return 0;
  }
  var_4 = 0;
  do {
    var_3 = *(type_2 **)(var_2 + 0x10);
    if (*(type_2 **)(var_2 + 0x18) != var_3) {
      sVar4 = (long)*(type_2 **)(var_2 + 0x18) - (long)var_3 >> 2;
      var_5 = var_1 - var_4;
      if ((long)sVar4 <= var_1 - var_4) {
        var_5 = sVar4;
      }
      var_4 = var_4 + var_5;
      var_6(var_7,var_3,var_5);
      *(size_t *)(var_2 + 0x10) = *(long *)(var_2 + 0x10) + var_5 * 4;
      if (var_1 <= var_4) {
        return var_4;
      }
      var_7 = var_7 + var_5;
    }
    var_8 = *(type_3 **)(*(long *)var_2 + 0x50);
    if (var_8 == (type_3 *)PTR_uflow_003f7aa0) {
      var_8 = *(type_3 **)(*(long *)var_2 + 0x48);
      if (var_8 == (type_3 *)PTR_underflow_003f7cf8) {
        return var_4;
      }
      var_9 = (*var_8)(var_2);
      if (var_9 == -1) {
        return var_4;
      }
      var_10 = **(type_2 **)(var_2 + 0x10);
      *(type_2 **)(var_2 + 0x10) = *(type_2 **)(var_2 + 0x10) + 1;
    }
    else {
      var_10 = (*var_8)(var_2);
    }
    if (var_10 == L'\xffffffff') {
      return var_4;
    }
    var_4 = var_4 + 1;
    *var_7 = var_10;
    var_7 = var_7 + 1;
  } while (var_4 < var_1);
  return var_4;
}


(translation_unit (function_definition type: (sized_type_specifier) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (sized_type_specifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (sized_type_specifier) declarator: (identifier)))) body: (compound_statement (declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (sized_type_specifier) declarator: (identifier)) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (return_statement (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (do_statement body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (subscript_expression argument: (identifier) index: (number_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (subscript_expression argument: (identifier) index: (number_literal))) right: (identifier))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier))) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier)))) (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (binary_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (binary_expression left: (identifier) right: (number_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator declarator: (abstract_pointer_declarator))) value: (parenthesized_expression (binary_expression left: (pointer_expression argument: (identifier)) right: (number_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (identifier)))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator declarator: (abstract_pointer_declarator))) value: (parenthesized_expression (binary_expression left: (pointer_expression argument: (identifier)) right: (number_literal))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (identifier)))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (parenthesized_expression (pointer_expression argument: (identifier))) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (subscript_expression argument: (identifier) index: (number_literal)))))) (expression_statement (assignment_expression left: (subscript_expression argument: (identifier) index: (number_literal)) right: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (parenthesized_expression (binary_expression left: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (subscript_expression argument: (identifier) index: (number_literal))) right: (number_literal))))))) alternative: (else_clause (compound_statement (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (parenthesized_expression (pointer_expression argument: (identifier))) arguments: (argument_list (identifier)))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (char_literal (escape_sequence) (character) (character) (character) (character)))) consequence: (compound_statement (return_statement (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal))))) condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) (return_statement (identifier)))))

long MASKED(long *param_1,wchar_t *param_2,long param_3)

{
  wchar_t *__s2;
  code *pcVar1;
  int iVar2;
  wchar_t wVar3;
  size_t sVar4;
  size_t __n;
  long lVar5;
  
  if (param_3 < 1) {
    return 0;
  }
  lVar5 = 0;
  do {
    __s2 = (wchar_t *)param_1[2];
    if ((wchar_t *)param_1[3] != __s2) {
      sVar4 = param_1[3] - (long)__s2 >> 2;
      __n = param_3 - lVar5;
      if ((long)sVar4 <= param_3 - lVar5) {
        __n = sVar4;
      }
      lVar5 = lVar5 + __n;
      wmemcpy(param_2,__s2,__n);
      param_1[2] = param_1[2] + __n * 4;
      if (param_3 <= lVar5) {
        return lVar5;
      }
      param_2 = param_2 + __n;
    }
    pcVar1 = *(code **)(*param_1 + 0x50);
    if (pcVar1 == (code *)PTR_FUN_003f7aa0) {
      pcVar1 = *(code **)(*param_1 + 0x48);
      if (pcVar1 == (code *)PTR_FUN_003f7cf8) {
        return lVar5;
      }
      iVar2 = (*pcVar1)(param_1);
      if (iVar2 == -1) {
        return lVar5;
      }
      wVar3 = *(wchar_t *)param_1[2];
      param_1[2] = (long)((wchar_t *)param_1[2] + 1);
    }
    else {
      wVar3 = (*pcVar1)(param_1);
    }
    if (wVar3 == L'\xffffffff') {
      return lVar5;
    }
    lVar5 = lVar5 + 1;
    *param_2 = wVar3;
    param_2 = param_2 + 1;
  } while (lVar5 < param_3);
  return lVar5;
}

