
/* std::wstring::replace(unsigned int, unsigned int, wchar_t const*, unsigned int) */

wstring * __thiscall
std::wstring::replace(wstring *this,uint param_1,uint param_2,wchar_t *param_3,uint param_4)

{
  wchar_t *pwVar1;
  int iVar2;
  wchar_t *__s1;
  wstring *pwVar3;
  wchar_t wVar4;
  int unaff_EDI;
  int local_34;
  allocator local_21;
  wchar_t *local_20 [4];
  
  __x86_get_pc_thunk_di();
  pwVar1 = *(wchar_t **)this;
  wVar4 = pwVar1[-3];
  if ((uint)wVar4 < param_1) {
                    /* WARNING: Subroutine does not return */
    __throw_out_of_range_fmt
              ((char *)((int)&__DT_REL[0x25fb].r_offset + unaff_EDI + 3),unaff_EDI + 0x3b409,param_1
               ,wVar4);
  }
  if ((uint)(wVar4 - param_1) <= param_2) {
    param_2 = wVar4 - param_1;
  }
  if ((uint)((param_2 - wVar4) + 0xffffffeU) < param_4) {
                    /* WARNING: Subroutine does not return */
    __throw_length_error((char *)(unaff_EDI + 0x3b409));
  }
  if (((param_3 < pwVar1) || (pwVar1 + wVar4 < param_3)) || (L'\0' < pwVar1[-1])) {
    this = (wstring *)_M_replace_safe(this,param_1,param_2,param_3,param_4);
  }
  else {
    iVar2 = *(int *)this;
    if ((wchar_t *)(iVar2 + param_1 * 4) < param_3 + param_4) {
      if (param_3 < (wchar_t *)(iVar2 + (param_1 + param_2) * 4)) {
        wstring((wstring *)local_20,param_3,param_4,&local_21);
                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */
        pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4);
        if ((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)) {
          return pwVar3;
        }
        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {
          wVar4 = local_20[0][-1];
          local_20[0][-1] = wVar4 + L'\xffffffff';
        }
        else {
          LOCK();
          pwVar1 = local_20[0] + -1;
          wVar4 = *pwVar1;
          *pwVar1 = *pwVar1 + L'\xffffffff';
          UNLOCK();
        }
        if (L'\0' < wVar4) {
          return pwVar3;
        }
        _Rep::_M_destroy((allocator *)(local_20[0] + -3));
        return pwVar3;
      }
      local_34 = (((int)param_3 - iVar2 >> 2) + param_4) - param_2;
    }
    else {
      local_34 = (int)param_3 - iVar2 >> 2;
    }
    _M_mutate(this,param_1,param_2,param_4);
    pwVar1 = (wchar_t *)(*(int *)this + local_34 * 4);
    __s1 = (wchar_t *)(*(int *)this + param_1 * 4);
    if (param_4 == 1) {
      *__s1 = *pwVar1;
    }
    else if (param_4 != 0) {
      wmemcpy(__s1,pwVar1,param_4);
    }
  }
  return this;
}



uint * FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)

{
  int *piVar1;
  wchar_t *__s2;
  uint uVar2;
  uint uVar3;
  wchar_t *__s1;
  uint *puVar4;
  int iVar5;
  int unaff_EDI;
  int local_34;
  undefined1 local_21;
  int local_20 [4];
  
  FUN_00058c4a();
  uVar2 = *param_1;
  uVar3 = *(uint *)(uVar2 - 0xc);
  if (uVar3 < param_2) {
                    /* WARNING: Subroutine does not return */
    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);
  }
  if (uVar3 - param_2 <= param_3) {
    param_3 = uVar3 - param_2;
  }
  if ((param_3 - uVar3) + 0xffffffe < param_5) {
                    /* WARNING: Subroutine does not return */
    FUN_001f1e60(unaff_EDI + 0x3b409);
  }
  if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {
    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);
  }
  else {
    uVar2 = *param_1;
    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {
      if (param_4 < uVar2 + (param_2 + param_3) * 4) {
        FUN_00231240(local_20,param_4,param_5,&local_21);
                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */
        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);
        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {
          return puVar4;
        }
        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {
          iVar5 = *(int *)(local_20[0] + -4);
          *(int *)(local_20[0] + -4) = iVar5 + -1;
        }
        else {
          LOCK();
          piVar1 = (int *)(local_20[0] + -4);
          iVar5 = *piVar1;
          *piVar1 = *piVar1 + -1;
          UNLOCK();
        }
        if (0 < iVar5) {
          return puVar4;
        }
        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);
        return puVar4;
      }
      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;
    }
    else {
      local_34 = (int)(param_4 - uVar2) >> 2;
    }
    FUN_0022f5a0(param_1,param_2,param_3,param_5);
    __s2 = (wchar_t *)(*param_1 + local_34 * 4);
    __s1 = (wchar_t *)(*param_1 + param_2 * 4);
    if (param_5 == 1) {
      *__s1 = *__s2;
    }
    else if (param_5 != 0) {
      wmemcpy(__s1,__s2,param_5);
    }
  }
  return param_1;
}


