
/* std::codecvt<wchar_t, char, __mbstate_t>::do_out(__mbstate_t&, wchar_t const*, wchar_t const*,
   wchar_t const*&, char*, char*, char*&) const */

int __thiscall
std::codecvt<wchar_t,char,__mbstate_t>::do_out
          (codecvt<wchar_t,char,__mbstate_t> *this,__mbstate_t *param_1,wchar_t *param_2,
          wchar_t *param_3,wchar_t **param_4,char *param_5,char *param_6,char **param_7)

{
  wchar_t __wc;
  undefined8 uVar1;
  wchar_t *pwVar2;
  int iVar3;
  size_t sVar4;
  char *pcVar5;
  wchar_t *pwVar6;
  __mbstate_t local_50;
  char local_48 [24];
  
  local_50 = *param_1;
  uVar1 = __uselocale(*(undefined8 *)(this + 0x10));
  *param_4 = param_2;
  iVar3 = 0;
  *param_7 = param_5;
joined_r0x003658b5:
  do {
    if (((param_3 <= param_2) || (pcVar5 = *param_7, param_6 <= pcVar5)) || (iVar3 != 0)) {
LAB_00365958:
      __uselocale(uVar1);
      return iVar3;
    }
    while( true ) {
      sVar4 = (long)param_3 - (long)param_2 >> 2;
      pwVar2 = wmemchr(param_2,L'\0',sVar4);
      pwVar6 = param_3;
      if (pwVar2 != (wchar_t *)0x0) {
        sVar4 = (long)pwVar2 - (long)param_2 >> 2;
        pwVar6 = pwVar2;
      }
      sVar4 = wcsnrtombs(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1);
      if (sVar4 == 0xffffffffffffffff) break;
      param_2 = *param_4;
      pcVar5 = *param_7;
      if ((param_2 != (wchar_t *)0x0) && (param_2 < pwVar6)) {
        *param_7 = pcVar5 + sVar4;
        iVar3 = 1;
        goto joined_r0x003658b5;
      }
      *param_4 = pwVar6;
      *param_7 = pcVar5 + sVar4;
      if (param_3 <= pwVar6) goto LAB_003659e0;
      local_50 = *param_1;
      sVar4 = wcrtomb(local_48,*pwVar6,&local_50);
      if ((ulong)((long)param_6 - (long)*param_7) < sVar4) {
        iVar3 = 1;
        goto LAB_00365958;
      }
      memcpy(*param_7,local_48,sVar4);
      *param_1 = local_50;
      pcVar5 = *param_7 + sVar4;
      param_2 = *param_4 + 1;
      *param_7 = pcVar5;
      *param_4 = param_2;
      if ((param_3 <= param_2) || (param_6 <= pcVar5)) {
        iVar3 = 0;
        goto LAB_00365958;
      }
    }
    if (param_2 < *param_4) {
      pcVar5 = *param_7;
      do {
        __wc = *param_2;
        param_2 = param_2 + 1;
        sVar4 = wcrtomb(pcVar5,__wc,&local_50);
        pcVar5 = *param_7 + sVar4;
        *param_7 = pcVar5;
      } while (param_2 < *param_4);
    }
    iVar3 = 2;
    *param_1 = local_50;
    param_2 = *param_4;
  } while( true );
LAB_003659e0:
  iVar3 = 0;
  param_2 = pwVar6;
  goto joined_r0x003658b5;
}



int FUN_00365850(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5
                ,ulong param_6,char *param_7,ulong *param_8)

{
  wchar_t __wc;
  ulong uVar1;
  undefined8 uVar2;
  wchar_t *pwVar3;
  int iVar4;
  size_t sVar5;
  char *pcVar6;
  wchar_t *pwVar7;
  mbstate_t local_50;
  char local_48 [24];
  
  local_50 = *param_2;
  uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));
  *param_5 = param_3;
  iVar4 = 0;
  *param_8 = param_6;
joined_r0x003658b5:
  do {
    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {
LAB_00365958:
      __uselocale(uVar2);
      return iVar4;
    }
    while( true ) {
      sVar5 = (long)param_4 - (long)param_3 >> 2;
      pwVar3 = wmemchr(param_3,L'\0',sVar5);
      pwVar7 = param_4;
      if (pwVar3 != (wchar_t *)0x0) {
        sVar5 = (long)pwVar3 - (long)param_3 >> 2;
        pwVar7 = pwVar3;
      }
      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);
      if (sVar5 == 0xffffffffffffffff) break;
      param_3 = *param_5;
      uVar1 = *param_8;
      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {
        *param_8 = sVar5 + uVar1;
        iVar4 = 1;
        goto joined_r0x003658b5;
      }
      *param_5 = pwVar7;
      *param_8 = sVar5 + uVar1;
      if (param_4 <= pwVar7) goto LAB_003659e0;
      local_50 = *param_2;
      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);
      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {
        iVar4 = 1;
        goto LAB_00365958;
      }
      memcpy((void *)*param_8,local_48,sVar5);
      *param_2 = local_50;
      pcVar6 = (char *)(sVar5 + *param_8);
      param_3 = *param_5 + 1;
      *param_8 = (ulong)pcVar6;
      *param_5 = param_3;
      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {
        iVar4 = 0;
        goto LAB_00365958;
      }
    }
    if (param_3 < *param_5) {
      pcVar6 = (char *)*param_8;
      do {
        __wc = *param_3;
        param_3 = param_3 + 1;
        sVar5 = wcrtomb(pcVar6,__wc,&local_50);
        pcVar6 = (char *)(sVar5 + *param_8);
        *param_8 = (ulong)pcVar6;
      } while (param_3 < *param_5);
    }
    iVar4 = 2;
    *param_2 = local_50;
    param_3 = *param_5;
  } while( true );
LAB_003659e0:
  iVar4 = 0;
  param_3 = pwVar7;
  goto joined_r0x003658b5;
}


