
/* std::string::replace(unsigned int, unsigned int, char const*, unsigned int) */

string * __thiscall
std::string::replace(string *this,uint param_1,uint param_2,char *param_3,uint param_4)

{
  int *piVar1;
  uint uVar2;
  string *psVar3;
  int iVar4;
  char *pcVar5;
  int unaff_EDI;
  allocator local_21;
  uint local_20 [4];
  
  __x86_get_pc_thunk_di();
  pcVar5 = *(char **)this;
  uVar2 = *(uint *)(pcVar5 + -0xc);
  if (uVar2 < param_1) {
                    /* WARNING: Subroutine does not return */
    __throw_out_of_range_fmt((char *)(unaff_EDI + 0x9e657),unaff_EDI + 0xbaca9,param_1,uVar2);
  }
  if ((char *)(uVar2 - param_1) <= param_2) {
    param_2 = uVar2 - param_1;
  }
  if ((char *)(param_2 + (0x3ffffffc - uVar2)) < param_4) {
                    /* WARNING: Subroutine does not return */
    __throw_length_error((char *)(unaff_EDI + 0xbaca9));
  }
  if (((param_3 < pcVar5) || (pcVar5 + uVar2 < param_3)) || (0 < *(int *)(pcVar5 + -4))) {
    this = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,(uint)param_3);
  }
  else {
    iVar4 = *(int *)this;
    if ((char *)(iVar4 + param_1) < param_3 + param_4) {
      if (param_3 < (char *)(param_2 + iVar4 + param_1)) {
        string((string *)local_20,param_3,param_4,&local_21);
                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */
        psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0]);
        if ((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)) {
          return psVar3;
        }
        if (*(int *)(unaff_EDI + 0x2024af) == 0) {
          iVar4 = *(int *)(local_20[0] - 4);
          *(int *)(local_20[0] - 4) = iVar4 + -1;
        }
        else {
          LOCK();
          piVar1 = (int *)(local_20[0] - 4);
          iVar4 = *piVar1;
          *piVar1 = *piVar1 + -1;
          UNLOCK();
        }
        if (0 < iVar4) {
          return psVar3;
        }
        _Rep::_M_destroy((allocator *)(local_20[0] - 0xc));
        return psVar3;
      }
      iVar4 = (param_4 - iVar4) - param_2;
    }
    else {
      iVar4 = -iVar4;
    }
    _M_mutate((uint)this,param_1,param_2);
    pcVar5 = (char *)(param_1 + *(int *)this);
    if (param_4 == 1) {
      *pcVar5 = param_3[*(int *)this + iVar4];
    }
    else if (param_4 != 0) {
      memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4);
    }
  }
  return this;
}



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

{
  int *piVar1;
  uint uVar2;
  uint uVar3;
  uint *puVar4;
  undefined1 *__src;
  int iVar5;
  undefined1 *__dest;
  int unaff_EDI;
  int local_30;
  undefined1 local_21;
  int local_20 [4];
  
  FUN_00074f0a();
  uVar2 = *param_1;
  uVar3 = *(uint *)(uVar2 - 0xc);
  if (uVar3 < param_2) {
                    /* WARNING: Subroutine does not return */
    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);
  }
  if (uVar3 - param_2 <= param_3) {
    param_3 = uVar3 - param_2;
  }
  if ((param_3 - uVar3) + 0x3ffffffc < param_5) {
                    /* WARNING: Subroutine does not return */
    FUN_003f3a70(unaff_EDI + 0xbaca9);
  }
  if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {
    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);
  }
  else {
    uVar2 = *param_1;
    if (uVar2 + param_2 < param_5 + param_4) {
      if (param_4 < param_2 + param_3 + uVar2) {
        FUN_003e7b00(local_20,param_4,param_5,&local_21);
                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */
        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);
        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {
          return puVar4;
        }
        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);
        return puVar4;
      }
      local_30 = ((param_4 - uVar2) + param_5) - param_3;
    }
    else {
      local_30 = param_4 - uVar2;
    }
    FUN_003e5e60(param_1,param_2,param_3,param_5);
    __src = (undefined1 *)(local_30 + *param_1);
    __dest = (undefined1 *)(param_2 + *param_1);
    if (param_5 == 1) {
      *__dest = *__src;
    }
    else if (param_5 != 0) {
      memcpy(__dest,__src,param_5);
    }
  }
  return param_1;
}