PUSH EBP
MOV EBP,ESP
PUSH EDI
CALL 0x00058c4a
ADD EDI,0x10dd77
PUSH ESI
PUSH EBX
SUB ESP,0x2c
MOV EAX,dword ptr [EBP + 0x8]
MOV EDX,dword ptr [EBP + 0xc]
MOV ESI,dword ptr [EBP + 0x10]
MOV ECX,dword ptr [EBP + 0x14]
MOV EAX,dword ptr [EAX]
MOV dword ptr [EBP + -0x2c],EAX
MOV EAX,dword ptr [EAX + -0xc]
CMP EDX,EAX
JA 0x00231448
MOV EBX,EAX
SUB EBX,EDX
CMP EBX,ESI
CMOVBE ESI,EBX
MOV EBX,ESI
SUB EBX,EAX
ADD EBX,0xffffffe
CMP dword ptr [EBP + 0x18],EBX
JA 0x00231437
MOV EBX,dword ptr [EBP + -0x2c]
CMP EBX,ECX
JBE 0x002312f8
SUB ESP,0xc
PUSH dword ptr [EBP + 0x18]
MOV EBX,EDI
PUSH ECX
PUSH ESI
PUSH EDX
PUSH dword ptr [EBP + 0x8]
CALL 0x0022fe00
ADD ESP,0x20
MOV ESI,EAX
LEA ESP,[EBP + -0xc]
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
POP EBP
RET
LEA EAX,[EBX + EAX*0x4]
CMP ECX,EAX
JA 0x002312d3
MOV EAX,dword ptr [EBX + -0x4]
TEST EAX,EAX
JG 0x002312d3
MOV EAX,dword ptr [EBP + 0x8]
LEA EBX,[EDX*0x4 + 0x0]
MOV dword ptr [EBP + -0x2c],EBX
MOV EBX,dword ptr [EBP + 0x18]
MOV EAX,dword ptr [EAX]
LEA EBX,[ECX + EBX*0x4]
MOV dword ptr [EBP + -0x30],EAX
ADD EAX,dword ptr [EBP + -0x2c]
CMP EBX,EAX
JBE 0x00231410
MOV EBX,dword ptr [EBP + -0x30]
LEA EAX,[EDX + ESI*0x1]
LEA EAX,[EBX + EAX*0x4]
CMP ECX,EAX
JC 0x00231398
SUB ECX,dword ptr [EBP + -0x30]
SAR ECX,0x2
ADD ECX,dword ptr [EBP + 0x18]
SUB ECX,ESI
MOV dword ptr [EBP + -0x30],ECX
PUSH dword ptr [EBP + 0x18]
MOV EBX,EDI
PUSH ESI
PUSH EDX
PUSH dword ptr [EBP + 0x8]
CALL 0x0022f5a0
MOV EAX,dword ptr [EBP + 0x8]
MOV ECX,dword ptr [EBP + -0x30]
ADD ESP,0x10
MOV EAX,dword ptr [EAX]
LEA EDX,[EAX + ECX*0x4]
ADD EAX,dword ptr [EBP + -0x2c]
CMP dword ptr [EBP + 0x18],0x1
JZ 0x00231420
MOV EBX,dword ptr [EBP + 0x18]
MOV ESI,dword ptr [EBP + 0x8]
TEST EBX,EBX
JZ 0x002312eb
SUB ESP,0x4
PUSH dword ptr [EBP + 0x18]
MOV EBX,EDI
PUSH EDX
PUSH EAX
CALL 0x00028380
ADD ESP,0x10
JMP 0x002312eb
LEA EAX,[EBP + -0x1d]
MOV EBX,EDI
MOV dword ptr [EBP + 0xc],EDX
PUSH EAX
MOV dword ptr [EBP + -0x2c],EAX
LEA EAX,[EBP + -0x1c]
PUSH dword ptr [EBP + 0x18]
PUSH ECX
PUSH EAX
CALL 0x00231240
MOV EDX,dword ptr [EBP + 0xc]
POP EAX
PUSH dword ptr [EBP + 0x18]
PUSH dword ptr [EBP + -0x1c]
PUSH ESI
PUSH EDX
PUSH dword ptr [EBP + 0x8]
CALL 0x0022fe00
MOV ESI,EAX
MOV EAX,dword ptr [EBP + -0x1c]
ADD ESP,0x20
LEA EDX,[EAX + -0xc]
CMP EDX,dword ptr [EDI + 0xfffffd74]
JZ 0x002312eb
MOV ECX,dword ptr [EDI + 0xffffff3c]
TEST ECX,ECX
JZ 0x0023142c
MOV ECX,0xffffffff
XADD.LOCK dword ptr [EAX + -0x4],ECX
TEST ECX,ECX
JG 0x002312eb
PUSH EAX
MOV EBX,EDI
PUSH EAX
PUSH dword ptr [EBP + -0x2c]
PUSH EDX
CALL 0x0022f3c0
ADD ESP,0x10
JMP 0x002312eb
SUB ECX,dword ptr [EBP + -0x30]
SAR ECX,0x2
MOV dword ptr [EBP + -0x30],ECX
JMP 0x00231344
MOV EDX,dword ptr [EDX]
MOV ESI,dword ptr [EBP + 0x8]
MOV dword ptr [EAX],EDX
JMP 0x002312eb
MOV ECX,dword ptr [EAX + -0x4]
LEA EBX,[ECX + -0x1]
MOV dword ptr [EAX + -0x4],EBX
JMP 0x002313f0
SUB ESP,0xc
LEA EAX,[EDI + 0xfff2d692]
MOV EBX,EDI
PUSH EAX
CALL 0x001f1e60
PUSH EAX
LEA EAX,[EDI + 0xfff2d692]
MOV EBX,EDI
PUSH EDX
PUSH EAX
LEA EAX,[EDI + 0xfff16ab4]
PUSH EAX
CALL 0x001f1f00
(translation_unit "uint * FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)\n\n{\n  int *piVar1;\n  wchar_t *__s2;\n  uint uVar2;\n  uint uVar3;\n  wchar_t *__s1;\n  uint *puVar4;\n  int iVar5;\n  int unaff_EDI;\n  int local_34;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00058c4a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    /* WARNING: Subroutine does not return */\n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    /* WARNING: Subroutine does not return */\n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }\n  if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }\n  return param_1;\n}\n\n" (function_definition "uint * FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)\n\n{\n  int *piVar1;\n  wchar_t *__s2;\n  uint uVar2;\n  uint uVar3;\n  wchar_t *__s1;\n  uint *puVar4;\n  int iVar5;\n  int unaff_EDI;\n  int local_34;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00058c4a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    /* WARNING: Subroutine does not return */\n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    /* WARNING: Subroutine does not return */\n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }\n  if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }\n  return param_1;\n}" type_identifier (pointer_declarator "* FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" * (function_declarator "FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" identifier (parameter_list "(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" ( (parameter_declaration "uint *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "uint param_2" type_identifier identifier) , (parameter_declaration "uint param_3" type_identifier identifier) , (parameter_declaration "uint param_4" type_identifier identifier) , (parameter_declaration "uint param_5" type_identifier identifier) )))) (compound_statement "{\n  int *piVar1;\n  wchar_t *__s2;\n  uint uVar2;\n  uint uVar3;\n  wchar_t *__s1;\n  uint *puVar4;\n  int iVar5;\n  int unaff_EDI;\n  int local_34;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00058c4a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    /* WARNING: Subroutine does not return */\n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    /* WARNING: Subroutine does not return */\n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }\n  if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }\n  return param_1;\n}" { (declaration "int *piVar1;" primitive_type (pointer_declarator "*piVar1" * identifier) ;) (declaration "wchar_t *__s2;" type_identifier (pointer_declarator "*__s2" * identifier) ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (declaration "wchar_t *__s1;" type_identifier (pointer_declarator "*__s1" * identifier) ;) (declaration "uint *puVar4;" type_identifier (pointer_declarator "*puVar4" * identifier) ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "int unaff_EDI;" primitive_type identifier ;) (declaration "int local_34;" primitive_type identifier ;) (declaration "undefined1 local_21;" type_identifier identifier ;) (declaration "int local_20 [4];" primitive_type (array_declarator "local_20 [4]" identifier [ number_literal ]) ;) (expression_statement "FUN_00058c4a();" (call_expression "FUN_00058c4a()" identifier (argument_list "()" ( ))) ;) (expression_statement "uVar2 = *param_1;" (assignment_expression "uVar2 = *param_1" identifier = (pointer_expression "*param_1" * identifier)) ;) (expression_statement "uVar3 = *(uint *)(uVar2 - 0xc);" (assignment_expression "uVar3 = *(uint *)(uVar2 - 0xc)" identifier = (pointer_expression "*(uint *)(uVar2 - 0xc)" * (cast_expression "(uint *)(uVar2 - 0xc)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(uVar2 - 0xc)" ( (binary_expression "uVar2 - 0xc" identifier - number_literal) ))))) ;) (if_statement "if (uVar3 < param_2) {\n                    /* WARNING: Subroutine does not return */\n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }" if (parenthesized_expression "(uVar3 < param_2)" ( (binary_expression "uVar3 < param_2" identifier < identifier) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }" { comment (expression_statement "FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);" (call_expression "FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3)" identifier (argument_list "(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3)" ( (binary_expression "unaff_EDI + 0x2482b" identifier + number_literal) , (binary_expression "unaff_EDI + 0x3b409" identifier + number_literal) , identifier , identifier ))) ;) })) (if_statement "if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }" if (parenthesized_expression "(uVar3 - param_2 <= param_3)" ( (binary_expression "uVar3 - param_2 <= param_3" (binary_expression "uVar3 - param_2" identifier - identifier) <= identifier) )) (compound_statement "{\n    param_3 = uVar3 - param_2;\n  }" { (expression_statement "param_3 = uVar3 - param_2;" (assignment_expression "param_3 = uVar3 - param_2" identifier = (binary_expression "uVar3 - param_2" identifier - identifier)) ;) })) (if_statement "if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    /* WARNING: Subroutine does not return */\n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }" if (parenthesized_expression "((param_3 - uVar3) + 0xffffffe < param_5)" ( (binary_expression "(param_3 - uVar3) + 0xffffffe < param_5" (binary_expression "(param_3 - uVar3) + 0xffffffe" (parenthesized_expression "(param_3 - uVar3)" ( (binary_expression "param_3 - uVar3" identifier - identifier) )) + number_literal) < identifier) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }" { comment (expression_statement "FUN_001f1e60(unaff_EDI + 0x3b409);" (call_expression "FUN_001f1e60(unaff_EDI + 0x3b409)" identifier (argument_list "(unaff_EDI + 0x3b409)" ( (binary_expression "unaff_EDI + 0x3b409" identifier + number_literal) ))) ;) })) (if_statement "if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }" if (parenthesized_expression "(((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4)))" ( (binary_expression "((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))" (parenthesized_expression "((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4))" ( (binary_expression "(param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)" (parenthesized_expression "(param_4 < uVar2)" ( (binary_expression "param_4 < uVar2" identifier < identifier) )) || (parenthesized_expression "(uVar2 + uVar3 * 4 < param_4)" ( (binary_expression "uVar2 + uVar3 * 4 < param_4" (binary_expression "uVar2 + uVar3 * 4" identifier + (binary_expression "uVar3 * 4" identifier * number_literal)) < identifier) ))) )) || (parenthesized_expression "(0 < *(int *)(uVar2 - 4))" ( (binary_expression "0 < *(int *)(uVar2 - 4)" number_literal < (pointer_expression "*(int *)(uVar2 - 4)" * (cast_expression "(int *)(uVar2 - 4)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(uVar2 - 4)" ( (binary_expression "uVar2 - 4" identifier - number_literal) ))))) ))) )) (compound_statement "{\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }" { (expression_statement "param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);" (assignment_expression "param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5)" identifier = (cast_expression "(uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_0022fe00(param_1,param_2,param_3,param_4,param_5)" identifier (argument_list "(param_1,param_2,param_3,param_4,param_5)" ( identifier , identifier , identifier , identifier , identifier ))))) ;) }) (else_clause "else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }" else (compound_statement "{\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }" { (expression_statement "uVar2 = *param_1;" (assignment_expression "uVar2 = *param_1" identifier = (pointer_expression "*param_1" * identifier)) ;) (if_statement "if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }" if (parenthesized_expression "(uVar2 + param_2 * 4 < param_4 + param_5 * 4)" ( (binary_expression "uVar2 + param_2 * 4 < param_4 + param_5 * 4" (binary_expression "uVar2 + param_2 * 4" identifier + (binary_expression "param_2 * 4" identifier * number_literal)) < (binary_expression "param_4 + param_5 * 4" identifier + (binary_expression "param_5 * 4" identifier * number_literal))) )) (compound_statement "{\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }" { (if_statement "if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" if (parenthesized_expression "(param_4 < uVar2 + (param_2 + param_3) * 4)" ( (binary_expression "param_4 < uVar2 + (param_2 + param_3) * 4" identifier < (binary_expression "uVar2 + (param_2 + param_3) * 4" identifier + (binary_expression "(param_2 + param_3) * 4" (parenthesized_expression "(param_2 + param_3)" ( (binary_expression "param_2 + param_3" identifier + identifier) )) * number_literal))) )) (compound_statement "{\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" { (expression_statement "FUN_00231240(local_20,param_4,param_5,&local_21);" (call_expression "FUN_00231240(local_20,param_4,param_5,&local_21)" identifier (argument_list "(local_20,param_4,param_5,&local_21)" ( identifier , identifier , identifier , (pointer_expression "&local_21" & identifier) ))) ;) comment (expression_statement "puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);" (assignment_expression "puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5)" identifier = (cast_expression "(uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5)" identifier (argument_list "(param_1,param_2,param_3,local_20[0],param_5)" ( identifier , identifier , identifier , (subscript_expression "local_20[0]" identifier [ number_literal ]) , identifier ))))) ;) (if_statement "if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }" if (parenthesized_expression "(local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb))" ( (binary_expression "local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)" (binary_expression "local_20[0] + -0xc" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) == (pointer_expression "*(int *)(unaff_EDI + 0x10daeb)" * (cast_expression "(int *)(unaff_EDI + 0x10daeb)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x10daeb)" ( (binary_expression "unaff_EDI + 0x10daeb" identifier + number_literal) ))))) )) (compound_statement "{\n          return puVar4;\n        }" { (return_statement "return puVar4;" return identifier ;) })) (if_statement "if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" if (parenthesized_expression "(*(int *)(unaff_EDI + 0x10dcb3) == 0)" ( (binary_expression "*(int *)(unaff_EDI + 0x10dcb3) == 0" (pointer_expression "*(int *)(unaff_EDI + 0x10dcb3)" * (cast_expression "(int *)(unaff_EDI + 0x10dcb3)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x10dcb3)" ( (binary_expression "unaff_EDI + 0x10dcb3" identifier + number_literal) )))) == number_literal) )) (compound_statement "{\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }" { (expression_statement "iVar5 = *(int *)(local_20[0] + -4);" (assignment_expression "iVar5 = *(int *)(local_20[0] + -4)" identifier = (pointer_expression "*(int *)(local_20[0] + -4)" * (cast_expression "(int *)(local_20[0] + -4)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_20[0] + -4)" ( (binary_expression "local_20[0] + -4" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) ))))) ;) (expression_statement "*(int *)(local_20[0] + -4) = iVar5 + -1;" (assignment_expression "*(int *)(local_20[0] + -4) = iVar5 + -1" (pointer_expression "*(int *)(local_20[0] + -4)" * (cast_expression "(int *)(local_20[0] + -4)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_20[0] + -4)" ( (binary_expression "local_20[0] + -4" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) )))) = (binary_expression "iVar5 + -1" identifier + number_literal)) ;) }) (else_clause "else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" else (compound_statement "{\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" { (expression_statement "LOCK();" (call_expression "LOCK()" identifier (argument_list "()" ( ))) ;) (expression_statement "piVar1 = (int *)(local_20[0] + -4);" (assignment_expression "piVar1 = (int *)(local_20[0] + -4)" identifier = (cast_expression "(int *)(local_20[0] + -4)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_20[0] + -4)" ( (binary_expression "local_20[0] + -4" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) )))) ;) (expression_statement "iVar5 = *piVar1;" (assignment_expression "iVar5 = *piVar1" identifier = (pointer_expression "*piVar1" * identifier)) ;) (expression_statement "*piVar1 = *piVar1 + -1;" (assignment_expression "*piVar1 = *piVar1 + -1" (pointer_expression "*piVar1" * identifier) = (binary_expression "*piVar1 + -1" (pointer_expression "*piVar1" * identifier) + number_literal)) ;) (expression_statement "UNLOCK();" (call_expression "UNLOCK()" identifier (argument_list "()" ( ))) ;) }))) (if_statement "if (0 < iVar5) {\n          return puVar4;\n        }" if (parenthesized_expression "(0 < iVar5)" ( (binary_expression "0 < iVar5" number_literal < identifier) )) (compound_statement "{\n          return puVar4;\n        }" { (return_statement "return puVar4;" return identifier ;) })) (expression_statement "FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);" (call_expression "FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0])" identifier (argument_list "(local_20[0] + -0xc,&local_21,local_20[0],local_20[0])" ( (binary_expression "local_20[0] + -0xc" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) , (pointer_expression "&local_21" & identifier) , (subscript_expression "local_20[0]" identifier [ number_literal ]) , (subscript_expression "local_20[0]" identifier [ number_literal ]) ))) ;) (return_statement "return puVar4;" return identifier ;) })) (expression_statement "local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;" (assignment_expression "local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3" identifier = (binary_expression "(((int)(param_4 - uVar2) >> 2) + param_5) - param_3" (parenthesized_expression "(((int)(param_4 - uVar2) >> 2) + param_5)" ( (binary_expression "((int)(param_4 - uVar2) >> 2) + param_5" (parenthesized_expression "((int)(param_4 - uVar2) >> 2)" ( (binary_expression "(int)(param_4 - uVar2) >> 2" (cast_expression "(int)(param_4 - uVar2)" ( (type_descriptor "int" primitive_type) ) (parenthesized_expression "(param_4 - uVar2)" ( (binary_expression "param_4 - uVar2" identifier - identifier) ))) >> number_literal) )) + identifier) )) - identifier)) ;) }) (else_clause "else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }" else (compound_statement "{\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }" { (expression_statement "local_34 = (int)(param_4 - uVar2) >> 2;" (assignment_expression "local_34 = (int)(param_4 - uVar2) >> 2" identifier = (binary_expression "(int)(param_4 - uVar2) >> 2" (cast_expression "(int)(param_4 - uVar2)" ( (type_descriptor "int" primitive_type) ) (parenthesized_expression "(param_4 - uVar2)" ( (binary_expression "param_4 - uVar2" identifier - identifier) ))) >> number_literal)) ;) }))) (expression_statement "FUN_0022f5a0(param_1,param_2,param_3,param_5);" (call_expression "FUN_0022f5a0(param_1,param_2,param_3,param_5)" identifier (argument_list "(param_1,param_2,param_3,param_5)" ( identifier , identifier , identifier , identifier ))) ;) (expression_statement "__s2 = (wchar_t *)(*param_1 + local_34 * 4);" (assignment_expression "__s2 = (wchar_t *)(*param_1 + local_34 * 4)" identifier = (cast_expression "(wchar_t *)(*param_1 + local_34 * 4)" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*param_1 + local_34 * 4)" ( (binary_expression "*param_1 + local_34 * 4" (pointer_expression "*param_1" * identifier) + (binary_expression "local_34 * 4" identifier * number_literal)) )))) ;) (expression_statement "__s1 = (wchar_t *)(*param_1 + param_2 * 4);" (assignment_expression "__s1 = (wchar_t *)(*param_1 + param_2 * 4)" identifier = (cast_expression "(wchar_t *)(*param_1 + param_2 * 4)" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*param_1 + param_2 * 4)" ( (binary_expression "*param_1 + param_2 * 4" (pointer_expression "*param_1" * identifier) + (binary_expression "param_2 * 4" identifier * number_literal)) )))) ;) (if_statement "if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }" if (parenthesized_expression "(param_5 == 1)" ( (binary_expression "param_5 == 1" identifier == number_literal) )) (compound_statement "{\n      *__s1 = *__s2;\n    }" { (expression_statement "*__s1 = *__s2;" (assignment_expression "*__s1 = *__s2" (pointer_expression "*__s1" * identifier) = (pointer_expression "*__s2" * identifier)) ;) }) (else_clause "else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }" else (if_statement "if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }" if (parenthesized_expression "(param_5 != 0)" ( (binary_expression "param_5 != 0" identifier != number_literal) )) (compound_statement "{\n      wmemcpy(__s1,__s2,param_5);\n    }" { (expression_statement "wmemcpy(__s1,__s2,param_5);" (call_expression "wmemcpy(__s1,__s2,param_5)" identifier (argument_list "(__s1,__s2,param_5)" ( identifier , identifier , identifier ))) ;) })))) }))) (return_statement "return param_1;" return identifier ;) })))
(translation_unit "/* std::wstring::replace(unsigned int, unsigned int, wchar_t const*, unsigned int) */\n\nwstring * __thiscall\nstd::wstring::replace(wstring *this,uint param_1,uint param_2,wchar_t *param_3,uint param_4)\n\n{\n  wchar_t *pwVar1;\n  int iVar2;\n  wchar_t *__s1;\n  wstring *pwVar3;\n  wchar_t wVar4;\n  int unaff_EDI;\n  int local_34;\n  allocator local_21;\n  wchar_t *local_20 [4];\n  \n  __x86_get_pc_thunk_di();\n  pwVar1 = *(wchar_t **)this;\n  wVar4 = pwVar1[-3];\n  if ((uint)wVar4 < param_1) {\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt\n              ((char *)((int)&__DT_REL[0x25fb].r_offset + unaff_EDI + 3),unaff_EDI + 0x3b409,param_1\n               ,wVar4);\n  }\n  if ((uint)(wVar4 - param_1) <= param_2) {\n    param_2 = wVar4 - param_1;\n  }\n  if ((uint)((param_2 - wVar4) + 0xffffffeU) < param_4) {\n                    /* WARNING: Subroutine does not return */\n    __throw_length_error((char *)(unaff_EDI + 0x3b409));\n  }\n  if (((param_3 < pwVar1) || (pwVar1 + wVar4 < param_3)) || (L'\0' < pwVar1[-1])) {\n    this = (wstring *)_M_replace_safe(this,param_1,param_2,param_3,param_4);\n  }\n  else {\n    iVar2 = *(int *)this;\n    if ((wchar_t *)(iVar2 + param_1 * 4) < param_3 + param_4) {\n      if (param_3 < (wchar_t *)(iVar2 + (param_1 + param_2) * 4)) {\n        wstring((wstring *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4);\n        if ((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)) {\n          return pwVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          wVar4 = local_20[0][-1];\n          local_20[0][-1] = wVar4 + L'\xffffffff';\n        }\n        else {\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }\n        if (L'\0' < wVar4) {\n          return pwVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] + -3));\n        return pwVar3;\n      }\n      local_34 = (((int)param_3 - iVar2 >> 2) + param_4) - param_2;\n    }\n    else {\n      local_34 = (int)param_3 - iVar2 >> 2;\n    }\n    _M_mutate(this,param_1,param_2,param_4);\n    pwVar1 = (wchar_t *)(*(int *)this + local_34 * 4);\n    __s1 = (wchar_t *)(*(int *)this + param_1 * 4);\n    if (param_4 == 1) {\n      *__s1 = *pwVar1;\n    }\n    else if (param_4 != 0) {\n      wmemcpy(__s1,pwVar1,param_4);\n    }\n  }\n  return this;\n}\n\n" comment (ERROR "wstring * __thiscall\nstd::wstring::replace(wstring *this," (binary_expression "wstring * __thiscall\nstd::wstring::replace(wstring *this" (binary_expression "wstring * __thiscall" identifier * identifier) (ERROR "std::wstring::replace(wstring" identifier : : identifier : : identifier ( identifier) * identifier) ,) (declaration "uint param_1,uint param_2,wchar_t *param_3,uint param_4)\n\n{\n  wchar_t *pwVar1;" type_identifier identifier , (ERROR "uint" identifier) identifier , (ERROR "wchar_t" identifier) (pointer_declarator "*param_3" * identifier) , (ERROR "uint param_4)\n\n{\n  wchar_t" identifier identifier ) { identifier) (pointer_declarator "*pwVar1" * identifier) ;) (declaration "int iVar2;" primitive_type identifier ;) (declaration "wchar_t *__s1;" type_identifier (pointer_declarator "*__s1" * identifier) ;) (declaration "wstring *pwVar3;" type_identifier (pointer_declarator "*pwVar3" * identifier) ;) (declaration "wchar_t wVar4;" type_identifier identifier ;) (declaration "int unaff_EDI;" primitive_type identifier ;) (declaration "int local_34;" primitive_type identifier ;) (declaration "allocator local_21;" type_identifier identifier ;) (declaration "wchar_t *local_20 [4];" type_identifier (pointer_declarator "*local_20 [4]" * (array_declarator "local_20 [4]" identifier [ number_literal ])) ;) (expression_statement "__x86_get_pc_thunk_di();" (call_expression "__x86_get_pc_thunk_di()" identifier (argument_list "()" ( ))) ;) (expression_statement "pwVar1 = *(wchar_t **)this;" (assignment_expression "pwVar1 = *(wchar_t **)this" identifier = (pointer_expression "*(wchar_t **)this" * (cast_expression "(wchar_t **)this" ( (type_descriptor "wchar_t **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) identifier))) ;) (expression_statement "wVar4 = pwVar1[-3];" (assignment_expression "wVar4 = pwVar1[-3]" identifier = (subscript_expression "pwVar1[-3]" identifier [ number_literal ])) ;) (if_statement "if ((uint)wVar4 < param_1) {\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt\n              ((char *)((int)&__DT_REL[0x25fb].r_offset + unaff_EDI + 3),unaff_EDI + 0x3b409,param_1\n               ,wVar4);\n  }" if (parenthesized_expression "((uint)wVar4 < param_1)" ( (binary_expression "(uint)wVar4 < param_1" (cast_expression "(uint)wVar4" ( (type_descriptor "uint" type_identifier) ) identifier) < identifier) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt\n              ((char *)((int)&__DT_REL[0x25fb].r_offset + unaff_EDI + 3),unaff_EDI + 0x3b409,param_1\n               ,wVar4);\n  }" { comment (expression_statement "__throw_out_of_range_fmt\n              ((char *)((int)&__DT_REL[0x25fb].r_offset + unaff_EDI + 3),unaff_EDI + 0x3b409,param_1\n               ,wVar4);" (call_expression "__throw_out_of_range_fmt\n              ((char *)((int)&__DT_REL[0x25fb].r_offset + unaff_EDI + 3),unaff_EDI + 0x3b409,param_1\n               ,wVar4)" identifier (argument_list "((char *)((int)&__DT_REL[0x25fb].r_offset + unaff_EDI + 3),unaff_EDI + 0x3b409,param_1\n               ,wVar4)" ( (cast_expression "(char *)((int)&__DT_REL[0x25fb].r_offset + unaff_EDI + 3)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "((int)&__DT_REL[0x25fb].r_offset + unaff_EDI + 3)" ( (binary_expression "(int)&__DT_REL[0x25fb].r_offset + unaff_EDI + 3" (binary_expression "(int)&__DT_REL[0x25fb].r_offset + unaff_EDI" (cast_expression "(int)&__DT_REL[0x25fb].r_offset" ( (type_descriptor "int" primitive_type) ) (pointer_expression "&__DT_REL[0x25fb].r_offset" & (field_expression "__DT_REL[0x25fb].r_offset" (subscript_expression "__DT_REL[0x25fb]" identifier [ number_literal ]) . field_identifier))) + identifier) + number_literal) ))) , (binary_expression "unaff_EDI + 0x3b409" identifier + number_literal) , identifier , identifier ))) ;) })) (if_statement "if ((uint)(wVar4 - param_1) <= param_2) {\n    param_2 = wVar4 - param_1;\n  }" if (parenthesized_expression "((uint)(wVar4 - param_1) <= param_2)" ( (binary_expression "(uint)(wVar4 - param_1) <= param_2" (call_expression "(uint)(wVar4 - param_1)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "(wVar4 - param_1)" ( (binary_expression "wVar4 - param_1" identifier - identifier) ))) <= identifier) )) (compound_statement "{\n    param_2 = wVar4 - param_1;\n  }" { (expression_statement "param_2 = wVar4 - param_1;" (assignment_expression "param_2 = wVar4 - param_1" identifier = (binary_expression "wVar4 - param_1" identifier - identifier)) ;) })) (if_statement "if ((uint)((param_2 - wVar4) + 0xffffffeU) < param_4) {\n                    /* WARNING: Subroutine does not return */\n    __throw_length_error((char *)(unaff_EDI + 0x3b409));\n  }" if (parenthesized_expression "((uint)((param_2 - wVar4) + 0xffffffeU) < param_4)" ( (binary_expression "(uint)((param_2 - wVar4) + 0xffffffeU) < param_4" (call_expression "(uint)((param_2 - wVar4) + 0xffffffeU)" (parenthesized_expression "(uint)" ( identifier )) (argument_list "((param_2 - wVar4) + 0xffffffeU)" ( (binary_expression "(param_2 - wVar4) + 0xffffffeU" (parenthesized_expression "(param_2 - wVar4)" ( (binary_expression "param_2 - wVar4" identifier - identifier) )) + number_literal) ))) < identifier) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    __throw_length_error((char *)(unaff_EDI + 0x3b409));\n  }" { comment (expression_statement "__throw_length_error((char *)(unaff_EDI + 0x3b409));" (call_expression "__throw_length_error((char *)(unaff_EDI + 0x3b409))" identifier (argument_list "((char *)(unaff_EDI + 0x3b409))" ( (cast_expression "(char *)(unaff_EDI + 0x3b409)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x3b409)" ( (binary_expression "unaff_EDI + 0x3b409" identifier + number_literal) ))) ))) ;) })) (if_statement "if (((param_3 < pwVar1) || (pwVar1 + wVar4 < param_3)) || (L'\0' < pwVar1[-1])) {\n    this = (wstring *)_M_replace_safe(this,param_1,param_2,param_3,param_4);\n  }\n  else {\n    iVar2 = *(int *)this;\n    if ((wchar_t *)(iVar2 + param_1 * 4) < param_3 + param_4) {\n      if (param_3 < (wchar_t *)(iVar2 + (param_1 + param_2) * 4)) {\n        wstring((wstring *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4);\n        if ((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)) {\n          return pwVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          wVar4 = local_20[0][-1];\n          local_20[0][-1] = wVar4 + L'\xffffffff';\n        }\n        else {\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }\n        if (L'\0' < wVar4) {\n          return pwVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] + -3));\n        return pwVar3;\n      }\n      local_34 = (((int)param_3 - iVar2 >> 2) + param_4) - param_2;\n    }\n    else {\n      local_34 = (int)param_3 - iVar2 >> 2;\n    }\n    _M_mutate(this,param_1,param_2,param_4);\n    pwVar1 = (wchar_t *)(*(int *)this + local_34 * 4);\n    __s1 = (wchar_t *)(*(int *)this + param_1 * 4);\n    if (param_4 == 1) {\n      *__s1 = *pwVar1;\n    }\n    else if (param_4 != 0) {\n      wmemcpy(__s1,pwVar1,param_4);\n    }\n  }" if (parenthesized_expression "(((param_3 < pwVar1) || (pwVar1 + wVar4 < param_3)) || (L'\0' < pwVar1[-1]))" ( (binary_expression "((param_3 < pwVar1) || (pwVar1 + wVar4 < param_3)) || (L'\0' < pwVar1[-1])" (parenthesized_expression "((param_3 < pwVar1) || (pwVar1 + wVar4 < param_3))" ( (binary_expression "(param_3 < pwVar1) || (pwVar1 + wVar4 < param_3)" (parenthesized_expression "(param_3 < pwVar1)" ( (binary_expression "param_3 < pwVar1" identifier < identifier) )) || (parenthesized_expression "(pwVar1 + wVar4 < param_3)" ( (binary_expression "pwVar1 + wVar4 < param_3" (binary_expression "pwVar1 + wVar4" identifier + identifier) < identifier) ))) )) || (parenthesized_expression "(L'\0' < pwVar1[-1])" ( (binary_expression "L'\0' < pwVar1[-1]" (char_literal "L'\0'" L' escape_sequence ') < (subscript_expression "pwVar1[-1]" identifier [ number_literal ])) ))) )) (compound_statement "{\n    this = (wstring *)_M_replace_safe(this,param_1,param_2,param_3,param_4);\n  }" { (expression_statement "this = (wstring *)_M_replace_safe(this,param_1,param_2,param_3,param_4);" (assignment_expression "this = (wstring *)_M_replace_safe(this,param_1,param_2,param_3,param_4)" identifier = (cast_expression "(wstring *)_M_replace_safe(this,param_1,param_2,param_3,param_4)" ( (type_descriptor "wstring *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "_M_replace_safe(this,param_1,param_2,param_3,param_4)" identifier (argument_list "(this,param_1,param_2,param_3,param_4)" ( identifier , identifier , identifier , identifier , identifier ))))) ;) }) (else_clause "else {\n    iVar2 = *(int *)this;\n    if ((wchar_t *)(iVar2 + param_1 * 4) < param_3 + param_4) {\n      if (param_3 < (wchar_t *)(iVar2 + (param_1 + param_2) * 4)) {\n        wstring((wstring *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4);\n        if ((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)) {\n          return pwVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          wVar4 = local_20[0][-1];\n          local_20[0][-1] = wVar4 + L'\xffffffff';\n        }\n        else {\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }\n        if (L'\0' < wVar4) {\n          return pwVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] + -3));\n        return pwVar3;\n      }\n      local_34 = (((int)param_3 - iVar2 >> 2) + param_4) - param_2;\n    }\n    else {\n      local_34 = (int)param_3 - iVar2 >> 2;\n    }\n    _M_mutate(this,param_1,param_2,param_4);\n    pwVar1 = (wchar_t *)(*(int *)this + local_34 * 4);\n    __s1 = (wchar_t *)(*(int *)this + param_1 * 4);\n    if (param_4 == 1) {\n      *__s1 = *pwVar1;\n    }\n    else if (param_4 != 0) {\n      wmemcpy(__s1,pwVar1,param_4);\n    }\n  }" else (compound_statement "{\n    iVar2 = *(int *)this;\n    if ((wchar_t *)(iVar2 + param_1 * 4) < param_3 + param_4) {\n      if (param_3 < (wchar_t *)(iVar2 + (param_1 + param_2) * 4)) {\n        wstring((wstring *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4);\n        if ((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)) {\n          return pwVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          wVar4 = local_20[0][-1];\n          local_20[0][-1] = wVar4 + L'\xffffffff';\n        }\n        else {\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }\n        if (L'\0' < wVar4) {\n          return pwVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] + -3));\n        return pwVar3;\n      }\n      local_34 = (((int)param_3 - iVar2 >> 2) + param_4) - param_2;\n    }\n    else {\n      local_34 = (int)param_3 - iVar2 >> 2;\n    }\n    _M_mutate(this,param_1,param_2,param_4);\n    pwVar1 = (wchar_t *)(*(int *)this + local_34 * 4);\n    __s1 = (wchar_t *)(*(int *)this + param_1 * 4);\n    if (param_4 == 1) {\n      *__s1 = *pwVar1;\n    }\n    else if (param_4 != 0) {\n      wmemcpy(__s1,pwVar1,param_4);\n    }\n  }" { (expression_statement "iVar2 = *(int *)this;" (assignment_expression "iVar2 = *(int *)this" identifier = (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier))) ;) (if_statement "if ((wchar_t *)(iVar2 + param_1 * 4) < param_3 + param_4) {\n      if (param_3 < (wchar_t *)(iVar2 + (param_1 + param_2) * 4)) {\n        wstring((wstring *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4);\n        if ((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)) {\n          return pwVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          wVar4 = local_20[0][-1];\n          local_20[0][-1] = wVar4 + L'\xffffffff';\n        }\n        else {\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }\n        if (L'\0' < wVar4) {\n          return pwVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] + -3));\n        return pwVar3;\n      }\n      local_34 = (((int)param_3 - iVar2 >> 2) + param_4) - param_2;\n    }\n    else {\n      local_34 = (int)param_3 - iVar2 >> 2;\n    }" if (parenthesized_expression "((wchar_t *)(iVar2 + param_1 * 4) < param_3 + param_4)" ( (binary_expression "(wchar_t *)(iVar2 + param_1 * 4) < param_3 + param_4" (cast_expression "(wchar_t *)(iVar2 + param_1 * 4)" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar2 + param_1 * 4)" ( (binary_expression "iVar2 + param_1 * 4" identifier + (binary_expression "param_1 * 4" identifier * number_literal)) ))) < (binary_expression "param_3 + param_4" identifier + identifier)) )) (compound_statement "{\n      if (param_3 < (wchar_t *)(iVar2 + (param_1 + param_2) * 4)) {\n        wstring((wstring *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4);\n        if ((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)) {\n          return pwVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          wVar4 = local_20[0][-1];\n          local_20[0][-1] = wVar4 + L'\xffffffff';\n        }\n        else {\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }\n        if (L'\0' < wVar4) {\n          return pwVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] + -3));\n        return pwVar3;\n      }\n      local_34 = (((int)param_3 - iVar2 >> 2) + param_4) - param_2;\n    }" { (if_statement "if (param_3 < (wchar_t *)(iVar2 + (param_1 + param_2) * 4)) {\n        wstring((wstring *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4);\n        if ((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)) {\n          return pwVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          wVar4 = local_20[0][-1];\n          local_20[0][-1] = wVar4 + L'\xffffffff';\n        }\n        else {\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }\n        if (L'\0' < wVar4) {\n          return pwVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] + -3));\n        return pwVar3;\n      }" if (parenthesized_expression "(param_3 < (wchar_t *)(iVar2 + (param_1 + param_2) * 4))" ( (binary_expression "param_3 < (wchar_t *)(iVar2 + (param_1 + param_2) * 4)" identifier < (cast_expression "(wchar_t *)(iVar2 + (param_1 + param_2) * 4)" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar2 + (param_1 + param_2) * 4)" ( (binary_expression "iVar2 + (param_1 + param_2) * 4" identifier + (binary_expression "(param_1 + param_2) * 4" (parenthesized_expression "(param_1 + param_2)" ( (binary_expression "param_1 + param_2" identifier + identifier) )) * number_literal)) )))) )) (compound_statement "{\n        wstring((wstring *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */\n        pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4);\n        if ((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)) {\n          return pwVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          wVar4 = local_20[0][-1];\n          local_20[0][-1] = wVar4 + L'\xffffffff';\n        }\n        else {\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }\n        if (L'\0' < wVar4) {\n          return pwVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] + -3));\n        return pwVar3;\n      }" { (expression_statement "wstring((wstring *)local_20,param_3,param_4,&local_21);" (call_expression "wstring((wstring *)local_20,param_3,param_4,&local_21)" identifier (argument_list "((wstring *)local_20,param_3,param_4,&local_21)" ( (cast_expression "(wstring *)local_20" ( (type_descriptor "wstring *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier) , identifier , identifier , (pointer_expression "&local_21" & identifier) ))) ;) comment (expression_statement "pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4);" (assignment_expression "pwVar3 = (wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4)" identifier = (cast_expression "(wstring *)_M_replace_safe(this,param_1,param_2,local_20[0],param_4)" ( (type_descriptor "wstring *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "_M_replace_safe(this,param_1,param_2,local_20[0],param_4)" identifier (argument_list "(this,param_1,param_2,local_20[0],param_4)" ( identifier , identifier , identifier , (subscript_expression "local_20[0]" identifier [ number_literal ]) , identifier ))))) ;) (if_statement "if ((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)) {\n          return pwVar3;\n        }" if (parenthesized_expression "((allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb))" ( (binary_expression "(allocator *)(local_20[0] + -3) == *(allocator **)(unaff_EDI + 0x10daeb)" (cast_expression "(allocator *)(local_20[0] + -3)" ( (type_descriptor "allocator *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_20[0] + -3)" ( (binary_expression "local_20[0] + -3" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) ))) == (pointer_expression "*(allocator **)(unaff_EDI + 0x10daeb)" * (cast_expression "(allocator **)(unaff_EDI + 0x10daeb)" ( (type_descriptor "allocator **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(unaff_EDI + 0x10daeb)" ( (binary_expression "unaff_EDI + 0x10daeb" identifier + number_literal) ))))) )) (compound_statement "{\n          return pwVar3;\n        }" { (return_statement "return pwVar3;" return identifier ;) })) (if_statement "if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          wVar4 = local_20[0][-1];\n          local_20[0][-1] = wVar4 + L'\xffffffff';\n        }\n        else {\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }" if (parenthesized_expression "(*(int *)(unaff_EDI + 0x10dcb3) == 0)" ( (binary_expression "*(int *)(unaff_EDI + 0x10dcb3) == 0" (pointer_expression "*(int *)(unaff_EDI + 0x10dcb3)" * (cast_expression "(int *)(unaff_EDI + 0x10dcb3)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x10dcb3)" ( (binary_expression "unaff_EDI + 0x10dcb3" identifier + number_literal) )))) == number_literal) )) (compound_statement "{\n          wVar4 = local_20[0][-1];\n          local_20[0][-1] = wVar4 + L'\xffffffff';\n        }" { (expression_statement "wVar4 = local_20[0][-1];" (assignment_expression "wVar4 = local_20[0][-1]" identifier = (subscript_expression "local_20[0][-1]" (subscript_expression "local_20[0]" identifier [ number_literal ]) [ number_literal ])) ;) (expression_statement "local_20[0][-1] = wVar4 + L'\xffffffff';" (assignment_expression "local_20[0][-1] = wVar4 + L'\xffffffff'" (subscript_expression "local_20[0][-1]" (subscript_expression "local_20[0]" identifier [ number_literal ]) [ number_literal ]) = (binary_expression "wVar4 + L'\xffffffff'" identifier + (char_literal "L'\xffffffff'" L' escape_sequence character character character character '))) ;) }) (else_clause "else {\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }" else (compound_statement "{\n          LOCK();\n          pwVar1 = local_20[0] + -1;\n          wVar4 = *pwVar1;\n          *pwVar1 = *pwVar1 + L'\xffffffff';\n          UNLOCK();\n        }" { (expression_statement "LOCK();" (call_expression "LOCK()" identifier (argument_list "()" ( ))) ;) (expression_statement "pwVar1 = local_20[0] + -1;" (assignment_expression "pwVar1 = local_20[0] + -1" identifier = (binary_expression "local_20[0] + -1" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal)) ;) (expression_statement "wVar4 = *pwVar1;" (assignment_expression "wVar4 = *pwVar1" identifier = (pointer_expression "*pwVar1" * identifier)) ;) (expression_statement "*pwVar1 = *pwVar1 + L'\xffffffff';" (assignment_expression "*pwVar1 = *pwVar1 + L'\xffffffff'" (pointer_expression "*pwVar1" * identifier) = (binary_expression "*pwVar1 + L'\xffffffff'" (pointer_expression "*pwVar1" * identifier) + (char_literal "L'\xffffffff'" L' escape_sequence character character character character '))) ;) (expression_statement "UNLOCK();" (call_expression "UNLOCK()" identifier (argument_list "()" ( ))) ;) }))) (if_statement "if (L'\0' < wVar4) {\n          return pwVar3;\n        }" if (parenthesized_expression "(L'\0' < wVar4)" ( (binary_expression "L'\0' < wVar4" (char_literal "L'\0'" L' escape_sequence ') < identifier) )) (compound_statement "{\n          return pwVar3;\n        }" { (return_statement "return pwVar3;" return identifier ;) })) (labeled_statement "_Rep::_M_destroy((allocator *)(local_20[0] + -3));" statement_identifier : (ERROR ":" :) (expression_statement "_M_destroy((allocator *)(local_20[0] + -3));" (call_expression "_M_destroy((allocator *)(local_20[0] + -3))" identifier (argument_list "((allocator *)(local_20[0] + -3))" ( (cast_expression "(allocator *)(local_20[0] + -3)" ( (type_descriptor "allocator *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_20[0] + -3)" ( (binary_expression "local_20[0] + -3" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) ))) ))) ;)) (return_statement "return pwVar3;" return identifier ;) })) (expression_statement "local_34 = (((int)param_3 - iVar2 >> 2) + param_4) - param_2;" (assignment_expression "local_34 = (((int)param_3 - iVar2 >> 2) + param_4) - param_2" identifier = (binary_expression "(((int)param_3 - iVar2 >> 2) + param_4) - param_2" (parenthesized_expression "(((int)param_3 - iVar2 >> 2) + param_4)" ( (binary_expression "((int)param_3 - iVar2 >> 2) + param_4" (parenthesized_expression "((int)param_3 - iVar2 >> 2)" ( (binary_expression "(int)param_3 - iVar2 >> 2" (binary_expression "(int)param_3 - iVar2" (cast_expression "(int)param_3" ( (type_descriptor "int" primitive_type) ) identifier) - identifier) >> number_literal) )) + identifier) )) - identifier)) ;) }) (else_clause "else {\n      local_34 = (int)param_3 - iVar2 >> 2;\n    }" else (compound_statement "{\n      local_34 = (int)param_3 - iVar2 >> 2;\n    }" { (expression_statement "local_34 = (int)param_3 - iVar2 >> 2;" (assignment_expression "local_34 = (int)param_3 - iVar2 >> 2" identifier = (binary_expression "(int)param_3 - iVar2 >> 2" (binary_expression "(int)param_3 - iVar2" (cast_expression "(int)param_3" ( (type_descriptor "int" primitive_type) ) identifier) - identifier) >> number_literal)) ;) }))) (expression_statement "_M_mutate(this,param_1,param_2,param_4);" (call_expression "_M_mutate(this,param_1,param_2,param_4)" identifier (argument_list "(this,param_1,param_2,param_4)" ( identifier , identifier , identifier , identifier ))) ;) (expression_statement "pwVar1 = (wchar_t *)(*(int *)this + local_34 * 4);" (assignment_expression "pwVar1 = (wchar_t *)(*(int *)this + local_34 * 4)" identifier = (cast_expression "(wchar_t *)(*(int *)this + local_34 * 4)" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(int *)this + local_34 * 4)" ( (binary_expression "*(int *)this + local_34 * 4" (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier)) + (binary_expression "local_34 * 4" identifier * number_literal)) )))) ;) (expression_statement "__s1 = (wchar_t *)(*(int *)this + param_1 * 4);" (assignment_expression "__s1 = (wchar_t *)(*(int *)this + param_1 * 4)" identifier = (cast_expression "(wchar_t *)(*(int *)this + param_1 * 4)" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*(int *)this + param_1 * 4)" ( (binary_expression "*(int *)this + param_1 * 4" (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier)) + (binary_expression "param_1 * 4" identifier * number_literal)) )))) ;) (if_statement "if (param_4 == 1) {\n      *__s1 = *pwVar1;\n    }\n    else if (param_4 != 0) {\n      wmemcpy(__s1,pwVar1,param_4);\n    }" if (parenthesized_expression "(param_4 == 1)" ( (binary_expression "param_4 == 1" identifier == number_literal) )) (compound_statement "{\n      *__s1 = *pwVar1;\n    }" { (expression_statement "*__s1 = *pwVar1;" (assignment_expression "*__s1 = *pwVar1" (pointer_expression "*__s1" * identifier) = (pointer_expression "*pwVar1" * identifier)) ;) }) (else_clause "else if (param_4 != 0) {\n      wmemcpy(__s1,pwVar1,param_4);\n    }" else (if_statement "if (param_4 != 0) {\n      wmemcpy(__s1,pwVar1,param_4);\n    }" if (parenthesized_expression "(param_4 != 0)" ( (binary_expression "param_4 != 0" identifier != number_literal) )) (compound_statement "{\n      wmemcpy(__s1,pwVar1,param_4);\n    }" { (expression_statement "wmemcpy(__s1,pwVar1,param_4);" (call_expression "wmemcpy(__s1,pwVar1,param_4)" identifier (argument_list "(__s1,pwVar1,param_4)" ( identifier , identifier , identifier ))) ;) })))) }))) (return_statement "return this;" return identifier ;) (ERROR "}" }))
(translation_unit "uint * FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)\n\n{\n  int *piVar1;\n  wchar_t *__s2;\n  uint uVar2;\n  uint uVar3;\n  wchar_t *__s1;\n  uint *puVar4;\n  int iVar5;\n  int unaff_EDI;\n  int local_34;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00058c4a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    \n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    \n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }\n  if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }\n  return param_1;\n}\n\n" (function_definition "uint * FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)\n\n{\n  int *piVar1;\n  wchar_t *__s2;\n  uint uVar2;\n  uint uVar3;\n  wchar_t *__s1;\n  uint *puVar4;\n  int iVar5;\n  int unaff_EDI;\n  int local_34;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00058c4a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    \n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    \n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }\n  if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }\n  return param_1;\n}" type_identifier (pointer_declarator "* FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" * (function_declarator "FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" identifier (parameter_list "(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" ( (parameter_declaration "uint *param_1" type_identifier (pointer_declarator "*param_1" * identifier)) , (parameter_declaration "uint param_2" type_identifier identifier) , (parameter_declaration "uint param_3" type_identifier identifier) , (parameter_declaration "uint param_4" type_identifier identifier) , (parameter_declaration "uint param_5" type_identifier identifier) )))) (compound_statement "{\n  int *piVar1;\n  wchar_t *__s2;\n  uint uVar2;\n  uint uVar3;\n  wchar_t *__s1;\n  uint *puVar4;\n  int iVar5;\n  int unaff_EDI;\n  int local_34;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00058c4a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    \n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    \n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }\n  if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }\n  return param_1;\n}" { (declaration "int *piVar1;" primitive_type (pointer_declarator "*piVar1" * identifier) ;) (declaration "wchar_t *__s2;" type_identifier (pointer_declarator "*__s2" * identifier) ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (declaration "wchar_t *__s1;" type_identifier (pointer_declarator "*__s1" * identifier) ;) (declaration "uint *puVar4;" type_identifier (pointer_declarator "*puVar4" * identifier) ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "int unaff_EDI;" primitive_type identifier ;) (declaration "int local_34;" primitive_type identifier ;) (declaration "undefined1 local_21;" type_identifier identifier ;) (declaration "int local_20 [4];" primitive_type (array_declarator "local_20 [4]" identifier [ number_literal ]) ;) (expression_statement "FUN_00058c4a();" (call_expression "FUN_00058c4a()" identifier (argument_list "()" ( ))) ;) (expression_statement "uVar2 = *param_1;" (assignment_expression "uVar2 = *param_1" identifier = (pointer_expression "*param_1" * identifier)) ;) (expression_statement "uVar3 = *(uint *)(uVar2 - 0xc);" (assignment_expression "uVar3 = *(uint *)(uVar2 - 0xc)" identifier = (pointer_expression "*(uint *)(uVar2 - 0xc)" * (cast_expression "(uint *)(uVar2 - 0xc)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(uVar2 - 0xc)" ( (binary_expression "uVar2 - 0xc" identifier - number_literal) ))))) ;) (if_statement "if (uVar3 < param_2) {\n                    \n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }" if (parenthesized_expression "(uVar3 < param_2)" ( (binary_expression "uVar3 < param_2" identifier < identifier) )) (compound_statement "{\n                    \n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }" { (expression_statement "FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);" (call_expression "FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3)" identifier (argument_list "(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3)" ( (binary_expression "unaff_EDI + 0x2482b" identifier + number_literal) , (binary_expression "unaff_EDI + 0x3b409" identifier + number_literal) , identifier , identifier ))) ;) })) (if_statement "if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }" if (parenthesized_expression "(uVar3 - param_2 <= param_3)" ( (binary_expression "uVar3 - param_2 <= param_3" (binary_expression "uVar3 - param_2" identifier - identifier) <= identifier) )) (compound_statement "{\n    param_3 = uVar3 - param_2;\n  }" { (expression_statement "param_3 = uVar3 - param_2;" (assignment_expression "param_3 = uVar3 - param_2" identifier = (binary_expression "uVar3 - param_2" identifier - identifier)) ;) })) (if_statement "if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    \n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }" if (parenthesized_expression "((param_3 - uVar3) + 0xffffffe < param_5)" ( (binary_expression "(param_3 - uVar3) + 0xffffffe < param_5" (binary_expression "(param_3 - uVar3) + 0xffffffe" (parenthesized_expression "(param_3 - uVar3)" ( (binary_expression "param_3 - uVar3" identifier - identifier) )) + number_literal) < identifier) )) (compound_statement "{\n                    \n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }" { (expression_statement "FUN_001f1e60(unaff_EDI + 0x3b409);" (call_expression "FUN_001f1e60(unaff_EDI + 0x3b409)" identifier (argument_list "(unaff_EDI + 0x3b409)" ( (binary_expression "unaff_EDI + 0x3b409" identifier + number_literal) ))) ;) })) (if_statement "if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }" if (parenthesized_expression "(((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4)))" ( (binary_expression "((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))" (parenthesized_expression "((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4))" ( (binary_expression "(param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)" (parenthesized_expression "(param_4 < uVar2)" ( (binary_expression "param_4 < uVar2" identifier < identifier) )) || (parenthesized_expression "(uVar2 + uVar3 * 4 < param_4)" ( (binary_expression "uVar2 + uVar3 * 4 < param_4" (binary_expression "uVar2 + uVar3 * 4" identifier + (binary_expression "uVar3 * 4" identifier * number_literal)) < identifier) ))) )) || (parenthesized_expression "(0 < *(int *)(uVar2 - 4))" ( (binary_expression "0 < *(int *)(uVar2 - 4)" number_literal < (pointer_expression "*(int *)(uVar2 - 4)" * (cast_expression "(int *)(uVar2 - 4)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(uVar2 - 4)" ( (binary_expression "uVar2 - 4" identifier - number_literal) ))))) ))) )) (compound_statement "{\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }" { (expression_statement "param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);" (assignment_expression "param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5)" identifier = (cast_expression "(uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_0022fe00(param_1,param_2,param_3,param_4,param_5)" identifier (argument_list "(param_1,param_2,param_3,param_4,param_5)" ( identifier , identifier , identifier , identifier , identifier ))))) ;) }) (else_clause "else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }" else (compound_statement "{\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }" { (expression_statement "uVar2 = *param_1;" (assignment_expression "uVar2 = *param_1" identifier = (pointer_expression "*param_1" * identifier)) ;) (if_statement "if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }" if (parenthesized_expression "(uVar2 + param_2 * 4 < param_4 + param_5 * 4)" ( (binary_expression "uVar2 + param_2 * 4 < param_4 + param_5 * 4" (binary_expression "uVar2 + param_2 * 4" identifier + (binary_expression "param_2 * 4" identifier * number_literal)) < (binary_expression "param_4 + param_5 * 4" identifier + (binary_expression "param_5 * 4" identifier * number_literal))) )) (compound_statement "{\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }" { (if_statement "if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" if (parenthesized_expression "(param_4 < uVar2 + (param_2 + param_3) * 4)" ( (binary_expression "param_4 < uVar2 + (param_2 + param_3) * 4" identifier < (binary_expression "uVar2 + (param_2 + param_3) * 4" identifier + (binary_expression "(param_2 + param_3) * 4" (parenthesized_expression "(param_2 + param_3)" ( (binary_expression "param_2 + param_3" identifier + identifier) )) * number_literal))) )) (compound_statement "{\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" { (expression_statement "FUN_00231240(local_20,param_4,param_5,&local_21);" (call_expression "FUN_00231240(local_20,param_4,param_5,&local_21)" identifier (argument_list "(local_20,param_4,param_5,&local_21)" ( identifier , identifier , identifier , (pointer_expression "&local_21" & identifier) ))) ;) (expression_statement "puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);" (assignment_expression "puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5)" identifier = (cast_expression "(uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5)" identifier (argument_list "(param_1,param_2,param_3,local_20[0],param_5)" ( identifier , identifier , identifier , (subscript_expression "local_20[0]" identifier [ number_literal ]) , identifier ))))) ;) (if_statement "if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }" if (parenthesized_expression "(local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb))" ( (binary_expression "local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)" (binary_expression "local_20[0] + -0xc" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) == (pointer_expression "*(int *)(unaff_EDI + 0x10daeb)" * (cast_expression "(int *)(unaff_EDI + 0x10daeb)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x10daeb)" ( (binary_expression "unaff_EDI + 0x10daeb" identifier + number_literal) ))))) )) (compound_statement "{\n          return puVar4;\n        }" { (return_statement "return puVar4;" return identifier ;) })) (if_statement "if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" if (parenthesized_expression "(*(int *)(unaff_EDI + 0x10dcb3) == 0)" ( (binary_expression "*(int *)(unaff_EDI + 0x10dcb3) == 0" (pointer_expression "*(int *)(unaff_EDI + 0x10dcb3)" * (cast_expression "(int *)(unaff_EDI + 0x10dcb3)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x10dcb3)" ( (binary_expression "unaff_EDI + 0x10dcb3" identifier + number_literal) )))) == number_literal) )) (compound_statement "{\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }" { (expression_statement "iVar5 = *(int *)(local_20[0] + -4);" (assignment_expression "iVar5 = *(int *)(local_20[0] + -4)" identifier = (pointer_expression "*(int *)(local_20[0] + -4)" * (cast_expression "(int *)(local_20[0] + -4)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_20[0] + -4)" ( (binary_expression "local_20[0] + -4" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) ))))) ;) (expression_statement "*(int *)(local_20[0] + -4) = iVar5 + -1;" (assignment_expression "*(int *)(local_20[0] + -4) = iVar5 + -1" (pointer_expression "*(int *)(local_20[0] + -4)" * (cast_expression "(int *)(local_20[0] + -4)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_20[0] + -4)" ( (binary_expression "local_20[0] + -4" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) )))) = (binary_expression "iVar5 + -1" identifier + number_literal)) ;) }) (else_clause "else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" else (compound_statement "{\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" { (expression_statement "LOCK();" (call_expression "LOCK()" identifier (argument_list "()" ( ))) ;) (expression_statement "piVar1 = (int *)(local_20[0] + -4);" (assignment_expression "piVar1 = (int *)(local_20[0] + -4)" identifier = (cast_expression "(int *)(local_20[0] + -4)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_20[0] + -4)" ( (binary_expression "local_20[0] + -4" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) )))) ;) (expression_statement "iVar5 = *piVar1;" (assignment_expression "iVar5 = *piVar1" identifier = (pointer_expression "*piVar1" * identifier)) ;) (expression_statement "*piVar1 = *piVar1 + -1;" (assignment_expression "*piVar1 = *piVar1 + -1" (pointer_expression "*piVar1" * identifier) = (binary_expression "*piVar1 + -1" (pointer_expression "*piVar1" * identifier) + number_literal)) ;) (expression_statement "UNLOCK();" (call_expression "UNLOCK()" identifier (argument_list "()" ( ))) ;) }))) (if_statement "if (0 < iVar5) {\n          return puVar4;\n        }" if (parenthesized_expression "(0 < iVar5)" ( (binary_expression "0 < iVar5" number_literal < identifier) )) (compound_statement "{\n          return puVar4;\n        }" { (return_statement "return puVar4;" return identifier ;) })) (expression_statement "FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);" (call_expression "FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0])" identifier (argument_list "(local_20[0] + -0xc,&local_21,local_20[0],local_20[0])" ( (binary_expression "local_20[0] + -0xc" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) , (pointer_expression "&local_21" & identifier) , (subscript_expression "local_20[0]" identifier [ number_literal ]) , (subscript_expression "local_20[0]" identifier [ number_literal ]) ))) ;) (return_statement "return puVar4;" return identifier ;) })) (expression_statement "local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;" (assignment_expression "local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3" identifier = (binary_expression "(((int)(param_4 - uVar2) >> 2) + param_5) - param_3" (parenthesized_expression "(((int)(param_4 - uVar2) >> 2) + param_5)" ( (binary_expression "((int)(param_4 - uVar2) >> 2) + param_5" (parenthesized_expression "((int)(param_4 - uVar2) >> 2)" ( (binary_expression "(int)(param_4 - uVar2) >> 2" (cast_expression "(int)(param_4 - uVar2)" ( (type_descriptor "int" primitive_type) ) (parenthesized_expression "(param_4 - uVar2)" ( (binary_expression "param_4 - uVar2" identifier - identifier) ))) >> number_literal) )) + identifier) )) - identifier)) ;) }) (else_clause "else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }" else (compound_statement "{\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }" { (expression_statement "local_34 = (int)(param_4 - uVar2) >> 2;" (assignment_expression "local_34 = (int)(param_4 - uVar2) >> 2" identifier = (binary_expression "(int)(param_4 - uVar2) >> 2" (cast_expression "(int)(param_4 - uVar2)" ( (type_descriptor "int" primitive_type) ) (parenthesized_expression "(param_4 - uVar2)" ( (binary_expression "param_4 - uVar2" identifier - identifier) ))) >> number_literal)) ;) }))) (expression_statement "FUN_0022f5a0(param_1,param_2,param_3,param_5);" (call_expression "FUN_0022f5a0(param_1,param_2,param_3,param_5)" identifier (argument_list "(param_1,param_2,param_3,param_5)" ( identifier , identifier , identifier , identifier ))) ;) (expression_statement "__s2 = (wchar_t *)(*param_1 + local_34 * 4);" (assignment_expression "__s2 = (wchar_t *)(*param_1 + local_34 * 4)" identifier = (cast_expression "(wchar_t *)(*param_1 + local_34 * 4)" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*param_1 + local_34 * 4)" ( (binary_expression "*param_1 + local_34 * 4" (pointer_expression "*param_1" * identifier) + (binary_expression "local_34 * 4" identifier * number_literal)) )))) ;) (expression_statement "__s1 = (wchar_t *)(*param_1 + param_2 * 4);" (assignment_expression "__s1 = (wchar_t *)(*param_1 + param_2 * 4)" identifier = (cast_expression "(wchar_t *)(*param_1 + param_2 * 4)" ( (type_descriptor "wchar_t *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(*param_1 + param_2 * 4)" ( (binary_expression "*param_1 + param_2 * 4" (pointer_expression "*param_1" * identifier) + (binary_expression "param_2 * 4" identifier * number_literal)) )))) ;) (if_statement "if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }" if (parenthesized_expression "(param_5 == 1)" ( (binary_expression "param_5 == 1" identifier == number_literal) )) (compound_statement "{\n      *__s1 = *__s2;\n    }" { (expression_statement "*__s1 = *__s2;" (assignment_expression "*__s1 = *__s2" (pointer_expression "*__s1" * identifier) = (pointer_expression "*__s2" * identifier)) ;) }) (else_clause "else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }" else (if_statement "if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }" if (parenthesized_expression "(param_5 != 0)" ( (binary_expression "param_5 != 0" identifier != number_literal) )) (compound_statement "{\n      wmemcpy(__s1,__s2,param_5);\n    }" { (expression_statement "wmemcpy(__s1,__s2,param_5);" (call_expression "wmemcpy(__s1,__s2,param_5)" identifier (argument_list "(__s1,__s2,param_5)" ( identifier , identifier , identifier ))) ;) })))) }))) (return_statement "return param_1;" return identifier ;) })))
(translation_unit (function_definition TYPE (pointer_declarator * (function_declarator IDENT (parameter_list ( (parameter_declaration TYPE (pointer_declarator * IDENT)) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) , (parameter_declaration TYPE IDENT) )))) (compound_statement { (declaration TYPE (pointer_declarator * 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 IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (array_declarator IDENT [ LIT ]) ;) (expression_statement (call_expression IDENT (argument_list ( ))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT - LIT) ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT < IDENT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) , (binary_expression IDENT + LIT) , IDENT , IDENT ))) ;) })) (if_statement if (parenthesized_expression ( (binary_expression (binary_expression IDENT - IDENT) <= IDENT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) })) (if_statement if (parenthesized_expression ( (binary_expression (binary_expression (parenthesized_expression ( (binary_expression IDENT - IDENT) )) + LIT) < IDENT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( (binary_expression IDENT + LIT) ))) ;) })) (if_statement if (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression IDENT < IDENT) )) || (parenthesized_expression ( (binary_expression (binary_expression IDENT + (binary_expression IDENT * LIT)) < IDENT) ))) )) || (parenthesized_expression ( (binary_expression LIT < (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT - LIT) ))))) ))) )) (compound_statement { (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT , IDENT , IDENT ))))) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (if_statement if (parenthesized_expression ( (binary_expression (binary_expression IDENT + (binary_expression IDENT * LIT)) < (binary_expression IDENT + (binary_expression IDENT * LIT))) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT < (binary_expression IDENT + (binary_expression (parenthesized_expression ( (binary_expression IDENT + IDENT) )) * LIT))) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT , (pointer_expression & IDENT) ))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT , (subscript_expression IDENT [ LIT ]) , IDENT ))))) ;) (if_statement if (parenthesized_expression ( (binary_expression (binary_expression (subscript_expression IDENT [ LIT ]) + LIT) == (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) ))))) )) (compound_statement { (return_statement return IDENT ;) })) (if_statement if (parenthesized_expression ( (binary_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + LIT) )))) == LIT) )) (compound_statement { (expression_statement (assignment_expression IDENT = (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (subscript_expression IDENT [ LIT ]) + LIT) ))))) ;) (expression_statement (assignment_expression (pointer_expression * (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (subscript_expression IDENT [ LIT ]) + LIT) )))) = (binary_expression IDENT + LIT)) ;) }) (else_clause else (compound_statement { (expression_statement (call_expression IDENT (argument_list ( ))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (subscript_expression IDENT [ LIT ]) + LIT) )))) ;) (expression_statement (assignment_expression IDENT = (pointer_expression * IDENT)) ;) (expression_statement (assignment_expression (pointer_expression * IDENT) = (binary_expression (pointer_expression * IDENT) + LIT)) ;) (expression_statement (call_expression IDENT (argument_list ( ))) ;) }))) (if_statement if (parenthesized_expression ( (binary_expression LIT < IDENT) )) (compound_statement { (return_statement return IDENT ;) })) (expression_statement (call_expression IDENT (argument_list ( (binary_expression (subscript_expression IDENT [ LIT ]) + LIT) , (pointer_expression & IDENT) , (subscript_expression IDENT [ LIT ]) , (subscript_expression IDENT [ LIT ]) ))) ;) (return_statement return IDENT ;) })) (expression_statement (assignment_expression IDENT = (binary_expression (parenthesized_expression ( (binary_expression (parenthesized_expression ( (binary_expression (cast_expression ( (type_descriptor TYPE) ) (parenthesized_expression ( (binary_expression IDENT - IDENT) ))) >> LIT) )) + IDENT) )) - IDENT)) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression (cast_expression ( (type_descriptor TYPE) ) (parenthesized_expression ( (binary_expression IDENT - IDENT) ))) >> LIT)) ;) }))) (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT , IDENT ))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) + (binary_expression IDENT * LIT)) )))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression (pointer_expression * IDENT) + (binary_expression IDENT * LIT)) )))) ;) (if_statement if (parenthesized_expression ( (binary_expression IDENT == LIT) )) (compound_statement { (expression_statement (assignment_expression (pointer_expression * IDENT) = (pointer_expression * IDENT)) ;) }) (else_clause else (if_statement if (parenthesized_expression ( (binary_expression IDENT != LIT) )) (compound_statement { (expression_statement (call_expression IDENT (argument_list ( IDENT , IDENT , IDENT ))) ;) })))) }))) (return_statement return IDENT ;) })))
(function_definition "uint * FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)\n\n{\n  int *piVar1;\n  wchar_t *__s2;\n  uint uVar2;\n  uint uVar3;\n  wchar_t *__s1;\n  uint *puVar4;\n  int iVar5;\n  int unaff_EDI;\n  int local_34;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00058c4a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    \n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    \n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }\n  if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }\n  return param_1;\n}" (type_identifier "uint") (pointer_declarator "* FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" (* "*") (function_declarator "FUN_00231280(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" (identifier "FUN_00231280") (parameter_list "(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" (( "(") (parameter_declaration "uint *param_1" (type_identifier "uint") (pointer_declarator "*param_1" (* "*") (identifier "param_1"))) (, ",") (parameter_declaration "uint param_2" (type_identifier "uint") (identifier "param_2")) (, ",") (parameter_declaration "uint param_3" (type_identifier "uint") (identifier "param_3")) (, ",") (parameter_declaration "uint param_4" (type_identifier "uint") (identifier "param_4")) (, ",") (parameter_declaration "uint param_5" (type_identifier "uint") (identifier "param_5")) () ")")))) (compound_statement "{\n  int *piVar1;\n  wchar_t *__s2;\n  uint uVar2;\n  uint uVar3;\n  wchar_t *__s1;\n  uint *puVar4;\n  int iVar5;\n  int unaff_EDI;\n  int local_34;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00058c4a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    \n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    \n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }\n  if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }\n  return param_1;\n}" ({ "{") (declaration "int *piVar1;" (primitive_type "int") (pointer_declarator "*piVar1" (* "*") (identifier "piVar1")) (; ";")) (declaration "wchar_t *__s2;" (type_identifier "wchar_t") (pointer_declarator "*__s2" (* "*") (identifier "__s2")) (; ";")) (declaration "uint uVar2;" (type_identifier "uint") (identifier "uVar2") (; ";")) (declaration "uint uVar3;" (type_identifier "uint") (identifier "uVar3") (; ";")) (declaration "wchar_t *__s1;" (type_identifier "wchar_t") (pointer_declarator "*__s1" (* "*") (identifier "__s1")) (; ";")) (declaration "uint *puVar4;" (type_identifier "uint") (pointer_declarator "*puVar4" (* "*") (identifier "puVar4")) (; ";")) (declaration "int iVar5;" (primitive_type "int") (identifier "iVar5") (; ";")) (declaration "int unaff_EDI;" (primitive_type "int") (identifier "unaff_EDI") (; ";")) (declaration "int local_34;" (primitive_type "int") (identifier "local_34") (; ";")) (declaration "undefined1 local_21;" (type_identifier "undefined1") (identifier "local_21") (; ";")) (declaration "int local_20 [4];" (primitive_type "int") (array_declarator "local_20 [4]" (identifier "local_20") ([ "[") (number_literal "4") (] "]")) (; ";")) (expression_statement "FUN_00058c4a();" (call_expression "FUN_00058c4a()" (identifier "FUN_00058c4a") (argument_list "()" (( "(") () ")"))) (; ";")) (expression_statement "uVar2 = *param_1;" (assignment_expression "uVar2 = *param_1" (identifier "uVar2") (= "=") (pointer_expression "*param_1" (* "*") (identifier "param_1"))) (; ";")) (expression_statement "uVar3 = *(uint *)(uVar2 - 0xc);" (assignment_expression "uVar3 = *(uint *)(uVar2 - 0xc)" (identifier "uVar3") (= "=") (pointer_expression "*(uint *)(uVar2 - 0xc)" (* "*") (cast_expression "(uint *)(uVar2 - 0xc)" (( "(") (type_descriptor "uint *" (type_identifier "uint") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(uVar2 - 0xc)" (( "(") (binary_expression "uVar2 - 0xc" (identifier "uVar2") (- "-") (number_literal "0xc")) () ")"))))) (; ";")) (if_statement "if (uVar3 < param_2) {\n                    \n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }" (if "if") (parenthesized_expression "(uVar3 < param_2)" (( "(") (binary_expression "uVar3 < param_2" (identifier "uVar3") (< "<") (identifier "param_2")) () ")")) (compound_statement "{\n                    \n    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);\n  }" ({ "{") (expression_statement "FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);" (call_expression "FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3)" (identifier "FUN_001f1f00") (argument_list "(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3)" (( "(") (binary_expression "unaff_EDI + 0x2482b" (identifier "unaff_EDI") (+ "+") (number_literal "0x2482b")) (, ",") (binary_expression "unaff_EDI + 0x3b409" (identifier "unaff_EDI") (+ "+") (number_literal "0x3b409")) (, ",") (identifier "param_2") (, ",") (identifier "uVar3") () ")"))) (; ";")) (} "}"))) (if_statement "if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }" (if "if") (parenthesized_expression "(uVar3 - param_2 <= param_3)" (( "(") (binary_expression "uVar3 - param_2 <= param_3" (binary_expression "uVar3 - param_2" (identifier "uVar3") (- "-") (identifier "param_2")) (<= "<=") (identifier "param_3")) () ")")) (compound_statement "{\n    param_3 = uVar3 - param_2;\n  }" ({ "{") (expression_statement "param_3 = uVar3 - param_2;" (assignment_expression "param_3 = uVar3 - param_2" (identifier "param_3") (= "=") (binary_expression "uVar3 - param_2" (identifier "uVar3") (- "-") (identifier "param_2"))) (; ";")) (} "}"))) (if_statement "if ((param_3 - uVar3) + 0xffffffe < param_5) {\n                    \n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }" (if "if") (parenthesized_expression "((param_3 - uVar3) + 0xffffffe < param_5)" (( "(") (binary_expression "(param_3 - uVar3) + 0xffffffe < param_5" (binary_expression "(param_3 - uVar3) + 0xffffffe" (parenthesized_expression "(param_3 - uVar3)" (( "(") (binary_expression "param_3 - uVar3" (identifier "param_3") (- "-") (identifier "uVar3")) () ")")) (+ "+") (number_literal "0xffffffe")) (< "<") (identifier "param_5")) () ")")) (compound_statement "{\n                    \n    FUN_001f1e60(unaff_EDI + 0x3b409);\n  }" ({ "{") (expression_statement "FUN_001f1e60(unaff_EDI + 0x3b409);" (call_expression "FUN_001f1e60(unaff_EDI + 0x3b409)" (identifier "FUN_001f1e60") (argument_list "(unaff_EDI + 0x3b409)" (( "(") (binary_expression "unaff_EDI + 0x3b409" (identifier "unaff_EDI") (+ "+") (number_literal "0x3b409")) () ")"))) (; ";")) (} "}"))) (if_statement "if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }" (if "if") (parenthesized_expression "(((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4)))" (( "(") (binary_expression "((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))" (parenthesized_expression "((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4))" (( "(") (binary_expression "(param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)" (parenthesized_expression "(param_4 < uVar2)" (( "(") (binary_expression "param_4 < uVar2" (identifier "param_4") (< "<") (identifier "uVar2")) () ")")) (|| "||") (parenthesized_expression "(uVar2 + uVar3 * 4 < param_4)" (( "(") (binary_expression "uVar2 + uVar3 * 4 < param_4" (binary_expression "uVar2 + uVar3 * 4" (identifier "uVar2") (+ "+") (binary_expression "uVar3 * 4" (identifier "uVar3") (* "*") (number_literal "4"))) (< "<") (identifier "param_4")) () ")"))) () ")")) (|| "||") (parenthesized_expression "(0 < *(int *)(uVar2 - 4))" (( "(") (binary_expression "0 < *(int *)(uVar2 - 4)" (number_literal "0") (< "<") (pointer_expression "*(int *)(uVar2 - 4)" (* "*") (cast_expression "(int *)(uVar2 - 4)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(uVar2 - 4)" (( "(") (binary_expression "uVar2 - 4" (identifier "uVar2") (- "-") (number_literal "4")) () ")"))))) () ")"))) () ")")) (compound_statement "{\n    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);\n  }" ({ "{") (expression_statement "param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);" (assignment_expression "param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5)" (identifier "param_1") (= "=") (cast_expression "(uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5)" (( "(") (type_descriptor "uint *" (type_identifier "uint") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "FUN_0022fe00(param_1,param_2,param_3,param_4,param_5)" (identifier "FUN_0022fe00") (argument_list "(param_1,param_2,param_3,param_4,param_5)" (( "(") (identifier "param_1") (, ",") (identifier "param_2") (, ",") (identifier "param_3") (, ",") (identifier "param_4") (, ",") (identifier "param_5") () ")"))))) (; ";")) (} "}")) (else_clause "else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }" (else "else") (compound_statement "{\n    uVar2 = *param_1;\n    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }\n    FUN_0022f5a0(param_1,param_2,param_3,param_5);\n    __s2 = (wchar_t *)(*param_1 + local_34 * 4);\n    __s1 = (wchar_t *)(*param_1 + param_2 * 4);\n    if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }\n  }" ({ "{") (expression_statement "uVar2 = *param_1;" (assignment_expression "uVar2 = *param_1" (identifier "uVar2") (= "=") (pointer_expression "*param_1" (* "*") (identifier "param_1"))) (; ";")) (if_statement "if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }\n    else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }" (if "if") (parenthesized_expression "(uVar2 + param_2 * 4 < param_4 + param_5 * 4)" (( "(") (binary_expression "uVar2 + param_2 * 4 < param_4 + param_5 * 4" (binary_expression "uVar2 + param_2 * 4" (identifier "uVar2") (+ "+") (binary_expression "param_2 * 4" (identifier "param_2") (* "*") (number_literal "4"))) (< "<") (binary_expression "param_4 + param_5 * 4" (identifier "param_4") (+ "+") (binary_expression "param_5 * 4" (identifier "param_5") (* "*") (number_literal "4")))) () ")")) (compound_statement "{\n      if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;\n    }" ({ "{") (if_statement "if (param_4 < uVar2 + (param_2 + param_3) * 4) {\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" (if "if") (parenthesized_expression "(param_4 < uVar2 + (param_2 + param_3) * 4)" (( "(") (binary_expression "param_4 < uVar2 + (param_2 + param_3) * 4" (identifier "param_4") (< "<") (binary_expression "uVar2 + (param_2 + param_3) * 4" (identifier "uVar2") (+ "+") (binary_expression "(param_2 + param_3) * 4" (parenthesized_expression "(param_2 + param_3)" (( "(") (binary_expression "param_2 + param_3" (identifier "param_2") (+ "+") (identifier "param_3")) () ")")) (* "*") (number_literal "4")))) () ")")) (compound_statement "{\n        FUN_00231240(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar5) {\n          return puVar4;\n        }\n        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" ({ "{") (expression_statement "FUN_00231240(local_20,param_4,param_5,&local_21);" (call_expression "FUN_00231240(local_20,param_4,param_5,&local_21)" (identifier "FUN_00231240") (argument_list "(local_20,param_4,param_5,&local_21)" (( "(") (identifier "local_20") (, ",") (identifier "param_4") (, ",") (identifier "param_5") (, ",") (pointer_expression "&local_21" (& "&") (identifier "local_21")) () ")"))) (; ";")) (expression_statement "puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);" (assignment_expression "puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5)" (identifier "puVar4") (= "=") (cast_expression "(uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5)" (( "(") (type_descriptor "uint *" (type_identifier "uint") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5)" (identifier "FUN_0022fe00") (argument_list "(param_1,param_2,param_3,local_20[0],param_5)" (( "(") (identifier "param_1") (, ",") (identifier "param_2") (, ",") (identifier "param_3") (, ",") (subscript_expression "local_20[0]" (identifier "local_20") ([ "[") (number_literal "0") (] "]")) (, ",") (identifier "param_5") () ")"))))) (; ";")) (if_statement "if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {\n          return puVar4;\n        }" (if "if") (parenthesized_expression "(local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb))" (( "(") (binary_expression "local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)" (binary_expression "local_20[0] + -0xc" (subscript_expression "local_20[0]" (identifier "local_20") ([ "[") (number_literal "0") (] "]")) (+ "+") (number_literal "-0xc")) (== "==") (pointer_expression "*(int *)(unaff_EDI + 0x10daeb)" (* "*") (cast_expression "(int *)(unaff_EDI + 0x10daeb)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(unaff_EDI + 0x10daeb)" (( "(") (binary_expression "unaff_EDI + 0x10daeb" (identifier "unaff_EDI") (+ "+") (number_literal "0x10daeb")) () ")"))))) () ")")) (compound_statement "{\n          return puVar4;\n        }" ({ "{") (return_statement "return puVar4;" (return "return") (identifier "puVar4") (; ";")) (} "}"))) (if_statement "if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" (if "if") (parenthesized_expression "(*(int *)(unaff_EDI + 0x10dcb3) == 0)" (( "(") (binary_expression "*(int *)(unaff_EDI + 0x10dcb3) == 0" (pointer_expression "*(int *)(unaff_EDI + 0x10dcb3)" (* "*") (cast_expression "(int *)(unaff_EDI + 0x10dcb3)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(unaff_EDI + 0x10dcb3)" (( "(") (binary_expression "unaff_EDI + 0x10dcb3" (identifier "unaff_EDI") (+ "+") (number_literal "0x10dcb3")) () ")")))) (== "==") (number_literal "0")) () ")")) (compound_statement "{\n          iVar5 = *(int *)(local_20[0] + -4);\n          *(int *)(local_20[0] + -4) = iVar5 + -1;\n        }" ({ "{") (expression_statement "iVar5 = *(int *)(local_20[0] + -4);" (assignment_expression "iVar5 = *(int *)(local_20[0] + -4)" (identifier "iVar5") (= "=") (pointer_expression "*(int *)(local_20[0] + -4)" (* "*") (cast_expression "(int *)(local_20[0] + -4)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(local_20[0] + -4)" (( "(") (binary_expression "local_20[0] + -4" (subscript_expression "local_20[0]" (identifier "local_20") ([ "[") (number_literal "0") (] "]")) (+ "+") (number_literal "-4")) () ")"))))) (; ";")) (expression_statement "*(int *)(local_20[0] + -4) = iVar5 + -1;" (assignment_expression "*(int *)(local_20[0] + -4) = iVar5 + -1" (pointer_expression "*(int *)(local_20[0] + -4)" (* "*") (cast_expression "(int *)(local_20[0] + -4)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(local_20[0] + -4)" (( "(") (binary_expression "local_20[0] + -4" (subscript_expression "local_20[0]" (identifier "local_20") ([ "[") (number_literal "0") (] "]")) (+ "+") (number_literal "-4")) () ")")))) (= "=") (binary_expression "iVar5 + -1" (identifier "iVar5") (+ "+") (number_literal "-1"))) (; ";")) (} "}")) (else_clause "else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" (else "else") (compound_statement "{\n          LOCK();\n          piVar1 = (int *)(local_20[0] + -4);\n          iVar5 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" ({ "{") (expression_statement "LOCK();" (call_expression "LOCK()" (identifier "LOCK") (argument_list "()" (( "(") () ")"))) (; ";")) (expression_statement "piVar1 = (int *)(local_20[0] + -4);" (assignment_expression "piVar1 = (int *)(local_20[0] + -4)" (identifier "piVar1") (= "=") (cast_expression "(int *)(local_20[0] + -4)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(local_20[0] + -4)" (( "(") (binary_expression "local_20[0] + -4" (subscript_expression "local_20[0]" (identifier "local_20") ([ "[") (number_literal "0") (] "]")) (+ "+") (number_literal "-4")) () ")")))) (; ";")) (expression_statement "iVar5 = *piVar1;" (assignment_expression "iVar5 = *piVar1" (identifier "iVar5") (= "=") (pointer_expression "*piVar1" (* "*") (identifier "piVar1"))) (; ";")) (expression_statement "*piVar1 = *piVar1 + -1;" (assignment_expression "*piVar1 = *piVar1 + -1" (pointer_expression "*piVar1" (* "*") (identifier "piVar1")) (= "=") (binary_expression "*piVar1 + -1" (pointer_expression "*piVar1" (* "*") (identifier "piVar1")) (+ "+") (number_literal "-1"))) (; ";")) (expression_statement "UNLOCK();" (call_expression "UNLOCK()" (identifier "UNLOCK") (argument_list "()" (( "(") () ")"))) (; ";")) (} "}")))) (if_statement "if (0 < iVar5) {\n          return puVar4;\n        }" (if "if") (parenthesized_expression "(0 < iVar5)" (( "(") (binary_expression "0 < iVar5" (number_literal "0") (< "<") (identifier "iVar5")) () ")")) (compound_statement "{\n          return puVar4;\n        }" ({ "{") (return_statement "return puVar4;" (return "return") (identifier "puVar4") (; ";")) (} "}"))) (expression_statement "FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);" (call_expression "FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0])" (identifier "FUN_0022f3c0") (argument_list "(local_20[0] + -0xc,&local_21,local_20[0],local_20[0])" (( "(") (binary_expression "local_20[0] + -0xc" (subscript_expression "local_20[0]" (identifier "local_20") ([ "[") (number_literal "0") (] "]")) (+ "+") (number_literal "-0xc")) (, ",") (pointer_expression "&local_21" (& "&") (identifier "local_21")) (, ",") (subscript_expression "local_20[0]" (identifier "local_20") ([ "[") (number_literal "0") (] "]")) (, ",") (subscript_expression "local_20[0]" (identifier "local_20") ([ "[") (number_literal "0") (] "]")) () ")"))) (; ";")) (return_statement "return puVar4;" (return "return") (identifier "puVar4") (; ";")) (} "}"))) (expression_statement "local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;" (assignment_expression "local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3" (identifier "local_34") (= "=") (binary_expression "(((int)(param_4 - uVar2) >> 2) + param_5) - param_3" (parenthesized_expression "(((int)(param_4 - uVar2) >> 2) + param_5)" (( "(") (binary_expression "((int)(param_4 - uVar2) >> 2) + param_5" (parenthesized_expression "((int)(param_4 - uVar2) >> 2)" (( "(") (binary_expression "(int)(param_4 - uVar2) >> 2" (cast_expression "(int)(param_4 - uVar2)" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (parenthesized_expression "(param_4 - uVar2)" (( "(") (binary_expression "param_4 - uVar2" (identifier "param_4") (- "-") (identifier "uVar2")) () ")"))) (>> ">>") (number_literal "2")) () ")")) (+ "+") (identifier "param_5")) () ")")) (- "-") (identifier "param_3"))) (; ";")) (} "}")) (else_clause "else {\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }" (else "else") (compound_statement "{\n      local_34 = (int)(param_4 - uVar2) >> 2;\n    }" ({ "{") (expression_statement "local_34 = (int)(param_4 - uVar2) >> 2;" (assignment_expression "local_34 = (int)(param_4 - uVar2) >> 2" (identifier "local_34") (= "=") (binary_expression "(int)(param_4 - uVar2) >> 2" (cast_expression "(int)(param_4 - uVar2)" (( "(") (type_descriptor "int" (primitive_type "int")) () ")") (parenthesized_expression "(param_4 - uVar2)" (( "(") (binary_expression "param_4 - uVar2" (identifier "param_4") (- "-") (identifier "uVar2")) () ")"))) (>> ">>") (number_literal "2"))) (; ";")) (} "}")))) (expression_statement "FUN_0022f5a0(param_1,param_2,param_3,param_5);" (call_expression "FUN_0022f5a0(param_1,param_2,param_3,param_5)" (identifier "FUN_0022f5a0") (argument_list "(param_1,param_2,param_3,param_5)" (( "(") (identifier "param_1") (, ",") (identifier "param_2") (, ",") (identifier "param_3") (, ",") (identifier "param_5") () ")"))) (; ";")) (expression_statement "__s2 = (wchar_t *)(*param_1 + local_34 * 4);" (assignment_expression "__s2 = (wchar_t *)(*param_1 + local_34 * 4)" (identifier "__s2") (= "=") (cast_expression "(wchar_t *)(*param_1 + local_34 * 4)" (( "(") (type_descriptor "wchar_t *" (type_identifier "wchar_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(*param_1 + local_34 * 4)" (( "(") (binary_expression "*param_1 + local_34 * 4" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (+ "+") (binary_expression "local_34 * 4" (identifier "local_34") (* "*") (number_literal "4"))) () ")")))) (; ";")) (expression_statement "__s1 = (wchar_t *)(*param_1 + param_2 * 4);" (assignment_expression "__s1 = (wchar_t *)(*param_1 + param_2 * 4)" (identifier "__s1") (= "=") (cast_expression "(wchar_t *)(*param_1 + param_2 * 4)" (( "(") (type_descriptor "wchar_t *" (type_identifier "wchar_t") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(*param_1 + param_2 * 4)" (( "(") (binary_expression "*param_1 + param_2 * 4" (pointer_expression "*param_1" (* "*") (identifier "param_1")) (+ "+") (binary_expression "param_2 * 4" (identifier "param_2") (* "*") (number_literal "4"))) () ")")))) (; ";")) (if_statement "if (param_5 == 1) {\n      *__s1 = *__s2;\n    }\n    else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }" (if "if") (parenthesized_expression "(param_5 == 1)" (( "(") (binary_expression "param_5 == 1" (identifier "param_5") (== "==") (number_literal "1")) () ")")) (compound_statement "{\n      *__s1 = *__s2;\n    }" ({ "{") (expression_statement "*__s1 = *__s2;" (assignment_expression "*__s1 = *__s2" (pointer_expression "*__s1" (* "*") (identifier "__s1")) (= "=") (pointer_expression "*__s2" (* "*") (identifier "__s2"))) (; ";")) (} "}")) (else_clause "else if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }" (else "else") (if_statement "if (param_5 != 0) {\n      wmemcpy(__s1,__s2,param_5);\n    }" (if "if") (parenthesized_expression "(param_5 != 0)" (( "(") (binary_expression "param_5 != 0" (identifier "param_5") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      wmemcpy(__s1,__s2,param_5);\n    }" ({ "{") (expression_statement "wmemcpy(__s1,__s2,param_5);" (call_expression "wmemcpy(__s1,__s2,param_5)" (identifier "wmemcpy") (argument_list "(__s1,__s2,param_5)" (( "(") (identifier "__s1") (, ",") (identifier "__s2") (, ",") (identifier "param_5") () ")"))) (; ";")) (} "}"))))) (} "}")))) (return_statement "return param_1;" (return "return") (identifier "param_1") (; ";")) (} "}")))