PUSH R15
PUSH R14
PUSH R13
MOV R13,RCX
PUSH R12
MOV R12,R8
PUSH RBP
PUSH RBX
MOV RBX,RDX
SUB RSP,0x58
MOV RAX,qword ptr [RSI]
MOV RDI,qword ptr [RDI + 0x10]
MOV qword ptr [RSP + 0x8],R9
MOV RBP,qword ptr [RSP + 0x98]
MOV qword ptr [RSP + 0x18],RSI
MOV qword ptr [RSP + 0x38],RAX
CALL 0x00147790
MOV R9,qword ptr [RSP + 0x8]
MOV qword ptr [R12],RBX
XOR EDX,EDX
MOV qword ptr [RSP + 0x28],RAX
LEA RAX,[RSP + 0x38]
MOV qword ptr [RSP + 0x10],RAX
LEA RAX,[RSP + 0x40]
MOV qword ptr [RBP],R9
MOV qword ptr [RSP + 0x20],RAX
CMP R13,RBX
JBE 0x00365958
MOV R14,qword ptr [RBP]
CMP R14,qword ptr [RSP + 0x90]
JNC 0x00365958
TEST EDX,EDX
JNZ 0x00365958
MOV R9,R13
XOR ESI,ESI
MOV RDI,RBX
SUB R9,RBX
SAR R9,0x2
MOV RDX,R9
MOV qword ptr [RSP + 0x8],R9
CALL 0x001474d0
MOV R9,qword ptr [RSP + 0x8]
TEST RAX,RAX
MOV R15,RAX
JZ 0x003659d0
MOV R9,RAX
SUB R9,RBX
SAR R9,0x2
MOV R8,qword ptr [RSP + 0x18]
MOV RDX,R9
MOV RSI,R12
MOV RDI,R14
MOV RCX,qword ptr [RSP + 0x90]
SUB RCX,R14
CALL 0x00147940
CMP RAX,-0x1
JZ 0x003659f0
MOV RBX,qword ptr [R12]
ADD RAX,qword ptr [RBP]
TEST RBX,RBX
JZ 0x00365980
CMP RBX,R15
JNC 0x00365980
MOV qword ptr [RBP],RAX
MOV EDX,0x1
CMP R13,RBX
JA 0x003658bb
MOV RDI,qword ptr [RSP + 0x28]
MOV dword ptr [RSP + 0x8],EDX
CALL 0x00147790
MOV EDX,dword ptr [RSP + 0x8]
ADD RSP,0x58
POP RBX
POP RBP
MOV EAX,EDX
POP R12
POP R13
POP R14
POP R15
RET
MOV qword ptr [R12],R15
MOV qword ptr [RBP],RAX
CMP R15,R13
JNC 0x003659e0
MOV RAX,qword ptr [RSP + 0x18]
MOV RDI,qword ptr [RSP + 0x20]
MOV RDX,qword ptr [RSP + 0x10]
MOV RAX,qword ptr [RAX]
MOV qword ptr [RSP + 0x38],RAX
MOV ESI,dword ptr [R15]
CALL 0x00147680
MOV RDI,qword ptr [RBP]
MOV R14,RAX
MOV RAX,qword ptr [RSP + 0x90]
SUB RAX,RDI
CMP RAX,R14
JNC 0x00365a40
MOV EDX,0x1
JMP 0x00365958
MOV R15,R13
JMP 0x0036590c
MOV RBX,R15
XOR EDX,EDX
JMP 0x003658b2
CMP RBX,qword ptr [R12]
JNC 0x00365a21
MOV RDI,qword ptr [RBP]
NOP word ptr [RAX + RAX*0x1]
MOV ESI,dword ptr [RBX]
MOV RDX,qword ptr [RSP + 0x10]
ADD RBX,0x4
CALL 0x00147680
ADD RAX,qword ptr [RBP]
MOV RDI,RAX
MOV qword ptr [RBP],RAX
CMP qword ptr [R12],RBX
JA 0x00365a00
MOV RAX,qword ptr [RSP + 0x38]
MOV RSI,qword ptr [RSP + 0x18]
MOV EDX,0x2
MOV qword ptr [RSI],RAX
MOV RBX,qword ptr [R12]
JMP 0x003658b2
MOV RSI,qword ptr [RSP + 0x20]
MOV RDX,R14
CALL 0x00147aa0
MOV RAX,qword ptr [RSP + 0x38]
MOV RSI,qword ptr [RSP + 0x18]
MOV qword ptr [RSI],RAX
MOV RAX,qword ptr [R12]
ADD R14,qword ptr [RBP]
LEA RBX,[RAX + 0x4]
MOV qword ptr [RBP],R14
MOV qword ptr [R12],RBX
CMP RBX,R13
JNC 0x00365a81
CMP R14,qword ptr [RSP + 0x90]
JC 0x003658d5
XOR EDX,EDX
JMP 0x00365958
(translation_unit "int FUN_00365850(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)\n\n{\n  wchar_t __wc;\n  ulong uVar1;\n  undefined8 uVar2;\n  wchar_t *pwVar3;\n  int iVar4;\n  size_t sVar5;\n  char *pcVar6;\n  wchar_t *pwVar7;\n  mbstate_t local_50;\n  char local_48 [24];\n  \n  local_50 = *param_2;\n  uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));\n  *param_5 = param_3;\n  iVar4 = 0;\n  *param_8 = param_6;\njoined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );\nLAB_003659e0:\n  iVar4 = 0;\n  param_3 = pwVar7;\n  goto joined_r0x003658b5;\n}\n\n" (function_definition "int FUN_00365850(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)\n\n{\n  wchar_t __wc;\n  ulong uVar1;\n  undefined8 uVar2;\n  wchar_t *pwVar3;\n  int iVar4;\n  size_t sVar5;\n  char *pcVar6;\n  wchar_t *pwVar7;\n  mbstate_t local_50;\n  char local_48 [24];\n  \n  local_50 = *param_2;\n  uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));\n  *param_5 = param_3;\n  iVar4 = 0;\n  *param_8 = param_6;\njoined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );\nLAB_003659e0:\n  iVar4 = 0;\n  param_3 = pwVar7;\n  goto joined_r0x003658b5;\n}" primitive_type (function_declarator "FUN_00365850(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)" identifier (parameter_list "(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "mbstate_t *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "wchar_t *param_3" type_identifier (pointer_declarator "*param_3" * identifier)) , (parameter_declaration "wchar_t *param_4" type_identifier (pointer_declarator "*param_4" * identifier)) , (parameter_declaration "wchar_t **param_5" type_identifier (pointer_declarator "**param_5" * (pointer_declarator "*param_5" * identifier))) , (parameter_declaration "ulong param_6" type_identifier identifier) , (parameter_declaration "char *param_7" primitive_type (pointer_declarator "*param_7" * identifier)) , (parameter_declaration "ulong *param_8" type_identifier (pointer_declarator "*param_8" * identifier)) ))) (compound_statement "{\n  wchar_t __wc;\n  ulong uVar1;\n  undefined8 uVar2;\n  wchar_t *pwVar3;\n  int iVar4;\n  size_t sVar5;\n  char *pcVar6;\n  wchar_t *pwVar7;\n  mbstate_t local_50;\n  char local_48 [24];\n  \n  local_50 = *param_2;\n  uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));\n  *param_5 = param_3;\n  iVar4 = 0;\n  *param_8 = param_6;\njoined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );\nLAB_003659e0:\n  iVar4 = 0;\n  param_3 = pwVar7;\n  goto joined_r0x003658b5;\n}" { (declaration "wchar_t __wc;" type_identifier identifier ;) (declaration "ulong uVar1;" type_identifier identifier ;) (declaration "undefined8 uVar2;" type_identifier identifier ;) (declaration "wchar_t *pwVar3;" type_identifier (pointer_declarator "*pwVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "size_t sVar5;" primitive_type identifier ;) (declaration "char *pcVar6;" primitive_type (pointer_declarator "*pcVar6" * identifier) ;) (declaration "wchar_t *pwVar7;" type_identifier (pointer_declarator "*pwVar7" * identifier) ;) (declaration "mbstate_t local_50;" type_identifier identifier ;) (declaration "char local_48 [24];" primitive_type (array_declarator "local_48 [24]" identifier [ number_literal ]) ;) (expression_statement "local_50 = *param_2;" (assignment_expression "local_50 = *param_2" identifier = (pointer_expression "*param_2" * identifier)) ;) (expression_statement "uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));" (assignment_expression "uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10))" identifier = (call_expression "__uselocale(*(undefined8 *)(param_1 + 0x10))" identifier (argument_list "(*(undefined8 *)(param_1 + 0x10))" ( (pointer_expression "*(undefined8 *)(param_1 + 0x10)" * (cast_expression "(undefined8 *)(param_1 + 0x10)" ( (type_descriptor "undefined8 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x10)" ( (binary_expression "param_1 + 0x10" identifier + number_literal) )))) )))) ;) (expression_statement "*param_5 = param_3;" (assignment_expression "*param_5 = param_3" (pointer_expression "*param_5" * identifier) = identifier) ;) (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (expression_statement "*param_8 = param_6;" (assignment_expression "*param_8 = param_6" (pointer_expression "*param_8" * identifier) = identifier) ;) (labeled_statement "joined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );" statement_identifier : (do_statement "do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );" do (compound_statement "{\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  }" { (if_statement "if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }" if (parenthesized_expression "(((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0))" ( (binary_expression "((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)" (parenthesized_expression "((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6))" ( (binary_expression "(param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)" (parenthesized_expression "(param_4 <= param_3)" ( (binary_expression "param_4 <= param_3" identifier <= identifier) )) || (parenthesized_expression "(pcVar6 = (char *)*param_8, param_7 <= pcVar6)" ( (comma_expression "pcVar6 = (char *)*param_8, param_7 <= pcVar6" (assignment_expression "pcVar6 = (char *)*param_8" identifier = (cast_expression "(char *)*param_8" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*param_8" * identifier))) , (binary_expression "param_7 <= pcVar6" identifier <= identifier)) ))) )) || (parenthesized_expression "(iVar4 != 0)" ( (binary_expression "iVar4 != 0" identifier != number_literal) ))) )) (compound_statement "{\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }" { (labeled_statement "LAB_00365958:\n      __uselocale(uVar2);" statement_identifier : (expression_statement "__uselocale(uVar2);" (call_expression "__uselocale(uVar2)" identifier (argument_list "(uVar2)" ( identifier ))) ;)) (return_statement "return iVar4;" return identifier ;) })) (while_statement "while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }" { (expression_statement "sVar5 = (long)param_4 - (long)param_3 >> 2;" (assignment_expression "sVar5 = (long)param_4 - (long)param_3 >> 2" identifier = (binary_expression "(long)param_4 - (long)param_3 >> 2" (binary_expression "(long)param_4 - (long)param_3" (cast_expression "(long)param_4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)param_3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) >> number_literal)) ;) (expression_statement "pwVar3 = wmemchr(param_3,L'\0',sVar5);" (assignment_expression "pwVar3 = wmemchr(param_3,L'\0',sVar5)" identifier = (call_expression "wmemchr(param_3,L'\0',sVar5)" identifier (argument_list "(param_3,L'\0',sVar5)" ( identifier , (char_literal "L'\0'" L' escape_sequence ') , identifier )))) ;) (expression_statement "pwVar7 = param_4;" (assignment_expression "pwVar7 = param_4" identifier = identifier) ;) (if_statement "if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }" if (parenthesized_expression "(pwVar3 != (wchar_t *)0x0)" ( (binary_expression "pwVar3 != (wchar_t *)0x0" identifier != (cast_expression "(wchar_t *)0x0" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }" { (expression_statement "sVar5 = (long)pwVar3 - (long)param_3 >> 2;" (assignment_expression "sVar5 = (long)pwVar3 - (long)param_3 >> 2" identifier = (binary_expression "(long)pwVar3 - (long)param_3 >> 2" (binary_expression "(long)pwVar3 - (long)param_3" (cast_expression "(long)pwVar3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)param_3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) >> number_literal)) ;) (expression_statement "pwVar7 = pwVar3;" (assignment_expression "pwVar7 = pwVar3" identifier = identifier) ;) })) (expression_statement "sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);" (assignment_expression "sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2)" identifier = (call_expression "wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2)" identifier (argument_list "(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2)" ( identifier , identifier , identifier , (binary_expression "(long)param_7 - (long)pcVar6" (cast_expression "(long)param_7" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)pcVar6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) , identifier )))) ;) (if_statement "if (sVar5 == 0xffffffffffffffff) break;" if (parenthesized_expression "(sVar5 == 0xffffffffffffffff)" ( (binary_expression "sVar5 == 0xffffffffffffffff" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "param_3 = *param_5;" (assignment_expression "param_3 = *param_5" identifier = (pointer_expression "*param_5" * identifier)) ;) (expression_statement "uVar1 = *param_8;" (assignment_expression "uVar1 = *param_8" identifier = (pointer_expression "*param_8" * identifier)) ;) (if_statement "if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }" if (parenthesized_expression "((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7))" ( (binary_expression "(param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)" (parenthesized_expression "(param_3 != (wchar_t *)0x0)" ( (binary_expression "param_3 != (wchar_t *)0x0" identifier != (cast_expression "(wchar_t *)0x0" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(param_3 < pwVar7)" ( (binary_expression "param_3 < pwVar7" identifier < identifier) ))) )) (compound_statement "{\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }" { (expression_statement "*param_8 = sVar5 + uVar1;" (assignment_expression "*param_8 = sVar5 + uVar1" (pointer_expression "*param_8" * identifier) = (binary_expression "sVar5 + uVar1" identifier + identifier)) ;) (expression_statement "iVar4 = 1;" (assignment_expression "iVar4 = 1" identifier = number_literal) ;) (goto_statement "goto joined_r0x003658b5;" goto statement_identifier ;) })) (expression_statement "*param_5 = pwVar7;" (assignment_expression "*param_5 = pwVar7" (pointer_expression "*param_5" * identifier) = identifier) ;) (expression_statement "*param_8 = sVar5 + uVar1;" (assignment_expression "*param_8 = sVar5 + uVar1" (pointer_expression "*param_8" * identifier) = (binary_expression "sVar5 + uVar1" identifier + identifier)) ;) (if_statement "if (param_4 <= pwVar7) goto LAB_003659e0;" if (parenthesized_expression "(param_4 <= pwVar7)" ( (binary_expression "param_4 <= pwVar7" identifier <= identifier) )) (goto_statement "goto LAB_003659e0;" goto statement_identifier ;)) (expression_statement "local_50 = *param_2;" (assignment_expression "local_50 = *param_2" identifier = (pointer_expression "*param_2" * identifier)) ;) (expression_statement "sVar5 = wcrtomb(local_48,*pwVar7,&local_50);" (assignment_expression "sVar5 = wcrtomb(local_48,*pwVar7,&local_50)" identifier = (call_expression "wcrtomb(local_48,*pwVar7,&local_50)" identifier (argument_list "(local_48,*pwVar7,&local_50)" ( identifier , (pointer_expression "*pwVar7" * identifier) , (pointer_expression "&local_50" & identifier) )))) ;) (if_statement "if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }" if (parenthesized_expression "((ulong)((long)param_7 - (long)*param_8) < sVar5)" ( (binary_expression "(ulong)((long)param_7 - (long)*param_8) < sVar5" (call_expression "(ulong)((long)param_7 - (long)*param_8)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "((long)param_7 - (long)*param_8)" ( (binary_expression "(long)param_7 - (long)*param_8" (cast_expression "(long)param_7" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)*param_8" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (pointer_expression "*param_8" * identifier))) ))) < identifier) )) (compound_statement "{\n        iVar4 = 1;\n        goto LAB_00365958;\n      }" { (expression_statement "iVar4 = 1;" (assignment_expression "iVar4 = 1" identifier = number_literal) ;) (goto_statement "goto LAB_00365958;" goto statement_identifier ;) })) (expression_statement "memcpy((void *)*param_8,local_48,sVar5);" (call_expression "memcpy((void *)*param_8,local_48,sVar5)" identifier (argument_list "((void *)*param_8,local_48,sVar5)" ( (cast_expression "(void *)*param_8" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*param_8" * identifier)) , identifier , identifier ))) ;) (expression_statement "*param_2 = local_50;" (assignment_expression "*param_2 = local_50" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "pcVar6 = (char *)(sVar5 + *param_8);" (assignment_expression "pcVar6 = (char *)(sVar5 + *param_8)" identifier = (cast_expression "(char *)(sVar5 + *param_8)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(sVar5 + *param_8)" ( (binary_expression "sVar5 + *param_8" identifier + (pointer_expression "*param_8" * identifier)) )))) ;) (expression_statement "param_3 = *param_5 + 1;" (assignment_expression "param_3 = *param_5 + 1" identifier = (binary_expression "*param_5 + 1" (pointer_expression "*param_5" * identifier) + number_literal)) ;) (expression_statement "*param_8 = (ulong)pcVar6;" (assignment_expression "*param_8 = (ulong)pcVar6" (pointer_expression "*param_8" * identifier) = (cast_expression "(ulong)pcVar6" ( (type_descriptor "ulong" type_identifier) ) identifier)) ;) (expression_statement "*param_5 = param_3;" (assignment_expression "*param_5 = param_3" (pointer_expression "*param_5" * identifier) = identifier) ;) (if_statement "if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }" if (parenthesized_expression "((param_4 <= param_3) || (param_7 <= pcVar6))" ( (binary_expression "(param_4 <= param_3) || (param_7 <= pcVar6)" (parenthesized_expression "(param_4 <= param_3)" ( (binary_expression "param_4 <= param_3" identifier <= identifier) )) || (parenthesized_expression "(param_7 <= pcVar6)" ( (binary_expression "param_7 <= pcVar6" identifier <= identifier) ))) )) (compound_statement "{\n        iVar4 = 0;\n        goto LAB_00365958;\n      }" { (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_00365958;" goto statement_identifier ;) })) })) (if_statement "if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }" if (parenthesized_expression "(param_3 < *param_5)" ( (binary_expression "param_3 < *param_5" identifier < (pointer_expression "*param_5" * identifier)) )) (compound_statement "{\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }" { (expression_statement "pcVar6 = (char *)*param_8;" (assignment_expression "pcVar6 = (char *)*param_8" identifier = (cast_expression "(char *)*param_8" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*param_8" * identifier))) ;) (do_statement "do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);" do (compound_statement "{\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      }" { (expression_statement "__wc = *param_3;" (assignment_expression "__wc = *param_3" identifier = (pointer_expression "*param_3" * identifier)) ;) (expression_statement "param_3 = param_3 + 1;" (assignment_expression "param_3 = param_3 + 1" identifier = (binary_expression "param_3 + 1" identifier + number_literal)) ;) (expression_statement "sVar5 = wcrtomb(pcVar6,__wc,&local_50);" (assignment_expression "sVar5 = wcrtomb(pcVar6,__wc,&local_50)" identifier = (call_expression "wcrtomb(pcVar6,__wc,&local_50)" identifier (argument_list "(pcVar6,__wc,&local_50)" ( identifier , identifier , (pointer_expression "&local_50" & identifier) )))) ;) (expression_statement "pcVar6 = (char *)(sVar5 + *param_8);" (assignment_expression "pcVar6 = (char *)(sVar5 + *param_8)" identifier = (cast_expression "(char *)(sVar5 + *param_8)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(sVar5 + *param_8)" ( (binary_expression "sVar5 + *param_8" identifier + (pointer_expression "*param_8" * identifier)) )))) ;) (expression_statement "*param_8 = (ulong)pcVar6;" (assignment_expression "*param_8 = (ulong)pcVar6" (pointer_expression "*param_8" * identifier) = (cast_expression "(ulong)pcVar6" ( (type_descriptor "ulong" type_identifier) ) identifier)) ;) }) while (parenthesized_expression "(param_3 < *param_5)" ( (binary_expression "param_3 < *param_5" identifier < (pointer_expression "*param_5" * identifier)) )) ;) })) (expression_statement "iVar4 = 2;" (assignment_expression "iVar4 = 2" identifier = number_literal) ;) (expression_statement "*param_2 = local_50;" (assignment_expression "*param_2 = local_50" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "param_3 = *param_5;" (assignment_expression "param_3 = *param_5" identifier = (pointer_expression "*param_5" * identifier)) ;) }) while (parenthesized_expression "( true )" ( true )) ;)) (labeled_statement "LAB_003659e0:\n  iVar4 = 0;" statement_identifier : (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;)) (expression_statement "param_3 = pwVar7;" (assignment_expression "param_3 = pwVar7" identifier = identifier) ;) (goto_statement "goto joined_r0x003658b5;" goto statement_identifier ;) })))
(translation_unit "/* std::codecvt<wchar_t, char, __mbstate_t>::do_out(__mbstate_t&, wchar_t const*, wchar_t const*,\n   wchar_t const*&, char*, char*, char*&) const */\n\nint __thiscall\nstd::codecvt<wchar_t,char,__mbstate_t>::do_out\n          (codecvt<wchar_t,char,__mbstate_t> *this,__mbstate_t *param_1,wchar_t *param_2,\n          wchar_t *param_3,wchar_t **param_4,char *param_5,char *param_6,char **param_7)\n\n{\n  wchar_t __wc;\n  undefined8 uVar1;\n  wchar_t *pwVar2;\n  int iVar3;\n  size_t sVar4;\n  char *pcVar5;\n  wchar_t *pwVar6;\n  __mbstate_t local_50;\n  char local_48 [24];\n  \n  local_50 = *param_1;\n  uVar1 = __uselocale(*(undefined8 *)(this + 0x10));\n  *param_4 = param_2;\n  iVar3 = 0;\n  *param_7 = param_5;\njoined_r0x003658b5:\n  do {\n    if (((param_3 <= param_2) || (pcVar5 = *param_7, param_6 <= pcVar5)) || (iVar3 != 0)) {\nLAB_00365958:\n      __uselocale(uVar1);\n      return iVar3;\n    }\n    while( true ) {\n      sVar4 = (long)param_3 - (long)param_2 >> 2;\n      pwVar2 = wmemchr(param_2,L'\0',sVar4);\n      pwVar6 = param_3;\n      if (pwVar2 != (wchar_t *)0x0) {\n        sVar4 = (long)pwVar2 - (long)param_2 >> 2;\n        pwVar6 = pwVar2;\n      }\n      sVar4 = wcsnrtombs(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1);\n      if (sVar4 == 0xffffffffffffffff) break;\n      param_2 = *param_4;\n      pcVar5 = *param_7;\n      if ((param_2 != (wchar_t *)0x0) && (param_2 < pwVar6)) {\n        *param_7 = pcVar5 + sVar4;\n        iVar3 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_4 = pwVar6;\n      *param_7 = pcVar5 + sVar4;\n      if (param_3 <= pwVar6) goto LAB_003659e0;\n      local_50 = *param_1;\n      sVar4 = wcrtomb(local_48,*pwVar6,&local_50);\n      if ((ulong)((long)param_6 - (long)*param_7) < sVar4) {\n        iVar3 = 1;\n        goto LAB_00365958;\n      }\n      memcpy(*param_7,local_48,sVar4);\n      *param_1 = local_50;\n      pcVar5 = *param_7 + sVar4;\n      param_2 = *param_4 + 1;\n      *param_7 = pcVar5;\n      *param_4 = param_2;\n      if ((param_3 <= param_2) || (param_6 <= pcVar5)) {\n        iVar3 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_2 < *param_4) {\n      pcVar5 = *param_7;\n      do {\n        __wc = *param_2;\n        param_2 = param_2 + 1;\n        sVar4 = wcrtomb(pcVar5,__wc,&local_50);\n        pcVar5 = *param_7 + sVar4;\n        *param_7 = pcVar5;\n      } while (param_2 < *param_4);\n    }\n    iVar3 = 2;\n    *param_1 = local_50;\n    param_2 = *param_4;\n  } while( true );\nLAB_003659e0:\n  iVar3 = 0;\n  param_2 = pwVar6;\n  goto joined_r0x003658b5;\n}\n\n" comment (declaration "int __thiscall\nstd::codecvt<wchar_t,char,__mbstate_t>::do_out\n          (codecvt<wchar_t,char,__mbstate_t> *this,__mbstate_t *param_1,wchar_t *param_2,\n          wchar_t *param_3,wchar_t **param_4,char *param_5,char *param_6,char **param_7)\n\n{\n  wchar_t __wc;" primitive_type (ms_call_modifier "__thiscall" __thiscall) (ERROR "std::codecvt<" identifier : : identifier <) identifier , identifier , (ERROR "__mbstate_t>::do_out\n          (codecvt<wchar_t,char,__mbstate_t> *this,__mbstate_t *param_1,wchar_t *param_2,\n          wchar_t *param_3,wchar_t **param_4,char *param_5,char *param_6,char **param_7)\n\n{\n  wchar_t" (function_declarator "__mbstate_t>::do_out\n          (codecvt<wchar_t,char,__mbstate_t> *this,__mbstate_t *param_1,wchar_t *param_2,\n          wchar_t *param_3,wchar_t **param_4,char *param_5,char *param_6,char **param_7)" identifier (ERROR ">::do_out" > : : identifier) (parameter_list "(codecvt<wchar_t,char,__mbstate_t> *this,__mbstate_t *param_1,wchar_t *param_2,\n          wchar_t *param_3,wchar_t **param_4,char *param_5,char *param_6,char **param_7)" ( (parameter_declaration "codecvt<wchar_t" type_identifier (ERROR "<" <) identifier) , (parameter_declaration "char" primitive_type) , (parameter_declaration "__mbstate_t> *this" type_identifier (ERROR ">" >) (pointer_declarator "*this" * identifier)) , (parameter_declaration "__mbstate_t *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "wchar_t *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "wchar_t *param_3" type_identifier (pointer_declarator "*param_3" * identifier)) , (parameter_declaration "wchar_t **param_4" type_identifier (pointer_declarator "**param_4" * (pointer_declarator "*param_4" * identifier))) , (parameter_declaration "char *param_5" primitive_type (pointer_declarator "*param_5" * identifier)) , (parameter_declaration "char *param_6" primitive_type (pointer_declarator "*param_6" * identifier)) , (parameter_declaration "char **param_7" primitive_type (pointer_declarator "**param_7" * (pointer_declarator "*param_7" * identifier))) ))) { identifier) identifier ;) (declaration "undefined8 uVar1;" type_identifier identifier ;) (declaration "wchar_t *pwVar2;" type_identifier (pointer_declarator "*pwVar2" * identifier) ;) (declaration "int iVar3;" primitive_type identifier ;) (declaration "size_t sVar4;" primitive_type identifier ;) (declaration "char *pcVar5;" primitive_type (pointer_declarator "*pcVar5" * identifier) ;) (declaration "wchar_t *pwVar6;" type_identifier (pointer_declarator "*pwVar6" * identifier) ;) (declaration "__mbstate_t local_50;" type_identifier identifier ;) (declaration "char local_48 [24];" primitive_type (array_declarator "local_48 [24]" identifier [ number_literal ]) ;) (expression_statement "local_50 = *param_1;" (assignment_expression "local_50 = *param_1" identifier = (pointer_expression "*param_1" * identifier)) ;) (expression_statement "uVar1 = __uselocale(*(undefined8 *)(this + 0x10));" (assignment_expression "uVar1 = __uselocale(*(undefined8 *)(this + 0x10))" identifier = (call_expression "__uselocale(*(undefined8 *)(this + 0x10))" identifier (argument_list "(*(undefined8 *)(this + 0x10))" ( (pointer_expression "*(undefined8 *)(this + 0x10)" * (cast_expression "(undefined8 *)(this + 0x10)" ( (type_descriptor "undefined8 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(this + 0x10)" ( (binary_expression "this + 0x10" identifier + number_literal) )))) )))) ;) (expression_statement "*param_4 = param_2;" (assignment_expression "*param_4 = param_2" (pointer_expression "*param_4" * identifier) = identifier) ;) (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (expression_statement "*param_7 = param_5;" (assignment_expression "*param_7 = param_5" (pointer_expression "*param_7" * identifier) = identifier) ;) (labeled_statement "joined_r0x003658b5:\n  do {\n    if (((param_3 <= param_2) || (pcVar5 = *param_7, param_6 <= pcVar5)) || (iVar3 != 0)) {\nLAB_00365958:\n      __uselocale(uVar1);\n      return iVar3;\n    }\n    while( true ) {\n      sVar4 = (long)param_3 - (long)param_2 >> 2;\n      pwVar2 = wmemchr(param_2,L'\0',sVar4);\n      pwVar6 = param_3;\n      if (pwVar2 != (wchar_t *)0x0) {\n        sVar4 = (long)pwVar2 - (long)param_2 >> 2;\n        pwVar6 = pwVar2;\n      }\n      sVar4 = wcsnrtombs(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1);\n      if (sVar4 == 0xffffffffffffffff) break;\n      param_2 = *param_4;\n      pcVar5 = *param_7;\n      if ((param_2 != (wchar_t *)0x0) && (param_2 < pwVar6)) {\n        *param_7 = pcVar5 + sVar4;\n        iVar3 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_4 = pwVar6;\n      *param_7 = pcVar5 + sVar4;\n      if (param_3 <= pwVar6) goto LAB_003659e0;\n      local_50 = *param_1;\n      sVar4 = wcrtomb(local_48,*pwVar6,&local_50);\n      if ((ulong)((long)param_6 - (long)*param_7) < sVar4) {\n        iVar3 = 1;\n        goto LAB_00365958;\n      }\n      memcpy(*param_7,local_48,sVar4);\n      *param_1 = local_50;\n      pcVar5 = *param_7 + sVar4;\n      param_2 = *param_4 + 1;\n      *param_7 = pcVar5;\n      *param_4 = param_2;\n      if ((param_3 <= param_2) || (param_6 <= pcVar5)) {\n        iVar3 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_2 < *param_4) {\n      pcVar5 = *param_7;\n      do {\n        __wc = *param_2;\n        param_2 = param_2 + 1;\n        sVar4 = wcrtomb(pcVar5,__wc,&local_50);\n        pcVar5 = *param_7 + sVar4;\n        *param_7 = pcVar5;\n      } while (param_2 < *param_4);\n    }\n    iVar3 = 2;\n    *param_1 = local_50;\n    param_2 = *param_4;\n  } while( true );" statement_identifier : (do_statement "do {\n    if (((param_3 <= param_2) || (pcVar5 = *param_7, param_6 <= pcVar5)) || (iVar3 != 0)) {\nLAB_00365958:\n      __uselocale(uVar1);\n      return iVar3;\n    }\n    while( true ) {\n      sVar4 = (long)param_3 - (long)param_2 >> 2;\n      pwVar2 = wmemchr(param_2,L'\0',sVar4);\n      pwVar6 = param_3;\n      if (pwVar2 != (wchar_t *)0x0) {\n        sVar4 = (long)pwVar2 - (long)param_2 >> 2;\n        pwVar6 = pwVar2;\n      }\n      sVar4 = wcsnrtombs(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1);\n      if (sVar4 == 0xffffffffffffffff) break;\n      param_2 = *param_4;\n      pcVar5 = *param_7;\n      if ((param_2 != (wchar_t *)0x0) && (param_2 < pwVar6)) {\n        *param_7 = pcVar5 + sVar4;\n        iVar3 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_4 = pwVar6;\n      *param_7 = pcVar5 + sVar4;\n      if (param_3 <= pwVar6) goto LAB_003659e0;\n      local_50 = *param_1;\n      sVar4 = wcrtomb(local_48,*pwVar6,&local_50);\n      if ((ulong)((long)param_6 - (long)*param_7) < sVar4) {\n        iVar3 = 1;\n        goto LAB_00365958;\n      }\n      memcpy(*param_7,local_48,sVar4);\n      *param_1 = local_50;\n      pcVar5 = *param_7 + sVar4;\n      param_2 = *param_4 + 1;\n      *param_7 = pcVar5;\n      *param_4 = param_2;\n      if ((param_3 <= param_2) || (param_6 <= pcVar5)) {\n        iVar3 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_2 < *param_4) {\n      pcVar5 = *param_7;\n      do {\n        __wc = *param_2;\n        param_2 = param_2 + 1;\n        sVar4 = wcrtomb(pcVar5,__wc,&local_50);\n        pcVar5 = *param_7 + sVar4;\n        *param_7 = pcVar5;\n      } while (param_2 < *param_4);\n    }\n    iVar3 = 2;\n    *param_1 = local_50;\n    param_2 = *param_4;\n  } while( true );" do (compound_statement "{\n    if (((param_3 <= param_2) || (pcVar5 = *param_7, param_6 <= pcVar5)) || (iVar3 != 0)) {\nLAB_00365958:\n      __uselocale(uVar1);\n      return iVar3;\n    }\n    while( true ) {\n      sVar4 = (long)param_3 - (long)param_2 >> 2;\n      pwVar2 = wmemchr(param_2,L'\0',sVar4);\n      pwVar6 = param_3;\n      if (pwVar2 != (wchar_t *)0x0) {\n        sVar4 = (long)pwVar2 - (long)param_2 >> 2;\n        pwVar6 = pwVar2;\n      }\n      sVar4 = wcsnrtombs(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1);\n      if (sVar4 == 0xffffffffffffffff) break;\n      param_2 = *param_4;\n      pcVar5 = *param_7;\n      if ((param_2 != (wchar_t *)0x0) && (param_2 < pwVar6)) {\n        *param_7 = pcVar5 + sVar4;\n        iVar3 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_4 = pwVar6;\n      *param_7 = pcVar5 + sVar4;\n      if (param_3 <= pwVar6) goto LAB_003659e0;\n      local_50 = *param_1;\n      sVar4 = wcrtomb(local_48,*pwVar6,&local_50);\n      if ((ulong)((long)param_6 - (long)*param_7) < sVar4) {\n        iVar3 = 1;\n        goto LAB_00365958;\n      }\n      memcpy(*param_7,local_48,sVar4);\n      *param_1 = local_50;\n      pcVar5 = *param_7 + sVar4;\n      param_2 = *param_4 + 1;\n      *param_7 = pcVar5;\n      *param_4 = param_2;\n      if ((param_3 <= param_2) || (param_6 <= pcVar5)) {\n        iVar3 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_2 < *param_4) {\n      pcVar5 = *param_7;\n      do {\n        __wc = *param_2;\n        param_2 = param_2 + 1;\n        sVar4 = wcrtomb(pcVar5,__wc,&local_50);\n        pcVar5 = *param_7 + sVar4;\n        *param_7 = pcVar5;\n      } while (param_2 < *param_4);\n    }\n    iVar3 = 2;\n    *param_1 = local_50;\n    param_2 = *param_4;\n  }" { (if_statement "if (((param_3 <= param_2) || (pcVar5 = *param_7, param_6 <= pcVar5)) || (iVar3 != 0)) {\nLAB_00365958:\n      __uselocale(uVar1);\n      return iVar3;\n    }" if (parenthesized_expression "(((param_3 <= param_2) || (pcVar5 = *param_7, param_6 <= pcVar5)) || (iVar3 != 0))" ( (binary_expression "((param_3 <= param_2) || (pcVar5 = *param_7, param_6 <= pcVar5)) || (iVar3 != 0)" (parenthesized_expression "((param_3 <= param_2) || (pcVar5 = *param_7, param_6 <= pcVar5))" ( (binary_expression "(param_3 <= param_2) || (pcVar5 = *param_7, param_6 <= pcVar5)" (parenthesized_expression "(param_3 <= param_2)" ( (binary_expression "param_3 <= param_2" identifier <= identifier) )) || (parenthesized_expression "(pcVar5 = *param_7, param_6 <= pcVar5)" ( (comma_expression "pcVar5 = *param_7, param_6 <= pcVar5" (assignment_expression "pcVar5 = *param_7" identifier = (pointer_expression "*param_7" * identifier)) , (binary_expression "param_6 <= pcVar5" identifier <= identifier)) ))) )) || (parenthesized_expression "(iVar3 != 0)" ( (binary_expression "iVar3 != 0" identifier != number_literal) ))) )) (compound_statement "{\nLAB_00365958:\n      __uselocale(uVar1);\n      return iVar3;\n    }" { (labeled_statement "LAB_00365958:\n      __uselocale(uVar1);" statement_identifier : (expression_statement "__uselocale(uVar1);" (call_expression "__uselocale(uVar1)" identifier (argument_list "(uVar1)" ( identifier ))) ;)) (return_statement "return iVar3;" return identifier ;) })) (while_statement "while( true ) {\n      sVar4 = (long)param_3 - (long)param_2 >> 2;\n      pwVar2 = wmemchr(param_2,L'\0',sVar4);\n      pwVar6 = param_3;\n      if (pwVar2 != (wchar_t *)0x0) {\n        sVar4 = (long)pwVar2 - (long)param_2 >> 2;\n        pwVar6 = pwVar2;\n      }\n      sVar4 = wcsnrtombs(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1);\n      if (sVar4 == 0xffffffffffffffff) break;\n      param_2 = *param_4;\n      pcVar5 = *param_7;\n      if ((param_2 != (wchar_t *)0x0) && (param_2 < pwVar6)) {\n        *param_7 = pcVar5 + sVar4;\n        iVar3 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_4 = pwVar6;\n      *param_7 = pcVar5 + sVar4;\n      if (param_3 <= pwVar6) goto LAB_003659e0;\n      local_50 = *param_1;\n      sVar4 = wcrtomb(local_48,*pwVar6,&local_50);\n      if ((ulong)((long)param_6 - (long)*param_7) < sVar4) {\n        iVar3 = 1;\n        goto LAB_00365958;\n      }\n      memcpy(*param_7,local_48,sVar4);\n      *param_1 = local_50;\n      pcVar5 = *param_7 + sVar4;\n      param_2 = *param_4 + 1;\n      *param_7 = pcVar5;\n      *param_4 = param_2;\n      if ((param_3 <= param_2) || (param_6 <= pcVar5)) {\n        iVar3 = 0;\n        goto LAB_00365958;\n      }\n    }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n      sVar4 = (long)param_3 - (long)param_2 >> 2;\n      pwVar2 = wmemchr(param_2,L'\0',sVar4);\n      pwVar6 = param_3;\n      if (pwVar2 != (wchar_t *)0x0) {\n        sVar4 = (long)pwVar2 - (long)param_2 >> 2;\n        pwVar6 = pwVar2;\n      }\n      sVar4 = wcsnrtombs(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1);\n      if (sVar4 == 0xffffffffffffffff) break;\n      param_2 = *param_4;\n      pcVar5 = *param_7;\n      if ((param_2 != (wchar_t *)0x0) && (param_2 < pwVar6)) {\n        *param_7 = pcVar5 + sVar4;\n        iVar3 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_4 = pwVar6;\n      *param_7 = pcVar5 + sVar4;\n      if (param_3 <= pwVar6) goto LAB_003659e0;\n      local_50 = *param_1;\n      sVar4 = wcrtomb(local_48,*pwVar6,&local_50);\n      if ((ulong)((long)param_6 - (long)*param_7) < sVar4) {\n        iVar3 = 1;\n        goto LAB_00365958;\n      }\n      memcpy(*param_7,local_48,sVar4);\n      *param_1 = local_50;\n      pcVar5 = *param_7 + sVar4;\n      param_2 = *param_4 + 1;\n      *param_7 = pcVar5;\n      *param_4 = param_2;\n      if ((param_3 <= param_2) || (param_6 <= pcVar5)) {\n        iVar3 = 0;\n        goto LAB_00365958;\n      }\n    }" { (expression_statement "sVar4 = (long)param_3 - (long)param_2 >> 2;" (assignment_expression "sVar4 = (long)param_3 - (long)param_2 >> 2" identifier = (binary_expression "(long)param_3 - (long)param_2 >> 2" (binary_expression "(long)param_3 - (long)param_2" (cast_expression "(long)param_3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)param_2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) >> number_literal)) ;) (expression_statement "pwVar2 = wmemchr(param_2,L'\0',sVar4);" (assignment_expression "pwVar2 = wmemchr(param_2,L'\0',sVar4)" identifier = (call_expression "wmemchr(param_2,L'\0',sVar4)" identifier (argument_list "(param_2,L'\0',sVar4)" ( identifier , (char_literal "L'\0'" L' escape_sequence ') , identifier )))) ;) (expression_statement "pwVar6 = param_3;" (assignment_expression "pwVar6 = param_3" identifier = identifier) ;) (if_statement "if (pwVar2 != (wchar_t *)0x0) {\n        sVar4 = (long)pwVar2 - (long)param_2 >> 2;\n        pwVar6 = pwVar2;\n      }" if (parenthesized_expression "(pwVar2 != (wchar_t *)0x0)" ( (binary_expression "pwVar2 != (wchar_t *)0x0" identifier != (cast_expression "(wchar_t *)0x0" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        sVar4 = (long)pwVar2 - (long)param_2 >> 2;\n        pwVar6 = pwVar2;\n      }" { (expression_statement "sVar4 = (long)pwVar2 - (long)param_2 >> 2;" (assignment_expression "sVar4 = (long)pwVar2 - (long)param_2 >> 2" identifier = (binary_expression "(long)pwVar2 - (long)param_2 >> 2" (binary_expression "(long)pwVar2 - (long)param_2" (cast_expression "(long)pwVar2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)param_2" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) >> number_literal)) ;) (expression_statement "pwVar6 = pwVar2;" (assignment_expression "pwVar6 = pwVar2" identifier = identifier) ;) })) (expression_statement "sVar4 = wcsnrtombs(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1);" (assignment_expression "sVar4 = wcsnrtombs(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1)" identifier = (call_expression "wcsnrtombs(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1)" identifier (argument_list "(pcVar5,param_4,sVar4,(long)param_6 - (long)pcVar5,param_1)" ( identifier , identifier , identifier , (binary_expression "(long)param_6 - (long)pcVar5" (cast_expression "(long)param_6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)pcVar5" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) , identifier )))) ;) (if_statement "if (sVar4 == 0xffffffffffffffff) break;" if (parenthesized_expression "(sVar4 == 0xffffffffffffffff)" ( (binary_expression "sVar4 == 0xffffffffffffffff" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "param_2 = *param_4;" (assignment_expression "param_2 = *param_4" identifier = (pointer_expression "*param_4" * identifier)) ;) (expression_statement "pcVar5 = *param_7;" (assignment_expression "pcVar5 = *param_7" identifier = (pointer_expression "*param_7" * identifier)) ;) (if_statement "if ((param_2 != (wchar_t *)0x0) && (param_2 < pwVar6)) {\n        *param_7 = pcVar5 + sVar4;\n        iVar3 = 1;\n        goto joined_r0x003658b5;\n      }" if (parenthesized_expression "((param_2 != (wchar_t *)0x0) && (param_2 < pwVar6))" ( (binary_expression "(param_2 != (wchar_t *)0x0) && (param_2 < pwVar6)" (parenthesized_expression "(param_2 != (wchar_t *)0x0)" ( (binary_expression "param_2 != (wchar_t *)0x0" identifier != (cast_expression "(wchar_t *)0x0" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(param_2 < pwVar6)" ( (binary_expression "param_2 < pwVar6" identifier < identifier) ))) )) (compound_statement "{\n        *param_7 = pcVar5 + sVar4;\n        iVar3 = 1;\n        goto joined_r0x003658b5;\n      }" { (expression_statement "*param_7 = pcVar5 + sVar4;" (assignment_expression "*param_7 = pcVar5 + sVar4" (pointer_expression "*param_7" * identifier) = (binary_expression "pcVar5 + sVar4" identifier + identifier)) ;) (expression_statement "iVar3 = 1;" (assignment_expression "iVar3 = 1" identifier = number_literal) ;) (goto_statement "goto joined_r0x003658b5;" goto statement_identifier ;) })) (expression_statement "*param_4 = pwVar6;" (assignment_expression "*param_4 = pwVar6" (pointer_expression "*param_4" * identifier) = identifier) ;) (expression_statement "*param_7 = pcVar5 + sVar4;" (assignment_expression "*param_7 = pcVar5 + sVar4" (pointer_expression "*param_7" * identifier) = (binary_expression "pcVar5 + sVar4" identifier + identifier)) ;) (if_statement "if (param_3 <= pwVar6) goto LAB_003659e0;" if (parenthesized_expression "(param_3 <= pwVar6)" ( (binary_expression "param_3 <= pwVar6" identifier <= identifier) )) (goto_statement "goto LAB_003659e0;" goto statement_identifier ;)) (expression_statement "local_50 = *param_1;" (assignment_expression "local_50 = *param_1" identifier = (pointer_expression "*param_1" * identifier)) ;) (expression_statement "sVar4 = wcrtomb(local_48,*pwVar6,&local_50);" (assignment_expression "sVar4 = wcrtomb(local_48,*pwVar6,&local_50)" identifier = (call_expression "wcrtomb(local_48,*pwVar6,&local_50)" identifier (argument_list "(local_48,*pwVar6,&local_50)" ( identifier , (pointer_expression "*pwVar6" * identifier) , (pointer_expression "&local_50" & identifier) )))) ;) (if_statement "if ((ulong)((long)param_6 - (long)*param_7) < sVar4) {\n        iVar3 = 1;\n        goto LAB_00365958;\n      }" if (parenthesized_expression "((ulong)((long)param_6 - (long)*param_7) < sVar4)" ( (binary_expression "(ulong)((long)param_6 - (long)*param_7) < sVar4" (call_expression "(ulong)((long)param_6 - (long)*param_7)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "((long)param_6 - (long)*param_7)" ( (binary_expression "(long)param_6 - (long)*param_7" (cast_expression "(long)param_6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)*param_7" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (pointer_expression "*param_7" * identifier))) ))) < identifier) )) (compound_statement "{\n        iVar3 = 1;\n        goto LAB_00365958;\n      }" { (expression_statement "iVar3 = 1;" (assignment_expression "iVar3 = 1" identifier = number_literal) ;) (goto_statement "goto LAB_00365958;" goto statement_identifier ;) })) (expression_statement "memcpy(*param_7,local_48,sVar4);" (call_expression "memcpy(*param_7,local_48,sVar4)" identifier (argument_list "(*param_7,local_48,sVar4)" ( (pointer_expression "*param_7" * identifier) , identifier , identifier ))) ;) (expression_statement "*param_1 = local_50;" (assignment_expression "*param_1 = local_50" (pointer_expression "*param_1" * identifier) = identifier) ;) (expression_statement "pcVar5 = *param_7 + sVar4;" (assignment_expression "pcVar5 = *param_7 + sVar4" identifier = (binary_expression "*param_7 + sVar4" (pointer_expression "*param_7" * identifier) + identifier)) ;) (expression_statement "param_2 = *param_4 + 1;" (assignment_expression "param_2 = *param_4 + 1" identifier = (binary_expression "*param_4 + 1" (pointer_expression "*param_4" * identifier) + number_literal)) ;) (expression_statement "*param_7 = pcVar5;" (assignment_expression "*param_7 = pcVar5" (pointer_expression "*param_7" * identifier) = identifier) ;) (expression_statement "*param_4 = param_2;" (assignment_expression "*param_4 = param_2" (pointer_expression "*param_4" * identifier) = identifier) ;) (if_statement "if ((param_3 <= param_2) || (param_6 <= pcVar5)) {\n        iVar3 = 0;\n        goto LAB_00365958;\n      }" if (parenthesized_expression "((param_3 <= param_2) || (param_6 <= pcVar5))" ( (binary_expression "(param_3 <= param_2) || (param_6 <= pcVar5)" (parenthesized_expression "(param_3 <= param_2)" ( (binary_expression "param_3 <= param_2" identifier <= identifier) )) || (parenthesized_expression "(param_6 <= pcVar5)" ( (binary_expression "param_6 <= pcVar5" identifier <= identifier) ))) )) (compound_statement "{\n        iVar3 = 0;\n        goto LAB_00365958;\n      }" { (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_00365958;" goto statement_identifier ;) })) })) (if_statement "if (param_2 < *param_4) {\n      pcVar5 = *param_7;\n      do {\n        __wc = *param_2;\n        param_2 = param_2 + 1;\n        sVar4 = wcrtomb(pcVar5,__wc,&local_50);\n        pcVar5 = *param_7 + sVar4;\n        *param_7 = pcVar5;\n      } while (param_2 < *param_4);\n    }" if (parenthesized_expression "(param_2 < *param_4)" ( (binary_expression "param_2 < *param_4" identifier < (pointer_expression "*param_4" * identifier)) )) (compound_statement "{\n      pcVar5 = *param_7;\n      do {\n        __wc = *param_2;\n        param_2 = param_2 + 1;\n        sVar4 = wcrtomb(pcVar5,__wc,&local_50);\n        pcVar5 = *param_7 + sVar4;\n        *param_7 = pcVar5;\n      } while (param_2 < *param_4);\n    }" { (expression_statement "pcVar5 = *param_7;" (assignment_expression "pcVar5 = *param_7" identifier = (pointer_expression "*param_7" * identifier)) ;) (do_statement "do {\n        __wc = *param_2;\n        param_2 = param_2 + 1;\n        sVar4 = wcrtomb(pcVar5,__wc,&local_50);\n        pcVar5 = *param_7 + sVar4;\n        *param_7 = pcVar5;\n      } while (param_2 < *param_4);" do (compound_statement "{\n        __wc = *param_2;\n        param_2 = param_2 + 1;\n        sVar4 = wcrtomb(pcVar5,__wc,&local_50);\n        pcVar5 = *param_7 + sVar4;\n        *param_7 = pcVar5;\n      }" { (expression_statement "__wc = *param_2;" (assignment_expression "__wc = *param_2" identifier = (pointer_expression "*param_2" * identifier)) ;) (expression_statement "param_2 = param_2 + 1;" (assignment_expression "param_2 = param_2 + 1" identifier = (binary_expression "param_2 + 1" identifier + number_literal)) ;) (expression_statement "sVar4 = wcrtomb(pcVar5,__wc,&local_50);" (assignment_expression "sVar4 = wcrtomb(pcVar5,__wc,&local_50)" identifier = (call_expression "wcrtomb(pcVar5,__wc,&local_50)" identifier (argument_list "(pcVar5,__wc,&local_50)" ( identifier , identifier , (pointer_expression "&local_50" & identifier) )))) ;) (expression_statement "pcVar5 = *param_7 + sVar4;" (assignment_expression "pcVar5 = *param_7 + sVar4" identifier = (binary_expression "*param_7 + sVar4" (pointer_expression "*param_7" * identifier) + identifier)) ;) (expression_statement "*param_7 = pcVar5;" (assignment_expression "*param_7 = pcVar5" (pointer_expression "*param_7" * identifier) = identifier) ;) }) while (parenthesized_expression "(param_2 < *param_4)" ( (binary_expression "param_2 < *param_4" identifier < (pointer_expression "*param_4" * identifier)) )) ;) })) (expression_statement "iVar3 = 2;" (assignment_expression "iVar3 = 2" identifier = number_literal) ;) (expression_statement "*param_1 = local_50;" (assignment_expression "*param_1 = local_50" (pointer_expression "*param_1" * identifier) = identifier) ;) (expression_statement "param_2 = *param_4;" (assignment_expression "param_2 = *param_4" identifier = (pointer_expression "*param_4" * identifier)) ;) }) while (parenthesized_expression "( true )" ( true )) ;)) (labeled_statement "LAB_003659e0:\n  iVar3 = 0;" statement_identifier : (expression_statement "iVar3 = 0;" (assignment_expression "iVar3 = 0" identifier = number_literal) ;)) (expression_statement "param_2 = pwVar6;" (assignment_expression "param_2 = pwVar6" identifier = identifier) ;) (goto_statement "goto joined_r0x003658b5;" goto statement_identifier ;) (ERROR "}" }))
(translation_unit "int FUN_00365850(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)\n\n{\n  wchar_t __wc;\n  ulong uVar1;\n  undefined8 uVar2;\n  wchar_t *pwVar3;\n  int iVar4;\n  size_t sVar5;\n  char *pcVar6;\n  wchar_t *pwVar7;\n  mbstate_t local_50;\n  char local_48 [24];\n  \n  local_50 = *param_2;\n  uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));\n  *param_5 = param_3;\n  iVar4 = 0;\n  *param_8 = param_6;\njoined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );\nLAB_003659e0:\n  iVar4 = 0;\n  param_3 = pwVar7;\n  goto joined_r0x003658b5;\n}\n\n" (function_definition "int FUN_00365850(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)\n\n{\n  wchar_t __wc;\n  ulong uVar1;\n  undefined8 uVar2;\n  wchar_t *pwVar3;\n  int iVar4;\n  size_t sVar5;\n  char *pcVar6;\n  wchar_t *pwVar7;\n  mbstate_t local_50;\n  char local_48 [24];\n  \n  local_50 = *param_2;\n  uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));\n  *param_5 = param_3;\n  iVar4 = 0;\n  *param_8 = param_6;\njoined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );\nLAB_003659e0:\n  iVar4 = 0;\n  param_3 = pwVar7;\n  goto joined_r0x003658b5;\n}" primitive_type (function_declarator "FUN_00365850(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)" identifier (parameter_list "(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)" ( (parameter_declaration "long param_1" (sized_type_specifier "long" long) identifier) , (parameter_declaration "mbstate_t *param_2" type_identifier (pointer_declarator "*param_2" * identifier)) , (parameter_declaration "wchar_t *param_3" type_identifier (pointer_declarator "*param_3" * identifier)) , (parameter_declaration "wchar_t *param_4" type_identifier (pointer_declarator "*param_4" * identifier)) , (parameter_declaration "wchar_t **param_5" type_identifier (pointer_declarator "**param_5" * (pointer_declarator "*param_5" * identifier))) , (parameter_declaration "ulong param_6" type_identifier identifier) , (parameter_declaration "char *param_7" primitive_type (pointer_declarator "*param_7" * identifier)) , (parameter_declaration "ulong *param_8" type_identifier (pointer_declarator "*param_8" * identifier)) ))) (compound_statement "{\n  wchar_t __wc;\n  ulong uVar1;\n  undefined8 uVar2;\n  wchar_t *pwVar3;\n  int iVar4;\n  size_t sVar5;\n  char *pcVar6;\n  wchar_t *pwVar7;\n  mbstate_t local_50;\n  char local_48 [24];\n  \n  local_50 = *param_2;\n  uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));\n  *param_5 = param_3;\n  iVar4 = 0;\n  *param_8 = param_6;\njoined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );\nLAB_003659e0:\n  iVar4 = 0;\n  param_3 = pwVar7;\n  goto joined_r0x003658b5;\n}" { (declaration "wchar_t __wc;" type_identifier identifier ;) (declaration "ulong uVar1;" type_identifier identifier ;) (declaration "undefined8 uVar2;" type_identifier identifier ;) (declaration "wchar_t *pwVar3;" type_identifier (pointer_declarator "*pwVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "size_t sVar5;" primitive_type identifier ;) (declaration "char *pcVar6;" primitive_type (pointer_declarator "*pcVar6" * identifier) ;) (declaration "wchar_t *pwVar7;" type_identifier (pointer_declarator "*pwVar7" * identifier) ;) (declaration "mbstate_t local_50;" type_identifier identifier ;) (declaration "char local_48 [24];" primitive_type (array_declarator "local_48 [24]" identifier [ number_literal ]) ;) (expression_statement "local_50 = *param_2;" (assignment_expression "local_50 = *param_2" identifier = (pointer_expression "*param_2" * identifier)) ;) (expression_statement "uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));" (assignment_expression "uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10))" identifier = (call_expression "__uselocale(*(undefined8 *)(param_1 + 0x10))" identifier (argument_list "(*(undefined8 *)(param_1 + 0x10))" ( (pointer_expression "*(undefined8 *)(param_1 + 0x10)" * (cast_expression "(undefined8 *)(param_1 + 0x10)" ( (type_descriptor "undefined8 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + 0x10)" ( (binary_expression "param_1 + 0x10" identifier + number_literal) )))) )))) ;) (expression_statement "*param_5 = param_3;" (assignment_expression "*param_5 = param_3" (pointer_expression "*param_5" * identifier) = identifier) ;) (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (expression_statement "*param_8 = param_6;" (assignment_expression "*param_8 = param_6" (pointer_expression "*param_8" * identifier) = identifier) ;) (labeled_statement "joined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );" statement_identifier : (do_statement "do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );" do (compound_statement "{\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  }" { (if_statement "if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }" if (parenthesized_expression "(((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0))" ( (binary_expression "((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)" (parenthesized_expression "((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6))" ( (binary_expression "(param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)" (parenthesized_expression "(param_4 <= param_3)" ( (binary_expression "param_4 <= param_3" identifier <= identifier) )) || (parenthesized_expression "(pcVar6 = (char *)*param_8, param_7 <= pcVar6)" ( (comma_expression "pcVar6 = (char *)*param_8, param_7 <= pcVar6" (assignment_expression "pcVar6 = (char *)*param_8" identifier = (cast_expression "(char *)*param_8" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*param_8" * identifier))) , (binary_expression "param_7 <= pcVar6" identifier <= identifier)) ))) )) || (parenthesized_expression "(iVar4 != 0)" ( (binary_expression "iVar4 != 0" identifier != number_literal) ))) )) (compound_statement "{\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }" { (labeled_statement "LAB_00365958:\n      __uselocale(uVar2);" statement_identifier : (expression_statement "__uselocale(uVar2);" (call_expression "__uselocale(uVar2)" identifier (argument_list "(uVar2)" ( identifier ))) ;)) (return_statement "return iVar4;" return identifier ;) })) (while_statement "while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }" while (parenthesized_expression "( true )" ( true )) (compound_statement "{\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }" { (expression_statement "sVar5 = (long)param_4 - (long)param_3 >> 2;" (assignment_expression "sVar5 = (long)param_4 - (long)param_3 >> 2" identifier = (binary_expression "(long)param_4 - (long)param_3 >> 2" (binary_expression "(long)param_4 - (long)param_3" (cast_expression "(long)param_4" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)param_3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) >> number_literal)) ;) (expression_statement "pwVar3 = wmemchr(param_3,L'\0',sVar5);" (assignment_expression "pwVar3 = wmemchr(param_3,L'\0',sVar5)" identifier = (call_expression "wmemchr(param_3,L'\0',sVar5)" identifier (argument_list "(param_3,L'\0',sVar5)" ( identifier , (char_literal "L'\0'" L' escape_sequence ') , identifier )))) ;) (expression_statement "pwVar7 = param_4;" (assignment_expression "pwVar7 = param_4" identifier = identifier) ;) (if_statement "if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }" if (parenthesized_expression "(pwVar3 != (wchar_t *)0x0)" ( (binary_expression "pwVar3 != (wchar_t *)0x0" identifier != (cast_expression "(wchar_t *)0x0" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) (compound_statement "{\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }" { (expression_statement "sVar5 = (long)pwVar3 - (long)param_3 >> 2;" (assignment_expression "sVar5 = (long)pwVar3 - (long)param_3 >> 2" identifier = (binary_expression "(long)pwVar3 - (long)param_3 >> 2" (binary_expression "(long)pwVar3 - (long)param_3" (cast_expression "(long)pwVar3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)param_3" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) >> number_literal)) ;) (expression_statement "pwVar7 = pwVar3;" (assignment_expression "pwVar7 = pwVar3" identifier = identifier) ;) })) (expression_statement "sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);" (assignment_expression "sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2)" identifier = (call_expression "wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2)" identifier (argument_list "(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2)" ( identifier , identifier , identifier , (binary_expression "(long)param_7 - (long)pcVar6" (cast_expression "(long)param_7" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)pcVar6" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier)) , identifier )))) ;) (if_statement "if (sVar5 == 0xffffffffffffffff) break;" if (parenthesized_expression "(sVar5 == 0xffffffffffffffff)" ( (binary_expression "sVar5 == 0xffffffffffffffff" identifier == number_literal) )) (break_statement "break;" break ;)) (expression_statement "param_3 = *param_5;" (assignment_expression "param_3 = *param_5" identifier = (pointer_expression "*param_5" * identifier)) ;) (expression_statement "uVar1 = *param_8;" (assignment_expression "uVar1 = *param_8" identifier = (pointer_expression "*param_8" * identifier)) ;) (if_statement "if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }" if (parenthesized_expression "((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7))" ( (binary_expression "(param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)" (parenthesized_expression "(param_3 != (wchar_t *)0x0)" ( (binary_expression "param_3 != (wchar_t *)0x0" identifier != (cast_expression "(wchar_t *)0x0" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) number_literal)) )) && (parenthesized_expression "(param_3 < pwVar7)" ( (binary_expression "param_3 < pwVar7" identifier < identifier) ))) )) (compound_statement "{\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }" { (expression_statement "*param_8 = sVar5 + uVar1;" (assignment_expression "*param_8 = sVar5 + uVar1" (pointer_expression "*param_8" * identifier) = (binary_expression "sVar5 + uVar1" identifier + identifier)) ;) (expression_statement "iVar4 = 1;" (assignment_expression "iVar4 = 1" identifier = number_literal) ;) (goto_statement "goto joined_r0x003658b5;" goto statement_identifier ;) })) (expression_statement "*param_5 = pwVar7;" (assignment_expression "*param_5 = pwVar7" (pointer_expression "*param_5" * identifier) = identifier) ;) (expression_statement "*param_8 = sVar5 + uVar1;" (assignment_expression "*param_8 = sVar5 + uVar1" (pointer_expression "*param_8" * identifier) = (binary_expression "sVar5 + uVar1" identifier + identifier)) ;) (if_statement "if (param_4 <= pwVar7) goto LAB_003659e0;" if (parenthesized_expression "(param_4 <= pwVar7)" ( (binary_expression "param_4 <= pwVar7" identifier <= identifier) )) (goto_statement "goto LAB_003659e0;" goto statement_identifier ;)) (expression_statement "local_50 = *param_2;" (assignment_expression "local_50 = *param_2" identifier = (pointer_expression "*param_2" * identifier)) ;) (expression_statement "sVar5 = wcrtomb(local_48,*pwVar7,&local_50);" (assignment_expression "sVar5 = wcrtomb(local_48,*pwVar7,&local_50)" identifier = (call_expression "wcrtomb(local_48,*pwVar7,&local_50)" identifier (argument_list "(local_48,*pwVar7,&local_50)" ( identifier , (pointer_expression "*pwVar7" * identifier) , (pointer_expression "&local_50" & identifier) )))) ;) (if_statement "if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }" if (parenthesized_expression "((ulong)((long)param_7 - (long)*param_8) < sVar5)" ( (binary_expression "(ulong)((long)param_7 - (long)*param_8) < sVar5" (call_expression "(ulong)((long)param_7 - (long)*param_8)" (parenthesized_expression "(ulong)" ( identifier )) (argument_list "((long)param_7 - (long)*param_8)" ( (binary_expression "(long)param_7 - (long)*param_8" (cast_expression "(long)param_7" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) identifier) - (cast_expression "(long)*param_8" ( (type_descriptor "long" (sized_type_specifier "long" long)) ) (pointer_expression "*param_8" * identifier))) ))) < identifier) )) (compound_statement "{\n        iVar4 = 1;\n        goto LAB_00365958;\n      }" { (expression_statement "iVar4 = 1;" (assignment_expression "iVar4 = 1" identifier = number_literal) ;) (goto_statement "goto LAB_00365958;" goto statement_identifier ;) })) (expression_statement "memcpy((void *)*param_8,local_48,sVar5);" (call_expression "memcpy((void *)*param_8,local_48,sVar5)" identifier (argument_list "((void *)*param_8,local_48,sVar5)" ( (cast_expression "(void *)*param_8" ( (type_descriptor "void *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*param_8" * identifier)) , identifier , identifier ))) ;) (expression_statement "*param_2 = local_50;" (assignment_expression "*param_2 = local_50" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "pcVar6 = (char *)(sVar5 + *param_8);" (assignment_expression "pcVar6 = (char *)(sVar5 + *param_8)" identifier = (cast_expression "(char *)(sVar5 + *param_8)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(sVar5 + *param_8)" ( (binary_expression "sVar5 + *param_8" identifier + (pointer_expression "*param_8" * identifier)) )))) ;) (expression_statement "param_3 = *param_5 + 1;" (assignment_expression "param_3 = *param_5 + 1" identifier = (binary_expression "*param_5 + 1" (pointer_expression "*param_5" * identifier) + number_literal)) ;) (expression_statement "*param_8 = (ulong)pcVar6;" (assignment_expression "*param_8 = (ulong)pcVar6" (pointer_expression "*param_8" * identifier) = (cast_expression "(ulong)pcVar6" ( (type_descriptor "ulong" type_identifier) ) identifier)) ;) (expression_statement "*param_5 = param_3;" (assignment_expression "*param_5 = param_3" (pointer_expression "*param_5" * identifier) = identifier) ;) (if_statement "if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }" if (parenthesized_expression "((param_4 <= param_3) || (param_7 <= pcVar6))" ( (binary_expression "(param_4 <= param_3) || (param_7 <= pcVar6)" (parenthesized_expression "(param_4 <= param_3)" ( (binary_expression "param_4 <= param_3" identifier <= identifier) )) || (parenthesized_expression "(param_7 <= pcVar6)" ( (binary_expression "param_7 <= pcVar6" identifier <= identifier) ))) )) (compound_statement "{\n        iVar4 = 0;\n        goto LAB_00365958;\n      }" { (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;) (goto_statement "goto LAB_00365958;" goto statement_identifier ;) })) })) (if_statement "if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }" if (parenthesized_expression "(param_3 < *param_5)" ( (binary_expression "param_3 < *param_5" identifier < (pointer_expression "*param_5" * identifier)) )) (compound_statement "{\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }" { (expression_statement "pcVar6 = (char *)*param_8;" (assignment_expression "pcVar6 = (char *)*param_8" identifier = (cast_expression "(char *)*param_8" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (pointer_expression "*param_8" * identifier))) ;) (do_statement "do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);" do (compound_statement "{\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      }" { (expression_statement "__wc = *param_3;" (assignment_expression "__wc = *param_3" identifier = (pointer_expression "*param_3" * identifier)) ;) (expression_statement "param_3 = param_3 + 1;" (assignment_expression "param_3 = param_3 + 1" identifier = (binary_expression "param_3 + 1" identifier + number_literal)) ;) (expression_statement "sVar5 = wcrtomb(pcVar6,__wc,&local_50);" (assignment_expression "sVar5 = wcrtomb(pcVar6,__wc,&local_50)" identifier = (call_expression "wcrtomb(pcVar6,__wc,&local_50)" identifier (argument_list "(pcVar6,__wc,&local_50)" ( identifier , identifier , (pointer_expression "&local_50" & identifier) )))) ;) (expression_statement "pcVar6 = (char *)(sVar5 + *param_8);" (assignment_expression "pcVar6 = (char *)(sVar5 + *param_8)" identifier = (cast_expression "(char *)(sVar5 + *param_8)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(sVar5 + *param_8)" ( (binary_expression "sVar5 + *param_8" identifier + (pointer_expression "*param_8" * identifier)) )))) ;) (expression_statement "*param_8 = (ulong)pcVar6;" (assignment_expression "*param_8 = (ulong)pcVar6" (pointer_expression "*param_8" * identifier) = (cast_expression "(ulong)pcVar6" ( (type_descriptor "ulong" type_identifier) ) identifier)) ;) }) while (parenthesized_expression "(param_3 < *param_5)" ( (binary_expression "param_3 < *param_5" identifier < (pointer_expression "*param_5" * identifier)) )) ;) })) (expression_statement "iVar4 = 2;" (assignment_expression "iVar4 = 2" identifier = number_literal) ;) (expression_statement "*param_2 = local_50;" (assignment_expression "*param_2 = local_50" (pointer_expression "*param_2" * identifier) = identifier) ;) (expression_statement "param_3 = *param_5;" (assignment_expression "param_3 = *param_5" identifier = (pointer_expression "*param_5" * identifier)) ;) }) while (parenthesized_expression "( true )" ( true )) ;)) (labeled_statement "LAB_003659e0:\n  iVar4 = 0;" statement_identifier : (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" identifier = number_literal) ;)) (expression_statement "param_3 = pwVar7;" (assignment_expression "param_3 = pwVar7" identifier = identifier) ;) (goto_statement "goto joined_r0x003658b5;" goto statement_identifier ;) })))
(translation_unit (function_definition TYPE (function_declarator IDENT (parameter_list ( (parameter_declaration (sized_type_specifier long) IDENT) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE (pointer_declarator * (pointer_declarator * IDENT))) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE (pointer_declarator * IDENT)) ))) (compound_statement { (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE (array_declarator IDENT [ LIT ]) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) )))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (labeled_statement statement_identifier : (do_statement do (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT <= IDENT) )) || (parenthesized_expression ( (comma_expression (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (pointer_expression * IDENT))) , (binary_expression IDENT <= IDENT)) ))) )) || (parenthesized_expression ( (binary_expression IDENT != LIT) ))) )) (compound_statement { (labeled_statement statement_identifier : (expression_statement (call_expression IDENT (argument_list ( IDENT ))) ;)) (return_statement return IDENT ;) })) (while_statement while (parenthesized_expression ( BOOL )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) - (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) >> LIT)) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , (char_literal L' escape_sequence ') , IDENT )))) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) - (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) >> LIT)) ;) (expression_statement (assignment_expression IDENT = IDENT) ;) })) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT , (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) - (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT)) , IDENT )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (break_statement break ;)) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT != (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) LIT)) )) && (parenthesized_expression ( (binary_expression IDENT < IDENT) ))) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * IDENT) = (binary_expression IDENT + IDENT)) ;) (expression_statement (assignment_expression IDENT = LIT) ;) (goto_statement goto statement_identifier ;) })) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = (binary_expression IDENT + IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT <= IDENT) )) (goto_statement goto statement_identifier ;)) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , (pointer_expression * IDENT) , (pointer_expression & IDENT) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression (call_expression (parenthesized_expression ( IDENT )) (argument_list ( (binary_expression (cast_expression ( (type_descriptor (sized_type_specifier long)) ) IDENT) - (cast_expression ( (type_descriptor (sized_type_specifier long)) ) (pointer_expression * IDENT))) ))) < IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (goto_statement goto statement_identifier ;) })) (expression_statement (call_expression IDENT (argument_list ( (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (pointer_expression * IDENT)) , IDENT , IDENT ))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + (pointer_expression * IDENT)) )))) ;) (expression_statement (assignment_expression IDENT = (binary_expression (pointer_expression * IDENT) + LIT)) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = (cast_expression ( (type_descriptor TYPE) ) IDENT)) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT <= IDENT) )) || (parenthesized_expression ( (binary_expression IDENT <= IDENT) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = LIT) ;) (goto_statement goto statement_identifier ;) })) })) (if_statement if (parenthesized_expression ( (binary_expression IDENT < (pointer_expression * IDENT)) )) (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (pointer_expression * IDENT))) ;) (do_statement do (compound_statement { (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (binary_expression IDENT + LIT)) ;) (expression_statement (assignment_expression IDENT = (call_expression IDENT (argument_list ( IDENT , IDENT , (pointer_expression & IDENT) )))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + (pointer_expression * IDENT)) )))) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = (cast_expression ( (type_descriptor TYPE) ) IDENT)) ;) }) while (parenthesized_expression ( (binary_expression IDENT < (pointer_expression * IDENT)) )) ;) })) (expression_statement (assignment_expression IDENT = LIT) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = IDENT) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) }) while (parenthesized_expression ( BOOL )) ;)) (labeled_statement statement_identifier : (expression_statement (assignment_expression IDENT = LIT) ;)) (expression_statement (assignment_expression IDENT = IDENT) ;) (goto_statement goto statement_identifier ;) })))
(function_definition "int FUN_00365850(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)\n\n{\n  wchar_t __wc;\n  ulong uVar1;\n  undefined8 uVar2;\n  wchar_t *pwVar3;\n  int iVar4;\n  size_t sVar5;\n  char *pcVar6;\n  wchar_t *pwVar7;\n  mbstate_t local_50;\n  char local_48 [24];\n  \n  local_50 = *param_2;\n  uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));\n  *param_5 = param_3;\n  iVar4 = 0;\n  *param_8 = param_6;\njoined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );\nLAB_003659e0:\n  iVar4 = 0;\n  param_3 = pwVar7;\n  goto joined_r0x003658b5;\n}" (primitive_type "int") (function_declarator "FUN_00365850(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)" (identifier "FUN_00365850") (parameter_list "(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5\n                ,ulong param_6,char *param_7,ulong *param_8)" (( "(") (parameter_declaration "long param_1" (sized_type_specifier "long" (long "long")) (identifier "param_1")) (, ",") (parameter_declaration "mbstate_t *param_2" (type_identifier "mbstate_t") (pointer_declarator "*param_2" (* "*") (identifier "param_2"))) (, ",") (parameter_declaration "wchar_t *param_3" (type_identifier "wchar_t") (pointer_declarator "*param_3" (* "*") (identifier "param_3"))) (, ",") (parameter_declaration "wchar_t *param_4" (type_identifier "wchar_t") (pointer_declarator "*param_4" (* "*") (identifier "param_4"))) (, ",") (parameter_declaration "wchar_t **param_5" (type_identifier "wchar_t") (pointer_declarator "**param_5" (* "*") (pointer_declarator "*param_5" (* "*") (identifier "param_5")))) (, ",") (parameter_declaration "ulong param_6" (type_identifier "ulong") (identifier "param_6")) (, ",") (parameter_declaration "char *param_7" (primitive_type "char") (pointer_declarator "*param_7" (* "*") (identifier "param_7"))) (, ",") (parameter_declaration "ulong *param_8" (type_identifier "ulong") (pointer_declarator "*param_8" (* "*") (identifier "param_8"))) () ")"))) (compound_statement "{\n  wchar_t __wc;\n  ulong uVar1;\n  undefined8 uVar2;\n  wchar_t *pwVar3;\n  int iVar4;\n  size_t sVar5;\n  char *pcVar6;\n  wchar_t *pwVar7;\n  mbstate_t local_50;\n  char local_48 [24];\n  \n  local_50 = *param_2;\n  uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));\n  *param_5 = param_3;\n  iVar4 = 0;\n  *param_8 = param_6;\njoined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );\nLAB_003659e0:\n  iVar4 = 0;\n  param_3 = pwVar7;\n  goto joined_r0x003658b5;\n}" ({ "{") (declaration "wchar_t __wc;" (type_identifier "wchar_t") (identifier "__wc") (; ";")) (declaration "ulong uVar1;" (type_identifier "ulong") (identifier "uVar1") (; ";")) (declaration "undefined8 uVar2;" (type_identifier "undefined8") (identifier "uVar2") (; ";")) (declaration "wchar_t *pwVar3;" (type_identifier "wchar_t") (pointer_declarator "*pwVar3" (* "*") (identifier "pwVar3")) (; ";")) (declaration "int iVar4;" (primitive_type "int") (identifier "iVar4") (; ";")) (declaration "size_t sVar5;" (primitive_type "size_t") (identifier "sVar5") (; ";")) (declaration "char *pcVar6;" (primitive_type "char") (pointer_declarator "*pcVar6" (* "*") (identifier "pcVar6")) (; ";")) (declaration "wchar_t *pwVar7;" (type_identifier "wchar_t") (pointer_declarator "*pwVar7" (* "*") (identifier "pwVar7")) (; ";")) (declaration "mbstate_t local_50;" (type_identifier "mbstate_t") (identifier "local_50") (; ";")) (declaration "char local_48 [24];" (primitive_type "char") (array_declarator "local_48 [24]" (identifier "local_48") ([ "[") (number_literal "24") (] "]")) (; ";")) (expression_statement "local_50 = *param_2;" (assignment_expression "local_50 = *param_2" (identifier "local_50") (= "=") (pointer_expression "*param_2" (* "*") (identifier "param_2"))) (; ";")) (expression_statement "uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));" (assignment_expression "uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10))" (identifier "uVar2") (= "=") (call_expression "__uselocale(*(undefined8 *)(param_1 + 0x10))" (identifier "__uselocale") (argument_list "(*(undefined8 *)(param_1 + 0x10))" (( "(") (pointer_expression "*(undefined8 *)(param_1 + 0x10)" (* "*") (cast_expression "(undefined8 *)(param_1 + 0x10)" (( "(") (type_descriptor "undefined8 *" (type_identifier "undefined8") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_1 + 0x10)" (( "(") (binary_expression "param_1 + 0x10" (identifier "param_1") (+ "+") (number_literal "0x10")) () ")")))) () ")")))) (; ";")) (expression_statement "*param_5 = param_3;" (assignment_expression "*param_5 = param_3" (pointer_expression "*param_5" (* "*") (identifier "param_5")) (= "=") (identifier "param_3")) (; ";")) (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" (identifier "iVar4") (= "=") (number_literal "0")) (; ";")) (expression_statement "*param_8 = param_6;" (assignment_expression "*param_8 = param_6" (pointer_expression "*param_8" (* "*") (identifier "param_8")) (= "=") (identifier "param_6")) (; ";")) (labeled_statement "joined_r0x003658b5:\n  do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );" (statement_identifier "joined_r0x003658b5") (: ":") (do_statement "do {\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  } while( true );" (do "do") (compound_statement "{\n    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }\n    while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }\n    if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }\n    iVar4 = 2;\n    *param_2 = local_50;\n    param_3 = *param_5;\n  }" ({ "{") (if_statement "if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }" (if "if") (parenthesized_expression "(((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0))" (( "(") (binary_expression "((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)" (parenthesized_expression "((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6))" (( "(") (binary_expression "(param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)" (parenthesized_expression "(param_4 <= param_3)" (( "(") (binary_expression "param_4 <= param_3" (identifier "param_4") (<= "<=") (identifier "param_3")) () ")")) (|| "||") (parenthesized_expression "(pcVar6 = (char *)*param_8, param_7 <= pcVar6)" (( "(") (comma_expression "pcVar6 = (char *)*param_8, param_7 <= pcVar6" (assignment_expression "pcVar6 = (char *)*param_8" (identifier "pcVar6") (= "=") (cast_expression "(char *)*param_8" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (pointer_expression "*param_8" (* "*") (identifier "param_8")))) (, ",") (binary_expression "param_7 <= pcVar6" (identifier "param_7") (<= "<=") (identifier "pcVar6"))) () ")"))) () ")")) (|| "||") (parenthesized_expression "(iVar4 != 0)" (( "(") (binary_expression "iVar4 != 0" (identifier "iVar4") (!= "!=") (number_literal "0")) () ")"))) () ")")) (compound_statement "{\nLAB_00365958:\n      __uselocale(uVar2);\n      return iVar4;\n    }" ({ "{") (labeled_statement "LAB_00365958:\n      __uselocale(uVar2);" (statement_identifier "LAB_00365958") (: ":") (expression_statement "__uselocale(uVar2);" (call_expression "__uselocale(uVar2)" (identifier "__uselocale") (argument_list "(uVar2)" (( "(") (identifier "uVar2") () ")"))) (; ";"))) (return_statement "return iVar4;" (return "return") (identifier "iVar4") (; ";")) (} "}"))) (while_statement "while( true ) {\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }" (while "while") (parenthesized_expression "( true )" (( "(") (true "true") () ")")) (compound_statement "{\n      sVar5 = (long)param_4 - (long)param_3 >> 2;\n      pwVar3 = wmemchr(param_3,L'\0',sVar5);\n      pwVar7 = param_4;\n      if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }\n      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);\n      if (sVar5 == 0xffffffffffffffff) break;\n      param_3 = *param_5;\n      uVar1 = *param_8;\n      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }\n      *param_5 = pwVar7;\n      *param_8 = sVar5 + uVar1;\n      if (param_4 <= pwVar7) goto LAB_003659e0;\n      local_50 = *param_2;\n      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);\n      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }\n      memcpy((void *)*param_8,local_48,sVar5);\n      *param_2 = local_50;\n      pcVar6 = (char *)(sVar5 + *param_8);\n      param_3 = *param_5 + 1;\n      *param_8 = (ulong)pcVar6;\n      *param_5 = param_3;\n      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }\n    }" ({ "{") (expression_statement "sVar5 = (long)param_4 - (long)param_3 >> 2;" (assignment_expression "sVar5 = (long)param_4 - (long)param_3 >> 2" (identifier "sVar5") (= "=") (binary_expression "(long)param_4 - (long)param_3 >> 2" (binary_expression "(long)param_4 - (long)param_3" (cast_expression "(long)param_4" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "param_4")) (- "-") (cast_expression "(long)param_3" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "param_3"))) (>> ">>") (number_literal "2"))) (; ";")) (expression_statement "pwVar3 = wmemchr(param_3,L'\0',sVar5);" (assignment_expression "pwVar3 = wmemchr(param_3,L'\0',sVar5)" (identifier "pwVar3") (= "=") (call_expression "wmemchr(param_3,L'\0',sVar5)" (identifier "wmemchr") (argument_list "(param_3,L'\0',sVar5)" (( "(") (identifier "param_3") (, ",") (char_literal "L'\0'" (L' "L'") (escape_sequence "\0") (' "'")) (, ",") (identifier "sVar5") () ")")))) (; ";")) (expression_statement "pwVar7 = param_4;" (assignment_expression "pwVar7 = param_4" (identifier "pwVar7") (= "=") (identifier "param_4")) (; ";")) (if_statement "if (pwVar3 != (wchar_t *)0x0) {\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }" (if "if") (parenthesized_expression "(pwVar3 != (wchar_t *)0x0)" (( "(") (binary_expression "pwVar3 != (wchar_t *)0x0" (identifier "pwVar3") (!= "!=") (cast_expression "(wchar_t *)0x0" (( "(") (type_descriptor "wchar_t *" (type_identifier "wchar_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (compound_statement "{\n        sVar5 = (long)pwVar3 - (long)param_3 >> 2;\n        pwVar7 = pwVar3;\n      }" ({ "{") (expression_statement "sVar5 = (long)pwVar3 - (long)param_3 >> 2;" (assignment_expression "sVar5 = (long)pwVar3 - (long)param_3 >> 2" (identifier "sVar5") (= "=") (binary_expression "(long)pwVar3 - (long)param_3 >> 2" (binary_expression "(long)pwVar3 - (long)param_3" (cast_expression "(long)pwVar3" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "pwVar3")) (- "-") (cast_expression "(long)param_3" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "param_3"))) (>> ">>") (number_literal "2"))) (; ";")) (expression_statement "pwVar7 = pwVar3;" (assignment_expression "pwVar7 = pwVar3" (identifier "pwVar7") (= "=") (identifier "pwVar3")) (; ";")) (} "}"))) (expression_statement "sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);" (assignment_expression "sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2)" (identifier "sVar5") (= "=") (call_expression "wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2)" (identifier "wcsnrtombs") (argument_list "(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2)" (( "(") (identifier "pcVar6") (, ",") (identifier "param_5") (, ",") (identifier "sVar5") (, ",") (binary_expression "(long)param_7 - (long)pcVar6" (cast_expression "(long)param_7" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "param_7")) (- "-") (cast_expression "(long)pcVar6" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "pcVar6"))) (, ",") (identifier "param_2") () ")")))) (; ";")) (if_statement "if (sVar5 == 0xffffffffffffffff) break;" (if "if") (parenthesized_expression "(sVar5 == 0xffffffffffffffff)" (( "(") (binary_expression "sVar5 == 0xffffffffffffffff" (identifier "sVar5") (== "==") (number_literal "0xffffffffffffffff")) () ")")) (break_statement "break;" (break "break") (; ";"))) (expression_statement "param_3 = *param_5;" (assignment_expression "param_3 = *param_5" (identifier "param_3") (= "=") (pointer_expression "*param_5" (* "*") (identifier "param_5"))) (; ";")) (expression_statement "uVar1 = *param_8;" (assignment_expression "uVar1 = *param_8" (identifier "uVar1") (= "=") (pointer_expression "*param_8" (* "*") (identifier "param_8"))) (; ";")) (if_statement "if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }" (if "if") (parenthesized_expression "((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7))" (( "(") (binary_expression "(param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)" (parenthesized_expression "(param_3 != (wchar_t *)0x0)" (( "(") (binary_expression "param_3 != (wchar_t *)0x0" (identifier "param_3") (!= "!=") (cast_expression "(wchar_t *)0x0" (( "(") (type_descriptor "wchar_t *" (type_identifier "wchar_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (number_literal "0x0"))) () ")")) (&& "&&") (parenthesized_expression "(param_3 < pwVar7)" (( "(") (binary_expression "param_3 < pwVar7" (identifier "param_3") (< "<") (identifier "pwVar7")) () ")"))) () ")")) (compound_statement "{\n        *param_8 = sVar5 + uVar1;\n        iVar4 = 1;\n        goto joined_r0x003658b5;\n      }" ({ "{") (expression_statement "*param_8 = sVar5 + uVar1;" (assignment_expression "*param_8 = sVar5 + uVar1" (pointer_expression "*param_8" (* "*") (identifier "param_8")) (= "=") (binary_expression "sVar5 + uVar1" (identifier "sVar5") (+ "+") (identifier "uVar1"))) (; ";")) (expression_statement "iVar4 = 1;" (assignment_expression "iVar4 = 1" (identifier "iVar4") (= "=") (number_literal "1")) (; ";")) (goto_statement "goto joined_r0x003658b5;" (goto "goto") (statement_identifier "joined_r0x003658b5") (; ";")) (} "}"))) (expression_statement "*param_5 = pwVar7;" (assignment_expression "*param_5 = pwVar7" (pointer_expression "*param_5" (* "*") (identifier "param_5")) (= "=") (identifier "pwVar7")) (; ";")) (expression_statement "*param_8 = sVar5 + uVar1;" (assignment_expression "*param_8 = sVar5 + uVar1" (pointer_expression "*param_8" (* "*") (identifier "param_8")) (= "=") (binary_expression "sVar5 + uVar1" (identifier "sVar5") (+ "+") (identifier "uVar1"))) (; ";")) (if_statement "if (param_4 <= pwVar7) goto LAB_003659e0;" (if "if") (parenthesized_expression "(param_4 <= pwVar7)" (( "(") (binary_expression "param_4 <= pwVar7" (identifier "param_4") (<= "<=") (identifier "pwVar7")) () ")")) (goto_statement "goto LAB_003659e0;" (goto "goto") (statement_identifier "LAB_003659e0") (; ";"))) (expression_statement "local_50 = *param_2;" (assignment_expression "local_50 = *param_2" (identifier "local_50") (= "=") (pointer_expression "*param_2" (* "*") (identifier "param_2"))) (; ";")) (expression_statement "sVar5 = wcrtomb(local_48,*pwVar7,&local_50);" (assignment_expression "sVar5 = wcrtomb(local_48,*pwVar7,&local_50)" (identifier "sVar5") (= "=") (call_expression "wcrtomb(local_48,*pwVar7,&local_50)" (identifier "wcrtomb") (argument_list "(local_48,*pwVar7,&local_50)" (( "(") (identifier "local_48") (, ",") (pointer_expression "*pwVar7" (* "*") (identifier "pwVar7")) (, ",") (pointer_expression "&local_50" (& "&") (identifier "local_50")) () ")")))) (; ";")) (if_statement "if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {\n        iVar4 = 1;\n        goto LAB_00365958;\n      }" (if "if") (parenthesized_expression "((ulong)((long)param_7 - (long)*param_8) < sVar5)" (( "(") (binary_expression "(ulong)((long)param_7 - (long)*param_8) < sVar5" (call_expression "(ulong)((long)param_7 - (long)*param_8)" (parenthesized_expression "(ulong)" (( "(") (identifier "ulong") () ")")) (argument_list "((long)param_7 - (long)*param_8)" (( "(") (binary_expression "(long)param_7 - (long)*param_8" (cast_expression "(long)param_7" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (identifier "param_7")) (- "-") (cast_expression "(long)*param_8" (( "(") (type_descriptor "long" (sized_type_specifier "long" (long "long"))) () ")") (pointer_expression "*param_8" (* "*") (identifier "param_8")))) () ")"))) (< "<") (identifier "sVar5")) () ")")) (compound_statement "{\n        iVar4 = 1;\n        goto LAB_00365958;\n      }" ({ "{") (expression_statement "iVar4 = 1;" (assignment_expression "iVar4 = 1" (identifier "iVar4") (= "=") (number_literal "1")) (; ";")) (goto_statement "goto LAB_00365958;" (goto "goto") (statement_identifier "LAB_00365958") (; ";")) (} "}"))) (expression_statement "memcpy((void *)*param_8,local_48,sVar5);" (call_expression "memcpy((void *)*param_8,local_48,sVar5)" (identifier "memcpy") (argument_list "((void *)*param_8,local_48,sVar5)" (( "(") (cast_expression "(void *)*param_8" (( "(") (type_descriptor "void *" (primitive_type "void") (abstract_pointer_declarator "*" (* "*"))) () ")") (pointer_expression "*param_8" (* "*") (identifier "param_8"))) (, ",") (identifier "local_48") (, ",") (identifier "sVar5") () ")"))) (; ";")) (expression_statement "*param_2 = local_50;" (assignment_expression "*param_2 = local_50" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (identifier "local_50")) (; ";")) (expression_statement "pcVar6 = (char *)(sVar5 + *param_8);" (assignment_expression "pcVar6 = (char *)(sVar5 + *param_8)" (identifier "pcVar6") (= "=") (cast_expression "(char *)(sVar5 + *param_8)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(sVar5 + *param_8)" (( "(") (binary_expression "sVar5 + *param_8" (identifier "sVar5") (+ "+") (pointer_expression "*param_8" (* "*") (identifier "param_8"))) () ")")))) (; ";")) (expression_statement "param_3 = *param_5 + 1;" (assignment_expression "param_3 = *param_5 + 1" (identifier "param_3") (= "=") (binary_expression "*param_5 + 1" (pointer_expression "*param_5" (* "*") (identifier "param_5")) (+ "+") (number_literal "1"))) (; ";")) (expression_statement "*param_8 = (ulong)pcVar6;" (assignment_expression "*param_8 = (ulong)pcVar6" (pointer_expression "*param_8" (* "*") (identifier "param_8")) (= "=") (cast_expression "(ulong)pcVar6" (( "(") (type_descriptor "ulong" (type_identifier "ulong")) () ")") (identifier "pcVar6"))) (; ";")) (expression_statement "*param_5 = param_3;" (assignment_expression "*param_5 = param_3" (pointer_expression "*param_5" (* "*") (identifier "param_5")) (= "=") (identifier "param_3")) (; ";")) (if_statement "if ((param_4 <= param_3) || (param_7 <= pcVar6)) {\n        iVar4 = 0;\n        goto LAB_00365958;\n      }" (if "if") (parenthesized_expression "((param_4 <= param_3) || (param_7 <= pcVar6))" (( "(") (binary_expression "(param_4 <= param_3) || (param_7 <= pcVar6)" (parenthesized_expression "(param_4 <= param_3)" (( "(") (binary_expression "param_4 <= param_3" (identifier "param_4") (<= "<=") (identifier "param_3")) () ")")) (|| "||") (parenthesized_expression "(param_7 <= pcVar6)" (( "(") (binary_expression "param_7 <= pcVar6" (identifier "param_7") (<= "<=") (identifier "pcVar6")) () ")"))) () ")")) (compound_statement "{\n        iVar4 = 0;\n        goto LAB_00365958;\n      }" ({ "{") (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" (identifier "iVar4") (= "=") (number_literal "0")) (; ";")) (goto_statement "goto LAB_00365958;" (goto "goto") (statement_identifier "LAB_00365958") (; ";")) (} "}"))) (} "}"))) (if_statement "if (param_3 < *param_5) {\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }" (if "if") (parenthesized_expression "(param_3 < *param_5)" (( "(") (binary_expression "param_3 < *param_5" (identifier "param_3") (< "<") (pointer_expression "*param_5" (* "*") (identifier "param_5"))) () ")")) (compound_statement "{\n      pcVar6 = (char *)*param_8;\n      do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);\n    }" ({ "{") (expression_statement "pcVar6 = (char *)*param_8;" (assignment_expression "pcVar6 = (char *)*param_8" (identifier "pcVar6") (= "=") (cast_expression "(char *)*param_8" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (pointer_expression "*param_8" (* "*") (identifier "param_8")))) (; ";")) (do_statement "do {\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      } while (param_3 < *param_5);" (do "do") (compound_statement "{\n        __wc = *param_3;\n        param_3 = param_3 + 1;\n        sVar5 = wcrtomb(pcVar6,__wc,&local_50);\n        pcVar6 = (char *)(sVar5 + *param_8);\n        *param_8 = (ulong)pcVar6;\n      }" ({ "{") (expression_statement "__wc = *param_3;" (assignment_expression "__wc = *param_3" (identifier "__wc") (= "=") (pointer_expression "*param_3" (* "*") (identifier "param_3"))) (; ";")) (expression_statement "param_3 = param_3 + 1;" (assignment_expression "param_3 = param_3 + 1" (identifier "param_3") (= "=") (binary_expression "param_3 + 1" (identifier "param_3") (+ "+") (number_literal "1"))) (; ";")) (expression_statement "sVar5 = wcrtomb(pcVar6,__wc,&local_50);" (assignment_expression "sVar5 = wcrtomb(pcVar6,__wc,&local_50)" (identifier "sVar5") (= "=") (call_expression "wcrtomb(pcVar6,__wc,&local_50)" (identifier "wcrtomb") (argument_list "(pcVar6,__wc,&local_50)" (( "(") (identifier "pcVar6") (, ",") (identifier "__wc") (, ",") (pointer_expression "&local_50" (& "&") (identifier "local_50")) () ")")))) (; ";")) (expression_statement "pcVar6 = (char *)(sVar5 + *param_8);" (assignment_expression "pcVar6 = (char *)(sVar5 + *param_8)" (identifier "pcVar6") (= "=") (cast_expression "(char *)(sVar5 + *param_8)" (( "(") (type_descriptor "char *" (primitive_type "char") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(sVar5 + *param_8)" (( "(") (binary_expression "sVar5 + *param_8" (identifier "sVar5") (+ "+") (pointer_expression "*param_8" (* "*") (identifier "param_8"))) () ")")))) (; ";")) (expression_statement "*param_8 = (ulong)pcVar6;" (assignment_expression "*param_8 = (ulong)pcVar6" (pointer_expression "*param_8" (* "*") (identifier "param_8")) (= "=") (cast_expression "(ulong)pcVar6" (( "(") (type_descriptor "ulong" (type_identifier "ulong")) () ")") (identifier "pcVar6"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "(param_3 < *param_5)" (( "(") (binary_expression "param_3 < *param_5" (identifier "param_3") (< "<") (pointer_expression "*param_5" (* "*") (identifier "param_5"))) () ")")) (; ";")) (} "}"))) (expression_statement "iVar4 = 2;" (assignment_expression "iVar4 = 2" (identifier "iVar4") (= "=") (number_literal "2")) (; ";")) (expression_statement "*param_2 = local_50;" (assignment_expression "*param_2 = local_50" (pointer_expression "*param_2" (* "*") (identifier "param_2")) (= "=") (identifier "local_50")) (; ";")) (expression_statement "param_3 = *param_5;" (assignment_expression "param_3 = *param_5" (identifier "param_3") (= "=") (pointer_expression "*param_5" (* "*") (identifier "param_5"))) (; ";")) (} "}")) (while "while") (parenthesized_expression "( true )" (( "(") (true "true") () ")")) (; ";"))) (labeled_statement "LAB_003659e0:\n  iVar4 = 0;" (statement_identifier "LAB_003659e0") (: ":") (expression_statement "iVar4 = 0;" (assignment_expression "iVar4 = 0" (identifier "iVar4") (= "=") (number_literal "0")) (; ";"))) (expression_statement "param_3 = pwVar7;" (assignment_expression "param_3 = pwVar7" (identifier "param_3") (= "=") (identifier "pwVar7")) (; ";")) (goto_statement "goto joined_r0x003658b5;" (goto "goto") (statement_identifier "joined_r0x003658b5") (; ";")) (} "}")))

/* std::codecvt<wchar_t, char, __mbstate_t>::do_out(__mbstate_t&, wchar_t const*, wchar_t const*,
   wchar_t const*&, char*, char*, char*&) const */

int __thiscall
std::codecvt<type_2,char,type_3>::do_out
          (codecvt<type_2,char,type_3> *var_2,type_3 *param_1,type_2 *var_4,
          type_2 *var_3,type_2 **param_4,char *param_5,char *var_5,char **param_7)

{
  type_2 __wc;
  type_1 uVar1;
  type_2 *var_9;
  int var_7;
  size_t var_11;
  char *var_6;
  type_2 *var_12;
  type_3 local_50;
  char local_48 [24];
  
  local_50 = *param_1;
  uVar1 = var_1(*(type_1 *)(var_2 + 0x10));
  *param_4 = var_4;
  var_7 = 0;
  *param_7 = param_5;
joined_r0x003658b5:
  do {
    if (((var_3 <= var_4) || (var_6 = *param_7, var_5 <= var_6)) || (var_7 != 0)) {
LAB_00365958:
      var_1(uVar1);
      return var_7;
    }
    while( true ) {
      var_11 = (long)var_3 - (long)var_4 >> 2;
      var_9 = var_8(var_4,L'\0',var_11);
      var_12 = var_3;
      if (var_9 != (type_2 *)0x0) {
        var_11 = (long)var_9 - (long)var_4 >> 2;
        var_12 = var_9;
      }
      var_11 = var_10(var_6,param_4,var_11,(long)var_5 - (long)var_6,param_1);
      if (var_11 == 0xffffffffffffffff) break;
      var_4 = *param_4;
      var_6 = *param_7;
      if ((var_4 != (type_2 *)0x0) && (var_4 < var_12)) {
        *param_7 = var_6 + var_11;
        var_7 = 1;
        goto joined_r0x003658b5;
      }
      *param_4 = var_12;
      *param_7 = var_6 + var_11;
      if (var_3 <= var_12) goto LAB_003659e0;
      local_50 = *param_1;
      var_11 = var_13(local_48,*var_12,&local_50);
      if ((ulong)((long)var_5 - (long)*param_7) < var_11) {
        var_7 = 1;
        goto LAB_00365958;
      }
      var_14(*param_7,local_48,var_11);
      *param_1 = local_50;
      var_6 = *param_7 + var_11;
      var_4 = *param_4 + 1;
      *param_7 = var_6;
      *param_4 = var_4;
      if ((var_3 <= var_4) || (var_5 <= var_6)) {
        var_7 = 0;
        goto LAB_00365958;
      }
    }
    if (var_4 < *param_4) {
      var_6 = *param_7;
      do {
        __wc = *var_4;
        var_4 = var_4 + 1;
        var_11 = var_13(var_6,__wc,&local_50);
        var_6 = *param_7 + var_11;
        *param_7 = var_6;
      } while (var_4 < *param_4);
    }
    var_7 = 2;
    *param_1 = local_50;
    var_4 = *param_4;
  } while( true );
LAB_003659e0:
  var_7 = 0;
  var_4 = var_12;
  goto joined_r0x003658b5;
}


(translation_unit (function_definition type: (primitive_type) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list (parameter_declaration type: (sized_type_specifier) declarator: (identifier)) (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (pointer_declarator declarator: (identifier)))) (parameter_declaration type: (type_identifier) declarator: (identifier)) (parameter_declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (parameter_declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))))) body: (compound_statement (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (identifier)) (declaration type: (primitive_type) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (type_identifier) declarator: (pointer_declarator declarator: (identifier))) (declaration type: (type_identifier) declarator: (identifier)) (declaration type: (primitive_type) declarator: (array_declarator declarator: (identifier) size: (number_literal))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (pointer_expression argument: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))))))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (labeled_statement label: (statement_identifier) (do_statement body: (compound_statement (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (comma_expression left: (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (pointer_expression argument: (identifier)))) right: (binary_expression left: (identifier) right: (identifier)))))) right: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))))) consequence: (compound_statement (labeled_statement label: (statement_identifier) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier))))) (return_statement (identifier)))) (while_statement condition: (parenthesized_expression (true)) body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier)) right: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier))) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (char_literal (escape_sequence)) (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (number_literal)))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (binary_expression left: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier)) right: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier))) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (binary_expression left: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier)) right: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier))) (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (number_literal))) consequence: (break_statement)) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (type_identifier) declarator: (abstract_pointer_declarator)) value: (number_literal)))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))) consequence: (compound_statement (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (goto_statement label: (statement_identifier)))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (goto_statement label: (statement_identifier))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (pointer_expression argument: (identifier)) (pointer_expression argument: (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (call_expression function: (parenthesized_expression (identifier)) arguments: (argument_list (binary_expression left: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (identifier)) right: (cast_expression type: (type_descriptor type: (sized_type_specifier)) value: (pointer_expression argument: (identifier)))))) right: (identifier))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (goto_statement label: (statement_identifier)))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (pointer_expression argument: (identifier))) (identifier) (identifier)))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (pointer_expression argument: (identifier))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (pointer_expression argument: (identifier)) right: (number_literal)))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier)))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (goto_statement label: (statement_identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (pointer_expression argument: (identifier)))) consequence: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (pointer_expression argument: (identifier))))) (do_statement body: (compound_statement (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (pointer_expression argument: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (cast_expression type: (type_descriptor type: (primitive_type) declarator: (abstract_pointer_declarator)) value: (parenthesized_expression (binary_expression left: (identifier) right: (pointer_expression argument: (identifier))))))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (cast_expression type: (type_descriptor type: (type_identifier)) value: (identifier))))) condition: (parenthesized_expression (binary_expression left: (identifier) right: (pointer_expression argument: (identifier))))))) (expression_statement (assignment_expression left: (identifier) right: (number_literal))) (expression_statement (assignment_expression left: (pointer_expression argument: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (identifier) right: (pointer_expression argument: (identifier))))) condition: (parenthesized_expression (true)))) (labeled_statement label: (statement_identifier) (expression_statement (assignment_expression left: (identifier) right: (number_literal)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (goto_statement label: (statement_identifier)))))