PUSH EBP
MOV EBP,ESP
PUSH EDI
CALL 0x00074f0a
ADD EDI,0x2024b7
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 0x003e7cf1
MOV EBX,EAX
SUB EBX,EDX
CMP EBX,ESI
CMOVBE ESI,EBX
MOV EBX,ESI
SUB EBX,EAX
ADD EBX,0x3ffffffc
CMP dword ptr [EBP + 0x18],EBX
JA 0x003e7ce0
MOV EBX,dword ptr [EBP + -0x2c]
CMP EBX,ECX
JBE 0x003e7bb8
SUB ESP,0xc
PUSH dword ptr [EBP + 0x18]
MOV EBX,EDI
PUSH ECX
PUSH ESI
PUSH EDX
PUSH dword ptr [EBP + 0x8]
CALL 0x003e6700
ADD ESP,0x20
MOV ESI,EAX
LEA ESP,[EBP + -0xc]
MOV EAX,ESI
POP EBX
POP ESI
POP EDI
POP EBP
RET
ADD EAX,EBX
CMP EAX,ECX
JC 0x003e7b93
MOV EAX,dword ptr [EBX + -0x4]
TEST EAX,EAX
JG 0x003e7b93
MOV EAX,dword ptr [EBP + 0x8]
MOV EBX,dword ptr [EBP + 0x18]
MOV EAX,dword ptr [EAX]
ADD EBX,ECX
MOV dword ptr [EBP + -0x2c],EBX
LEA EBX,[EAX + EDX*0x1]
CMP dword ptr [EBP + -0x2c],EBX
JBE 0x003e7cb8
LEA EBX,[EDX + ESI*0x1]
ADD EBX,EAX
CMP ECX,EBX
JC 0x003e7c40
SUB ECX,EAX
ADD ECX,dword ptr [EBP + 0x18]
SUB ECX,ESI
MOV dword ptr [EBP + -0x2c],ECX
PUSH dword ptr [EBP + 0x18]
MOV EBX,EDI
PUSH ESI
PUSH EDX
PUSH dword ptr [EBP + 0x8]
MOV dword ptr [EBP + 0xc],EDX
CALL 0x003e5e60
MOV EAX,dword ptr [EBP + 0x8]
MOV ECX,dword ptr [EBP + -0x2c]
ADD ESP,0x10
MOV EDX,dword ptr [EBP + 0xc]
MOV EAX,dword ptr [EAX]
ADD ECX,EAX
ADD EDX,EAX
CMP dword ptr [EBP + 0x18],0x1
JZ 0x003e7cc8
MOV EBX,dword ptr [EBP + 0x18]
MOV ESI,dword ptr [EBP + 0x8]
TEST EBX,EBX
JZ 0x003e7bab
SUB ESP,0x4
PUSH dword ptr [EBP + 0x18]
MOV EBX,EDI
PUSH ECX
PUSH EDX
CALL 0x000392d0
ADD ESP,0x10
JMP 0x003e7bab
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 0x003e7b00
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 0x003e6700
MOV ESI,EAX
MOV EAX,dword ptr [EBP + -0x1c]
ADD ESP,0x20
LEA EDX,[EAX + -0xc]
CMP EDX,dword ptr [EDI + 0xfffffffc]
JZ 0x003e7bab
MOV ECX,dword ptr [EDI + 0xfffffff8]
TEST ECX,ECX
JZ 0x003e7cd5
MOV ECX,0xffffffff
XADD.LOCK dword ptr [EAX + -0x4],ECX
TEST ECX,ECX
JG 0x003e7bab
PUSH EAX
MOV EBX,EDI
PUSH EAX
PUSH dword ptr [EBP + -0x2c]
PUSH EDX
CALL 0x003e5c80
ADD ESP,0x10
JMP 0x003e7bab
SUB ECX,EAX
MOV dword ptr [EBP + -0x2c],ECX
JMP 0x003e7bf1
MOVZX EAX,byte ptr [ECX]
MOV ESI,dword ptr [EBP + 0x8]
MOV byte ptr [EDX],AL
JMP 0x003e7bab
MOV ECX,dword ptr [EAX + -0x4]
LEA EBX,[ECX + -0x1]
MOV dword ptr [EAX + -0x4],EBX
JMP 0x003e7c98
SUB ESP,0xc
LEA EAX,[EDI + 0xffeb87f2]
MOV EBX,EDI
PUSH EAX
CALL 0x003f3a70
PUSH EAX
LEA EAX,[EDI + 0xffeb87f2]
MOV EBX,EDI
PUSH EDX
PUSH EAX
LEA EAX,[EDI + 0xffe9c1a0]
PUSH EAX
CALL 0x003f3b10
(translation_unit "uint * FUN_003e7b40(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)\n\n{\n  int *piVar1;\n  uint uVar2;\n  uint uVar3;\n  uint *puVar4;\n  undefined1 *__src;\n  int iVar5;\n  undefined1 *__dest;\n  int unaff_EDI;\n  int local_30;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00074f0a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    /* WARNING: Subroutine does not return */\n    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0x3ffffffc < param_5) {\n                    /* WARNING: Subroutine does not return */\n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }\n  if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }\n  return param_1;\n}\n\n" (function_definition "uint * FUN_003e7b40(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)\n\n{\n  int *piVar1;\n  uint uVar2;\n  uint uVar3;\n  uint *puVar4;\n  undefined1 *__src;\n  int iVar5;\n  undefined1 *__dest;\n  int unaff_EDI;\n  int local_30;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00074f0a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    /* WARNING: Subroutine does not return */\n    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0x3ffffffc < param_5) {\n                    /* WARNING: Subroutine does not return */\n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }\n  if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }\n  return param_1;\n}" type_identifier (pointer_declarator "* FUN_003e7b40(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" * (function_declarator "FUN_003e7b40(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  uint uVar2;\n  uint uVar3;\n  uint *puVar4;\n  undefined1 *__src;\n  int iVar5;\n  undefined1 *__dest;\n  int unaff_EDI;\n  int local_30;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00074f0a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    /* WARNING: Subroutine does not return */\n    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0x3ffffffc < param_5) {\n                    /* WARNING: Subroutine does not return */\n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }\n  if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }\n  return param_1;\n}" { (declaration "int *piVar1;" primitive_type (pointer_declarator "*piVar1" * identifier) ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (declaration "uint *puVar4;" type_identifier (pointer_declarator "*puVar4" * identifier) ;) (declaration "undefined1 *__src;" type_identifier (pointer_declarator "*__src" * identifier) ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "undefined1 *__dest;" type_identifier (pointer_declarator "*__dest" * identifier) ;) (declaration "int unaff_EDI;" primitive_type identifier ;) (declaration "int local_30;" 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_00074f0a();" (call_expression "FUN_00074f0a()" 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_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,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_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }" { comment (expression_statement "FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);" (call_expression "FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3)" identifier (argument_list "(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3)" ( (binary_expression "&UNK_0009e657 + unaff_EDI" (pointer_expression "&UNK_0009e657" & identifier) + identifier) , (binary_expression "unaff_EDI + 0xbaca9" 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) + 0x3ffffffc < param_5) {\n                    /* WARNING: Subroutine does not return */\n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }" if (parenthesized_expression "((param_3 - uVar3) + 0x3ffffffc < param_5)" ( (binary_expression "(param_3 - uVar3) + 0x3ffffffc < param_5" (binary_expression "(param_3 - uVar3) + 0x3ffffffc" (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_003f3a70(unaff_EDI + 0xbaca9);\n  }" { comment (expression_statement "FUN_003f3a70(unaff_EDI + 0xbaca9);" (call_expression "FUN_003f3a70(unaff_EDI + 0xbaca9)" identifier (argument_list "(unaff_EDI + 0xbaca9)" ( (binary_expression "unaff_EDI + 0xbaca9" identifier + number_literal) ))) ;) })) (if_statement "if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }" if (parenthesized_expression "(((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4)))" ( (binary_expression "((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))" (parenthesized_expression "((param_4 < uVar2) || (uVar3 + uVar2 < param_4))" ( (binary_expression "(param_4 < uVar2) || (uVar3 + uVar2 < param_4)" (parenthesized_expression "(param_4 < uVar2)" ( (binary_expression "param_4 < uVar2" identifier < identifier) )) || (parenthesized_expression "(uVar3 + uVar2 < param_4)" ( (binary_expression "uVar3 + uVar2 < param_4" (binary_expression "uVar3 + uVar2" identifier + identifier) < 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_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }" { (expression_statement "param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);" (assignment_expression "param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5)" identifier = (cast_expression "(uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_003e6700(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 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }" else (compound_statement "{\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,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 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }" if (parenthesized_expression "(uVar2 + param_2 < param_5 + param_4)" ( (binary_expression "uVar2 + param_2 < param_5 + param_4" (binary_expression "uVar2 + param_2" identifier + identifier) < (binary_expression "param_5 + param_4" identifier + identifier)) )) (compound_statement "{\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }" { (if_statement "if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" if (parenthesized_expression "(param_4 < param_2 + param_3 + uVar2)" ( (binary_expression "param_4 < param_2 + param_3 + uVar2" identifier < (binary_expression "param_2 + param_3 + uVar2" (binary_expression "param_2 + param_3" identifier + identifier) + identifier)) )) (compound_statement "{\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" { (expression_statement "FUN_003e7b00(local_20,param_4,param_5,&local_21);" (call_expression "FUN_003e7b00(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_003e6700(param_1,param_2,param_3,local_20[0],param_5);" (assignment_expression "puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5)" identifier = (cast_expression "(uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_003e6700(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 + 0x2024b3)) {\n          return puVar4;\n        }" if (parenthesized_expression "(local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3))" ( (binary_expression "local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)" (binary_expression "local_20[0] + -0xc" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) == (pointer_expression "*(int *)(unaff_EDI + 0x2024b3)" * (cast_expression "(int *)(unaff_EDI + 0x2024b3)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x2024b3)" ( (binary_expression "unaff_EDI + 0x2024b3" identifier + number_literal) ))))) )) (compound_statement "{\n          return puVar4;\n        }" { (return_statement "return puVar4;" return identifier ;) })) (if_statement "if (*(int *)(unaff_EDI + 0x2024af) == 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 + 0x2024af) == 0)" ( (binary_expression "*(int *)(unaff_EDI + 0x2024af) == 0" (pointer_expression "*(int *)(unaff_EDI + 0x2024af)" * (cast_expression "(int *)(unaff_EDI + 0x2024af)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x2024af)" ( (binary_expression "unaff_EDI + 0x2024af" 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);" (call_expression "FUN_003e5c80(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_30 = ((param_4 - uVar2) + param_5) - param_3;" (assignment_expression "local_30 = ((param_4 - uVar2) + param_5) - param_3" identifier = (binary_expression "((param_4 - uVar2) + param_5) - param_3" (parenthesized_expression "((param_4 - uVar2) + param_5)" ( (binary_expression "(param_4 - uVar2) + param_5" (parenthesized_expression "(param_4 - uVar2)" ( (binary_expression "param_4 - uVar2" identifier - identifier) )) + identifier) )) - identifier)) ;) }) (else_clause "else {\n      local_30 = param_4 - uVar2;\n    }" else (compound_statement "{\n      local_30 = param_4 - uVar2;\n    }" { (expression_statement "local_30 = param_4 - uVar2;" (assignment_expression "local_30 = param_4 - uVar2" identifier = (binary_expression "param_4 - uVar2" identifier - identifier)) ;) }))) (expression_statement "FUN_003e5e60(param_1,param_2,param_3,param_5);" (call_expression "FUN_003e5e60(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 "__src = (undefined1 *)(local_30 + *param_1);" (assignment_expression "__src = (undefined1 *)(local_30 + *param_1)" identifier = (cast_expression "(undefined1 *)(local_30 + *param_1)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_30 + *param_1)" ( (binary_expression "local_30 + *param_1" identifier + (pointer_expression "*param_1" * identifier)) )))) ;) (expression_statement "__dest = (undefined1 *)(param_2 + *param_1);" (assignment_expression "__dest = (undefined1 *)(param_2 + *param_1)" identifier = (cast_expression "(undefined1 *)(param_2 + *param_1)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + *param_1)" ( (binary_expression "param_2 + *param_1" identifier + (pointer_expression "*param_1" * identifier)) )))) ;) (if_statement "if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }" if (parenthesized_expression "(param_5 == 1)" ( (binary_expression "param_5 == 1" identifier == number_literal) )) (compound_statement "{\n      *__dest = *__src;\n    }" { (expression_statement "*__dest = *__src;" (assignment_expression "*__dest = *__src" (pointer_expression "*__dest" * identifier) = (pointer_expression "*__src" * identifier)) ;) }) (else_clause "else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }" else (if_statement "if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }" if (parenthesized_expression "(param_5 != 0)" ( (binary_expression "param_5 != 0" identifier != number_literal) )) (compound_statement "{\n      memcpy(__dest,__src,param_5);\n    }" { (expression_statement "memcpy(__dest,__src,param_5);" (call_expression "memcpy(__dest,__src,param_5)" identifier (argument_list "(__dest,__src,param_5)" ( identifier , identifier , identifier ))) ;) })))) }))) (return_statement "return param_1;" return identifier ;) })))
(translation_unit "/* std::string::replace(unsigned int, unsigned int, char const*, unsigned int) */\n\nstring * __thiscall\nstd::string::replace(string *this,uint param_1,uint param_2,char *param_3,uint param_4)\n\n{\n  int *piVar1;\n  uint uVar2;\n  string *psVar3;\n  int iVar4;\n  char *pcVar5;\n  int unaff_EDI;\n  allocator local_21;\n  uint local_20 [4];\n  \n  __x86_get_pc_thunk_di();\n  pcVar5 = *(char **)this;\n  uVar2 = *(uint *)(pcVar5 + -0xc);\n  if (uVar2 < param_1) {\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt((char *)(unaff_EDI + 0x9e657),unaff_EDI + 0xbaca9,param_1,uVar2);\n  }\n  if ((char *)(uVar2 - param_1) <= param_2) {\n    param_2 = uVar2 - param_1;\n  }\n  if ((char *)(param_2 + (0x3ffffffc - uVar2)) < param_4) {\n                    /* WARNING: Subroutine does not return */\n    __throw_length_error((char *)(unaff_EDI + 0xbaca9));\n  }\n  if (((param_3 < pcVar5) || (pcVar5 + uVar2 < param_3)) || (0 < *(int *)(pcVar5 + -4))) {\n    this = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,(uint)param_3);\n  }\n  else {\n    iVar4 = *(int *)this;\n    if ((char *)(iVar4 + param_1) < param_3 + param_4) {\n      if (param_3 < (char *)(param_2 + iVar4 + param_1)) {\n        string((string *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0]);\n        if ((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)) {\n          return psVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 0) {\n          iVar4 = *(int *)(local_20[0] - 4);\n          *(int *)(local_20[0] - 4) = iVar4 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar4) {\n          return psVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] - 0xc));\n        return psVar3;\n      }\n      iVar4 = (param_4 - iVar4) - param_2;\n    }\n    else {\n      iVar4 = -iVar4;\n    }\n    _M_mutate((uint)this,param_1,param_2);\n    pcVar5 = (char *)(param_1 + *(int *)this);\n    if (param_4 == 1) {\n      *pcVar5 = param_3[*(int *)this + iVar4];\n    }\n    else if (param_4 != 0) {\n      memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4);\n    }\n  }\n  return this;\n}\n\n" comment (ERROR "string * __thiscall\nstd::string::replace(string *this," (binary_expression "string * __thiscall\nstd::string::replace(string *this" (binary_expression "string * __thiscall" identifier * identifier) (ERROR "std::string::replace(string" identifier : : identifier : : identifier ( identifier) * identifier) ,) (declaration "uint param_1,uint param_2,char *param_3,uint param_4)\n\n{\n  int *piVar1;" type_identifier identifier , (ERROR "uint" identifier) identifier , (ERROR "char" identifier) (pointer_declarator "*param_3" * identifier) , (ERROR "uint param_4)\n\n{\n  int" identifier identifier ) { primitive_type) (pointer_declarator "*piVar1" * identifier) ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "string *psVar3;" type_identifier (pointer_declarator "*psVar3" * identifier) ;) (declaration "int iVar4;" primitive_type identifier ;) (declaration "char *pcVar5;" primitive_type (pointer_declarator "*pcVar5" * identifier) ;) (declaration "int unaff_EDI;" primitive_type identifier ;) (declaration "allocator local_21;" type_identifier identifier ;) (declaration "uint local_20 [4];" type_identifier (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 "pcVar5 = *(char **)this;" (assignment_expression "pcVar5 = *(char **)this" identifier = (pointer_expression "*(char **)this" * (cast_expression "(char **)this" ( (type_descriptor "char **" primitive_type (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) identifier))) ;) (expression_statement "uVar2 = *(uint *)(pcVar5 + -0xc);" (assignment_expression "uVar2 = *(uint *)(pcVar5 + -0xc)" identifier = (pointer_expression "*(uint *)(pcVar5 + -0xc)" * (cast_expression "(uint *)(pcVar5 + -0xc)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(pcVar5 + -0xc)" ( (binary_expression "pcVar5 + -0xc" identifier + number_literal) ))))) ;) (if_statement "if (uVar2 < param_1) {\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt((char *)(unaff_EDI + 0x9e657),unaff_EDI + 0xbaca9,param_1,uVar2);\n  }" if (parenthesized_expression "(uVar2 < param_1)" ( (binary_expression "uVar2 < param_1" identifier < identifier) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    __throw_out_of_range_fmt((char *)(unaff_EDI + 0x9e657),unaff_EDI + 0xbaca9,param_1,uVar2);\n  }" { comment (expression_statement "__throw_out_of_range_fmt((char *)(unaff_EDI + 0x9e657),unaff_EDI + 0xbaca9,param_1,uVar2);" (call_expression "__throw_out_of_range_fmt((char *)(unaff_EDI + 0x9e657),unaff_EDI + 0xbaca9,param_1,uVar2)" identifier (argument_list "((char *)(unaff_EDI + 0x9e657),unaff_EDI + 0xbaca9,param_1,uVar2)" ( (cast_expression "(char *)(unaff_EDI + 0x9e657)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x9e657)" ( (binary_expression "unaff_EDI + 0x9e657" identifier + number_literal) ))) , (binary_expression "unaff_EDI + 0xbaca9" identifier + number_literal) , identifier , identifier ))) ;) })) (if_statement "if ((char *)(uVar2 - param_1) <= param_2) {\n    param_2 = uVar2 - param_1;\n  }" if (parenthesized_expression "((char *)(uVar2 - param_1) <= param_2)" ( (binary_expression "(char *)(uVar2 - param_1) <= param_2" (cast_expression "(char *)(uVar2 - param_1)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(uVar2 - param_1)" ( (binary_expression "uVar2 - param_1" identifier - identifier) ))) <= identifier) )) (compound_statement "{\n    param_2 = uVar2 - param_1;\n  }" { (expression_statement "param_2 = uVar2 - param_1;" (assignment_expression "param_2 = uVar2 - param_1" identifier = (binary_expression "uVar2 - param_1" identifier - identifier)) ;) })) (if_statement "if ((char *)(param_2 + (0x3ffffffc - uVar2)) < param_4) {\n                    /* WARNING: Subroutine does not return */\n    __throw_length_error((char *)(unaff_EDI + 0xbaca9));\n  }" if (parenthesized_expression "((char *)(param_2 + (0x3ffffffc - uVar2)) < param_4)" ( (binary_expression "(char *)(param_2 + (0x3ffffffc - uVar2)) < param_4" (cast_expression "(char *)(param_2 + (0x3ffffffc - uVar2))" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + (0x3ffffffc - uVar2))" ( (binary_expression "param_2 + (0x3ffffffc - uVar2)" identifier + (parenthesized_expression "(0x3ffffffc - uVar2)" ( (binary_expression "0x3ffffffc - uVar2" number_literal - identifier) ))) ))) < identifier) )) (compound_statement "{\n                    /* WARNING: Subroutine does not return */\n    __throw_length_error((char *)(unaff_EDI + 0xbaca9));\n  }" { comment (expression_statement "__throw_length_error((char *)(unaff_EDI + 0xbaca9));" (call_expression "__throw_length_error((char *)(unaff_EDI + 0xbaca9))" identifier (argument_list "((char *)(unaff_EDI + 0xbaca9))" ( (cast_expression "(char *)(unaff_EDI + 0xbaca9)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0xbaca9)" ( (binary_expression "unaff_EDI + 0xbaca9" identifier + number_literal) ))) ))) ;) })) (if_statement "if (((param_3 < pcVar5) || (pcVar5 + uVar2 < param_3)) || (0 < *(int *)(pcVar5 + -4))) {\n    this = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,(uint)param_3);\n  }\n  else {\n    iVar4 = *(int *)this;\n    if ((char *)(iVar4 + param_1) < param_3 + param_4) {\n      if (param_3 < (char *)(param_2 + iVar4 + param_1)) {\n        string((string *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0]);\n        if ((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)) {\n          return psVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 0) {\n          iVar4 = *(int *)(local_20[0] - 4);\n          *(int *)(local_20[0] - 4) = iVar4 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar4) {\n          return psVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] - 0xc));\n        return psVar3;\n      }\n      iVar4 = (param_4 - iVar4) - param_2;\n    }\n    else {\n      iVar4 = -iVar4;\n    }\n    _M_mutate((uint)this,param_1,param_2);\n    pcVar5 = (char *)(param_1 + *(int *)this);\n    if (param_4 == 1) {\n      *pcVar5 = param_3[*(int *)this + iVar4];\n    }\n    else if (param_4 != 0) {\n      memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4);\n    }\n  }" if (parenthesized_expression "(((param_3 < pcVar5) || (pcVar5 + uVar2 < param_3)) || (0 < *(int *)(pcVar5 + -4)))" ( (binary_expression "((param_3 < pcVar5) || (pcVar5 + uVar2 < param_3)) || (0 < *(int *)(pcVar5 + -4))" (parenthesized_expression "((param_3 < pcVar5) || (pcVar5 + uVar2 < param_3))" ( (binary_expression "(param_3 < pcVar5) || (pcVar5 + uVar2 < param_3)" (parenthesized_expression "(param_3 < pcVar5)" ( (binary_expression "param_3 < pcVar5" identifier < identifier) )) || (parenthesized_expression "(pcVar5 + uVar2 < param_3)" ( (binary_expression "pcVar5 + uVar2 < param_3" (binary_expression "pcVar5 + uVar2" identifier + identifier) < identifier) ))) )) || (parenthesized_expression "(0 < *(int *)(pcVar5 + -4))" ( (binary_expression "0 < *(int *)(pcVar5 + -4)" number_literal < (pointer_expression "*(int *)(pcVar5 + -4)" * (cast_expression "(int *)(pcVar5 + -4)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(pcVar5 + -4)" ( (binary_expression "pcVar5 + -4" identifier + number_literal) ))))) ))) )) (compound_statement "{\n    this = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,(uint)param_3);\n  }" { (expression_statement "this = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,(uint)param_3);" (assignment_expression "this = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,(uint)param_3)" identifier = (cast_expression "(string *)_M_replace_safe((uint)this,param_1,(char *)param_2,(uint)param_3)" ( (type_descriptor "string *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "_M_replace_safe((uint)this,param_1,(char *)param_2,(uint)param_3)" identifier (argument_list "((uint)this,param_1,(char *)param_2,(uint)param_3)" ( (cast_expression "(uint)this" ( (type_descriptor "uint" type_identifier) ) identifier) , identifier , (cast_expression "(char *)param_2" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier) , (cast_expression "(uint)param_3" ( (type_descriptor "uint" type_identifier) ) identifier) ))))) ;) }) (else_clause "else {\n    iVar4 = *(int *)this;\n    if ((char *)(iVar4 + param_1) < param_3 + param_4) {\n      if (param_3 < (char *)(param_2 + iVar4 + param_1)) {\n        string((string *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0]);\n        if ((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)) {\n          return psVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 0) {\n          iVar4 = *(int *)(local_20[0] - 4);\n          *(int *)(local_20[0] - 4) = iVar4 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar4) {\n          return psVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] - 0xc));\n        return psVar3;\n      }\n      iVar4 = (param_4 - iVar4) - param_2;\n    }\n    else {\n      iVar4 = -iVar4;\n    }\n    _M_mutate((uint)this,param_1,param_2);\n    pcVar5 = (char *)(param_1 + *(int *)this);\n    if (param_4 == 1) {\n      *pcVar5 = param_3[*(int *)this + iVar4];\n    }\n    else if (param_4 != 0) {\n      memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4);\n    }\n  }" else (compound_statement "{\n    iVar4 = *(int *)this;\n    if ((char *)(iVar4 + param_1) < param_3 + param_4) {\n      if (param_3 < (char *)(param_2 + iVar4 + param_1)) {\n        string((string *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0]);\n        if ((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)) {\n          return psVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 0) {\n          iVar4 = *(int *)(local_20[0] - 4);\n          *(int *)(local_20[0] - 4) = iVar4 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar4) {\n          return psVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] - 0xc));\n        return psVar3;\n      }\n      iVar4 = (param_4 - iVar4) - param_2;\n    }\n    else {\n      iVar4 = -iVar4;\n    }\n    _M_mutate((uint)this,param_1,param_2);\n    pcVar5 = (char *)(param_1 + *(int *)this);\n    if (param_4 == 1) {\n      *pcVar5 = param_3[*(int *)this + iVar4];\n    }\n    else if (param_4 != 0) {\n      memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4);\n    }\n  }" { (expression_statement "iVar4 = *(int *)this;" (assignment_expression "iVar4 = *(int *)this" identifier = (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier))) ;) (if_statement "if ((char *)(iVar4 + param_1) < param_3 + param_4) {\n      if (param_3 < (char *)(param_2 + iVar4 + param_1)) {\n        string((string *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0]);\n        if ((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)) {\n          return psVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 0) {\n          iVar4 = *(int *)(local_20[0] - 4);\n          *(int *)(local_20[0] - 4) = iVar4 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar4) {\n          return psVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] - 0xc));\n        return psVar3;\n      }\n      iVar4 = (param_4 - iVar4) - param_2;\n    }\n    else {\n      iVar4 = -iVar4;\n    }" if (parenthesized_expression "((char *)(iVar4 + param_1) < param_3 + param_4)" ( (binary_expression "(char *)(iVar4 + param_1) < param_3 + param_4" (cast_expression "(char *)(iVar4 + param_1)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(iVar4 + param_1)" ( (binary_expression "iVar4 + param_1" identifier + identifier) ))) < (binary_expression "param_3 + param_4" identifier + identifier)) )) (compound_statement "{\n      if (param_3 < (char *)(param_2 + iVar4 + param_1)) {\n        string((string *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0]);\n        if ((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)) {\n          return psVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 0) {\n          iVar4 = *(int *)(local_20[0] - 4);\n          *(int *)(local_20[0] - 4) = iVar4 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar4) {\n          return psVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] - 0xc));\n        return psVar3;\n      }\n      iVar4 = (param_4 - iVar4) - param_2;\n    }" { (if_statement "if (param_3 < (char *)(param_2 + iVar4 + param_1)) {\n        string((string *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0]);\n        if ((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)) {\n          return psVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 0) {\n          iVar4 = *(int *)(local_20[0] - 4);\n          *(int *)(local_20[0] - 4) = iVar4 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar4) {\n          return psVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] - 0xc));\n        return psVar3;\n      }" if (parenthesized_expression "(param_3 < (char *)(param_2 + iVar4 + param_1))" ( (binary_expression "param_3 < (char *)(param_2 + iVar4 + param_1)" identifier < (cast_expression "(char *)(param_2 + iVar4 + param_1)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + iVar4 + param_1)" ( (binary_expression "param_2 + iVar4 + param_1" (binary_expression "param_2 + iVar4" identifier + identifier) + identifier) )))) )) (compound_statement "{\n        string((string *)local_20,param_3,param_4,&local_21);\n                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */\n        psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0]);\n        if ((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)) {\n          return psVar3;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 0) {\n          iVar4 = *(int *)(local_20[0] - 4);\n          *(int *)(local_20[0] - 4) = iVar4 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }\n        if (0 < iVar4) {\n          return psVar3;\n        }\n        _Rep::_M_destroy((allocator *)(local_20[0] - 0xc));\n        return psVar3;\n      }" { (expression_statement "string((string *)local_20,param_3,param_4,&local_21);" (call_expression "string((string *)local_20,param_3,param_4,&local_21)" identifier (argument_list "((string *)local_20,param_3,param_4,&local_21)" ( (cast_expression "(string *)local_20" ( (type_descriptor "string *" type_identifier (abstract_pointer_declarator "*" *)) ) identifier) , identifier , identifier , (pointer_expression "&local_21" & identifier) ))) ;) comment (expression_statement "psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0]);" (assignment_expression "psVar3 = (string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0])" identifier = (cast_expression "(string *)_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0])" ( (type_descriptor "string *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "_M_replace_safe((uint)this,param_1,(char *)param_2,local_20[0])" identifier (argument_list "((uint)this,param_1,(char *)param_2,local_20[0])" ( (cast_expression "(uint)this" ( (type_descriptor "uint" type_identifier) ) identifier) , identifier , (cast_expression "(char *)param_2" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier) , (subscript_expression "local_20[0]" identifier [ number_literal ]) ))))) ;) (if_statement "if ((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)) {\n          return psVar3;\n        }" if (parenthesized_expression "((allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3))" ( (binary_expression "(allocator *)(local_20[0] - 0xc) == *(allocator **)(unaff_EDI + 0x2024b3)" (cast_expression "(allocator *)(local_20[0] - 0xc)" ( (type_descriptor "allocator *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_20[0] - 0xc)" ( (binary_expression "local_20[0] - 0xc" (subscript_expression "local_20[0]" identifier [ number_literal ]) - number_literal) ))) == (pointer_expression "*(allocator **)(unaff_EDI + 0x2024b3)" * (cast_expression "(allocator **)(unaff_EDI + 0x2024b3)" ( (type_descriptor "allocator **" type_identifier (abstract_pointer_declarator "**" * (abstract_pointer_declarator "*" *))) ) (parenthesized_expression "(unaff_EDI + 0x2024b3)" ( (binary_expression "unaff_EDI + 0x2024b3" identifier + number_literal) ))))) )) (compound_statement "{\n          return psVar3;\n        }" { (return_statement "return psVar3;" return identifier ;) })) (if_statement "if (*(int *)(unaff_EDI + 0x2024af) == 0) {\n          iVar4 = *(int *)(local_20[0] - 4);\n          *(int *)(local_20[0] - 4) = iVar4 + -1;\n        }\n        else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" if (parenthesized_expression "(*(int *)(unaff_EDI + 0x2024af) == 0)" ( (binary_expression "*(int *)(unaff_EDI + 0x2024af) == 0" (pointer_expression "*(int *)(unaff_EDI + 0x2024af)" * (cast_expression "(int *)(unaff_EDI + 0x2024af)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x2024af)" ( (binary_expression "unaff_EDI + 0x2024af" identifier + number_literal) )))) == number_literal) )) (compound_statement "{\n          iVar4 = *(int *)(local_20[0] - 4);\n          *(int *)(local_20[0] - 4) = iVar4 + -1;\n        }" { (expression_statement "iVar4 = *(int *)(local_20[0] - 4);" (assignment_expression "iVar4 = *(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) = iVar4 + -1;" (assignment_expression "*(int *)(local_20[0] - 4) = iVar4 + -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 "iVar4 + -1" identifier + number_literal)) ;) }) (else_clause "else {\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *piVar1;\n          *piVar1 = *piVar1 + -1;\n          UNLOCK();\n        }" else (compound_statement "{\n          LOCK();\n          piVar1 = (int *)(local_20[0] - 4);\n          iVar4 = *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 "iVar4 = *piVar1;" (assignment_expression "iVar4 = *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 < iVar4) {\n          return psVar3;\n        }" if (parenthesized_expression "(0 < iVar4)" ( (binary_expression "0 < iVar4" number_literal < identifier) )) (compound_statement "{\n          return psVar3;\n        }" { (return_statement "return psVar3;" return identifier ;) })) (labeled_statement "_Rep::_M_destroy((allocator *)(local_20[0] - 0xc));" statement_identifier : (ERROR ":" :) (expression_statement "_M_destroy((allocator *)(local_20[0] - 0xc));" (call_expression "_M_destroy((allocator *)(local_20[0] - 0xc))" identifier (argument_list "((allocator *)(local_20[0] - 0xc))" ( (cast_expression "(allocator *)(local_20[0] - 0xc)" ( (type_descriptor "allocator *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_20[0] - 0xc)" ( (binary_expression "local_20[0] - 0xc" (subscript_expression "local_20[0]" identifier [ number_literal ]) - number_literal) ))) ))) ;)) (return_statement "return psVar3;" return identifier ;) })) (expression_statement "iVar4 = (param_4 - iVar4) - param_2;" (assignment_expression "iVar4 = (param_4 - iVar4) - param_2" identifier = (binary_expression "(param_4 - iVar4) - param_2" (parenthesized_expression "(param_4 - iVar4)" ( (binary_expression "param_4 - iVar4" identifier - identifier) )) - identifier)) ;) }) (else_clause "else {\n      iVar4 = -iVar4;\n    }" else (compound_statement "{\n      iVar4 = -iVar4;\n    }" { (expression_statement "iVar4 = -iVar4;" (assignment_expression "iVar4 = -iVar4" identifier = (unary_expression "-iVar4" - identifier)) ;) }))) (expression_statement "_M_mutate((uint)this,param_1,param_2);" (call_expression "_M_mutate((uint)this,param_1,param_2)" identifier (argument_list "((uint)this,param_1,param_2)" ( (cast_expression "(uint)this" ( (type_descriptor "uint" type_identifier) ) identifier) , identifier , identifier ))) ;) (expression_statement "pcVar5 = (char *)(param_1 + *(int *)this);" (assignment_expression "pcVar5 = (char *)(param_1 + *(int *)this)" identifier = (cast_expression "(char *)(param_1 + *(int *)this)" ( (type_descriptor "char *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_1 + *(int *)this)" ( (binary_expression "param_1 + *(int *)this" identifier + (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier))) )))) ;) (if_statement "if (param_4 == 1) {\n      *pcVar5 = param_3[*(int *)this + iVar4];\n    }\n    else if (param_4 != 0) {\n      memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4);\n    }" if (parenthesized_expression "(param_4 == 1)" ( (binary_expression "param_4 == 1" identifier == number_literal) )) (compound_statement "{\n      *pcVar5 = param_3[*(int *)this + iVar4];\n    }" { (expression_statement "*pcVar5 = param_3[*(int *)this + iVar4];" (assignment_expression "*pcVar5 = param_3[*(int *)this + iVar4]" (pointer_expression "*pcVar5" * identifier) = (subscript_expression "param_3[*(int *)this + iVar4]" identifier [ (binary_expression "*(int *)this + iVar4" (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier)) + identifier) ])) ;) }) (else_clause "else if (param_4 != 0) {\n      memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4);\n    }" else (if_statement "if (param_4 != 0) {\n      memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4);\n    }" if (parenthesized_expression "(param_4 != 0)" ( (binary_expression "param_4 != 0" identifier != number_literal) )) (compound_statement "{\n      memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4);\n    }" { (expression_statement "memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4);" (call_expression "memcpy(pcVar5,param_3 + *(int *)this + iVar4,param_4)" identifier (argument_list "(pcVar5,param_3 + *(int *)this + iVar4,param_4)" ( identifier , (binary_expression "param_3 + *(int *)this + iVar4" (binary_expression "param_3 + *(int *)this" identifier + (pointer_expression "*(int *)this" * (cast_expression "(int *)this" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) identifier))) + identifier) , identifier ))) ;) })))) }))) (return_statement "return this;" return identifier ;) (ERROR "}" }))
(translation_unit "uint * FUN_003e7b40(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)\n\n{\n  int *piVar1;\n  uint uVar2;\n  uint uVar3;\n  uint *puVar4;\n  undefined1 *__src;\n  int iVar5;\n  undefined1 *__dest;\n  int unaff_EDI;\n  int local_30;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00074f0a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    \n    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0x3ffffffc < param_5) {\n                    \n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }\n  if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }\n  return param_1;\n}\n\n" (function_definition "uint * FUN_003e7b40(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)\n\n{\n  int *piVar1;\n  uint uVar2;\n  uint uVar3;\n  uint *puVar4;\n  undefined1 *__src;\n  int iVar5;\n  undefined1 *__dest;\n  int unaff_EDI;\n  int local_30;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00074f0a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    \n    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0x3ffffffc < param_5) {\n                    \n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }\n  if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }\n  return param_1;\n}" type_identifier (pointer_declarator "* FUN_003e7b40(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" * (function_declarator "FUN_003e7b40(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  uint uVar2;\n  uint uVar3;\n  uint *puVar4;\n  undefined1 *__src;\n  int iVar5;\n  undefined1 *__dest;\n  int unaff_EDI;\n  int local_30;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00074f0a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    \n    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0x3ffffffc < param_5) {\n                    \n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }\n  if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }\n  return param_1;\n}" { (declaration "int *piVar1;" primitive_type (pointer_declarator "*piVar1" * identifier) ;) (declaration "uint uVar2;" type_identifier identifier ;) (declaration "uint uVar3;" type_identifier identifier ;) (declaration "uint *puVar4;" type_identifier (pointer_declarator "*puVar4" * identifier) ;) (declaration "undefined1 *__src;" type_identifier (pointer_declarator "*__src" * identifier) ;) (declaration "int iVar5;" primitive_type identifier ;) (declaration "undefined1 *__dest;" type_identifier (pointer_declarator "*__dest" * identifier) ;) (declaration "int unaff_EDI;" primitive_type identifier ;) (declaration "int local_30;" 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_00074f0a();" (call_expression "FUN_00074f0a()" 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_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }" if (parenthesized_expression "(uVar3 < param_2)" ( (binary_expression "uVar3 < param_2" identifier < identifier) )) (compound_statement "{\n                    \n    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }" { (expression_statement "FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);" (call_expression "FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3)" identifier (argument_list "(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3)" ( (binary_expression "&UNK_0009e657 + unaff_EDI" (pointer_expression "&UNK_0009e657" & identifier) + identifier) , (binary_expression "unaff_EDI + 0xbaca9" 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) + 0x3ffffffc < param_5) {\n                    \n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }" if (parenthesized_expression "((param_3 - uVar3) + 0x3ffffffc < param_5)" ( (binary_expression "(param_3 - uVar3) + 0x3ffffffc < param_5" (binary_expression "(param_3 - uVar3) + 0x3ffffffc" (parenthesized_expression "(param_3 - uVar3)" ( (binary_expression "param_3 - uVar3" identifier - identifier) )) + number_literal) < identifier) )) (compound_statement "{\n                    \n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }" { (expression_statement "FUN_003f3a70(unaff_EDI + 0xbaca9);" (call_expression "FUN_003f3a70(unaff_EDI + 0xbaca9)" identifier (argument_list "(unaff_EDI + 0xbaca9)" ( (binary_expression "unaff_EDI + 0xbaca9" identifier + number_literal) ))) ;) })) (if_statement "if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }" if (parenthesized_expression "(((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4)))" ( (binary_expression "((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))" (parenthesized_expression "((param_4 < uVar2) || (uVar3 + uVar2 < param_4))" ( (binary_expression "(param_4 < uVar2) || (uVar3 + uVar2 < param_4)" (parenthesized_expression "(param_4 < uVar2)" ( (binary_expression "param_4 < uVar2" identifier < identifier) )) || (parenthesized_expression "(uVar3 + uVar2 < param_4)" ( (binary_expression "uVar3 + uVar2 < param_4" (binary_expression "uVar3 + uVar2" identifier + identifier) < 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_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }" { (expression_statement "param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);" (assignment_expression "param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5)" identifier = (cast_expression "(uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_003e6700(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 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }" else (compound_statement "{\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,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 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }" if (parenthesized_expression "(uVar2 + param_2 < param_5 + param_4)" ( (binary_expression "uVar2 + param_2 < param_5 + param_4" (binary_expression "uVar2 + param_2" identifier + identifier) < (binary_expression "param_5 + param_4" identifier + identifier)) )) (compound_statement "{\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }" { (if_statement "if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" if (parenthesized_expression "(param_4 < param_2 + param_3 + uVar2)" ( (binary_expression "param_4 < param_2 + param_3 + uVar2" identifier < (binary_expression "param_2 + param_3 + uVar2" (binary_expression "param_2 + param_3" identifier + identifier) + identifier)) )) (compound_statement "{\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" { (expression_statement "FUN_003e7b00(local_20,param_4,param_5,&local_21);" (call_expression "FUN_003e7b00(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_003e6700(param_1,param_2,param_3,local_20[0],param_5);" (assignment_expression "puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5)" identifier = (cast_expression "(uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5)" ( (type_descriptor "uint *" type_identifier (abstract_pointer_declarator "*" *)) ) (call_expression "FUN_003e6700(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 + 0x2024b3)) {\n          return puVar4;\n        }" if (parenthesized_expression "(local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3))" ( (binary_expression "local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)" (binary_expression "local_20[0] + -0xc" (subscript_expression "local_20[0]" identifier [ number_literal ]) + number_literal) == (pointer_expression "*(int *)(unaff_EDI + 0x2024b3)" * (cast_expression "(int *)(unaff_EDI + 0x2024b3)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x2024b3)" ( (binary_expression "unaff_EDI + 0x2024b3" identifier + number_literal) ))))) )) (compound_statement "{\n          return puVar4;\n        }" { (return_statement "return puVar4;" return identifier ;) })) (if_statement "if (*(int *)(unaff_EDI + 0x2024af) == 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 + 0x2024af) == 0)" ( (binary_expression "*(int *)(unaff_EDI + 0x2024af) == 0" (pointer_expression "*(int *)(unaff_EDI + 0x2024af)" * (cast_expression "(int *)(unaff_EDI + 0x2024af)" ( (type_descriptor "int *" primitive_type (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(unaff_EDI + 0x2024af)" ( (binary_expression "unaff_EDI + 0x2024af" 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);" (call_expression "FUN_003e5c80(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_30 = ((param_4 - uVar2) + param_5) - param_3;" (assignment_expression "local_30 = ((param_4 - uVar2) + param_5) - param_3" identifier = (binary_expression "((param_4 - uVar2) + param_5) - param_3" (parenthesized_expression "((param_4 - uVar2) + param_5)" ( (binary_expression "(param_4 - uVar2) + param_5" (parenthesized_expression "(param_4 - uVar2)" ( (binary_expression "param_4 - uVar2" identifier - identifier) )) + identifier) )) - identifier)) ;) }) (else_clause "else {\n      local_30 = param_4 - uVar2;\n    }" else (compound_statement "{\n      local_30 = param_4 - uVar2;\n    }" { (expression_statement "local_30 = param_4 - uVar2;" (assignment_expression "local_30 = param_4 - uVar2" identifier = (binary_expression "param_4 - uVar2" identifier - identifier)) ;) }))) (expression_statement "FUN_003e5e60(param_1,param_2,param_3,param_5);" (call_expression "FUN_003e5e60(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 "__src = (undefined1 *)(local_30 + *param_1);" (assignment_expression "__src = (undefined1 *)(local_30 + *param_1)" identifier = (cast_expression "(undefined1 *)(local_30 + *param_1)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(local_30 + *param_1)" ( (binary_expression "local_30 + *param_1" identifier + (pointer_expression "*param_1" * identifier)) )))) ;) (expression_statement "__dest = (undefined1 *)(param_2 + *param_1);" (assignment_expression "__dest = (undefined1 *)(param_2 + *param_1)" identifier = (cast_expression "(undefined1 *)(param_2 + *param_1)" ( (type_descriptor "undefined1 *" type_identifier (abstract_pointer_declarator "*" *)) ) (parenthesized_expression "(param_2 + *param_1)" ( (binary_expression "param_2 + *param_1" identifier + (pointer_expression "*param_1" * identifier)) )))) ;) (if_statement "if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }" if (parenthesized_expression "(param_5 == 1)" ( (binary_expression "param_5 == 1" identifier == number_literal) )) (compound_statement "{\n      *__dest = *__src;\n    }" { (expression_statement "*__dest = *__src;" (assignment_expression "*__dest = *__src" (pointer_expression "*__dest" * identifier) = (pointer_expression "*__src" * identifier)) ;) }) (else_clause "else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }" else (if_statement "if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }" if (parenthesized_expression "(param_5 != 0)" ( (binary_expression "param_5 != 0" identifier != number_literal) )) (compound_statement "{\n      memcpy(__dest,__src,param_5);\n    }" { (expression_statement "memcpy(__dest,__src,param_5);" (call_expression "memcpy(__dest,__src,param_5)" identifier (argument_list "(__dest,__src,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 IDENT ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE (pointer_declarator * IDENT) ;) (declaration TYPE IDENT ;) (declaration TYPE (pointer_declarator * 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 (pointer_expression & IDENT) + IDENT) , (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 + IDENT) < 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 + IDENT) < (binary_expression IDENT + IDENT)) )) (compound_statement { (if_statement if (parenthesized_expression ( (binary_expression IDENT < (binary_expression (binary_expression IDENT + IDENT) + IDENT)) )) (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 IDENT - IDENT) )) + IDENT) )) - IDENT)) ;) }) (else_clause else (compound_statement { (expression_statement (assignment_expression IDENT = (binary_expression IDENT - IDENT)) ;) }))) (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 IDENT + (pointer_expression * IDENT)) )))) ;) (expression_statement (assignment_expression IDENT = (cast_expression ( (type_descriptor TYPE (abstract_pointer_declarator *)) ) (parenthesized_expression ( (binary_expression IDENT + (pointer_expression * IDENT)) )))) ;) (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_003e7b40(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)\n\n{\n  int *piVar1;\n  uint uVar2;\n  uint uVar3;\n  uint *puVar4;\n  undefined1 *__src;\n  int iVar5;\n  undefined1 *__dest;\n  int unaff_EDI;\n  int local_30;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00074f0a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    \n    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0x3ffffffc < param_5) {\n                    \n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }\n  if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }\n  return param_1;\n}" (type_identifier "uint") (pointer_declarator "* FUN_003e7b40(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" (* "*") (function_declarator "FUN_003e7b40(uint *param_1,uint param_2,uint param_3,uint param_4,uint param_5)" (identifier "FUN_003e7b40") (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  uint uVar2;\n  uint uVar3;\n  uint *puVar4;\n  undefined1 *__src;\n  int iVar5;\n  undefined1 *__dest;\n  int unaff_EDI;\n  int local_30;\n  undefined1 local_21;\n  int local_20 [4];\n  \n  FUN_00074f0a();\n  uVar2 = *param_1;\n  uVar3 = *(uint *)(uVar2 - 0xc);\n  if (uVar3 < param_2) {\n                    \n    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }\n  if (uVar3 - param_2 <= param_3) {\n    param_3 = uVar3 - param_2;\n  }\n  if ((param_3 - uVar3) + 0x3ffffffc < param_5) {\n                    \n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }\n  if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }\n  return param_1;\n}" ({ "{") (declaration "int *piVar1;" (primitive_type "int") (pointer_declarator "*piVar1" (* "*") (identifier "piVar1")) (; ";")) (declaration "uint uVar2;" (type_identifier "uint") (identifier "uVar2") (; ";")) (declaration "uint uVar3;" (type_identifier "uint") (identifier "uVar3") (; ";")) (declaration "uint *puVar4;" (type_identifier "uint") (pointer_declarator "*puVar4" (* "*") (identifier "puVar4")) (; ";")) (declaration "undefined1 *__src;" (type_identifier "undefined1") (pointer_declarator "*__src" (* "*") (identifier "__src")) (; ";")) (declaration "int iVar5;" (primitive_type "int") (identifier "iVar5") (; ";")) (declaration "undefined1 *__dest;" (type_identifier "undefined1") (pointer_declarator "*__dest" (* "*") (identifier "__dest")) (; ";")) (declaration "int unaff_EDI;" (primitive_type "int") (identifier "unaff_EDI") (; ";")) (declaration "int local_30;" (primitive_type "int") (identifier "local_30") (; ";")) (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_00074f0a();" (call_expression "FUN_00074f0a()" (identifier "FUN_00074f0a") (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_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,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_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);\n  }" ({ "{") (expression_statement "FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);" (call_expression "FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3)" (identifier "FUN_003f3b10") (argument_list "(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3)" (( "(") (binary_expression "&UNK_0009e657 + unaff_EDI" (pointer_expression "&UNK_0009e657" (& "&") (identifier "UNK_0009e657")) (+ "+") (identifier "unaff_EDI")) (, ",") (binary_expression "unaff_EDI + 0xbaca9" (identifier "unaff_EDI") (+ "+") (number_literal "0xbaca9")) (, ",") (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) + 0x3ffffffc < param_5) {\n                    \n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }" (if "if") (parenthesized_expression "((param_3 - uVar3) + 0x3ffffffc < param_5)" (( "(") (binary_expression "(param_3 - uVar3) + 0x3ffffffc < param_5" (binary_expression "(param_3 - uVar3) + 0x3ffffffc" (parenthesized_expression "(param_3 - uVar3)" (( "(") (binary_expression "param_3 - uVar3" (identifier "param_3") (- "-") (identifier "uVar3")) () ")")) (+ "+") (number_literal "0x3ffffffc")) (< "<") (identifier "param_5")) () ")")) (compound_statement "{\n                    \n    FUN_003f3a70(unaff_EDI + 0xbaca9);\n  }" ({ "{") (expression_statement "FUN_003f3a70(unaff_EDI + 0xbaca9);" (call_expression "FUN_003f3a70(unaff_EDI + 0xbaca9)" (identifier "FUN_003f3a70") (argument_list "(unaff_EDI + 0xbaca9)" (( "(") (binary_expression "unaff_EDI + 0xbaca9" (identifier "unaff_EDI") (+ "+") (number_literal "0xbaca9")) () ")"))) (; ";")) (} "}"))) (if_statement "if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {\n    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }\n  else {\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }" (if "if") (parenthesized_expression "(((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4)))" (( "(") (binary_expression "((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))" (parenthesized_expression "((param_4 < uVar2) || (uVar3 + uVar2 < param_4))" (( "(") (binary_expression "(param_4 < uVar2) || (uVar3 + uVar2 < param_4)" (parenthesized_expression "(param_4 < uVar2)" (( "(") (binary_expression "param_4 < uVar2" (identifier "param_4") (< "<") (identifier "uVar2")) () ")")) (|| "||") (parenthesized_expression "(uVar3 + uVar2 < param_4)" (( "(") (binary_expression "uVar3 + uVar2 < param_4" (binary_expression "uVar3 + uVar2" (identifier "uVar3") (+ "+") (identifier "uVar2")) (< "<") (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_003e6700(param_1,param_2,param_3,param_4,param_5);\n  }" ({ "{") (expression_statement "param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);" (assignment_expression "param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5)" (identifier "param_1") (= "=") (cast_expression "(uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5)" (( "(") (type_descriptor "uint *" (type_identifier "uint") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "FUN_003e6700(param_1,param_2,param_3,param_4,param_5)" (identifier "FUN_003e6700") (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 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }\n  }" (else "else") (compound_statement "{\n    uVar2 = *param_1;\n    if (uVar2 + param_2 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }\n    FUN_003e5e60(param_1,param_2,param_3,param_5);\n    __src = (undefined1 *)(local_30 + *param_1);\n    __dest = (undefined1 *)(param_2 + *param_1);\n    if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,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 < param_5 + param_4) {\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }\n    else {\n      local_30 = param_4 - uVar2;\n    }" (if "if") (parenthesized_expression "(uVar2 + param_2 < param_5 + param_4)" (( "(") (binary_expression "uVar2 + param_2 < param_5 + param_4" (binary_expression "uVar2 + param_2" (identifier "uVar2") (+ "+") (identifier "param_2")) (< "<") (binary_expression "param_5 + param_4" (identifier "param_5") (+ "+") (identifier "param_4"))) () ")")) (compound_statement "{\n      if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }\n      local_30 = ((param_4 - uVar2) + param_5) - param_3;\n    }" ({ "{") (if_statement "if (param_4 < param_2 + param_3 + uVar2) {\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" (if "if") (parenthesized_expression "(param_4 < param_2 + param_3 + uVar2)" (( "(") (binary_expression "param_4 < param_2 + param_3 + uVar2" (identifier "param_4") (< "<") (binary_expression "param_2 + param_3 + uVar2" (binary_expression "param_2 + param_3" (identifier "param_2") (+ "+") (identifier "param_3")) (+ "+") (identifier "uVar2"))) () ")")) (compound_statement "{\n        FUN_003e7b00(local_20,param_4,param_5,&local_21);\n                    \n        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);\n        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {\n          return puVar4;\n        }\n        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);\n        return puVar4;\n      }" ({ "{") (expression_statement "FUN_003e7b00(local_20,param_4,param_5,&local_21);" (call_expression "FUN_003e7b00(local_20,param_4,param_5,&local_21)" (identifier "FUN_003e7b00") (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_003e6700(param_1,param_2,param_3,local_20[0],param_5);" (assignment_expression "puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5)" (identifier "puVar4") (= "=") (cast_expression "(uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5)" (( "(") (type_descriptor "uint *" (type_identifier "uint") (abstract_pointer_declarator "*" (* "*"))) () ")") (call_expression "FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5)" (identifier "FUN_003e6700") (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 + 0x2024b3)) {\n          return puVar4;\n        }" (if "if") (parenthesized_expression "(local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3))" (( "(") (binary_expression "local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)" (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 + 0x2024b3)" (* "*") (cast_expression "(int *)(unaff_EDI + 0x2024b3)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(unaff_EDI + 0x2024b3)" (( "(") (binary_expression "unaff_EDI + 0x2024b3" (identifier "unaff_EDI") (+ "+") (number_literal "0x2024b3")) () ")"))))) () ")")) (compound_statement "{\n          return puVar4;\n        }" ({ "{") (return_statement "return puVar4;" (return "return") (identifier "puVar4") (; ";")) (} "}"))) (if_statement "if (*(int *)(unaff_EDI + 0x2024af) == 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 + 0x2024af) == 0)" (( "(") (binary_expression "*(int *)(unaff_EDI + 0x2024af) == 0" (pointer_expression "*(int *)(unaff_EDI + 0x2024af)" (* "*") (cast_expression "(int *)(unaff_EDI + 0x2024af)" (( "(") (type_descriptor "int *" (primitive_type "int") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(unaff_EDI + 0x2024af)" (( "(") (binary_expression "unaff_EDI + 0x2024af" (identifier "unaff_EDI") (+ "+") (number_literal "0x2024af")) () ")")))) (== "==") (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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);" (call_expression "FUN_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0])" (identifier "FUN_003e5c80") (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_30 = ((param_4 - uVar2) + param_5) - param_3;" (assignment_expression "local_30 = ((param_4 - uVar2) + param_5) - param_3" (identifier "local_30") (= "=") (binary_expression "((param_4 - uVar2) + param_5) - param_3" (parenthesized_expression "((param_4 - uVar2) + param_5)" (( "(") (binary_expression "(param_4 - uVar2) + param_5" (parenthesized_expression "(param_4 - uVar2)" (( "(") (binary_expression "param_4 - uVar2" (identifier "param_4") (- "-") (identifier "uVar2")) () ")")) (+ "+") (identifier "param_5")) () ")")) (- "-") (identifier "param_3"))) (; ";")) (} "}")) (else_clause "else {\n      local_30 = param_4 - uVar2;\n    }" (else "else") (compound_statement "{\n      local_30 = param_4 - uVar2;\n    }" ({ "{") (expression_statement "local_30 = param_4 - uVar2;" (assignment_expression "local_30 = param_4 - uVar2" (identifier "local_30") (= "=") (binary_expression "param_4 - uVar2" (identifier "param_4") (- "-") (identifier "uVar2"))) (; ";")) (} "}")))) (expression_statement "FUN_003e5e60(param_1,param_2,param_3,param_5);" (call_expression "FUN_003e5e60(param_1,param_2,param_3,param_5)" (identifier "FUN_003e5e60") (argument_list "(param_1,param_2,param_3,param_5)" (( "(") (identifier "param_1") (, ",") (identifier "param_2") (, ",") (identifier "param_3") (, ",") (identifier "param_5") () ")"))) (; ";")) (expression_statement "__src = (undefined1 *)(local_30 + *param_1);" (assignment_expression "__src = (undefined1 *)(local_30 + *param_1)" (identifier "__src") (= "=") (cast_expression "(undefined1 *)(local_30 + *param_1)" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(local_30 + *param_1)" (( "(") (binary_expression "local_30 + *param_1" (identifier "local_30") (+ "+") (pointer_expression "*param_1" (* "*") (identifier "param_1"))) () ")")))) (; ";")) (expression_statement "__dest = (undefined1 *)(param_2 + *param_1);" (assignment_expression "__dest = (undefined1 *)(param_2 + *param_1)" (identifier "__dest") (= "=") (cast_expression "(undefined1 *)(param_2 + *param_1)" (( "(") (type_descriptor "undefined1 *" (type_identifier "undefined1") (abstract_pointer_declarator "*" (* "*"))) () ")") (parenthesized_expression "(param_2 + *param_1)" (( "(") (binary_expression "param_2 + *param_1" (identifier "param_2") (+ "+") (pointer_expression "*param_1" (* "*") (identifier "param_1"))) () ")")))) (; ";")) (if_statement "if (param_5 == 1) {\n      *__dest = *__src;\n    }\n    else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }" (if "if") (parenthesized_expression "(param_5 == 1)" (( "(") (binary_expression "param_5 == 1" (identifier "param_5") (== "==") (number_literal "1")) () ")")) (compound_statement "{\n      *__dest = *__src;\n    }" ({ "{") (expression_statement "*__dest = *__src;" (assignment_expression "*__dest = *__src" (pointer_expression "*__dest" (* "*") (identifier "__dest")) (= "=") (pointer_expression "*__src" (* "*") (identifier "__src"))) (; ";")) (} "}")) (else_clause "else if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }" (else "else") (if_statement "if (param_5 != 0) {\n      memcpy(__dest,__src,param_5);\n    }" (if "if") (parenthesized_expression "(param_5 != 0)" (( "(") (binary_expression "param_5 != 0" (identifier "param_5") (!= "!=") (number_literal "0")) () ")")) (compound_statement "{\n      memcpy(__dest,__src,param_5);\n    }" ({ "{") (expression_statement "memcpy(__dest,__src,param_5);" (call_expression "memcpy(__dest,__src,param_5)" (identifier "memcpy") (argument_list "(__dest,__src,param_5)" (( "(") (identifier "__dest") (, ",") (identifier "__src") (, ",") (identifier "param_5") () ")"))) (; ";")) (} "}"))))) (} "}")))) (return_statement "return param_1;" (return "return") (identifier "param_1") (; ";")) (} "}")))

/* std::string::replace(unsigned int, unsigned int, char const*, unsigned int) */

type_2 * __thiscall
std::type_2::replace(type_2 *this,type_1 var_4,type_1 var_7,char *var_10,type_1 var_8)

{
  int *piVar1;
  type_1 var_3;
  type_2 *psVar3;
  int var_12;
  char *var_2;
  int var_6;
  type_3 local_21;
  type_1 local_20 [4];
  
  var_1();
  var_2 = *(char **)this;
  var_3 = *(type_1 *)(var_2 + -0xc);
  if (var_3 < var_4) {
                    /* WARNING: Subroutine does not return */
    var_5((char *)(var_6 + 0x9e657),var_6 + 0xbaca9,var_4,var_3);
  }
  if ((char *)(var_3 - var_4) <= var_7) {
    var_7 = var_3 - var_4;
  }
  if ((char *)(var_7 + (0x3ffffffc - var_3)) < var_8) {
                    /* WARNING: Subroutine does not return */
    var_9((char *)(var_6 + 0xbaca9));
  }
  if (((var_10 < var_2) || (var_2 + var_3 < var_10)) || (0 < *(int *)(var_2 + -4))) {
    this = (type_2 *)var_11((type_1)this,var_4,(char *)var_7,(type_1)var_10);
  }
  else {
    var_12 = *(int *)this;
    if ((char *)(var_12 + var_4) < var_10 + var_8) {
      if (var_10 < (char *)(var_7 + var_12 + var_4)) {
        type_2((type_2 *)local_20,var_10,var_8,&local_21);
                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */
        psVar3 = (type_2 *)var_11((type_1)this,var_4,(char *)var_7,local_20[0]);
        if ((type_3 *)(local_20[0] - 0xc) == *(type_3 **)(var_6 + 0x2024b3)) {
          return psVar3;
        }
        if (*(int *)(var_6 + 0x2024af) == 0) {
          var_12 = *(int *)(local_20[0] - 4);
          *(int *)(local_20[0] - 4) = var_12 + -1;
        }
        else {
          var_13();
          piVar1 = (int *)(local_20[0] - 4);
          var_12 = *piVar1;
          *piVar1 = *piVar1 + -1;
          var_14();
        }
        if (0 < var_12) {
          return psVar3;
        }
        _Rep::var_15((type_3 *)(local_20[0] - 0xc));
        return psVar3;
      }
      var_12 = (var_8 - var_12) - var_7;
    }
    else {
      var_12 = -var_12;
    }
    var_16((type_1)this,var_4,var_7);
    var_2 = (char *)(var_4 + *(int *)this);
    if (var_8 == 1) {
      *var_2 = var_10[*(int *)this + var_12];
    }
    else if (var_8 != 0) {
      var_17(var_2,var_10 + *(int *)this + var_12,var_8);
    }
  }
  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: (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: (type_identifier) declarator: (pointer_declarator 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: (pointer_expression argument: (identifier)) right: (identifier)) (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: (identifier)) 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: (identifier)) right: (binary_expression left: (identifier) right: (identifier)))) consequence: (compound_statement (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (binary_expression left: (identifier) right: (identifier)) right: (identifier)))) 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: (identifier) right: (identifier))) right: (identifier))) right: (identifier))))) alternative: (else_clause (compound_statement (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier))))))) (expression_statement (call_expression function: (identifier) arguments: (argument_list (identifier) (identifier) (identifier) (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: (identifier) right: (pointer_expression argument: (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: (identifier) right: (pointer_expression argument: (identifier))))))) (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;
  uint uVar2;
  uint uVar3;
  uint *puVar4;
  undefined1 *__src;
  int iVar5;
  undefined1 *__dest;
  int unaff_EDI;
  int local_30;
  undefined1 local_21;
  int local_20 [4];
  
  FUN_00074f0a();
  uVar2 = *param_1;
  uVar3 = *(uint *)(uVar2 - 0xc);
  if (uVar3 < param_2) {
                    /* WARNING: Subroutine does not return */
    FUN_003f3b10(&UNK_0009e657 + unaff_EDI,unaff_EDI + 0xbaca9,param_2,uVar3);
  }
  if (uVar3 - param_2 <= param_3) {
    param_3 = uVar3 - param_2;
  }
  if ((param_3 - uVar3) + 0x3ffffffc < param_5) {
                    /* WARNING: Subroutine does not return */
    FUN_003f3a70(unaff_EDI + 0xbaca9);
  }
  if (((param_4 < uVar2) || (uVar3 + uVar2 < param_4)) || (0 < *(int *)(uVar2 - 4))) {
    param_1 = (uint *)FUN_003e6700(param_1,param_2,param_3,param_4,param_5);
  }
  else {
    uVar2 = *param_1;
    if (uVar2 + param_2 < param_5 + param_4) {
      if (param_4 < param_2 + param_3 + uVar2) {
        FUN_003e7b00(local_20,param_4,param_5,&local_21);
                    /* try { // try from 003e7c68 to 003e7c6c has its CatchHandler @ 003e7d08 */
        puVar4 = (uint *)FUN_003e6700(param_1,param_2,param_3,local_20[0],param_5);
        if (local_20[0] + -0xc == *(int *)(unaff_EDI + 0x2024b3)) {
          return puVar4;
        }
        if (*(int *)(unaff_EDI + 0x2024af) == 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_003e5c80(local_20[0] + -0xc,&local_21,local_20[0],local_20[0]);
        return puVar4;
      }
      local_30 = ((param_4 - uVar2) + param_5) - param_3;
    }
    else {
      local_30 = param_4 - uVar2;
    }
    FUN_003e5e60(param_1,param_2,param_3,param_5);
    __src = (undefined1 *)(local_30 + *param_1);
    __dest = (undefined1 *)(param_2 + *param_1);
    if (param_5 == 1) {
      *__dest = *__src;
    }
    else if (param_5 != 0) {
      memcpy(__dest,__src,param_5);
    }
  }
  return param_1;
}