/* std::wstring::replace(unsigned int, unsigned int, wchar_t const*, unsigned int) */

type_3 * __thiscall
std::type_3::replace(type_3 *this,type_1 var_2,type_1 var_6,type_2 *var_9,type_1 var_7)

{
  type_2 *var_10;
  int var_12;
  type_2 *__s1;
  type_3 *pwVar3;
  type_2 var_5;
  int var_4;
  int var_17;
  type_4 local_21;
  type_2 *local_20 [4];
  
  var_1();
  var_10 = *(type_2 **)this;
  var_5 = var_10[-3];
  if ((type_1)var_5 < var_2) {
                    /* WARNING: Subroutine does not return */
    var_3
              ((char *)((int)&__DT_REL[0x25fb].r_offset + var_4 + 3),var_4 + 0x3b409,var_2
               ,var_5);
  }
  if ((type_1)(var_5 - var_2) <= var_6) {
    var_6 = var_5 - var_2;
  }
  if ((type_1)((var_6 - var_5) + 0xffffffeU) < var_7) {
                    /* WARNING: Subroutine does not return */
    var_8((char *)(var_4 + 0x3b409));
  }
  if (((var_9 < var_10) || (var_10 + var_5 < var_9)) || (L'\0' < var_10[-1])) {
    this = (type_3 *)var_11(this,var_2,var_6,var_9,var_7);
  }
  else {
    var_12 = *(int *)this;
    if ((type_2 *)(var_12 + var_2 * 4) < var_9 + var_7) {
      if (var_9 < (type_2 *)(var_12 + (var_2 + var_6) * 4)) {
        type_3((type_3 *)local_20,var_9,var_7,&local_21);
                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */
        pwVar3 = (type_3 *)var_11(this,var_2,var_6,local_20[0],var_7);
        if ((type_4 *)(local_20[0] + -3) == *(type_4 **)(var_4 + 0x10daeb)) {
          return pwVar3;
        }
        if (*(int *)(var_4 + 0x10dcb3) == 0) {
          var_5 = local_20[0][-1];
          local_20[0][-1] = var_5 + L'\xffffffff';
        }
        else {
          var_13();
          var_10 = local_20[0] + -1;
          var_5 = *var_10;
          *var_10 = *var_10 + L'\xffffffff';
          var_14();
        }
        if (L'\0' < var_5) {
          return pwVar3;
        }
        _Rep::var_15((type_4 *)(local_20[0] + -3));
        return pwVar3;
      }
      var_17 = (((int)var_9 - var_12 >> 2) + var_7) - var_6;
    }
    else {
      var_17 = (int)var_9 - var_12 >> 2;
    }
    var_16(this,var_2,var_6,var_7);
    var_10 = (type_2 *)(*(int *)this + var_17 * 4);
    __s1 = (type_2 *)(*(int *)this + var_2 * 4);
    if (var_7 == 1) {
      *__s1 = *var_10;
    }
    else if (var_7 != 0) {
      var_18(__s1,var_10,var_7);
    }
  }
  return this;
}


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