int MASKED(long param_1,mbstate_t *param_2,wchar_t *param_3,wchar_t *param_4,wchar_t **param_5
                ,ulong param_6,char *param_7,ulong *param_8)

{
  wchar_t __wc;
  ulong uVar1;
  undefined8 uVar2;
  wchar_t *pwVar3;
  int iVar4;
  size_t sVar5;
  char *pcVar6;
  wchar_t *pwVar7;
  mbstate_t local_50;
  char local_48 [24];
  
  local_50 = *param_2;
  uVar2 = __uselocale(*(undefined8 *)(param_1 + 0x10));
  *param_5 = param_3;
  iVar4 = 0;
  *param_8 = param_6;
joined_r0x003658b5:
  do {
    if (((param_4 <= param_3) || (pcVar6 = (char *)*param_8, param_7 <= pcVar6)) || (iVar4 != 0)) {
LAB_00365958:
      __uselocale(uVar2);
      return iVar4;
    }
    while( true ) {
      sVar5 = (long)param_4 - (long)param_3 >> 2;
      pwVar3 = wmemchr(param_3,L'\0',sVar5);
      pwVar7 = param_4;
      if (pwVar3 != (wchar_t *)0x0) {
        sVar5 = (long)pwVar3 - (long)param_3 >> 2;
        pwVar7 = pwVar3;
      }
      sVar5 = wcsnrtombs(pcVar6,param_5,sVar5,(long)param_7 - (long)pcVar6,param_2);
      if (sVar5 == 0xffffffffffffffff) break;
      param_3 = *param_5;
      uVar1 = *param_8;
      if ((param_3 != (wchar_t *)0x0) && (param_3 < pwVar7)) {
        *param_8 = sVar5 + uVar1;
        iVar4 = 1;
        goto joined_r0x003658b5;
      }
      *param_5 = pwVar7;
      *param_8 = sVar5 + uVar1;
      if (param_4 <= pwVar7) goto LAB_003659e0;
      local_50 = *param_2;
      sVar5 = wcrtomb(local_48,*pwVar7,&local_50);
      if ((ulong)((long)param_7 - (long)*param_8) < sVar5) {
        iVar4 = 1;
        goto LAB_00365958;
      }
      memcpy((void *)*param_8,local_48,sVar5);
      *param_2 = local_50;
      pcVar6 = (char *)(sVar5 + *param_8);
      param_3 = *param_5 + 1;
      *param_8 = (ulong)pcVar6;
      *param_5 = param_3;
      if ((param_4 <= param_3) || (param_7 <= pcVar6)) {
        iVar4 = 0;
        goto LAB_00365958;
      }
    }
    if (param_3 < *param_5) {
      pcVar6 = (char *)*param_8;
      do {
        __wc = *param_3;
        param_3 = param_3 + 1;
        sVar5 = wcrtomb(pcVar6,__wc,&local_50);
        pcVar6 = (char *)(sVar5 + *param_8);
        *param_8 = (ulong)pcVar6;
      } while (param_3 < *param_5);
    }
    iVar4 = 2;
    *param_2 = local_50;
    param_3 = *param_5;
  } while( true );
LAB_003659e0:
  iVar4 = 0;
  param_3 = pwVar7;
  goto joined_r0x003658b5;
}