uint * MASKED(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)

{
  int *piVar1;
  wchar_t *__s2;
  uint uVar2;
  uint uVar3;
  wchar_t *__s1;
  uint *puVar4;
  int iVar5;
  int unaff_EDI;
  int local_34;
  undefined1 local_21;
  int local_20 [4];
  
  FUN_00058c4a();
  uVar2 = *param_1;
  uVar3 = *(uint *)(uVar2 - 0xc);
  if (uVar3 < param_2) {
                    /* WARNING: Subroutine does not return */
    FUN_001f1f00(unaff_EDI + 0x2482b,unaff_EDI + 0x3b409,param_2,uVar3);
  }
  if (uVar3 - param_2 <= param_3) {
    param_3 = uVar3 - param_2;
  }
  if ((param_3 - uVar3) + 0xffffffe < param_5) {
                    /* WARNING: Subroutine does not return */
    FUN_001f1e60(unaff_EDI + 0x3b409);
  }
  if (((param_4 < uVar2) || (uVar2 + uVar3 * 4 < param_4)) || (0 < *(int *)(uVar2 - 4))) {
    param_1 = (uint *)FUN_0022fe00(param_1,param_2,param_3,param_4,param_5);
  }
  else {
    uVar2 = *param_1;
    if (uVar2 + param_2 * 4 < param_4 + param_5 * 4) {
      if (param_4 < uVar2 + (param_2 + param_3) * 4) {
        FUN_00231240(local_20,param_4,param_5,&local_21);
                    /* try { // try from 002313c0 to 002313c4 has its CatchHandler @ 0023145f */
        puVar4 = (uint *)FUN_0022fe00(param_1,param_2,param_3,local_20[0],param_5);
        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x10daeb)) {
          return puVar4;
        }
        if (*(int *)(unaff_EDI + 0x10dcb3) == 0) {
          iVar5 = *(int *)(local_20[0] + -4);
          *(int *)(local_20[0] + -4) = iVar5 + -1;
        }
        else {
          LOCK();
          piVar1 = (int *)(local_20[0] + -4);
          iVar5 = *piVar1;
          *piVar1 = *piVar1 + -1;
          UNLOCK();
        }
        if (0 < iVar5) {
          return puVar4;
        }
        FUN_0022f3c0(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);
        return puVar4;
      }
      local_34 = (((int)(param_4 - uVar2) >> 2) + param_5) - param_3;
    }
    else {
      local_34 = (int)(param_4 - uVar2) >> 2;
    }
    FUN_0022f5a0(param_1,param_2,param_3,param_5);
    __s2 = (wchar_t *)(*param_1 + local_34 * 4);
    __s1 = (wchar_t *)(*param_1 + param_2 * 4);
    if (param_5 == 1) {
      *__s1 = *__s2;
    }
    else if (param_5 != 0) {
      wmemcpy(__s1,__s2,param_5);
    }
  }
  return param_1;
}

