// Decompiled from acclient.exe — chunk 0x00470000
// Ghidra 12.0.4 + pyghidra headless

// --- FUN_004703b0 at 0x004703B0 (size: 140) ---


undefined4 * __thiscall FUN_004703b0(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  undefined4 uVar2;

  

  FUN_00471f10(param_2,param_3);

  uVar2 = DAT_0079e13c;

  uVar1 = DAT_0079e138;

  param_1[0x1c8] = 0;

  param_1[0x1ca] = 0;

  param_1[0x1cb] = 0;

  param_1[0x1cc] = 0;

  param_1[0x1cd] = 0;

  param_1[0x1ce] = 0;

  param_1[0x1cf] = 0;

  param_1[0x1d0] = 0;

  param_1[0x1d1] = 0;

  param_1[0x1dc] = 0;

  param_1[0x1dd] = 0;

  param_1[0x1de] = 0;

  *param_1 = &PTR_FUN_0079e140;

  param_1[0x182] = &PTR_FUN_0079d180;

  param_1[0x1d2] = uVar1;

  param_1[0x1d3] = uVar2;

  return param_1;

}





// --- FUN_00470510 at 0x00470510 (size: 100) ---


void FUN_00470510(undefined4 param_1)



{

  char cVar1;

  

  FUN_00460820(0xf,1);

  cVar1 = FUN_00460bf0(0x10,&param_1);

  if (cVar1 == '\0') {

    param_1 = 0x3f000000;

    FUN_00460760(0x10,0x3f000000);

  }

  cVar1 = FUN_00460bf0(0x11,&param_1);

  if (cVar1 == '\0') {

    param_1 = 0x3e000000;

    FUN_00460760(0x11,0x3e000000);

  }

  return;

}





// --- FUN_00470580 at 0x00470580 (size: 146) ---


undefined4 FUN_00470580(void)



{

  char cVar1;

  undefined4 uVar2;

  char local_5;

  int local_4;

  

  local_4 = 1;

  cVar1 = FUN_00460b30(0x7d,&local_4);

  if ((cVar1 != '\0') && (local_4 != 0)) {

    uVar2 = 0;

    local_5 = '\0';

    FUN_00460cc0(0x7e,&local_5);

    if (local_5 != '\0') {

      uVar2 = FUN_005df4c4();

      return uVar2;

    }

    if (1 < local_4) {

      local_4 = local_4 + -1;

      uVar2 = FUN_005df4c4();

    }

    return uVar2;

  }

  return 0xffffffff;

}





// --- FUN_00470620 at 0x00470620 (size: 63) ---


void __thiscall FUN_00470620(int param_1,int *param_2,int param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  iVar2 = *(int *)(param_3 + 0x20);

  iVar3 = *(int *)(param_3 + 0x1c);

  iVar1 = (**(code **)(**(int **)(param_3 + 4) + 0xa0))();

  if (iVar1 == param_1) {

    iVar3 = iVar3 + *(int *)(*(int *)(param_3 + 4) + 0x7c);

    iVar2 = iVar2 + *(int *)(*(int *)(param_3 + 4) + 0x80);

  }

  *param_2 = iVar3;

  param_2[1] = iVar2;

  return;

}





// --- FUN_00470660 at 0x00470660 (size: 133) ---


void __thiscall FUN_00470660(int param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  char local_9;

  int local_8;

  

  iVar1 = *(int *)(param_1 + 0x76c) - *(int *)(param_1 + 0x764);

  iVar2 = 0;

  iVar3 = *(int *)(param_1 + 0x768) - *(int *)(param_1 + 0x760);

  if (*(int *)(param_1 + 0x720) == 0) {

    local_8 = 0;

  }

  else {

    local_8 = FUN_0069fe60();

  }

  if (*(int *)(param_1 + 0x720) != 0) {

    iVar2 = FUN_0069fe70();

  }

  local_9 = '\0';

  FUN_00460cc0(0x7e,&local_9);

  if (local_9 == '\0') {

    iVar3 = iVar3 - local_8;

    iVar1 = iVar1 - iVar2;

  }

  *param_2 = iVar3;

  param_2[1] = iVar1;

  return;

}





// --- FUN_004706f0 at 0x004706F0 (size: 52) ---


void __thiscall FUN_004706f0(int param_1,char param_2,uint param_3)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | param_3;

    return;

  }

  *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) & ~param_3;

  return;

}





// --- FUN_00470730 at 0x00470730 (size: 38) ---


void __thiscall FUN_00470730(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | 1;

    return;

  }

  *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) & 0xfffffffe;

  return;

}





// --- FUN_00470760 at 0x00470760 (size: 38) ---


void __thiscall FUN_00470760(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | 2;

    return;

  }

  *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) & 0xfffffffd;

  return;

}





// --- FUN_00470790 at 0x00470790 (size: 38) ---


void __thiscall FUN_00470790(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | 4;

    return;

  }

  *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) & 0xfffffffb;

  return;

}





// --- FUN_004707c0 at 0x004707C0 (size: 38) ---


void __thiscall FUN_004707c0(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | 8;

    return;

  }

  *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) & 0xfffffff7;

  return;

}





// --- FUN_004707f0 at 0x004707F0 (size: 38) ---


void __thiscall FUN_004707f0(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | 0x10;

    return;

  }

  *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) & 0xffffffef;

  return;

}





// --- FUN_00470820 at 0x00470820 (size: 38) ---


void __thiscall FUN_00470820(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | 0x20;

    return;

  }

  *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) & 0xffffffdf;

  return;

}





// --- FUN_00470850 at 0x00470850 (size: 38) ---


void __thiscall FUN_00470850(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | 0x40;

    return;

  }

  *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) & 0xffffffbf;

  return;

}





// --- FUN_00470880 at 0x00470880 (size: 42) ---


void __thiscall FUN_00470880(int param_1,char param_2)



{

  if (param_2 != '\0') {

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | 0x100;

    return;

  }

  *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) & 0xfffffeff;

  return;

}





// --- FUN_004708b0 at 0x004708B0 (size: 28) ---


undefined4 __thiscall FUN_004708b0(int param_1,undefined4 *param_2)



{

  if ((*(byte *)(param_1 + 0x778) & 1) != 0) {

    return param_2[1];

  }

  return *param_2;

}





// --- FUN_004708d0 at 0x004708D0 (size: 16) ---


void FUN_004708d0(void)



{

  FUN_00460270(0xb,&LAB_00470470);

  return;

}





// --- FUN_00470910 at 0x00470910 (size: 200) ---


void __fastcall FUN_00470910(int param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  undefined4 uVar3;

  char cVar4;

  float local_4;

  

  uVar2 = *(uint *)(param_1 + 0x778);

  local_4 = 0.0;

  cVar4 = FUN_00460bf0(0x84,&local_4);

  if ((cVar4 != '\0') && (ABS(local_4) < DAT_0079e130 == (ABS(local_4) == DAT_0079e130))) {

    puVar1 = (undefined4 *)(param_1 + 0x738);

    *puVar1 = 0;

    FUN_00460bf0(0x86,puVar1);

    *(undefined4 *)(param_1 + 0x73c) = *puVar1;

    FUN_00460bf0(0x85,(undefined4 *)(param_1 + 0x73c));

    uVar3 = DAT_008379a8;

    *(undefined4 *)(param_1 + 0x72c) = DAT_008379ac;

    *(undefined4 *)(param_1 + 0x728) = uVar3;

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | 0x400000;

    *(double *)(param_1 + 0x730) = (double)(local_4 + (float)*(double *)(param_1 + 0x728));

    if ((uVar2 & 0x400000) != 0x400000) {

      FUN_00465f90(3);

    }

  }

  return;

}





// --- FUN_004709e0 at 0x004709E0 (size: 94) ---


int __thiscall FUN_004709e0(int param_1,char param_2)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  

  iVar1 = 0;

  if (param_2 == '\0') {

    iVar3 = *(int *)(param_1 + 0x774);

  }

  else {

    iVar3 = *(int *)(param_1 + 0x770);

  }

  if ((iVar3 != 0) &&

     (((piVar2 = (int *)FUN_00464690(iVar3), piVar2 == (int *)0x0 ||

       (iVar1 = (**(code **)(*piVar2 + 0x94))(1), iVar1 == 0)) ||

      (iVar3 = FUN_00464690(*(undefined4 *)(param_1 + 0x2e4)), iVar3 != param_1)))) {

    return 0;

  }

  return iVar1;

}





// --- FUN_00470a40 at 0x00470A40 (size: 76) ---


void __thiscall FUN_00470a40(int param_1,char param_2,undefined4 param_3)



{

  int iVar1;

  

  if (param_2 == '\0') {

    *(undefined4 *)(param_1 + 0x774) = param_3;

  }

  else {

    *(undefined4 *)(param_1 + 0x770) = param_3;

  }

  iVar1 = FUN_00463c00(param_3);

  if (iVar1 == 0) {

    *(uint *)(param_1 + 0x778) = *(uint *)(param_1 + 0x778) | 0x800000;

    FUN_00465f90(3);

    return;

  }

  FUN_00470510(iVar1);

  return;

}





// --- FUN_00470a90 at 0x00470A90 (size: 162) ---


void __thiscall FUN_00470a90(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  uint uVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  

  iVar1 = *(int *)(param_1 + 0x720);

  if (iVar1 != 0) {

    iVar7 = *(int *)(iVar1 + 0x7c);

    iVar1 = *(int *)(iVar1 + 0x80);

    iVar3 = FUN_0069fe60();

    iVar4 = FUN_0069fe70();

    uVar5 = *(uint *)(param_1 + 0x778) & 1;

    if (uVar5 == 0) {

      iVar8 = *(int *)(param_2 + 0x20);

    }

    else {

      iVar8 = *(int *)(param_2 + 0x1c);

    }

    iVar6 = iVar7;

    if (uVar5 != 1) {

      iVar6 = iVar1;

    }

    if (uVar5 == 1) {

      iVar2 = *(int *)(param_2 + 0x1c);

    }

    else {

      iVar2 = *(int *)(param_2 + 0x20);

      iVar3 = iVar4;

      iVar7 = iVar1;

    }

    if ((iVar8 < iVar6) || (iVar3 + iVar7 < iVar2)) {

      FUN_00460410(0x10 - (uint)(iVar8 < iVar6),0,0);

    }

  }

  return;

}





// --- FUN_00470b40 at 0x00470B40 (size: 168) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



float10 FUN_00470b40(int param_1)



{

  char cVar1;

  char local_5;

  int local_4;

  

  local_4 = 1;

  cVar1 = FUN_00460b30(0x7d,&local_4);

  if ((cVar1 == '\0') || (local_4 == 0)) {

    return (float10)_DAT_0079a1a0;

  }

  if (param_1 < 0) {

    param_1 = 0;

  }

  else if (local_4 + -1 < param_1) {

    param_1 = local_4 + -1;

  }

  local_5 = '\0';

  FUN_00460cc0(0x7e,&local_5);

  if (local_5 != '\0') {

    return ((float10)param_1 + (float10)_DAT_007938b8) / (float10)local_4;

  }

  if (1 < local_4) {

    return (float10)param_1 / (float10)(local_4 + -1);

  }

  return (float10)_DAT_007938b8;

}





// --- FUN_00470bf0 at 0x00470BF0 (size: 92) ---


void FUN_00470bf0(undefined4 param_1)



{

  undefined4 uVar1;

  float10 fVar2;

  

  fVar2 = (float10)FUN_00470b40(param_1);

  if ((float10)DAT_00796344 <= fVar2) {

    FUN_004606b0(0x87,param_1);

    FUN_00460760(0x86,(float)fVar2);

    uVar1 = FUN_005df4c4(param_1);

    FUN_00460410(10,uVar1,param_1);

  }

  return;

}





// --- FUN_00470c50 at 0x00470C50 (size: 264) ---


float10 __thiscall FUN_00470c50(int param_1,int *param_2)



{

  uint uVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  char local_11;

  int local_10;

  int local_c;

  int local_8;

  

  FUN_00470660(&local_10);

  iVar2 = 0;

  if (*(int *)(param_1 + 0x720) == 0) {

    local_8 = 0;

  }

  else {

    local_8 = FUN_0069fe60();

  }

  if (*(int *)(param_1 + 0x720) != 0) {

    iVar2 = FUN_0069fe70();

  }

  local_10 = local_10 + -1;

  iVar3 = *param_2 - *(int *)(param_1 + 0x760);

  local_c = local_c + -1;

  iVar4 = param_2[1] - *(int *)(param_1 + 0x764);

  local_11 = '\0';

  FUN_00460cc0(0x7e,&local_11);

  if (local_11 == '\0') {

    iVar3 = iVar3 - local_8 / 2;

    iVar4 = iVar4 - iVar2 / 2;

    if (iVar3 < 0) {

      iVar3 = 0;

    }

    else if (local_10 < iVar3) {

      iVar3 = local_10;

    }

    if (iVar4 < 0) {

      iVar4 = 0;

    }

    else if (local_c < iVar4) {

      iVar4 = local_c;

    }

  }

  uVar1 = *(uint *)(param_1 + 0x778) & 1;

  param_2 = (int *)iVar3;

  if (uVar1 == 0) {

    param_2 = (int *)iVar4;

  }

  if (uVar1 != 1) {

    local_10 = local_c;

  }

  if (1 < local_10) {

    return (float10)(int)param_2 / (float10)local_10;

  }

  return (float10)DAT_00796344;

}





// --- FUN_00470d60 at 0x00470D60 (size: 253) ---


void __thiscall FUN_00470d60(int param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  char local_19;

  undefined4 local_18;

  undefined4 local_14;

  int local_10;

  int local_c;

  int local_4;

  

  FUN_00470660(&local_18);

  local_4 = *(int *)(param_1 + 0x764);

  iVar2 = *(int *)(param_1 + 0x760);

  if (*(int *)(param_1 + 0x720) == 0) {

    local_10 = 0;

  }

  else {

    local_10 = FUN_0069fe60();

  }

  if (*(int *)(param_1 + 0x720) == 0) {

    local_c = 0;

  }

  else {

    local_c = FUN_0069fe70();

  }

  uVar3 = *(uint *)(param_1 + 0x778) & 1;

  if (uVar3 == 0) {

    local_18 = local_14;

  }

  iVar1 = FUN_005df4c4();

  if (uVar3 != 1) {

    iVar2 = local_4;

  }

  iVar1 = iVar1 + iVar2;

  local_19 = '\0';

  FUN_00460cc0(0x7e,&local_19);

  if (local_19 != '\0') {

    if ((*(byte *)(param_1 + 0x778) & 1) == 0) {

      local_10 = local_c;

    }

    iVar1 = iVar1 - local_10 / 2;

  }

  if ((*(byte *)(param_1 + 0x778) & 1) == 0) {

    *param_2 = 0;

    param_2[1] = iVar1;

    return;

  }

  *param_2 = iVar1;

  param_2[1] = 0;

  return;

}





// --- FUN_00470e60 at 0x00470E60 (size: 177) ---


void __fastcall FUN_00470e60(int param_1)



{

  undefined4 uVar1;

  int *piVar2;

  int iVar3;

  

  *(undefined4 *)(param_1 + 0x764) = 0;

  *(undefined4 *)(param_1 + 0x760) = 0;

  uVar1 = FUN_0069fe60();

  *(undefined4 *)(param_1 + 0x768) = uVar1;

  uVar1 = FUN_0069fe70();

  *(undefined4 *)(param_1 + 0x76c) = uVar1;

  piVar2 = (int *)FUN_004709e0(1);

  if (piVar2 != (int *)0x0) {

    iVar3 = FUN_0069fe70();

    *(int *)(param_1 + 0x764) = *(int *)(param_1 + 0x764) + iVar3;

    iVar3 = FUN_0069fe60();

    *(int *)(param_1 + 0x760) = *(int *)(param_1 + 0x760) + iVar3;

    (**(code **)(*piVar2 + 0x2c))(0,0);

  }

  piVar2 = (int *)FUN_004709e0(0);

  if (piVar2 != (int *)0x0) {

    iVar3 = FUN_0069fe60();

    *(int *)(param_1 + 0x768) = *(int *)(param_1 + 0x768) - iVar3;

    iVar3 = FUN_0069fe70();

    iVar3 = *(int *)(param_1 + 0x76c) - iVar3;

    *(int *)(param_1 + 0x76c) = iVar3;

    (**(code **)(*piVar2 + 0x2c))(*(undefined4 *)(param_1 + 0x768),iVar3);

  }

  return;

}





// --- FUN_00470f20 at 0x00470F20 (size: 89) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_00470f20(int param_1,float *param_2)



{

  undefined4 uVar1;

  float10 fVar2;

  

  if ((*(uint *)(param_1 + 0x778) & 0x100) != 0) {

    uVar1 = FUN_00470580(*param_2);

    fVar2 = (float10)FUN_00470b40(uVar1);

    *param_2 = (float)fVar2;

  }

  if (*param_2 < DAT_00796344) {

    *param_2 = 0.0;

    return;

  }

  if (_DAT_007938b0 < *param_2) {

    *param_2 = 1.0;

  }

  return;

}





// --- FUN_00470f80 at 0x00470F80 (size: 135) ---


void __fastcall FUN_00470f80(undefined4 *param_1)



{

  int iVar1;

  

  *param_1 = &PTR_FUN_0079e140;

  param_1[0x182] = &PTR_FUN_0079d180;

  param_1[0x1dc] = 0;

  iVar1 = FUN_00463c00(0);

  if (iVar1 == 0) {

    param_1[0x1de] = param_1[0x1de] | 0x800000;

    FUN_00465f90(3);

  }

  else {

    FUN_00470510(iVar1);

  }

  param_1[0x1dd] = 0;

  iVar1 = FUN_00463c00(0);

  if (iVar1 == 0) {

    param_1[0x1de] = param_1[0x1de] | 0x800000;

    FUN_00465f90(3);

    FUN_00471f80();

    return;

  }

  FUN_00470510(iVar1);

  FUN_00471f80();

  return;

}





// --- FUN_00471010 at 0x00471010 (size: 77) ---


bool FUN_00471010(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_00472620(param_1);

  FUN_00425ba0();

  if (param_1 == (int *)0x0) {

    return false;

  }

  cVar2 = FUN_00427240(0x12,param_1);

  (**(code **)(*param_1 + 0x14))();

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_00471060 at 0x00471060 (size: 344) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __fastcall FUN_00471060(int *param_1)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  int unaff_ESI;

  float10 fVar4;

  int iVar5;

  float local_4;

  

  if ((param_1[0x1de] & 0x800000U) != 0) {

    param_1[0x1de] = param_1[0x1de] & 0xff7fffff;

    iVar5 = param_1[0x1dc];

    (**(code **)(*param_1 + 0xa0))(iVar5);

    piVar1 = (int *)FUN_00463c00(iVar5);

    if (piVar1 != (int *)0x0) {

      FUN_0069fe60();

      FUN_0069fe70();

      (**(code **)(*piVar1 + 0x44))(param_1);

      (**(code **)(*piVar1 + 0x2c))(0,0);

      FUN_00470510(piVar1);

    }

    iVar5 = param_1[0x1dd];

    (**(code **)(*param_1 + 0xa0))(iVar5);

    piVar1 = (int *)FUN_00463c00(iVar5);

    if (piVar1 != (int *)0x0) {

      iVar2 = FUN_0069fe60();

      FUN_0069fe70();

      (**(code **)(*piVar1 + 0x44))(param_1);

      iVar5 = *piVar1;

      iVar3 = FUN_0069fe70();

      iVar3 = FUN_0069fe60(iVar3 - unaff_ESI);

      (**(code **)(iVar5 + 0x2c))(iVar3 - iVar2);

      FUN_00470510(piVar1);

    }

    FUN_00470e60();

    FUN_00465fb0(3);

  }

  if ((param_1[0x1de] & 0x400000U) != 0) {

    fVar4 = ((float10)_DAT_008379a8 - (float10)*(double *)(param_1 + 0x1ca)) /

            ((float10)*(double *)(param_1 + 0x1cc) - (float10)*(double *)(param_1 + 0x1ca));

    local_4 = (float)fVar4;

    if ((float10)_DAT_007938b0 <= fVar4) {

      param_1[0x1de] = param_1[0x1de] & 0xffbfffff;

      local_4 = 1.0;

      FUN_00465fb0(3);

    }

    FUN_00460760(0x86,((float)param_1[0x1cf] - (float)param_1[0x1ce]) * local_4 +

                      (float)param_1[0x1ce]);

  }

  return;

}





// --- FUN_004711f0 at 0x004711F0 (size: 88) ---


void FUN_004711f0(undefined4 param_1,int param_2)



{

  char cVar1;

  int local_4;

  

  local_4 = 0;

  cVar1 = FUN_00460b30(0x87,&local_4);

  if (cVar1 != '\0') {

    local_4 = local_4 + param_2;

    FUN_00470bf0(local_4,1);

    return;

  }

  FUN_00460410((param_2 < 1) + '\r',param_2,0);

  return;

}





// --- FUN_00471250 at 0x00471250 (size: 34) ---


void __thiscall FUN_00471250(int param_1,int *param_2)



{

  FUN_004711f0(0x86,(-(uint)(*param_2 != *(int *)(param_1 + 0x770)) & 0xfffffffe) + 1);

  return;

}





// --- FUN_00471280 at 0x00471280 (size: 135) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void FUN_00471280(float param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  

  if (DAT_00796344 <= param_1) {

    if (_DAT_007938b0 < param_1) {

      param_1 = 1.0;

    }

  }

  else {

    param_1 = 0.0;

  }

  iVar1 = FUN_00470580(param_1);

  if (-1 < iVar1) {

    FUN_00470bf0(iVar1,param_2);

    return;

  }

  FUN_00460760(0x86,param_1);

  uVar3 = 0xffffffff;

  uVar2 = FUN_005df4c4(0xffffffff);

  FUN_00460410(10,uVar2,uVar3);

  return;

}





// --- FUN_00471310 at 0x00471310 (size: 96) ---


void __thiscall FUN_00471310(int param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  float10 fVar4;

  int iStack_8;

  int iStack_4;

  

  iVar2 = *(int *)(param_2 + 0x20);

  iVar3 = *(int *)(param_2 + 0x1c);

  iVar1 = (**(code **)(**(int **)(param_2 + 4) + 0xa0))();

  if (iVar1 == param_1) {

    iVar3 = iVar3 + *(int *)(*(int *)(param_2 + 4) + 0x7c);

    iVar2 = iVar2 + *(int *)(*(int *)(param_2 + 4) + 0x80);

  }

  iStack_8 = iVar3;

  iStack_4 = iVar2;

  fVar4 = (float10)FUN_00470c50(&iStack_8);

  FUN_00471280((float)fVar4,param_3);

  return;

}





// --- FUN_00471370 at 0x00471370 (size: 109) ---


void __thiscall FUN_00471370(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  if ((*(byte *)(param_1 + 0x778) & 0x40) != 0) {

    FUN_00471310(param_2,1);

  }

  iVar2 = *(int *)(param_2 + 0x1c);

  iVar3 = *(int *)(param_2 + 0x20);

  iVar1 = (**(code **)(**(int **)(param_2 + 4) + 0xa0))();

  if (iVar1 == param_1) {

    iVar2 = iVar2 + *(int *)(*(int *)(param_2 + 4) + 0x7c);

    iVar3 = iVar3 + *(int *)(*(int *)(param_2 + 4) + 0x80);

  }

  *(int *)(param_1 + 0x750) = iVar2;

  *(int *)(param_1 + 0x754) = iVar3;

  FUN_00460bf0(0x86,param_1 + 0x758);

  *(undefined1 *)(param_1 + 0x75c) = 1;

  return;

}





// --- FUN_004713e0 at 0x004713E0 (size: 129) ---


void __thiscall FUN_004713e0(int param_1,int *param_2,undefined4 param_3)



{

  uint uVar1;

  int local_8;

  int local_4;

  

  FUN_00470660(&local_8);

  uVar1 = *(uint *)(param_1 + 0x778) & 1;

  if (uVar1 == 0) {

    local_8 = local_4;

  }

  if (local_8 == 0) {

    FUN_00471280(0,param_3);

    return;

  }

  if (uVar1 == 1) {

    param_2 = (int *)*param_2;

  }

  else {

    param_2 = (int *)param_2[1];

  }

  FUN_00471280((float)(int)param_2 / (float)local_8 + *(float *)(param_1 + 0x758),param_3);

  return;

}





// --- FUN_00471470 at 0x00471470 (size: 30) ---


void * __thiscall FUN_00471470(void *param_1,byte param_2)



{

  FUN_00470f80();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00471490 at 0x00471490 (size: 857) ---


void __fastcall FUN_00471490(int *param_1)



{

  uint uVar1;

  bool bVar2;

  char cVar3;

  int iVar4;

  int iVar5;

  int *piVar6;

  int iVar7;

  undefined4 local_24;

  int local_20;

  int local_1c;

  int local_18;

  int iStack_14;

  int local_10;

  undefined1 local_c [8];

  int local_4;

  

  if (param_1[0x1c8] == 0) {

    iVar4 = FUN_00463ba0(1);

    param_1[0x1c8] = iVar4;

  }

  if ((*(byte *)(param_1 + 0x1de) & 0x20) == 0) {

    local_24 = 0;

    FUN_00460bf0(0x86,&local_24);

    local_20 = 1;

    cVar3 = FUN_00460b30(0x7d,&local_20);

    if (((cVar3 != '\0') && (local_20 != 0)) && (cVar3 = FUN_00460b30(0x87,local_c), cVar3 == '\0'))

    {

      FUN_00471280(local_24,0);

      return;

    }

    FUN_00470e60();

    if (param_1[0x1c8] != 0) {

      iVar4 = FUN_0069fe60();

      local_4 = FUN_0069fe70();

      if ((*(byte *)(param_1 + 0x1de) & 2) != 0) {

        local_18 = 0x3f800000;

        FUN_00460bf0(0x88,&local_18);

        local_10 = 0;

        FUN_00460b30(0x89,&local_10);

        uVar1 = param_1[0x1de];

        local_1c = param_1[0x1da] - param_1[0x1d8];

        if ((uVar1 & 1) == 0) {

          local_1c = param_1[0x1db] - param_1[0x1d9];

        }

        iVar5 = FUN_005df4c4();

        if (iVar5 < local_10) {

          iVar5 = local_10;

        }

        if ((uVar1 & 1) == 1) {

          iVar4 = iVar5;

          iVar5 = local_4;

        }

        local_4 = iVar5;

        (**(code **)(*(int *)param_1[0x1c8] + 0x30))(iVar4,local_4);

      }

      FUN_00470d60(&local_18,local_24);

      iVar7 = local_18;

      (**(code **)(*(int *)param_1[0x1c8] + 0x2c))(local_18,iStack_14);

      iVar5 = param_1[0x1de];

      iVar7 = iVar4 / 2 + iVar7;

      local_10 = FUN_0069fe70();

      piVar6 = (int *)FUN_00463ba0(4);

      if (piVar6 != (int *)0x0) {

        (**(code **)(*piVar6 + 0x18))(((byte)iVar5 & 4) != 4);

        (**(code **)(*piVar6 + 0x2c))(0,0);

        (**(code **)(*piVar6 + 0x30))(iVar7,local_1c);

      }

      iVar4 = param_1[0x1de];

      local_10 = FUN_0069fe70();

      iVar5 = FUN_0069fe60();

      piVar6 = (int *)FUN_00463ba0(6);

      if (piVar6 != (int *)0x0) {

        (**(code **)(*piVar6 + 0x18))(((byte)iVar4 & 4) != 4);

        (**(code **)(*piVar6 + 0x2c))(iVar7,0);

        (**(code **)(*piVar6 + 0x30))(iVar5 - iVar7,local_1c);

      }

      iVar4 = param_1[0x1de];

      iVar5 = local_4 / 2 + iStack_14;

      local_10 = FUN_0069fe60();

      piVar6 = (int *)FUN_00463ba0(5);

      if (piVar6 != (int *)0x0) {

        (**(code **)(*piVar6 + 0x18))(((byte)iVar4 & 4) != 4);

        (**(code **)(*piVar6 + 0x2c))(0,0);

        (**(code **)(*piVar6 + 0x30))(local_1c,iVar5);

      }

      iVar4 = param_1[0x1de];

      iVar7 = FUN_0069fe70();

      local_10 = FUN_0069fe60();

      piVar6 = (int *)FUN_00463ba0(7);

      if (piVar6 != (int *)0x0) {

        (**(code **)(*piVar6 + 0x18))(((byte)iVar4 & 4) != 4);

        (**(code **)(*piVar6 + 0x2c))(0,iVar5);

        (**(code **)(*piVar6 + 0x30))(local_1c,iVar7 - iVar5);

      }

    }

    uVar1 = param_1[0x1de];

    if (((uVar1 & 4) == 0) || ((uVar1 & 8) == 0)) {

      bVar2 = false;

    }

    else {

      bVar2 = true;

    }

    (**(code **)(*param_1 + 0x18))(CONCAT31((int3)(uVar1 >> 8),!bVar2));

    if ((param_1[0x1de] & 0x1000000U) != 0) {

      (**(code **)(*param_1 + 0x9c))((-(uint)(((byte)param_1[0x1de] & 4) != 4) & 0xfffffff4) + 0xd);

    }

  }

  return;

}





// --- FUN_00471810 at 0x00471810 (size: 120) ---


void __thiscall FUN_00471810(int param_1,int param_2)



{

  char cVar1;

  bool bVar2;

  

  bVar2 = param_2 == 5;

  param_2 = 0;

  cVar1 = FUN_00460bf0(0x86,&param_2);

  if (cVar1 != '\0') {

    if ((*(uint *)(param_1 + 0x778) & 0x100) != 0) {

      FUN_004711f0(0x86,((-(uint)(((byte)*(uint *)(param_1 + 0x778) & 1) != 1) & 2) - 1) *

                        ((uint)bVar2 * 2 + -1));

      return;

    }

    FUN_00460410(0xe - (uint)bVar2,0,0);

  }

  return;

}





// --- FUN_00471c30 at 0x00471C30 (size: 681) ---


void __thiscall FUN_00471c30(int param_1,int *param_2)



{

  bool bVar1;

  bool bVar2;

  bool bVar3;

  int *piVar4;

  int iVar5;

  int iVar6;

  uint uVar7;

  int local_38;

  int local_34;

  int local_30;

  int local_2c;

  undefined1 local_28 [20];

  int iStack_14;

  int iStack_10;

  int iStack_c;

  int iStack_8;

  

  iVar5 = param_2[1];

  if ((iVar5 == *(int *)(param_1 + 0x720)) ||

     ((iVar5 == param_1 && ((*(byte *)(param_1 + 0x778) & 0x40) != 0)))) {

    bVar3 = true;

  }

  else {

    bVar3 = false;

  }

  for (piVar4 = *(int **)(*(int *)(iVar5 + 400) + (int)(7 % (ulonglong)*(uint *)(iVar5 + 0x198)) * 4

                         ); piVar4 != (int *)0x0; piVar4 = (int *)piVar4[1]) {

    if (*piVar4 == 7) {

      if (piVar4 != (int *)0x0) goto LAB_00471cc8;

      break;

    }

  }

  piVar4 = *(int **)(*(int *)(iVar5 + 400) + (int)(10 % (ulonglong)*(uint *)(iVar5 + 0x198)) * 4);

  if (piVar4 == (int *)0x0) {

LAB_00471cc4:

    bVar1 = false;

  }

  else {

    while (*piVar4 != 10) {

      piVar4 = (int *)piVar4[1];

      if (piVar4 == (int *)0x0) goto code_r0x00471cbc;

    }

    if (piVar4 == (int *)0x0) goto LAB_00471cc4;

LAB_00471cc8:

    bVar1 = true;

  }

LAB_00471cca:

  if ((param_2[3] == 7) || (param_2[3] == 10)) {

    bVar2 = true;

  }

  else {

    bVar2 = false;

  }

  switch(param_2[2]) {

  case 2:

    if ((*param_2 == *(int *)(param_1 + 0x770)) || (*param_2 == *(int *)(param_1 + 0x774))) {

      FUN_00471250(param_2);

      FUN_004725d0(param_2);

      return;

    }

    if (iVar5 == param_1) {

      FUN_00459ce0(param_2);

      iVar5 = (**(code **)(*DAT_00837ff4 + 0x18))();

      iStack_14 = iVar5;

      iVar6 = (**(code **)(*DAT_00837ff4 + 0x1c))();

      iStack_10 = iVar6;

      iStack_c = FUN_0069fe00();

      iStack_c = iVar5 - iStack_c;

      iStack_8 = FUN_0069fe30();

      iStack_8 = iVar6 - iStack_8;

      FUN_00470a90(local_28);

      FUN_004725d0(param_2);

      return;

    }

    break;

  case 3:

  case 4:

  case 5:

  case 6:

  case 7:

  case 8:

  case 9:

  case 10:

  case 0xb:

  case 0xc:

  case 0xd:

  case 0xe:

  case 0xf:

  case 0x10:

  case 0x11:

  case 0x12:

  case 0x13:

  case 0x14:

  case 0x15:

  case 0x16:

  case 0x17:

  case 0x18:

  case 0x19:

  case 0x1a:

  case 0x1b:

    break;

  case 0x1c:

    if ((bVar3) && (bVar1)) {

      FUN_00471370(param_2);

      FUN_004725d0(param_2);

      return;

    }

    break;

  case 0x1d:

    if (((bVar3) && (bVar2)) && (*(char *)(param_1 + 0x75c) != '\0')) {

      *(undefined1 *)(param_1 + 0x75c) = 0;

      FUN_004725d0(param_2);

      return;

    }

    break;

  case 0x1e:

    if ((bVar3) && (bVar1)) {

      FUN_00470620(&local_38,param_2);

      uVar7 = FUN_004708b0(&local_38);

      if ((int)((uVar7 ^ (int)uVar7 >> 0x1f) - ((int)uVar7 >> 0x1f)) < 0x65) {

        if ((*(byte *)(param_1 + 0x778) & 0x40) == 0) {

          local_30 = local_38 - *(int *)(param_1 + 0x750);

          local_2c = local_34 - *(int *)(param_1 + 0x754);

          FUN_004713e0(&local_30,*(undefined1 *)(param_1 + 0x75c));

        }

        else {

          FUN_00471310(param_2,*(undefined1 *)(param_1 + 0x75c));

        }

        *(undefined1 *)(param_1 + 0x75c) = 1;

      }

      else if (*(char *)(param_1 + 0x75c) != '\0') {

        FUN_00471280(*(undefined4 *)(param_1 + 0x758),0);

        *(undefined1 *)(param_1 + 0x75c) = 0;

        FUN_004725d0(param_2);

        return;

      }

    }

    break;

  default:

    goto switchD_00471cf4_default;

  }

switchD_00471cf4_default:

  FUN_004725d0(param_2);

  return;

code_r0x00471cbc:

  bVar1 = false;

  goto LAB_00471cca;

}





// --- FUN_00471f10 at 0x00471F10 (size: 68) ---


undefined4 * __thiscall FUN_00471f10(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00468800(param_2,param_3);

  *(undefined1 *)(param_1 + 0x1c4) = 0;

  *(undefined1 *)((int)param_1 + 0x711) = 0;

  param_1[0x1c6] = 0;

  param_1[0x1c7] = 0;

  *param_1 = &PTR_FUN_0079e280;

  param_1[0x182] = &PTR_FUN_0079d180;

  return param_1;

}





// --- FUN_00471f80 at 0x00471F80 (size: 51) ---


void __fastcall FUN_00471f80(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079e280;

  param_1[0x182] = &PTR_FUN_0079d180;

  if (*(char *)((int)param_1 + 0x711) != '\0') {

    *(undefined1 *)((int)param_1 + 0x711) = 0;

    FUN_00465fb0(3);

  }

  FUN_004679f0();

  return;

}





// --- FUN_00472020 at 0x00472020 (size: 142) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_00472020(int param_1,int param_2,float param_3)



{

  double dVar1;

  byte bVar2;

  

  FUN_0046a730(param_2,param_3);

  dVar1 = _DAT_008379a8;

  if ((param_2 == 3) && (*(char *)(param_1 + 0x711) != '\0')) {

    bVar2 = *(byte *)(param_1 + 0xa4) & 1;

    if ((bVar2 == 0) && (*(double *)(param_1 + 0x718) < _DAT_008379a8)) {

      *(double *)(param_1 + 0x718) = _DAT_008379a8;

    }

    if ((bVar2 != 0) && (*(double *)(param_1 + 0x718) <= dVar1)) {

      FUN_00460410(2,0,0);

      FUN_00460bf0(0x11,&param_3);

      *(double *)(param_1 + 0x718) = (double)(param_3 + (float)*(double *)(param_1 + 0x718));

      return;

    }

  }

  return;

}





// --- FUN_004720b0 at 0x004720B0 (size: 175) ---


void __fastcall FUN_004720b0(int *param_1)



{

  int iVar1;

  char cVar2;

  undefined4 uStack_4;

  

  uStack_4 = param_1;

  FUN_00460cc0(0xd,(int)&uStack_4 + 1);

  if (uStack_4._1_1_ == '\0') {

    FUN_00460cc0(0xe,(int)&uStack_4 + 2);

    FUN_00460cc0(0x13,(int)&uStack_4 + 3);

    cVar2 = (-(uStack_4._2_1_ != '\0') & 5U) + 1;

    if (((char)param_1[0x1c4] != '\0') ||

       ((uStack_4._3_1_ != '\0' && ((*(byte *)(param_1 + 0x29) & 1) != 0)))) {

      cVar2 = (-(uStack_4._2_1_ != '\0') & 5U) + 2;

    }

    if (((char)param_1[0x1c4] != '\0') && ((*(byte *)(param_1 + 0x29) & 1) != 0)) {

      cVar2 = (-(uStack_4._2_1_ != '\0') & 5U) + 3;

    }

  }

  else {

    cVar2 = '\r';

  }

  iVar1 = FUN_0069bad0(cVar2);

  if (iVar1 != 0) {

    (**(code **)(*param_1 + 0x9c))(cVar2);

  }

  return;

}





// --- FUN_00472210 at 0x00472210 (size: 125) ---


undefined1 FUN_00472210(void)



{

  undefined4 *puVar1;

  char cVar2;

  int iVar3;

  uint local_4c;

  uint auStack_48 [7];

  undefined4 uStack_2c;

  undefined1 uStack_28;

  

  cVar2 = FUN_00460990(0x12,&local_4c);

  if (cVar2 == '\0') {

    return 0;

  }

  if ((((local_4c != 1) && (DAT_00837ff4 != (int *)0x0)) &&

      (iVar3 = (**(code **)(*DAT_00837ff4 + 0x44))(), puVar1 = DAT_0083e03c, iVar3 != 0)) &&

     (DAT_0083e03c != (undefined4 *)0x0)) {

    FUN_00430ee0();

    auStack_48[0] = local_4c;

    uStack_2c = 3;

    uStack_28 = 1;

    (**(code **)*puVar1)(auStack_48);

    return 1;

  }

  return 0;

}





// --- FUN_00472290 at 0x00472290 (size: 72) ---


undefined4 * __thiscall FUN_00472290(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079e280;

  param_1[0x182] = &PTR_FUN_0079d180;

  if (*(char *)((int)param_1 + 0x711) != '\0') {

    *(undefined1 *)((int)param_1 + 0x711) = 0;

    FUN_00465fb0(3);

  }

  FUN_004679f0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004722e0 at 0x004722E0 (size: 16) ---


void FUN_004722e0(void)



{

  FUN_00460270(1,&LAB_00471fc0);

  return;

}





// --- FUN_004722f0 at 0x004722F0 (size: 16) ---


void FUN_004722f0(void)



{

  FUN_00474870();

  FUN_004720b0();

  return;

}





// --- FUN_00472300 at 0x00472300 (size: 140) ---


void __thiscall FUN_00472300(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  undefined4 uVar3;

  

  uVar2 = param_2;

  FUN_0046a8d0(param_2);

  uVar3 = FUN_00429a00();

  switch(uVar3) {

  case 0xd:

    FUN_004720b0();

    iVar1 = *param_1;

    uVar3 = (**(code **)(iVar1 + 0x124))();

    (**(code **)(iVar1 + 0x110))(uVar3);

    return;

  case 0xe:

  case 0x13:

    FUN_004720b0();

    return;

  case 0xf:

    param_2 = param_2 & 0xffffff00;

    if (*(int **)(uVar2 + 4) != (int *)0x0) {

      (**(code **)(**(int **)(uVar2 + 4) + 0x70))(&param_2);

    }

    if ((*(char *)((int)param_1 + 0x711) != '\0') && ((char)param_2 == '\0')) {

      *(undefined1 *)((int)param_1 + 0x711) = 0;

      FUN_00465fb0(3);

    }

  }

  return;

}





// --- FUN_004723b0 at 0x004723B0 (size: 231) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_004723b0(float param_1,undefined4 param_2,undefined4 param_3,int param_4)



{

  uint uVar1;

  int iVar2;

  float local_4;

  

  iVar2 = param_4;

  local_4 = param_1;

  FUN_00469600(param_2,param_3,param_4);

  uVar1 = *(uint *)((int)param_1 + 0x554);

  if (((((uVar1 >> 0x17 & 1) == 0) && (iVar2 == 10)) || (iVar2 == 7)) &&

     (((uVar1 >> 0x13 & 1) == 0 && ((uVar1 >> 0x12 & 1) == 0)))) {

    *(undefined1 *)((int)param_1 + 0x710) = 1;

    FUN_004720b0();

    FUN_00460cc0(0xd,&param_4);

    FUN_00460cc0(0xc,&param_3);

    if (((char)param_4 == '\0') || ((char)param_3 != '\0')) {

      FUN_00460cc0(0xf,&param_2);

      if ((char)param_2 != '\0') {

        FUN_00460410(2,iVar2,0);

        *(undefined1 *)((int)param_1 + 0x711) = 1;

        FUN_00465f90(3);

        FUN_00460bf0(0x10,&local_4);

        *(double *)((int)param_1 + 0x718) = (double)(local_4 + (float)_DAT_008379a8);

      }

    }

  }

  return;

}





// --- FUN_004724a0 at 0x004724A0 (size: 259) ---


void __thiscall FUN_004724a0(int param_1,undefined4 param_2,undefined4 param_3,uint param_4)



{

  bool bVar1;

  uint uVar2;

  undefined4 uStack_4;

  

  uVar2 = param_4;

  uStack_4 = param_1;

  FUN_00469780(param_2,param_3,param_4);

  FUN_00460cc0(0xd,&param_3);

  FUN_00460cc0(0xc,(int)&uStack_4 + 3);

  bVar1 = false;

  if ((*(char *)(param_1 + 0x710) != '\0') && ((uVar2 == 7 || (uVar2 == 10)))) {

    if (((*(byte *)(param_1 + 0xa4) & 1) != 0) && ((char)param_3 == '\0')) {

      param_4 = param_4 & 0xffffff00;

      FUN_00460cc0(0xb,&param_4);

      if ((char)param_4 != '\0') {

        FUN_00460cc0(0xe,&param_2);

        FUN_00460820(0xe,(char)param_2 == '\0');

      }

      if ((((char)param_3 == '\0') || (uStack_4._3_1_ != '\0')) &&

         (*(char *)(param_1 + 0x711) == '\0')) {

        bVar1 = true;

      }

      else {

        bVar1 = false;

      }

    }

    *(undefined1 *)(param_1 + 0x710) = 0;

    if (*(char *)(param_1 + 0x711) != '\0') {

      *(undefined1 *)(param_1 + 0x711) = 0;

      FUN_00465fb0(3);

    }

    FUN_004720b0();

    if (bVar1) {

      FUN_00460410(1,7,0);

    }

  }

  return;

}





// --- FUN_004725d0 at 0x004725D0 (size: 76) ---


undefined4 __thiscall FUN_004725d0(int param_1,int param_2)



{

  int iVar1;

  char cVar2;

  undefined4 uVar3;

  

  iVar1 = param_2;

  if ((*(int *)(param_2 + 4) == param_1) && (*(int *)(param_2 + 8) == 1)) {

    FUN_00460cc0(0xd,&param_2);

    if ((char)param_2 == '\0') {

      cVar2 = FUN_00472210(iVar1);

      if (cVar2 == '\0') goto LAB_0047260f;

    }

    return 2;

  }

LAB_0047260f:

  uVar3 = FUN_00468a50(iVar1);

  return uVar3;

}





// --- FUN_00472620 at 0x00472620 (size: 77) ---


bool FUN_00472620(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_00467a90(param_1);

  FUN_00425ba0();

  if (param_1 == (int *)0x0) {

    return false;

  }

  cVar2 = FUN_00427240(1,param_1);

  (**(code **)(*param_1 + 0x14))();

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_00472670 at 0x00472670 (size: 46) ---


undefined4 * __thiscall FUN_00472670(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00464900(param_2,param_3);

  *(undefined1 *)(param_1 + 0x17c) = 0;

  param_1[0x17d] = 0;

  *param_1 = &PTR_FUN_0079e3c0;

  return param_1;

}





// --- FUN_004726c0 at 0x004726C0 (size: 11) ---


void __fastcall FUN_004726c0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079e3c0;

  FUN_00464e00();

  return;

}





// --- FUN_00472810 at 0x00472810 (size: 53) ---


void __thiscall FUN_00472810(int *param_1,undefined4 param_2)



{

  if ((char)param_1[0x17c] != '\0') {

    (**(code **)(*param_1 + 0x9c))(param_1[0x17d]);

    *(undefined1 *)(param_1 + 0x17c) = 0;

  }

  FUN_00461860(param_2);

  return;

}





// --- FUN_00472850 at 0x00472850 (size: 36) ---


undefined4 * __thiscall FUN_00472850(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079e3c0;

  FUN_00464e00();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00472880 at 0x00472880 (size: 16) ---


void FUN_00472880(void)



{

  FUN_00460270(3,&LAB_004726d0);

  return;

}





// --- FUN_00472890 at 0x00472890 (size: 77) ---


bool FUN_00472890(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

  if (param_1 == (int *)0x0) {

    return false;

  }

  cVar2 = FUN_00427240(9,param_1);

  (**(code **)(*param_1 + 0x14))();

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_004728e0 at 0x004728E0 (size: 32) ---


undefined4 FUN_004728e0(short param_1)



{

  if (((param_1 != 9) && (param_1 != 0xd)) && (param_1 != 0x20)) {

    return 0;

  }

  return 1;

}





// --- FUN_00472900 at 0x00472900 (size: 98) ---


undefined4 FUN_00472900(short param_1)



{

  if (((((param_1 != 0x21) && (param_1 != 0x29)) && (param_1 != 0x2c)) &&

      ((((param_1 != 0x2e && (param_1 != 0x3f)) &&

        ((param_1 != 0x3001 && ((param_1 != 0x3002 && (param_1 != 0x30fc)))))) && (param_1 != -0xff)

       ))) && ((((param_1 != -0xf7 && (param_1 != -0xe1)) && (param_1 != -0x90)) &&

               ((param_1 != -0x62 && (param_1 != -0x61)))))) {

    return 0;

  }

  return 1;

}





// --- FUN_00472970 at 0x00472970 (size: 26) ---


undefined4 FUN_00472970(short param_1)



{

  if ((param_1 != 0x28) && (param_1 != -0xf8)) {

    return 0;

  }

  return 1;

}





// --- FUN_00472990 at 0x00472990 (size: 62) ---


undefined4 FUN_00472990(ushort param_1)



{

  if (((((param_1 < 0x1100) || (0x11ff < param_1)) && ((param_1 < 0x3000 || (0xd7af < param_1)))) &&

      ((param_1 < 0xf900 || (0xfaff < param_1)))) && ((param_1 < 0xff00 || (0xffdc < param_1)))) {

    return 0;

  }

  return 1;

}





// --- FUN_004729d0 at 0x004729D0 (size: 122) ---


undefined4 FUN_004729d0(short *param_1,short *param_2)



{

  short sVar1;

  short sVar2;

  char cVar3;

  

  if (((param_2 == (short *)0x0) || (param_1 == (short *)0x0)) || (param_1 == param_2)) {

    return 0;

  }

  sVar1 = *param_1;

  sVar2 = *param_2;

  if (sVar1 == 10) {

    return 1;

  }

  cVar3 = FUN_004728e0(sVar1);

  if (((cVar3 == '\0') && (cVar3 = FUN_00472990(sVar2), cVar3 == '\0')) &&

     (cVar3 = FUN_00472990(sVar1), cVar3 == '\0')) {

    return 0;

  }

  cVar3 = FUN_00472900(sVar2);

  if ((cVar3 == '\0') && (cVar3 = FUN_00472970(sVar1), cVar3 == '\0')) {

    return 1;

  }

  return 0;

}





// --- FUN_00472ab0 at 0x00472AB0 (size: 126) ---


undefined4 __thiscall FUN_00472ab0(int param_1,uint param_2,uint *param_3,undefined4 *param_4)



{

  uint uVar1;

  uint uVar2;

  uint uVar3;

  int iVar4;

  

  if (*(uint *)(param_1 + 0x10) < param_2) {

    return 0;

  }

  *param_3 = 0;

  *param_4 = 0;

  uVar2 = *(uint *)(param_1 + 0x1c);

  if (uVar2 != 0) {

    iVar4 = 0;

    uVar3 = 0;

    while ((uVar3 != uVar2 - 1 &&

           ((uVar1 = uVar3 + 1, uVar2 <= uVar1 ||

            (*(uint *)(iVar4 + 0x14 + *(int *)(param_1 + 0x14)) <= param_2))))) {

      iVar4 = iVar4 + 0x10;

      uVar3 = uVar1;

      if (uVar2 <= uVar1) {

        return 1;

      }

    }

    *param_3 = uVar3;

    *param_4 = *(undefined4 *)(uVar3 * 0x10 + 4 + *(int *)(param_1 + 0x14));

  }

  return 1;

}





// --- FUN_00472b30 at 0x00472B30 (size: 121) ---


undefined4 __thiscall FUN_00472b30(int param_1,uint param_2,uint *param_3)



{

  uint uVar1;

  int *piVar2;

  uint *puVar3;

  uint uVar4;

  int iVar5;

  uint local_4;

  

  if ((int)param_2 < 1) {

    *param_3 = 0;

    return 1;

  }

  uVar1 = *(uint *)(param_1 + 0x1c);

  iVar5 = 0;

  uVar4 = 0;

  if (uVar1 != 0) {

    piVar2 = (int *)(*(int *)(param_1 + 0x14) + 0xc);

    do {

      iVar5 = iVar5 + *piVar2;

      if ((int)param_2 <= iVar5) {

        *param_3 = uVar4;

        return 1;

      }

      uVar4 = uVar4 + 1;

      piVar2 = piVar2 + 4;

    } while (uVar4 < uVar1);

  }

  local_4 = 0;

  puVar3 = &param_2;

  if ((int)(uVar1 - 1) < 1) {

    puVar3 = &local_4;

  }

  *param_3 = *puVar3;

  return 1;

}





// --- FUN_00472bb0 at 0x00472BB0 (size: 70) ---


undefined4 __thiscall FUN_00472bb0(int param_1,int param_2,uint *param_3)



{

  uint uVar1;

  uint uVar2;

  int iVar3;

  int *piVar4;

  

  uVar1 = *(uint *)(param_1 + 0x1c);

  iVar3 = *(int *)(*(int *)(param_1 + 0x14) + 0xc);

  uVar2 = 1;

  if (1 < uVar1) {

    piVar4 = (int *)(*(int *)(param_1 + 0x14) + 0x1c);

    do {

      iVar3 = iVar3 + *piVar4;

      if (param_2 < iVar3) {

        *param_3 = uVar2 - 1;

        return CONCAT31((int3)(uVar2 - 1 >> 8),1);

      }

      uVar2 = uVar2 + 1;

      piVar4 = piVar4 + 4;

    } while (uVar2 < uVar1);

  }

  *param_3 = uVar1;

  return CONCAT31((int3)(uVar2 >> 8),1);

}





// --- FUN_00472c00 at 0x00472C00 (size: 86) ---


undefined4 __thiscall FUN_00472c00(int param_1,undefined4 param_2,int *param_3,undefined4 *param_4)



{

  int iVar1;

  int *piVar2;

  undefined4 *puVar3;

  char cVar4;

  int *piVar5;

  

  puVar3 = param_4;

  piVar2 = param_3;

  cVar4 = FUN_00472ab0(param_2,param_3,param_4);

  if ((cVar4 != '\0') && (*(int *)(param_1 + 0x1c) != 0)) {

    param_4 = (undefined4 *)(*(int *)(param_1 + 0x1c) - 1);

    param_3 = (int *)(*piVar2 + 1);

    piVar5 = (int *)&param_4;

    if (param_3 <= param_4) {

      piVar5 = (int *)&param_3;

    }

    iVar1 = *piVar5;

    *piVar2 = iVar1;

    *puVar3 = *(undefined4 *)(iVar1 * 0x10 + 4 + *(int *)(param_1 + 0x14));

  }

  return 1;

}





// --- FUN_00472c60 at 0x00472C60 (size: 85) ---


undefined4 __thiscall FUN_00472c60(int param_1,undefined4 param_2,int *param_3,undefined4 *param_4)



{

  int iVar1;

  int *piVar2;

  undefined4 *puVar3;

  char cVar4;

  int *piVar5;

  

  puVar3 = param_4;

  piVar2 = param_3;

  cVar4 = FUN_00472ab0(param_2,param_3,param_4);

  if ((cVar4 != '\0') && (*(int *)(param_1 + 0x1c) != 0)) {

    param_3 = (int *)(*piVar2 + -1);

    param_4 = (undefined4 *)0x0;

    piVar5 = (int *)&param_4;

    if (-1 < (int)param_3) {

      piVar5 = (int *)&param_3;

    }

    iVar1 = *piVar5;

    *piVar2 = iVar1;

    *puVar3 = *(undefined4 *)(iVar1 * 0x10 + 4 + *(int *)(param_1 + 0x14));

  }

  return 1;

}





// --- FUN_00472cc0 at 0x00472CC0 (size: 41) ---


uint __thiscall FUN_00472cc0(int param_1,uint param_2,undefined4 *param_3)



{

  undefined4 uVar1;

  

  *param_3 = 0;

  if (param_2 < *(uint *)(param_1 + 0x1c)) {

    uVar1 = *(undefined4 *)(param_2 * 0x10 + 0xc + *(int *)(param_1 + 0x14));

    *param_3 = uVar1;

    return CONCAT31((int3)((uint)uVar1 >> 8),1);

  }

  return param_2 & 0xffffff00;

}





// --- FUN_00472cf0 at 0x00472CF0 (size: 41) ---


uint __thiscall FUN_00472cf0(int param_1,uint param_2,undefined4 *param_3)



{

  undefined4 uVar1;

  

  *param_3 = 0;

  if (param_2 < *(uint *)(param_1 + 0x1c)) {

    uVar1 = *(undefined4 *)(param_2 * 0x10 + 8 + *(int *)(param_1 + 0x14));

    *param_3 = uVar1;

    return CONCAT31((int3)((uint)uVar1 >> 8),1);

  }

  return param_2 & 0xffffff00;

}





// --- FUN_00472d20 at 0x00472D20 (size: 106) ---


undefined4 __thiscall FUN_00472d20(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  

  iVar1 = FUN_005df0f5(0x2c);

  if (iVar1 == 0) {

    return 0;

  }

  FUN_00474d30(param_2);

  *(undefined4 *)(iVar1 + 0x24) = 0;

  *(undefined4 *)(iVar1 + 0x28) = 0;

  if (*(int *)(param_1 + 4) == 0) {

    iVar2 = *(int *)(param_1 + 0xc) + 1;

    *(int *)(param_1 + 4) = iVar1;

    *(int *)(param_1 + 8) = iVar1;

    *(int *)(param_1 + 0xc) = iVar2;

    return CONCAT31((int3)((uint)iVar2 >> 8),1);

  }

  iVar2 = *(int *)(param_1 + 8);

  *(int *)(iVar2 + 0x24) = iVar1;

  *(int *)(iVar1 + 0x28) = iVar2;

  iVar2 = *(int *)(param_1 + 0xc) + 1;

  *(int *)(param_1 + 8) = iVar1;

  *(int *)(param_1 + 0xc) = iVar2;

  return CONCAT31((int3)((uint)iVar2 >> 8),1);

}





// --- FUN_00472d90 at 0x00472D90 (size: 132) ---


undefined4 __thiscall FUN_00472d90(int param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  

  iVar1 = FUN_005df0f5(0x2c);

  if (iVar1 == 0) {

    return 0;

  }

  FUN_00474d30(param_3);

  *(undefined4 *)(iVar1 + 0x24) = 0;

  *(undefined4 *)(iVar1 + 0x28) = 0;

  if (*(int *)(param_1 + 4) == 0) {

    *(int *)(param_1 + 4) = iVar1;

    *(int *)(param_1 + 8) = iVar1;

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    return 1;

  }

  *(int *)(iVar1 + 0x24) = param_2;

  *(undefined4 *)(iVar1 + 0x28) = *(undefined4 *)(param_2 + 0x28);

  if (*(int *)(param_2 + 0x28) != 0) {

    *(int *)(*(int *)(param_2 + 0x28) + 0x24) = iVar1;

    *(int *)(param_2 + 0x28) = iVar1;

    *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

    return 1;

  }

  *(int *)(param_1 + 4) = iVar1;

  *(int *)(param_2 + 0x28) = iVar1;

  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

  return 1;

}





// --- FUN_00472e40 at 0x00472E40 (size: 88) ---


undefined4 __thiscall FUN_00472e40(int param_1,uint param_2,uint *param_3)



{

  bool bVar1;

  char cVar2;

  int iVar3;

  uint uVar4;

  

  if (*(uint *)(param_1 + 0x10) < param_2) {

    return 0;

  }

  *param_3 = param_2;

  iVar3 = *(int *)(param_1 + 8);

  bVar1 = false;

  uVar4 = 0;

  if (iVar3 == 0) {

    return 1;

  }

  while( true ) {

    if (param_2 <= uVar4) {

      cVar2 = FUN_00474b90();

      if (cVar2 == '\0') {

        if (bVar1) {

          return 1;

        }

      }

      else {

        bVar1 = true;

      }

      *param_3 = *param_3 + 1;

    }

    uVar4 = uVar4 + 1;

    if (iVar3 == 0) break;

    iVar3 = *(int *)(iVar3 + 0x24);

    if (iVar3 == 0) {

      return 1;

    }

  }

  return 1;

}





// --- FUN_00472ea0 at 0x00472EA0 (size: 93) ---


undefined4 __thiscall FUN_00472ea0(int param_1,uint param_2,uint *param_3)



{

  bool bVar1;

  char cVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  

  if (*(uint *)(param_1 + 0x10) < param_2) {

    return 0;

  }

  iVar4 = *(int *)(param_1 + 8);

  uVar3 = 0;

  uVar5 = 0;

  if (iVar4 != 0) {

    bVar1 = true;

    while (uVar5 < param_2) {

      cVar2 = FUN_00474b90();

      if (cVar2 == '\0') {

        if (bVar1) {

          bVar1 = false;

          uVar3 = uVar5;

        }

      }

      else {

        bVar1 = true;

      }

      uVar5 = uVar5 + 1;

      if ((iVar4 == 0) || (iVar4 = *(int *)(iVar4 + 0x24), iVar4 == 0)) break;

    }

  }

  *param_3 = uVar3;

  return 1;

}





// --- FUN_00472f00 at 0x00472F00 (size: 107) ---


uint __thiscall FUN_00472f00(int param_1,uint param_2,int *param_3)



{

  uint uVar1;

  int *piVar2;

  uint in_EAX;

  uint uVar3;

  int iVar4;

  uint uVar5;

  

  piVar2 = param_3;

  uVar1 = param_2;

  if (*(uint *)(param_1 + 0x10) < param_2) {

    return in_EAX & 0xffffff00;

  }

  *param_3 = 0;

  param_2 = 0;

  uVar3 = FUN_00472ab0(uVar1,&param_3,&param_2);

  if ((char)uVar3 != '\0') {

    iVar4 = *(int *)(param_1 + 8);

    uVar5 = 0;

    if (iVar4 != 0) {

      while (uVar5 < uVar1) {

        if (param_2 <= uVar5) {

          *piVar2 = *piVar2 + *(int *)(iVar4 + 4);

        }

        uVar5 = uVar5 + 1;

        if (iVar4 == 0) {

          return uVar3;

        }

        iVar4 = *(int *)(iVar4 + 0x24);

        if (iVar4 == 0) {

          return uVar3;

        }

      }

    }

  }

  return uVar3;

}





// --- FUN_00472f70 at 0x00472F70 (size: 43) ---


void __thiscall FUN_00472f70(int param_1,int param_2)



{

  int iVar1;

  

  if (param_2 != 0) {

    for (iVar1 = *(int *)(param_1 + 8); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x24)) {

      if (*(int *)(iVar1 + 0x20) == param_2) {

        FUN_00474ce0(0);

      }

    }

  }

  return;

}





// --- FUN_00472fa0 at 0x00472FA0 (size: 77) ---


void __thiscall FUN_00472fa0(int param_1,undefined4 *param_2,int param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  iVar2 = 0;

  iVar1 = *(int *)(param_1 + 8);

  while( true ) {

    if (iVar1 == 0) {

      param_2[1] = 0;

      *param_2 = &PTR_LAB_0079d17c;

      param_2[2] = param_1 + 4;

      return;

    }

    if (iVar2 == param_3) break;

    iVar3 = 0;

    if (iVar1 != 0) {

      iVar3 = *(int *)(iVar1 + 0x24);

    }

    iVar2 = iVar2 + 1;

    iVar1 = iVar3;

  }

  param_2[1] = iVar1;

  *param_2 = &PTR_LAB_0079d17c;

  param_2[2] = param_1 + 4;

  return;

}





// --- FUN_00472ff0 at 0x00472FF0 (size: 44) ---


void __thiscall FUN_00472ff0(int param_1,undefined4 param_2)



{

  int iVar1;

  

  *(undefined4 *)(param_1 + 0x2c) = 0;

  for (iVar1 = *(int *)(param_1 + 8); (iVar1 != 0 && (FUN_00474d60(param_2), iVar1 != 0));

      iVar1 = *(int *)(iVar1 + 0x24)) {

  }

  return;

}





// --- FUN_00473020 at 0x00473020 (size: 107) ---


uint __thiscall FUN_00473020(int param_1,void *param_2)



{

  uint in_EAX;

  int iVar1;

  undefined4 uVar2;

  

  uVar2 = 0;

  if ((param_2 == (void *)0x0) || (in_EAX = 0, *(void **)(param_1 + 4) == (void *)0x0)) {

    return in_EAX & 0xffffff00;

  }

  if (param_2 == *(void **)(param_1 + 4)) {

    iVar1 = *(int *)((int)param_2 + 0x24);

    *(int *)(param_1 + 4) = iVar1;

    if (iVar1 == 0) {

      *(undefined4 *)(param_1 + 8) = 0;

      goto LAB_0047306d;

    }

  }

  else {

    *(undefined4 *)(*(int *)((int)param_2 + 0x28) + 0x24) = *(undefined4 *)((int)param_2 + 0x24);

    iVar1 = *(int *)((int)param_2 + 0x24);

    if (iVar1 == 0) {

      *(undefined4 *)(param_1 + 8) = *(undefined4 *)((int)param_2 + 0x28);

      goto LAB_0047306d;

    }

    uVar2 = *(undefined4 *)((int)param_2 + 0x28);

  }

  *(undefined4 *)(iVar1 + 0x28) = uVar2;

LAB_0047306d:

  FUN_00474be0();

  operator_delete(param_2);

  iVar1 = *(int *)(param_1 + 0xc) + -1;

  *(int *)(param_1 + 0xc) = iVar1;

  return CONCAT31((int3)((uint)iVar1 >> 8),1);

}





// --- FUN_00473090 at 0x00473090 (size: 118) ---


void __fastcall FUN_00473090(int *param_1)



{

  undefined4 *puVar1;

  uint uVar2;

  int iVar3;

  int iVar4;

  

  param_1[2] = 0;

  if ((param_1[1] & 0x80000000U) != 0x80000000) {

    if (*param_1 != 0) {

      uVar2 = param_1[1] & 0x7fffffff;

      if (-1 < (int)(uVar2 - 1)) {

        iVar4 = (uVar2 - 1) * 0x10;

        do {

          iVar3 = *param_1 + iVar4;

          iVar4 = iVar4 + -0x10;

          uVar2 = uVar2 - 1;

          *(undefined4 *)(iVar3 + 4) = 0;

          *(undefined4 *)(iVar3 + 8) = 0;

          *(undefined4 *)(iVar3 + 0xc) = 0;

        } while (uVar2 != 0);

      }

    }

    return;

  }

  puVar1 = (undefined4 *)*param_1;

  if (puVar1 != (undefined4 *)0x0) {

    if (puVar1[-1] != 0) {

      (**(code **)*puVar1)(3);

      *param_1 = 0;

      param_1[1] = 0;

      return;

    }

    operator_delete__(puVar1 + -1);

  }

  *param_1 = 0;

  param_1[1] = 0;

  return;

}





// --- FUN_00473110 at 0x00473110 (size: 273) ---


undefined4 __thiscall FUN_00473110(int *param_1,uint param_2)



{

  uint *puVar1;

  undefined4 *puVar2;

  int iVar3;

  uint *puVar4;

  int iVar5;

  

  if ((uint)param_1[2] <= param_2) {

    if (param_2 <= (param_1[1] & 0x7fffffffU)) {

      return 1;

    }

    if (param_2 == 0) {

      FUN_00473090();

      return 1;

    }

    puVar4 = (uint *)thunk_FUN_005df0f5(param_2 * 0x10 + 4);

    if (puVar4 != (uint *)0x0) {

      puVar1 = puVar4 + 1;

      *puVar4 = param_2;

      FUN_00401000(puVar1,0x10,param_2,&LAB_00472e20);

      if (puVar1 != (uint *)0x0) {

        if (*param_1 != 0) {

          iVar5 = param_1[2];

          if (-1 < iVar5 + -1) {

            puVar4 = puVar1 + (iVar5 + -1) * 4 + 2;

            do {

              iVar3 = *param_1 + (-8 - (int)puVar1);

              puVar4[-1] = *(uint *)((int)puVar4 + iVar3 + 4);

              *puVar4 = *(uint *)((int)puVar4 + iVar3 + 8);

              puVar4[1] = *(uint *)((int)puVar4 + iVar3 + 0xc);

              puVar4 = puVar4 + -4;

              iVar5 = iVar5 + -1;

            } while (iVar5 != 0);

          }

          if (((param_1[1] & 0x80000000U) == 0x80000000) &&

             (puVar2 = (undefined4 *)*param_1, puVar2 != (undefined4 *)0x0)) {

            if (puVar2[-1] != 0) {

              (**(code **)*puVar2)(3);

              param_1[1] = param_2 | 0x80000000;

              *param_1 = (int)puVar1;

              return 1;

            }

            operator_delete__(puVar2 + -1);

          }

        }

        *param_1 = (int)puVar1;

        param_1[1] = param_2 | 0x80000000;

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_00473230 at 0x00473230 (size: 109) ---


bool FUN_00473230(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  char cVar3;

  

  iVar1 = *(int *)(param_1 + 4);

  if (((iVar1 != 0) && (*(int *)(iVar1 + 0x28) != 0)) &&

     (iVar2 = *(int *)(*(int *)(iVar1 + 0x28) + 0x20), iVar2 == *(int *)(iVar1 + 0x20))) {

    FUN_00472f70(iVar2);

  }

  if (*(int *)(param_1 + 8) != 0) {

    if (*(int *)(param_1 + 4) == 0) {

      cVar3 = FUN_00472d20(param_2);

      return cVar3 != '\0';

    }

    cVar3 = FUN_00472d90(*(int *)(param_1 + 4),param_2);

    return cVar3 != '\0';

  }

  return false;

}





// --- FUN_004732a0 at 0x004732A0 (size: 101) ---


void __thiscall FUN_004732a0(int param_1,undefined4 param_2,undefined4 *param_3,int *param_4)



{

  undefined4 *puVar1;

  int *piVar2;

  char cVar3;

  int iVar4;

  int iVar5;

  

  piVar2 = param_4;

  puVar1 = param_3;

  *param_3 = 0;

  *param_4 = 0;

  param_3 = (undefined4 *)0x0;

  cVar3 = FUN_00472ab0(param_2,&param_3,&param_4);

  if (cVar3 != '\0') {

    if (param_3 != (undefined4 *)0x0) {

      iVar4 = 0;

      iVar5 = (int)param_3;

      do {

        *piVar2 = *piVar2 + *(int *)(iVar4 + 0xc + *(int *)(param_1 + 0x14));

        iVar4 = iVar4 + 0x10;

        iVar5 = iVar5 + -1;

      } while (iVar5 != 0);

    }

    FUN_00472f00(param_2,puVar1);

  }

  return;

}





// --- FUN_00473310 at 0x00473310 (size: 87) ---


undefined4 * __thiscall FUN_00473310(int param_1,undefined4 *param_2,uint param_3)



{

  if (param_3 < *(uint *)(param_1 + 0x1c)) {

    FUN_00472fa0(param_2,*(undefined4 *)(param_3 * 0x10 + 4 + *(int *)(param_1 + 0x14)));

    return param_2;

  }

  if (*(uint *)(param_1 + 0x1c) == 0) {

    param_2[1] = *(undefined4 *)(param_1 + 8);

    *param_2 = &PTR_LAB_0079d17c;

    param_2[2] = param_1 + 4;

    return param_2;

  }

  param_2[1] = 0;

  *param_2 = &PTR_LAB_0079d17c;

  param_2[2] = param_1 + 4;

  return param_2;

}





// --- FUN_00473370 at 0x00473370 (size: 106) ---


void __fastcall FUN_00473370(int param_1)



{

  void *pvVar1;

  int iVar2;

  

  while (*(int *)(param_1 + 4) != 0) {

    FUN_00474bc0();

    pvVar1 = *(void **)(param_1 + 4);

    if (pvVar1 != (void *)0x0) {

      iVar2 = *(int *)((int)pvVar1 + 0x24);

      *(int *)(param_1 + 4) = iVar2;

      if (iVar2 == 0) {

        *(undefined4 *)(param_1 + 8) = 0;

      }

      else {

        *(undefined4 *)(iVar2 + 0x28) = 0;

      }

      FUN_00474c30(pvVar1);

      if (pvVar1 != (void *)0x0) {

        FUN_00474be0();

        operator_delete(pvVar1);

      }

      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + -1;

    }

    FUN_00474be0();

  }

  return;

}





// --- FUN_004733e0 at 0x004733E0 (size: 36) ---


void __fastcall FUN_004733e0(int param_1)



{

  FUN_00473370();

  FUN_00473090();

  *(undefined4 *)(param_1 + 0x28) = 0xffffffff;

  *(undefined4 *)(param_1 + 0x2c) = 0;

  *(undefined1 *)(param_1 + 0x30) = 0;

  return;

}





// --- FUN_00473410 at 0x00473410 (size: 69) ---


undefined4 __thiscall FUN_00473410(int param_1,uint param_2,undefined4 param_3)



{

  undefined4 uVar1;

  undefined1 local_c [12];

  

  if (param_2 <= *(uint *)(param_1 + 0x10)) {

    if (param_2 < *(uint *)(param_1 + 0x2c)) {

      *(uint *)(param_1 + 0x2c) = param_2;

    }

    FUN_00472fa0(local_c,param_2);

    uVar1 = FUN_00473230(local_c,param_3);

    return uVar1;

  }

  return 0;

}





// --- FUN_00473460 at 0x00473460 (size: 226) ---


int __thiscall FUN_00473460(int param_1,uint param_2,uint param_3)



{

  int iVar1;

  int iVar2;

  uint *puVar3;

  uint uVar4;

  uint uVar5;

  int iVar6;

  int local_c;

  uint local_4;

  

  uVar4 = *(uint *)(param_1 + 0x10);

  local_4 = uVar4 - 1;

  puVar3 = &local_4;

  if ((int)param_2 <= (int)(uVar4 - 1)) {

    puVar3 = &param_2;

  }

  param_2 = *puVar3;

  local_4 = uVar4;

  puVar3 = &local_4;

  if ((int)param_3 <= (int)uVar4) {

    puVar3 = &param_3;

  }

  param_3 = *puVar3;

  if (param_2 < *(uint *)(param_1 + 0x2c)) {

    *(uint *)(param_1 + 0x2c) = param_2;

  }

  local_4 = 0;

  local_c = 0;

  if (param_3 <= param_2) {

    return 0;

  }

  uVar4 = param_3;

  uVar5 = param_2;

  iVar6 = *(int *)(param_1 + 8);

  while ((iVar6 != 0 && (local_4 < uVar4))) {

    if (local_4 < uVar5) {

      iVar6 = *(int *)(iVar6 + 0x24);

      local_4 = local_4 + 1;

    }

    else {

      iVar1 = *(int *)(iVar6 + 0x20);

      if (iVar1 != 0) {

        for (iVar2 = *(int *)(param_1 + 8); iVar2 != 0; iVar2 = *(int *)(iVar2 + 0x24)) {

          if (*(int *)(iVar2 + 0x20) == iVar1) {

            FUN_00474ce0(0);

          }

        }

      }

      iVar1 = *(int *)(iVar6 + 0x24);

      FUN_00473020(iVar6);

      local_c = local_c + 1;

      local_4 = local_4 + 1;

      uVar4 = param_3;

      uVar5 = param_2;

      iVar6 = iVar1;

    }

  }

  return local_c;

}





// --- FUN_00473550 at 0x00473550 (size: 320) ---


int __thiscall FUN_00473550(int param_1,uint param_2,int *param_3)



{

  int iVar1;

  int iVar2;

  char cVar3;

  uint uVar4;

  int iVar5;

  uint local_1c;

  int local_18;

  int local_14;

  uint local_10;

  undefined1 local_c [4];

  int local_8;

  int local_4;

  

  local_1c = param_2;

  local_14 = 0;

  local_18 = 0;

  if (param_2 < *(uint *)(param_1 + 0x2c)) {

    *(uint *)(param_1 + 0x2c) = param_2;

  }

  FUN_00472fa0(local_c,param_2);

  local_10 = 0;

  if (param_3[2] != 0) {

    param_2 = 0;

    do {

      iVar5 = *param_3;

      if ((((local_8 != 0) && (*(int *)(local_8 + 0x28) != 0)) &&

          (iVar1 = *(int *)(*(int *)(local_8 + 0x28) + 0x20), iVar1 == *(int *)(local_8 + 0x20))) &&

         (iVar1 != 0)) {

        for (iVar2 = *(int *)(param_1 + 8); iVar2 != 0; iVar2 = *(int *)(iVar2 + 0x24)) {

          if (*(int *)(iVar2 + 0x20) == iVar1) {

            FUN_00474ce0(0);

          }

        }

      }

      if (local_4 == 0) {

        cVar3 = '\0';

      }

      else if (local_8 == 0) {

        cVar3 = FUN_00472d20(iVar5 + param_2);

      }

      else {

        cVar3 = FUN_00472d90(local_8,iVar5 + param_2);

      }

      local_18 = local_18 + (uint)(cVar3 != '\0');

      local_1c = local_1c + (cVar3 != '\0');

      local_10 = local_10 + 1;

      param_2 = param_2 + 0x24;

    } while (local_10 < (uint)param_3[2]);

  }

  if (*(uint *)(param_1 + 0x20) < *(uint *)(param_1 + 0x10)) {

    uVar4 = *(uint *)(param_1 + 0x10) - *(uint *)(param_1 + 0x20);

    if ((uint)param_3[2] < uVar4) {

      uVar4 = param_3[2];

    }

    if (*(char *)(param_1 + 0x24) == '\0') {

      iVar5 = local_1c - uVar4;

    }

    else {

      iVar5 = 0;

      local_1c = uVar4;

    }

    local_14 = FUN_00473460(iVar5,local_1c);

  }

  return local_18 - local_14;

}





// --- FUN_00473690 at 0x00473690 (size: 344) ---


undefined4 __thiscall FUN_00473690(int param_1,int *param_2,int *param_3,int param_4,uint *param_5)



{

  int *piVar1;

  char cVar2;

  int iVar3;

  int **ppiVar4;

  int *piVar5;

  uint uVar6;

  int *local_10;

  undefined1 local_c [4];

  int local_8;

  

  uVar6 = (uint)param_3;

  piVar1 = param_2;

  if (*(int **)(param_1 + 0x1c) <= param_2) {

    return 0;

  }

  iVar3 = (int)param_2 * 0x10;

  piVar5 = *(int **)(iVar3 + 4 + *(int *)(param_1 + 0x14));

  *param_5 = (uint)piVar5;

  local_10 = (int *)((int)param_2 + 1);

  ppiVar4 = &param_2;

  if ((int)param_2 + 1 <= *(int *)(param_1 + 0x1c) + -1) {

    ppiVar4 = &local_10;

  }

  local_10 = *ppiVar4;

  if (local_10 == param_2) {

    param_2 = *(int **)(param_1 + 0x10);

  }

  else {

    param_2 = *(int **)((int)local_10 * 0x10 + 4 + *(int *)(param_1 + 0x14));

  }

  iVar3 = iVar3 + *(int *)(param_1 + 0x14);

  if (*(uint *)(iVar3 + 8) < param_3) {

    param_4 = 0;

    FUN_00472c00(*(undefined4 *)(iVar3 + 4),&local_10,&param_4);

    if (piVar1 == (int *)(*(int *)(param_1 + 0x1c) + -1)) {

      *param_5 = *(uint *)(param_1 + 0x10);

      return 1;

    }

    *param_5 = param_4 - 1;

    return 1;

  }

  local_10 = piVar5;

  FUN_00473310(local_c,piVar1);

  param_3 = piVar5;

  if (local_8 != 0) {

    while (param_3 = (int *)((int)param_3 + 1), piVar5 < param_2) {

      cVar2 = FUN_00474bb0();

      if ((int)uVar6 <= *(int *)(local_8 + 4) / (int)(((char)param_4 != '\0') + 1)) {

        return 1;

      }

      if ((cVar2 != '\0') && (param_3 == param_2)) {

        return 1;

      }

      uVar6 = uVar6 - *(int *)(local_8 + 4);

      piVar5 = (int *)((int)local_10 + 1);

      *param_5 = *param_5 + 1;

      piVar1 = (int *)(local_8 + 0x24);

      local_8 = *piVar1;

      local_10 = piVar5;

      if (*piVar1 == 0) {

        return 1;

      }

    }

  }

  return 1;

}





// --- FUN_004737f0 at 0x004737F0 (size: 63) ---


undefined1 __thiscall FUN_004737f0(int param_1,uint param_2)



{

  undefined1 uVar1;

  int iVar2;

  uint uVar3;

  

  iVar2 = *(int *)(param_1 + 8);

  uVar1 = 0;

  if ((iVar2 != 0) && (param_2 < *(uint *)(param_1 + 0x10))) {

    uVar3 = 0;

    while (uVar3 != param_2) {

      if (iVar2 != 0) {

        iVar2 = *(int *)(iVar2 + 0x24);

      }

      uVar3 = uVar3 + 1;

      if (iVar2 == 0) {

        return uVar1;

      }

    }

    if (iVar2 != 0) {

      FUN_00474c30(iVar2);

      uVar1 = 1;

    }

  }

  return uVar1;

}





// --- FUN_00473830 at 0x00473830 (size: 36) ---


undefined4 * __thiscall FUN_00473830(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079e500;

  FUN_00473370();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00473860 at 0x00473860 (size: 59) ---


void __fastcall FUN_00473860(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079e504;

  param_1[1] = &PTR_FUN_0079e500;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0xffff;

  *(undefined1 *)(param_1 + 9) = 0;

  param_1[10] = 0xffffffff;

  param_1[0xb] = 0;

  *(undefined1 *)(param_1 + 0xc) = 0;

  return;

}





// --- FUN_004738a0 at 0x004738A0 (size: 124) ---


void __fastcall FUN_004738a0(undefined4 *param_1)



{

  undefined4 *puVar1;

  

  *param_1 = &PTR_FUN_0079e504;

  FUN_00473370();

  FUN_00473090();

  param_1[10] = 0xffffffff;

  param_1[0xb] = 0;

  *(undefined1 *)(param_1 + 0xc) = 0;

  if (((param_1[6] & 0x80000000) == 0x80000000) &&

     (puVar1 = (undefined4 *)param_1[5], puVar1 != (undefined4 *)0x0)) {

    if (puVar1[-1] != 0) {

      (**(code **)*puVar1)(3);

      param_1[1] = &PTR_FUN_0079e500;

      FUN_00473370();

      return;

    }

    operator_delete__(puVar1 + -1);

  }

  param_1[1] = &PTR_FUN_0079e500;

  FUN_00473370();

  return;

}





// --- FUN_00473920 at 0x00473920 (size: 662) ---


undefined4 __thiscall

FUN_00473920(int param_1,uint param_2,uint param_3,undefined *param_4,int *param_5)



{

  undefined *puVar1;

  uint uVar2;

  wchar_t *_Source;

  int iVar3;

  int *piVar4;

  int *piVar5;

  LONG LVar6;

  uint *puVar7;

  LONG *lpAddend;

  undefined4 *puVar8;

  int *piVar9;

  uint uStack_10;

  ushort *puStack_8;

  

  piVar5 = param_5;

  puVar1 = (undefined *)*param_5;

  if (puVar1 != PTR_DAT_00818340) {

    LVar6 = InterlockedDecrement((LONG *)(puVar1 + -0x10));

    if ((LVar6 == 0) && ((undefined4 *)(puVar1 + -0x14) != (undefined4 *)0x0)) {

      (*(code *)**(undefined4 **)(puVar1 + -0x14))(1);

    }

    lpAddend = (LONG *)(PTR_DAT_00818340 + -0x10);

    *piVar5 = (int)PTR_DAT_00818340;

    InterlockedIncrement(lpAddend);

  }

  uVar2 = *(uint *)(param_1 + 0x10);

  param_5 = (int *)(uVar2 - 1);

  puVar7 = (uint *)&param_5;

  if ((int)param_2 <= (int)(uVar2 - 1)) {

    puVar7 = &param_2;

  }

  param_5 = (int *)uVar2;

  param_2 = *puVar7;

  puVar7 = (uint *)&param_5;

  if ((int)param_3 <= (int)uVar2) {

    puVar7 = &param_3;

  }

  param_3 = *puVar7;

  puStack_8 = *(ushort **)(param_1 + 8);

  piVar4 = (int *)0x0;

  for (uStack_10 = 0; (puStack_8 != (ushort *)0x0 && (uStack_10 < param_3));

      uStack_10 = uStack_10 + 1) {

    piVar9 = piVar4;

    if (param_2 <= uStack_10) {

      piVar9 = *(int **)(puStack_8 + 0x10);

      if (((char)param_4 != '\0') && (piVar9 != piVar4)) {

        if (piVar4 != (int *)0x0) {

          param_5 = (int *)PTR_DAT_00818340;

          InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

          (**(code **)(*piVar4 + 0xc))(&param_5);

          FUN_004300a0(piVar5,&DAT_0079e508,param_5);

          puVar8 = (undefined4 *)((int)param_5 + -0x14);

          LVar6 = InterlockedDecrement((LONG *)((int)param_5 + -0x10));

          if ((LVar6 == 0) && (puVar8 != (undefined4 *)0x0)) {

            (**(code **)*puVar8)(1);

          }

        }

        if (piVar9 != (int *)0x0) {

          param_5 = (int *)PTR_DAT_00818340;

          InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

          (**(code **)(*piVar9 + 0x10))(&param_5);

          FUN_004300a0(piVar5,&DAT_0079e508,param_5);

          puVar8 = (undefined4 *)((int)param_5 + -0x14);

          LVar6 = InterlockedDecrement((LONG *)((int)param_5 + -0x10));

          if ((LVar6 == 0) && (puVar8 != (undefined4 *)0x0)) {

            (**(code **)*puVar8)(1);

          }

        }

      }

      param_5 = (int *)(uint)*puStack_8;

      if (*puStack_8 != 0) {

        _Source = (wchar_t *)*piVar5;

        iVar3 = *(int *)(_Source + -2);

        if ((*(int *)(_Source + -8) == 1) && (iVar3 + 1U <= *(uint *)(_Source + -6))) {

          *(uint *)(_Source + -2) = iVar3 + 1U;

          *(undefined4 *)(*piVar5 + -8) = 0xffffffff;

        }

        else {

          FUN_004022d0(iVar3);

          wcscpy((wchar_t *)*piVar5,_Source);

          LVar6 = InterlockedDecrement((LONG *)(_Source + -8));

          if ((LVar6 == 0) && (_Source + -10 != (wchar_t *)0x0)) {

            (*(code *)**(undefined4 **)(_Source + -10))(1);

          }

        }

        wcsncpy((wchar_t *)(*piVar5 + -2 + iVar3 * 2),(wchar_t *)&param_5,1);

        *(undefined2 *)(*piVar5 + -2 + *(int *)(*piVar5 + -4) * 2) = 0;

      }

    }

    if (puStack_8 != (ushort *)0x0) {

      puStack_8 = *(ushort **)(puStack_8 + 0x12);

    }

    piVar4 = piVar9;

  }

  if (((char)param_4 != '\0') && (piVar4 != (int *)0x0)) {

    param_4 = PTR_DAT_00818340;

    InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

    (**(code **)(*piVar4 + 0xc))(&param_4);

    FUN_004300a0(piVar5,&DAT_0079e508,param_3);

    puVar8 = (undefined4 *)(param_3 - 0x14);

    LVar6 = InterlockedDecrement((LONG *)(param_3 - 0x10));

    if ((LVar6 == 0) && (puVar8 != (undefined4 *)0x0)) {

      (**(code **)*puVar8)(1);

    }

  }

  return 1;

}





// --- FUN_00473bc0 at 0x00473BC0 (size: 1344) ---


undefined4 __thiscall FUN_00473bc0(int param_1,int param_2,char param_3,uint *param_4,int *param_5)



{

  undefined4 uVar1;

  bool bVar2;

  bool bVar3;

  char cVar4;

  uint uVar5;

  int iVar6;

  int iVar7;

  uint *puVar8;

  int iVar9;

  int iVar10;

  uint uVar11;

  int iVar12;

  uint uVar13;

  uint uVar14;

  uint local_44;

  uint local_40;

  uint local_3c;

  uint local_38;

  uint local_34;

  uint local_30;

  int local_2c;

  uint local_28;

  uint local_24;

  uint local_20 [2];

  int local_18;

  uint local_c;

  undefined4 local_4;

  

  *param_4 = 0;

  *param_5 = 0;

  if ((param_2 != *(int *)(param_1 + 0x28)) || (param_3 != *(char *)(param_1 + 0x30))) {

    *(undefined4 *)(param_1 + 0x2c) = 0;

    *(int *)(param_1 + 0x28) = param_2;

    *(char *)(param_1 + 0x30) = param_3;

  }

  local_40 = 0;

  if (*(int *)(param_1 + 0x2c) != 0) {

    FUN_00472c60(*(int *)(param_1 + 0x2c),&local_40,param_1 + 0x2c);

  }

  if (local_40 != 0) {

    iVar10 = 0;

    uVar13 = local_40;

    do {

      local_24 = *(uint *)(*(int *)(param_1 + 0x14) + 8 + iVar10);

      iVar9 = *(int *)(param_1 + 0x14) + iVar10;

      puVar8 = &local_24;

      if ((int)local_24 <= (int)*param_4) {

        puVar8 = param_4;

      }

      *param_4 = *puVar8;

      iVar10 = iVar10 + 0x10;

      uVar13 = uVar13 - 1;

      *param_5 = *param_5 + *(int *)(iVar9 + 0xc);

    } while (uVar13 != 0);

  }

  uVar13 = *(uint *)(param_1 + 0x2c);

  uVar14 = *(uint *)(param_1 + 0x1c);

  local_24 = uVar13;

  local_c = uVar13;

  iVar10 = 0;

  local_3c = 0;

  local_34 = 0;

  local_44 = 0;

  local_28 = 0;

  local_38 = 0;

  bVar3 = false;

  bVar2 = false;

  local_2c = 0;

  if (local_40 < uVar14) {

    local_20[0] = *(uint *)(local_40 * 0x10 + 4 + *(int *)(param_1 + 0x14));

    local_18 = *(int *)(param_1 + 8);

    local_30 = 0;

    while (local_18 != 0) {

      if (local_30 == local_20[0]) goto LAB_00473dcc;

      if (local_18 != 0) {

        local_18 = *(int *)(local_18 + 0x24);

      }

      local_30 = local_30 + 1;

    }

LAB_00473cf5:

    local_18 = 0;

  }

  else {

    if (uVar14 != 0) goto LAB_00473cf5;

    local_18 = *(int *)(param_1 + 8);

LAB_00473dcc:

  }

  uVar14 = uVar14 - 1;

  uVar11 = local_34;

  iVar9 = local_18;

  if ((int)local_40 <= (int)uVar14) {

    iVar12 = uVar14 * 0x10;

    do {

      if (uVar14 < *(uint *)(param_1 + 0x1c)) {

        uVar5 = *(uint *)(param_1 + 0x1c) - 1;

        *(uint *)(param_1 + 0x1c) = uVar5;

        if (uVar14 != uVar5) {

          iVar7 = *(int *)(param_1 + 0x14);

          iVar6 = uVar5 * 0x10 + iVar7;

          *(undefined4 *)(iVar7 + 4 + iVar12) = *(undefined4 *)(uVar5 * 0x10 + 4 + iVar7);

          *(undefined4 *)(iVar7 + 8 + iVar12) = *(undefined4 *)(iVar6 + 8);

          *(undefined4 *)(iVar7 + 0xc + iVar12) = *(undefined4 *)(iVar6 + 0xc);

          iVar7 = *(int *)(param_1 + 0x1c) * 0x10 + *(int *)(param_1 + 0x14);

          *(undefined4 *)(iVar7 + 4) = 0;

          *(undefined4 *)(iVar7 + 8) = 0;

          *(undefined4 *)(iVar7 + 0xc) = 0;

        }

      }

      uVar14 = uVar14 - 1;

      iVar12 = iVar12 + -0x10;

    } while ((int)local_40 <= (int)uVar14);

  }

  while (local_34 = uVar11, local_24 = uVar13, local_18 = iVar9, iVar9 != 0) {

    local_30 = *(uint *)(iVar9 + 4);

    if (param_3 == '\0') {

      cVar4 = FUN_004729d0(iVar10,iVar9);

      if (cVar4 == '\0') {

        cVar4 = FUN_00474b90();

        if (((cVar4 == '\0') && (cVar4 = FUN_00474bb0(), cVar4 == '\0')) &&

           (param_2 < (int)(local_30 + local_44))) {

          local_44 = 0;

          bVar3 = true;

          local_38 = uVar11;

          local_2c = iVar10;

          local_28 = uVar13;

        }

      }

      else {

        local_44 = 0;

        bVar3 = true;

        local_38 = uVar11;

        local_2c = iVar10;

        local_28 = uVar13;

        if ((iVar10 != 0) && (cVar4 = FUN_00474bb0(), cVar4 != '\0')) {

          bVar2 = true;

        }

      }

    }

    uVar13 = local_3c + local_30;

    local_44 = local_44 + local_30;

    local_3c = uVar13;

    cVar4 = FUN_00474b90();

    if ((cVar4 != '\0') || (cVar4 = FUN_00474bb0(), uVar14 = uVar13, cVar4 != '\0')) {

      uVar14 = uVar13 - local_30;

    }

    iVar12 = local_2c;

    if ((bVar2) || ((iVar10 = iVar9, bVar3 && (param_2 < (int)uVar14)))) {

      uVar13 = uVar13 - local_44;

      local_30 = uVar13;

      if ((local_2c != 0) &&

         ((cVar4 = FUN_00474b90(), cVar4 != '\0' || (cVar4 = FUN_00474bb0(), cVar4 != '\0')))) {

        uVar13 = uVar13 - *(int *)(iVar12 + 4);

        local_30 = uVar13;

      }

      uVar14 = *(uint *)(param_1 + 0x18) & 0x7fffffff;

      if (*(uint *)(param_1 + 0x1c) < uVar14) {

LAB_00473f06:

        iVar10 = *(int *)(param_1 + 0x1c) * 0x10 + *(int *)(param_1 + 0x14);

        *(uint *)(iVar10 + 4) = local_c;

        *(uint *)(iVar10 + 8) = uVar13;

        *(uint *)(iVar10 + 0xc) = local_38;

        *(int *)(param_1 + 0x1c) = *(int *)(param_1 + 0x1c) + 1;

      }

      else {

        uVar14 = uVar14 + 1;

        if (uVar14 < 9) {

          uVar14 = 8;

        }

        else if (uVar14 < 0x4001) {

          iVar10 = 0x1f;

          if (uVar14 != 0) {

            for (; uVar14 >> iVar10 == 0; iVar10 = iVar10 + -1) {

            }

          }

          uVar11 = 1 << ((byte)iVar10 & 0x1f);

          local_20[0] = uVar14;

          if (uVar11 < uVar14) {

            uVar14 = uVar11 * 2;

          }

        }

        else if ((uVar14 & 0x3fff) != 0) {

          uVar14 = uVar14 + (0x4000 - (uVar14 & 0x3fff));

        }

        cVar4 = FUN_00473110(uVar14);

        if (cVar4 != '\0') goto LAB_00473f06;

      }

      puVar8 = &local_30;

      if ((int)uVar13 <= (int)*param_4) {

        puVar8 = param_4;

      }

      *param_4 = *puVar8;

      *param_5 = *param_5 + local_38;

      uVar11 = 0;

      local_c = local_28;

      local_3c = local_44;

      local_34 = 0;

      bVar3 = false;

      bVar2 = false;

      iVar10 = local_18;

    }

    local_20[0] = *(uint *)(iVar10 + 8);

    puVar8 = &local_34;

    if ((int)uVar11 <= (int)*(uint *)(iVar10 + 8)) {

      puVar8 = local_20;

    }

    uVar13 = local_24 + 1;

    local_34 = *puVar8;

    local_24 = uVar13;

    local_18 = *(int *)(iVar10 + 0x24);

    uVar11 = local_34;

    iVar9 = *(int *)(iVar10 + 0x24);

  }

  uVar13 = *(uint *)(param_1 + 0x18) & 0x7fffffff;

  if (*(uint *)(param_1 + 0x1c) < uVar13) {

LAB_00473fff:

    iVar9 = *(int *)(param_1 + 0x1c) * 0x10 + *(int *)(param_1 + 0x14);

    *(uint *)(iVar9 + 4) = local_c;

    *(uint *)(iVar9 + 8) = local_3c;

    *(uint *)(iVar9 + 0xc) = uVar11;

    *(int *)(param_1 + 0x1c) = *(int *)(param_1 + 0x1c) + 1;

  }

  else {

    uVar13 = uVar13 + 1;

    if (uVar13 < 9) {

      uVar13 = 8;

    }

    else if (uVar13 < 0x4001) {

      iVar9 = 0x1f;

      if (uVar13 != 0) {

        for (; uVar13 >> iVar9 == 0; iVar9 = iVar9 + -1) {

        }

      }

      uVar14 = 1 << ((byte)iVar9 & 0x1f);

      local_20[0] = uVar13;

      if (uVar14 < uVar13) {

        uVar13 = uVar14 * 2;

      }

    }

    else if ((uVar13 & 0x3fff) != 0) {

      uVar13 = uVar13 + (0x4000 - (uVar13 & 0x3fff));

    }

    cVar4 = FUN_00473110(uVar13);

    if (cVar4 != '\0') goto LAB_00473fff;

  }

  puVar8 = &local_3c;

  if ((int)local_3c <= (int)*param_4) {

    puVar8 = param_4;

  }

  *param_4 = *puVar8;

  *param_5 = *param_5 + uVar11;

  if ((iVar10 == 0) || (cVar4 = FUN_00474bb0(), cVar4 == '\0')) goto LAB_004740f2;

  uVar1 = *(undefined4 *)(param_1 + 0x10);

  local_4 = *(undefined4 *)(iVar10 + 8);

  uVar13 = *(uint *)(param_1 + 0x18) & 0x7fffffff;

  if (*(uint *)(param_1 + 0x1c) < uVar13) {

LAB_004740cb:

    iVar9 = *(int *)(param_1 + 0x1c) * 0x10 + *(int *)(param_1 + 0x14);

    *(undefined4 *)(iVar9 + 4) = uVar1;

    *(undefined4 *)(iVar9 + 8) = 0;

    *(undefined4 *)(iVar9 + 0xc) = local_4;

    *(int *)(param_1 + 0x1c) = *(int *)(param_1 + 0x1c) + 1;

  }

  else {

    uVar13 = uVar13 + 1;

    if (uVar13 < 9) {

      uVar13 = 8;

    }

    else if (uVar13 < 0x4001) {

      iVar9 = 0x1f;

      if (uVar13 != 0) {

        for (; uVar13 >> iVar9 == 0; iVar9 = iVar9 + -1) {

        }

      }

      uVar14 = 1 << ((byte)iVar9 & 0x1f);

      local_20[0] = uVar13;

      if (uVar14 < uVar13) {

        uVar13 = uVar14 * 2;

      }

    }

    else if ((uVar13 & 0x3fff) != 0) {

      uVar13 = uVar13 + (0x4000 - (uVar13 & 0x3fff));

    }

    cVar4 = FUN_00473110(uVar13);

    if (cVar4 != '\0') goto LAB_004740cb;

  }

  *param_5 = *param_5 + *(int *)(iVar10 + 8);

LAB_004740f2:

  *(undefined4 *)(param_1 + 0x2c) = *(undefined4 *)(param_1 + 0x10);

  return 1;

}





// --- FUN_00474110 at 0x00474110 (size: 30) ---


void * __thiscall FUN_00474110(void *param_1,byte param_2)



{

  FUN_004738a0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00474130 at 0x00474130 (size: 24) ---


void __thiscall FUN_00474130(int param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00473920(0,*(undefined4 *)(param_1 + 0x10),param_2,param_3);

  return;

}





// --- FUN_00474150 at 0x00474150 (size: 70) ---


undefined4 * __thiscall FUN_00474150(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00464900(param_2,param_3);

  param_1[0x17c] = 0;

  param_1[0x17d] = 0;

  param_1[0x17e] = 0;

  param_1[0x17f] = 0;

  param_1[0x180] = 0;

  param_1[0x181] = 0;

  *param_1 = &PTR_FUN_0079e518;

  return param_1;

}





// --- FUN_004741c0 at 0x004741C0 (size: 78) ---


void __thiscall FUN_004741c0(int *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  char cVar1;

  int *piVar2;

  

  FUN_00460ff0(param_2,param_3,param_4);

  piVar2 = (int *)FUN_0045fb30();

  if (piVar2 != (int *)0x0) {

    cVar1 = (**(code **)(*piVar2 + 0x10c))();

    if (cVar1 != '\0') {

      (**(code **)(*piVar2 + 0xfc))();

      (**(code **)(*param_1 + 0x104))();

    }

  }

  return;

}





// --- FUN_00474210 at 0x00474210 (size: 57) ---


byte __thiscall FUN_00474210(undefined4 param_1,undefined4 param_2)



{

  byte bVar1;

  byte bVar2;

  

  if (DAT_00837ff4 == (int *)0x0) {

    return 0;

  }

  bVar1 = FUN_0045fbe0(param_2);

  bVar2 = (**(code **)(*DAT_00837ff4 + 0x34))(10,param_1,param_2);

  return bVar2 | bVar1;

}





// --- FUN_00474250 at 0x00474250 (size: 45) ---


byte __fastcall FUN_00474250(undefined4 param_1)



{

  byte bVar1;

  byte bVar2;

  

  if (DAT_00837ff4 == (int *)0x0) {

    return 0;

  }

  bVar1 = FUN_0045fc50();

  bVar2 = (**(code **)(*DAT_00837ff4 + 0x38))(10,param_1);

  return bVar2 | bVar1;

}





// --- FUN_00474280 at 0x00474280 (size: 94) ---


int __thiscall FUN_00474280(int param_1,char param_2)



{

  int iVar1;

  int *piVar2;

  int iVar3;

  

  iVar1 = 0;

  if (param_2 == '\0') {

    iVar3 = *(int *)(param_1 + 0x5f4);

  }

  else {

    iVar3 = *(int *)(param_1 + 0x5f0);

  }

  if ((iVar3 != 0) &&

     (((piVar2 = (int *)FUN_00464690(iVar3), piVar2 == (int *)0x0 ||

       (iVar1 = (**(code **)(*piVar2 + 0x94))(0xb), iVar1 == 0)) ||

      (iVar3 = FUN_00464690(*(undefined4 *)(param_1 + 0x2e4)), iVar3 != param_1)))) {

    return 0;

  }

  return iVar1;

}





// --- FUN_004742e0 at 0x004742E0 (size: 325) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_004742e0(int param_1,float param_2)



{

  int iVar1;

  int iVar2;

  float fVar3;

  undefined4 uVar4;

  int *piVar5;

  int iVar6;

  undefined4 *local_c;

  undefined4 *local_8;

  int *local_4;

  

  uVar4 = param_2;

  piVar5 = (int *)FUN_00474280(param_2);

  if (piVar5 != (int *)0x0) {

    if (SUB41(param_2,0) == '\0') {

      iVar1 = *(int *)(param_1 + 0x5fc);

      iVar2 = *(int *)(param_1 + 0x604);

      iVar6 = FUN_0069fe70();

      local_c = (undefined4 *)(iVar2 - iVar6);

    }

    else {

      iVar1 = *(int *)(param_1 + 0x5f8);

      iVar2 = *(int *)(param_1 + 0x600);

      iVar6 = FUN_0069fe60();

      local_c = (undefined4 *)(iVar2 - iVar6);

    }

    param_2 = (float)iVar1;

    fVar3 = ABS((float)(int)local_c);

    if (fVar3 < _DAT_0079e510 == (fVar3 == _DAT_0079e510)) {

      param_2 = param_2 / (float)(int)local_c;

    }

    else {

      param_2 = 0.0;

    }

    FUN_00460820(0x75,1);

    local_8 = (undefined4 *)0x0;

    local_4 = (int *)0x0;

    FUN_0042a2d0(0x86);

    if (local_4 != (int *)0x0) {

      FUN_00429b10();

      (**(code **)(*local_4 + 0x8c))(param_2);

    }

    FUN_00460820(0x7b,uVar4);

    (**(code **)(*piVar5 + 0xd4))(&local_8);

    FUN_00460820(0x75,0);

    FUN_00471490();

    if ((local_c != (undefined4 *)0x0) &&

       (iVar1 = local_c[1], local_c[1] = iVar1 + -1, iVar1 + -1 == 0)) {

      (**(code **)*local_c)(1);

    }

    if ((local_8 != (undefined4 *)0x0) &&

       (iVar1 = local_8[1], local_8[1] = iVar1 + -1, iVar1 + -1 == 0)) {

      (**(code **)*local_8)(1);

    }

  }

  return;

}





// --- FUN_00474430 at 0x00474430 (size: 77) ---


bool FUN_00474430(int *param_1)



{

  char cVar1;

  char cVar2;

  

  cVar1 = FUN_004625b0(param_1);

  FUN_00425ba0();

  if (param_1 == (int *)0x0) {

    return false;

  }

  cVar2 = FUN_00427240(0x11,param_1);

  (**(code **)(*param_1 + 0x14))();

  return cVar2 != '\0' && cVar1 != '\0';

}





// --- FUN_00474480 at 0x00474480 (size: 224) ---


void __thiscall FUN_00474480(int *param_1,int param_2,int param_3,int param_4)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  int local_8 [2];

  

  iVar1 = param_3;

  iVar4 = param_2;

  if ((char)param_4 == '\0') {

    param_4 = CONCAT31(param_4._1_3_,1);

    FUN_00460cc0(0x73,&param_4);

    iVar1 = param_3;

    iVar4 = param_2;

    if ((char)param_4 != '\0') {

      iVar4 = param_1[0x180];

      iVar1 = FUN_0069fe60();

      local_8[0] = iVar4 - iVar1;

      local_8[1] = 0;

      piVar3 = &param_2;

      if (iVar4 - iVar1 <= param_2) {

        piVar3 = local_8;

      }

      if (*piVar3 < 1) {

        piVar3 = local_8 + 1;

      }

      iVar4 = *piVar3;

      iVar1 = param_1[0x181];

      iVar2 = FUN_0069fe70();

      param_4 = iVar1 - iVar2;

      param_2 = 0;

      piVar3 = &param_3;

      if (iVar1 - iVar2 <= param_3) {

        piVar3 = &param_4;

      }

      if (*piVar3 < 1) {

        piVar3 = &param_2;

      }

      iVar1 = *piVar3;

    }

  }

  if ((iVar4 != param_1[0x17e]) || (iVar1 != param_1[0x17f])) {

    param_1[0x17e] = iVar4;

    param_1[0x17f] = iVar1;

    FUN_004742e0(1);

    FUN_004742e0(0);

    (**(code **)(*param_1 + 0x138))();

  }

  return;

}





// --- FUN_00474560 at 0x00474560 (size: 458) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_00474560(int *param_1,undefined4 param_2)



{

  float fVar1;

  int iVar2;

  float fVar3;

  float *pfVar4;

  uint uVar5;

  char cVar6;

  float fVar7;

  char local_11;

  undefined4 local_10;

  float local_c;

  float local_8;

  uint local_4;

  

  iVar2 = FUN_00474280(param_2);

  if (iVar2 != 0) {

    cVar6 = (char)param_2;

    if (cVar6 == '\0') {

      fVar1 = (float)param_1[0x181];

      local_8 = fVar1;

      fVar3 = (float)FUN_0069fe70();

      pfVar4 = (float *)(param_1 + 0x17f);

    }

    else {

      fVar1 = (float)param_1[0x180];

      local_8 = fVar1;

      fVar3 = (float)FUN_0069fe60();

      pfVar4 = (float *)(param_1 + 0x17e);

    }

    uVar5 = local_4;

    local_4 = local_4 & 0xffffff00;

    fVar7 = fVar1;

    if ((int)fVar1 <= (int)fVar3) {

      *pfVar4 = 0.0;

      local_4 = CONCAT31(SUB43(uVar5,1),1);

      fVar7 = fVar3;

      local_8 = fVar3;

    }

    if ((int)fVar7 < (int)*pfVar4) {

      *pfVar4 = fVar7;

    }

    if (fVar7 == 0.0) {

      local_8 = 1.0;

      local_c = fVar3;

    }

    else {

      local_c = 1.0;

      fVar7 = (float)(int)local_8;

      local_8 = (float)(int)fVar3 / fVar7;

      pfVar4 = &local_8;

      if (_DAT_007938b0 <= (float)(int)fVar3 / fVar7) {

        pfVar4 = &local_c;

      }

      local_8 = *pfVar4;

    }

    local_10 = 0;

    FUN_00460bf0(0x86,&local_10);

    if ((int)fVar1 <= (int)fVar3) {

      local_10 = 0;

    }

    FUN_00460820(0x75,1);

    FUN_00460820(0x7b,param_2);

    FUN_00460820(0x76,local_4);

    FUN_00460760(0x88,local_8);

    FUN_00460820(0x75,0);

    local_11 = '\0';

    FUN_00460cc0(0x74,&local_11);

    if (local_11 != '\0') {

      FUN_00460760(0x86,local_10);

      if (cVar6 == '\0') {

        FUN_0069fe70();

      }

      else {

        FUN_0069fe60();

      }

      uVar5 = FUN_005df4c4();

      param_1[0x17e] = -(uint)(cVar6 != '\0') & uVar5;

      param_1[0x17f] = (cVar6 != '\0') - 1 & uVar5;

      (**(code **)(*param_1 + 0x138))();

      return;

    }

    FUN_004742e0(param_2);

  }

  return;

}





// --- FUN_00474730 at 0x00474730 (size: 276) ---


void __thiscall FUN_00474730(int *param_1,undefined4 param_2,uint param_3,int param_4)



{

  uint uVar1;

  undefined4 uVar2;

  char cVar3;

  

  if (param_4 != 0) {

    cVar3 = (char)param_2;

    if (param_3 == 10) {

      param_4 = 0;

      FUN_00460bf0(0x86,&param_4);

      if (cVar3 == '\0') {

        FUN_0069fe70();

      }

      else {

        FUN_0069fe60();

      }

      uVar1 = FUN_005df4c4();

      param_1[0x17e] = -(uint)(cVar3 != '\0') & uVar1;

      param_1[0x17f] = (cVar3 != '\0') - 1 & uVar1;

      (**(code **)(*param_1 + 0x138))();

    }

    else if ((0xc < param_3) && (param_3 < 0x11)) {

      if ((param_3 == 0xf) || (param_3 == 0x10)) {

        uVar2 = 1;

      }

      else {

        uVar2 = 0;

      }

      if ((param_3 == 0xd) || (param_3 == 0xf)) {

        param_3 = 1;

      }

      else {

        param_3 = param_3 & 0xffffff00;

      }

      uVar1 = (**(code **)(*param_1 + 0x13c))(param_2,param_3,uVar2);

      FUN_00474480((-(uint)(cVar3 != '\0') & uVar1) + param_1[0x17e],

                   ((cVar3 != '\0') - 1 & uVar1) + param_1[0x17f],0);

      return;

    }

  }

  return;

}





// --- FUN_00474850 at 0x00474850 (size: 25) ---


void __fastcall FUN_00474850(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079e518;

  param_1[0x17c] = 0;

  param_1[0x17d] = 0;

  FUN_00464e00();

  return;

}





// --- FUN_00474870 at 0x00474870 (size: 162) ---


void __fastcall FUN_00474870(int param_1)



{

  int *piVar1;

  int iVar2;

  

  FUN_004639a0();

  if (*(int *)(param_1 + 0x5f0) != 0) {

    piVar1 = (int *)FUN_00464690(*(int *)(param_1 + 0x5f0));

    if (piVar1 != (int *)0x0) {

      iVar2 = (**(code **)(*piVar1 + 0x94))(0xb);

      if (iVar2 != 0) {

        iVar2 = FUN_00464690(*(undefined4 *)(param_1 + 0x2e4));

        if (iVar2 == param_1) {

          FUN_00464ad0(param_1);

        }

      }

    }

  }

  if (*(int *)(param_1 + 0x5f4) != 0) {

    piVar1 = (int *)FUN_00464690(*(int *)(param_1 + 0x5f4));

    if (piVar1 != (int *)0x0) {

      iVar2 = (**(code **)(*piVar1 + 0x94))(0xb);

      if (iVar2 != 0) {

        iVar2 = FUN_00464690(*(undefined4 *)(param_1 + 0x2e4));

        if (iVar2 == param_1) {

          FUN_00464ad0(param_1);

        }

      }

    }

  }

  FUN_00474560(1);

  FUN_00474560(0);

  return;

}





// --- FUN_00474920 at 0x00474920 (size: 205) ---


undefined4 __thiscall FUN_00474920(int param_1,int *param_2)



{

  int iVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  undefined4 uVar5;

  

  iVar1 = *param_2;

  iVar4 = *(int *)(param_1 + 0x5f0);

  if ((iVar1 == iVar4) || (iVar1 == *(int *)(param_1 + 0x5f4))) {

    iVar2 = FUN_00474280(iVar1 == iVar4);

    if (iVar2 == param_2[1]) {

      FUN_00474730(iVar1 == iVar4,param_2[2],iVar2);

      return 2;

    }

  }

  iVar1 = param_2[3];

  if ((((param_2[2] == 0x1c) && (((iVar1 == 5 || (iVar1 == 6)) && (*(int *)(param_1 + 0x5f4) != 0)))

       ) && (((piVar3 = (int *)FUN_00464690(*(int *)(param_1 + 0x5f4)), piVar3 != (int *)0x0 &&

              (iVar4 = (**(code **)(*piVar3 + 0x94))(0xb), iVar4 != 0)) &&

             (iVar2 = FUN_00464690(*(undefined4 *)(param_1 + 0x2e4)), iVar2 == param_1)))) &&

     ((*(uint *)(iVar4 + 0xa4) >> 4 & 1) == 0)) {

    FUN_00471810(iVar1);

    return 2;

  }

  uVar5 = FUN_00462420(param_2);

  return uVar5;

}





// --- FUN_004749f0 at 0x004749F0 (size: 129) ---


void __thiscall FUN_004749f0(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  

  iVar2 = param_2;

  FUN_00462e60(param_2);

  iVar3 = FUN_00429a00();

  if (iVar3 == 0x71) {

    piVar1 = *(int **)(iVar2 + 4);

    if (piVar1 != (int *)0x0) {

      (**(code **)(*piVar1 + 0xa8))(&param_2);

    }

    iVar2 = param_2;

    if (param_2 != 0) {

      FUN_00474560(1);

    }

    *(int *)(param_1 + 0x5f0) = iVar2;

  }

  else if (iVar3 == 0x72) {

    piVar1 = *(int **)(iVar2 + 4);

    if (piVar1 != (int *)0x0) {

      (**(code **)(*piVar1 + 0xa8))(&param_2);

    }

    iVar2 = param_2;

    if (param_2 != 0) {

      FUN_00474560(0);

    }

    *(int *)(param_1 + 0x5f4) = iVar2;

    return;

  }

  return;

}





// --- FUN_00474a80 at 0x00474A80 (size: 107) ---


void __thiscall FUN_00474a80(int param_1,undefined4 param_2,undefined4 param_3)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  iVar1 = FUN_0069fe60();

  iVar2 = FUN_0069fe70();

  FUN_00463d60(param_2,param_3);

  iVar3 = FUN_0069fe60();

  if ((iVar1 == iVar3) && (iVar1 = FUN_0069fe70(), iVar2 == iVar1)) {

    return;

  }

  FUN_00474560(1);

  FUN_00474560(0);

  FUN_00474480(*(undefined4 *)(param_1 + 0x5f8),*(undefined4 *)(param_1 + 0x5fc),0);

  return;

}





// --- FUN_00474af0 at 0x00474AF0 (size: 84) ---


void __thiscall FUN_00474af0(int param_1,int param_2,int param_3)



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = *(int *)(param_1 + 0x600);

  if ((iVar1 != param_2) || (*(int *)(param_1 + 0x604) != param_3)) {

    uVar2 = *(undefined4 *)(param_1 + 0x604);

    *(int *)(param_1 + 0x604) = param_3;

    *(int *)(param_1 + 0x600) = param_2;

    FUN_00474560(1);

    FUN_00474560(0);

    FUN_00460410(0x32,iVar1,uVar2);

  }

  return;

}





// --- FUN_00474b50 at 0x00474B50 (size: 50) ---


undefined4 * __thiscall FUN_00474b50(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079e518;

  param_1[0x17c] = 0;

  param_1[0x17d] = 0;

  FUN_00464e00();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00474b90 at 0x00474B90 (size: 30) ---


undefined4 __fastcall FUN_00474b90(short *param_1)



{

  short sVar1;

  

  sVar1 = *param_1;

  if (((sVar1 != 9) && (sVar1 != 0xd)) && (sVar1 != 0x20)) {

    return 0;

  }

  return 1;

}





// --- FUN_00474bb0 at 0x00474BB0 (size: 10) ---


bool __fastcall FUN_00474bb0(short *param_1)



{

  return *param_1 == 10;

}





// --- FUN_00474bc0 at 0x00474BC0 (size: 20) ---


void __fastcall FUN_00474bc0(undefined2 *param_1)



{

  *param_1 = 0;

  *(undefined4 *)(param_1 + 2) = 0;

  *(undefined4 *)(param_1 + 4) = 0;

  *(undefined4 *)(param_1 + 0xe) = 0;

  *(undefined4 *)(param_1 + 0x10) = 0;

  return;

}





// --- FUN_00474be0 at 0x00474BE0 (size: 66) ---


void __fastcall FUN_00474be0(int param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = *(undefined4 **)(param_1 + 0x20);

  if (puVar1 != (undefined4 *)0x0) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

    if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

    *(undefined4 *)(param_1 + 0x20) = 0;

  }

  if (*(int **)(param_1 + 0x1c) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x1c) + 0x14))();

    *(undefined4 *)(param_1 + 0x1c) = 0;

  }

  return;

}





// --- FUN_00474c30 at 0x00474C30 (size: 170) ---


undefined2 * __thiscall FUN_00474c30(undefined2 *param_1,undefined2 *param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  LONG LVar3;

  

  if (param_1 != param_2) {

    *param_1 = *param_2;

    *(undefined4 *)(param_1 + 2) = *(undefined4 *)(param_2 + 2);

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)(param_2 + 4);

    *(undefined4 *)(param_1 + 6) = *(undefined4 *)(param_2 + 6);

    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(param_2 + 8);

    *(undefined4 *)(param_1 + 10) = *(undefined4 *)(param_2 + 10);

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);

    if (*(int **)(param_1 + 0xe) != (int *)0x0) {

      (**(code **)(**(int **)(param_1 + 0xe) + 0x14))();

      *(undefined4 *)(param_1 + 0xe) = 0;

    }

    puVar1 = *(undefined4 **)(param_1 + 0x10);

    if (puVar1 != (undefined4 *)0x0) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

      if ((LVar3 == 0) && (puVar1 != (undefined4 *)0x0)) {

        (**(code **)*puVar1)(1);

      }

      *(undefined4 *)(param_1 + 0x10) = 0;

    }

    piVar2 = *(int **)(param_2 + 0xe);

    *(int **)(param_1 + 0xe) = piVar2;

    *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_2 + 0x10);

    if (piVar2 != (int *)0x0) {

      (**(code **)(*piVar2 + 0x10))();

    }

    if (*(int *)(param_1 + 0x10) != 0) {

      InterlockedIncrement((LONG *)(*(int *)(param_1 + 0x10) + 4));

    }

  }

  return param_1;

}





// --- FUN_00474ce0 at 0x00474CE0 (size: 68) ---


void __thiscall FUN_00474ce0(int param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = *(undefined4 **)(param_1 + 0x20);

  if (puVar1 != (undefined4 *)0x0) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

    if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

      (**(code **)*puVar1)(1);

    }

    *(undefined4 *)(param_1 + 0x20) = 0;

    *(undefined4 *)(param_1 + 0x20) = param_2;

    return;

  }

  *(undefined4 *)(param_1 + 0x20) = param_2;

  return;

}





// --- FUN_00474d30 at 0x00474D30 (size: 36) ---


undefined2 * __thiscall FUN_00474d30(undefined2 *param_1,undefined4 param_2)



{

  *param_1 = 0;

  *(undefined4 *)(param_1 + 2) = 0;

  *(undefined4 *)(param_1 + 4) = 0;

  *(undefined4 *)(param_1 + 0xe) = 0;

  *(undefined4 *)(param_1 + 0x10) = 0;

  FUN_00474c30(param_2);

  return param_1;

}





// --- FUN_00474d60 at 0x00474D60 (size: 229) ---


void __thiscall FUN_00474d60(short *param_1,int *param_2)



{

  short sVar1;

  char cVar2;

  int *piVar3;

  int *piVar4;

  uint uVar5;

  

  sVar1 = *param_1;

  if (*(int **)(param_1 + 0xe) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0xe) + 0x14))();

    param_1[0xe] = 0;

    param_1[0xf] = 0;

  }

  if (param_2 != (int *)0x0) {

    cVar2 = FUN_00443580(*param_1);

    if ((cVar2 == '\0') && (sVar1 != 10)) {

      piVar3 = (int *)FUN_00415730(0x14,9,0x2e);

      if (piVar3 != (int *)0x0) {

        cVar2 = FUN_00443580(*param_1);

        if (cVar2 != '\0') {

          *(int **)(param_1 + 0xe) = piVar3;

        }

      }

      piVar4 = (int *)FUN_00415730(0x16,9,0x2e);

      if (piVar4 != (int *)0x0) {

        cVar2 = FUN_00443580(*param_1);

        if (cVar2 != '\0') {

          *(int **)(param_1 + 0xe) = piVar4;

        }

      }

      if (*(int **)(param_1 + 0xe) != (int *)0x0) {

        (**(code **)(**(int **)(param_1 + 0xe) + 0x10))();

      }

      if (piVar4 != (int *)0x0) {

        (**(code **)(*piVar4 + 0x14))();

      }

      if (piVar3 != (int *)0x0) {

        (**(code **)(*piVar3 + 0x14))();

      }

    }

    else {

      *(int **)(param_1 + 0xe) = param_2;

      (**(code **)(*param_2 + 0x10))();

    }

  }

  if (*(int *)(param_1 + 0xe) != 0) {

    uVar5 = FUN_00443550(*param_1);

    *(uint *)(param_1 + 2) = uVar5 & 0xff;

    *(undefined4 *)(param_1 + 4) = *(undefined4 *)(*(int *)(param_1 + 0xe) + 0x30);

  }

  return;

}





// --- FUN_00474e50 at 0x00474E50 (size: 103) ---


undefined2 * __thiscall

FUN_00474e50(undefined2 *param_1,undefined2 param_2,undefined4 *param_3,undefined4 param_4,

            undefined4 param_5)



{

  *param_1 = param_2;

  *(undefined4 *)(param_1 + 2) = 0;

  *(undefined4 *)(param_1 + 4) = 0;

  *(undefined4 *)(param_1 + 6) = *param_3;

  *(undefined4 *)(param_1 + 8) = param_3[1];

  *(undefined4 *)(param_1 + 10) = param_3[2];

  *(undefined4 *)(param_1 + 0xc) = param_3[3];

  *(undefined4 *)(param_1 + 0xe) = 0;

  *(undefined4 *)(param_1 + 0x10) = param_5;

  FUN_00474d60(param_4);

  if (*(int *)(param_1 + 0x10) != 0) {

    InterlockedIncrement((LONG *)(*(int *)(param_1 + 0x10) + 4));

  }

  return param_1;

}





// --- FUN_00474ec0 at 0x00474EC0 (size: 103) ---


undefined2 * __thiscall

FUN_00474ec0(undefined2 *param_1,undefined2 param_2,undefined4 *param_3,undefined4 param_4,

            undefined4 param_5,undefined4 param_6,undefined4 param_7)



{

  *param_1 = param_2;

  *(undefined4 *)(param_1 + 2) = param_6;

  *(undefined4 *)(param_1 + 4) = param_7;

  *(undefined4 *)(param_1 + 6) = *param_3;

  *(undefined4 *)(param_1 + 8) = param_3[1];

  *(undefined4 *)(param_1 + 10) = param_3[2];

  *(undefined4 *)(param_1 + 0xc) = param_3[3];

  *(undefined4 *)(param_1 + 0xe) = 0;

  *(undefined4 *)(param_1 + 0x10) = param_5;

  FUN_00474d60(param_4);

  if (*(int *)(param_1 + 0x10) != 0) {

    InterlockedIncrement((LONG *)(*(int *)(param_1 + 0x10) + 4));

  }

  return param_1;

}





// --- FUN_00474f30 at 0x00474F30 (size: 167) ---


undefined1 __fastcall FUN_00474f30(int param_1)



{

  int iVar1;

  undefined1 uVar2;

  uint uVar3;

  int iVar4;

  

  if (*(char *)(param_1 + 0x14c) == '\0') {

    return 1;

  }

  uVar3 = 0;

  uVar2 = 1;

  if (*(int *)(param_1 + 0x98) != 0) {

    iVar4 = 0;

    uVar2 = 1;

    do {

      iVar1 = *(int *)(iVar4 + 0xa0 + *(int *)(param_1 + 0x90));

      if ((iVar1 != 0) && (*(char *)(iVar1 + 0x14c) != '\0')) {

        *(undefined4 *)(param_1 + 0x13c) = 0;

        FUN_00474f30();

        uVar2 = 0;

      }

      uVar3 = uVar3 + 1;

      iVar4 = iVar4 + 0xac;

    } while (uVar3 < *(uint *)(param_1 + 0x98));

  }

  if (*(int **)(param_1 + 0x130) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x130) + 0x18))(0);

    if (*(char *)(param_1 + 0x14d) != '\0') {

      (**(code **)(**(int **)(param_1 + 0x8c) + 0x18))(0);

    }

    *(undefined1 *)(param_1 + 0x14c) = 0;

    return uVar2;

  }

  *(undefined1 *)(param_1 + 0x14c) = 0;

  return 0;

}





// --- FUN_00474ff0 at 0x00474FF0 (size: 48) ---


void __thiscall FUN_00474ff0(int param_1,undefined4 param_2)



{

  if ((*(char *)(param_1 + 0x14c) != '\0') && ((char)param_2 == '\0')) {

    FUN_00474f30();

  }

  if (*(int **)(param_1 + 0x8c) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x8c) + 0x18))(param_2);

  }

  return;

}





// --- FUN_004750d0 at 0x004750D0 (size: 36) ---


undefined4 * __thiscall FUN_004750d0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079e678;

  FUN_00476c60();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00475100 at 0x00475100 (size: 16) ---


void FUN_00475100(void)



{

  FUN_00460270(0x19,&LAB_00475050);

  return;

}





// --- FUN_00475270 at 0x00475270 (size: 36) ---


undefined4 * __thiscall FUN_00475270(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079e7c0;

  FUN_00476c60();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004752a0 at 0x004752A0 (size: 16) ---


void FUN_004752a0(void)



{

  FUN_00460270(0x18,&LAB_00475230);

  return;

}





// --- FUN_004753d0 at 0x004753D0 (size: 38) ---


void FUN_004753d0(undefined4 param_1)



{

  undefined4 uVar1;

  

  uVar1 = param_1;

  param_1 = FUN_00429a00();

  FUN_0042c290(&param_1,uVar1);

  return;

}





// --- FUN_004756b0 at 0x004756B0 (size: 36) ---


undefined4 * __thiscall FUN_004756b0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079e908;

  FUN_00476c60();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004756e0 at 0x004756E0 (size: 16) ---


void FUN_004756e0(void)



{

  FUN_00460270(0x17,&LAB_00475630);

  return;

}





// --- FUN_00475870 at 0x00475870 (size: 36) ---


undefined4 * __thiscall FUN_00475870(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079ea50;

  FUN_00476c60();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004758a0 at 0x004758A0 (size: 16) ---


void FUN_004758a0(void)



{

  FUN_00460270(0x16,&LAB_00475830);

  return;

}





// --- FUN_00475dc0 at 0x00475DC0 (size: 36) ---


undefined4 * __thiscall FUN_00475dc0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079eb98;

  FUN_00476c60();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00475df0 at 0x00475DF0 (size: 16) ---


void FUN_00475df0(void)



{

  FUN_00460270(0x15,&LAB_00475d80);

  return;

}





// --- FUN_00476230 at 0x00476230 (size: 36) ---


undefined4 * __thiscall FUN_00476230(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079ece0;

  FUN_00476c60();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00476260 at 0x00476260 (size: 16) ---


void FUN_00476260(void)



{

  FUN_00460270(0x14,&LAB_004761f0);

  return;

}





// --- FUN_00476820 at 0x00476820 (size: 37) ---


undefined4 FUN_00476820(undefined4 param_1)



{

  int *piVar1;

  undefined4 uVar2;

  

  piVar1 = (int *)FUN_00463c00(param_1);

  if (piVar1 != (int *)0x0) {

                    /* WARNING: Could not recover jumptable at 0x0047683a. Too many branches */

                    /* WARNING: Treating indirect jump as call */

    uVar2 = (**(code **)(*piVar1 + 0x94))();

    return uVar2;

  }

  return 0;

}





// --- FUN_00476850 at 0x00476850 (size: 36) ---


undefined4 * __thiscall FUN_00476850(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079ee28;

  FUN_00476c60();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00476880 at 0x00476880 (size: 16) ---


void FUN_00476880(void)



{

  FUN_00460270(0x13,&LAB_004767e0);

  return;

}





// --- FUN_00476bf0 at 0x00476BF0 (size: 112) ---


undefined4 * __thiscall FUN_00476bf0(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 uVar1;

  undefined4 uVar2;

  

  FUN_00472670(param_2,param_3);

  *param_1 = &PTR_FUN_0079ef78;

  param_1[0x17e] = 0;

  FUN_006823d0();

  uVar2 = DAT_0079ef74;

  uVar1 = DAT_0079ef70;

  param_1[0x19e] = DAT_0079ef70;

  param_1[0x19f] = uVar2;

  param_1[0x1a0] = uVar1;

  param_1[0x1a1] = uVar2;

  param_1[0x1a2] = 0;

  param_1[0x1a3] = 0;

  return param_1;

}





// --- FUN_00476c60 at 0x00476C60 (size: 28) ---


void __fastcall FUN_00476c60(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0079ef78;

  FUN_00681f60();

  FUN_004726c0();

  return;

}





// --- FUN_00476c80 at 0x00476C80 (size: 40) ---


void __thiscall FUN_00476c80(int *param_1,int param_2)



{

  if ((*(int *)(param_2 + 8) == 0x24) && (*(int **)(param_2 + 4) == param_1)) {

    (**(code **)(*param_1 + 0x144))();

  }

  FUN_00462420(param_2);

  return;

}





// --- FUN_00476cb0 at 0x00476CB0 (size: 49) ---


undefined4 * __thiscall FUN_00476cb0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079ef78;

  FUN_00681f60();

  FUN_004726c0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00476cf0 at 0x00476CF0 (size: 114) ---


void __fastcall FUN_00476cf0(int param_1)



{

  int iVar1;

  int *piVar2;

  undefined4 uVar3;

  

  if ((*(int *)(param_1 + 0x688) != 0) && (*(int *)(param_1 + 0x68c) != 0)) goto LAB_00476d3d;

  iVar1 = FUN_00463c00(0x33);

  *(int *)(param_1 + 0x688) = iVar1;

  if (iVar1 == 0) {

LAB_00476d35:

    uVar3 = 0;

  }

  else {

    piVar2 = (int *)FUN_00463c00(0x34);

    if (piVar2 == (int *)0x0) goto LAB_00476d35;

    uVar3 = (**(code **)(*piVar2 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x68c) = uVar3;

LAB_00476d3d:

  if (*(int **)(param_1 + 0x688) != (int *)0x0) {

                    /* WARNING: Could not recover jumptable at 0x00476d59. Too many branches */

                    /* WARNING: Treating indirect jump as call */

    (**(code **)(**(int **)(param_1 + 0x688) + 0x9c))();

    return;

  }

  return;

}





// --- FUN_00476d70 at 0x00476D70 (size: 146) ---


void FUN_00476d70(void)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  int iVar4;

  undefined4 uVar5;

  

  piVar1 = (int *)FUN_00463c00(0x3e);

  if (piVar1 == (int *)0x0) {

    iVar2 = 0;

  }

  else {

    iVar2 = (**(code **)(*piVar1 + 0x94))(0xc);

  }

  piVar1 = (int *)FUN_00463c00(0x3d);

  if (piVar1 != (int *)0x0) {

    FUN_004686b0();

    iVar2 = *(int *)(iVar2 + 0x604);

    iVar3 = FUN_0069fe70();

    iVar4 = FUN_0069fe70();

    iVar4 = (iVar2 - iVar3) + iVar4;

    iVar2 = FUN_0069fe70();

    if (iVar2 < iVar4) {

      iVar2 = *piVar1;

      uVar5 = FUN_0069fe60(iVar4);

      (**(code **)(iVar2 + 0x30))(uVar5);

    }

    iVar2 = FUN_0069fe70();

    iVar2 = iVar2 / 2;

    iVar3 = FUN_0069fe60(iVar2);

    FUN_004600d0(iVar3 / 2,iVar2);

  }

  return;

}





// --- FUN_00476e10 at 0x00476E10 (size: 318) ---


/* WARNING: Removing unreachable block (ram,0x00476f08) */

/* WARNING: Removing unreachable block (ram,0x00476f19) */

/* WARNING: Removing unreachable block (ram,0x00476f1f) */

/* WARNING: Removing unreachable block (ram,0x00476e84) */

/* WARNING: Removing unreachable block (ram,0x00476e95) */

/* WARNING: Removing unreachable block (ram,0x00476ea2) */

/* WARNING: Removing unreachable block (ram,0x00476eb5) */

/* WARNING: Removing unreachable block (ram,0x00476ef6) */

/* WARNING: Removing unreachable block (ram,0x00476f2f) */

/* WARNING: Removing unreachable block (ram,0x00476f40) */



void __fastcall FUN_00476e10(int param_1)



{

  int *piVar1;

  

  piVar1 = *(int **)(*(int *)(param_1 + 0x664) +

                    (int)(0xc5 % (ulonglong)*(uint *)(param_1 + 0x66c)) * 4);

  if (piVar1 != (int *)0x0) {

    while (*piVar1 != 0xc5) {

      piVar1 = (int *)piVar1[1];

      if (piVar1 == (int *)0x0) {

        return;

      }

    }

    if (piVar1 != (int *)0x0) {

      FUN_00429ab0(piVar1 + 2);

      FUN_0042dc80();

      FUN_0042e590();

    }

  }

  return;

}





// --- FUN_00476fa0 at 0x00476FA0 (size: 358) ---


/* WARNING: Removing unreachable block (ram,0x004770c4) */

/* WARNING: Removing unreachable block (ram,0x004770d5) */

/* WARNING: Removing unreachable block (ram,0x004770db) */

/* WARNING: Removing unreachable block (ram,0x0047700e) */

/* WARNING: Removing unreachable block (ram,0x0047701e) */

/* WARNING: Removing unreachable block (ram,0x00477077) */

/* WARNING: Removing unreachable block (ram,0x004770e7) */

/* WARNING: Removing unreachable block (ram,0x004770f8) */



void __thiscall FUN_00476fa0(int param_1,undefined4 param_2)



{

  int *piVar1;

  undefined4 uVar2;

  

  FUN_00682400(param_2);

  for (piVar1 = *(int **)(*(int *)(param_1 + 0x664) +

                         (int)(0xac % (ulonglong)*(uint *)(param_1 + 0x66c)) * 4);

      piVar1 != (int *)0x0; piVar1 = (int *)piVar1[1]) {

    if (*piVar1 == 0xac) {

      if (piVar1 != (int *)0x0) {

        FUN_00429ab0(piVar1 + 2);

      }

      break;

    }

  }

  piVar1 = *(int **)(*(int *)(param_1 + 0x664) +

                    (int)(0xc6 % (ulonglong)*(uint *)(param_1 + 0x66c)) * 4);

  do {

    if (piVar1 == (int *)0x0) {

LAB_004770b5:

      FUN_00476e10();

      return;

    }

    if (*piVar1 == 0xc6) {

      if (piVar1 != (int *)0x0) {

        FUN_00429ab0(piVar1 + 2);

        uVar2 = DAT_008379ac;

        *(undefined4 *)(param_1 + 0x678) = DAT_008379a8;

        *(undefined4 *)(param_1 + 0x67c) = uVar2;

        *(double *)(param_1 + 0x680) = (double)((float)*(double *)(param_1 + 0x678) + 0.0);

        FUN_00465f90(3);

      }

      goto LAB_004770b5;

    }

    piVar1 = (int *)piVar1[1];

  } while( true );

}





// --- FUN_00477110 at 0x00477110 (size: 64) ---


undefined4 * __thiscall FUN_00477110(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f0dc;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00477150 at 0x00477150 (size: 64) ---


undefined4 * __thiscall FUN_00477150(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f0e0;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00477190 at 0x00477190 (size: 64) ---


undefined4 * __thiscall FUN_00477190(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f0e4;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004771d0 at 0x004771D0 (size: 112) ---


uint __thiscall FUN_004771d0(int param_1,int param_2)



{

  void *pvVar1;

  uint in_EAX;

  int iVar2;

  

  pvVar1 = *(void **)(param_1 + 4);

  if (pvVar1 == (void *)0x0) {

    return in_EAX & 0xffffff00;

  }

  iVar2 = *(int *)((int)pvVar1 + 0x84);

  *(int *)(param_1 + 4) = iVar2;

  if (iVar2 == 0) {

    *(undefined4 *)(param_1 + 8) = 0;

  }

  else {

    *(undefined4 *)(iVar2 + 0x88) = 0;

  }

  FUN_00682400(pvVar1);

  *(undefined4 *)(param_2 + 0x78) = *(undefined4 *)((int)pvVar1 + 0x78);

  *(undefined4 *)(param_2 + 0x7c) = *(undefined4 *)((int)pvVar1 + 0x7c);

  *(undefined4 *)(param_2 + 0x80) = *(undefined4 *)((int)pvVar1 + 0x80);

  FUN_00681f60();

  operator_delete(pvVar1);

  iVar2 = *(int *)(param_1 + 0xc) + -1;

  *(int *)(param_1 + 0xc) = iVar2;

  return CONCAT31((int3)((uint)iVar2 >> 8),1);

}





// --- FUN_00477240 at 0x00477240 (size: 131) ---


uint __thiscall FUN_00477240(int param_1,void *param_2)



{

  uint in_EAX;

  int iVar1;

  undefined4 uVar2;

  

  uVar2 = 0;

  if ((param_2 == (void *)0x0) || (in_EAX = 0, *(void **)(param_1 + 4) == (void *)0x0)) {

    return in_EAX & 0xffffff00;

  }

  if (param_2 == *(void **)(param_1 + 4)) {

    iVar1 = *(int *)((int)param_2 + 0x84);

    *(int *)(param_1 + 4) = iVar1;

    if (iVar1 == 0) {

      *(undefined4 *)(param_1 + 8) = 0;

      goto LAB_004772a5;

    }

  }

  else {

    *(undefined4 *)(*(int *)((int)param_2 + 0x88) + 0x84) = *(undefined4 *)((int)param_2 + 0x84);

    iVar1 = *(int *)((int)param_2 + 0x84);

    if (iVar1 == 0) {

      *(undefined4 *)(param_1 + 8) = *(undefined4 *)((int)param_2 + 0x88);

      goto LAB_004772a5;

    }

    uVar2 = *(undefined4 *)((int)param_2 + 0x88);

  }

  *(undefined4 *)(iVar1 + 0x88) = uVar2;

LAB_004772a5:

  FUN_00681f60();

  operator_delete(param_2);

  iVar1 = *(int *)(param_1 + 0xc) + -1;

  *(int *)(param_1 + 0xc) = iVar1;

  return CONCAT31((int3)((uint)iVar1 >> 8),1);

}





// --- FUN_004772d0 at 0x004772D0 (size: 176) ---


void __fastcall FUN_004772d0(int param_1)



{

  void *pvVar1;

  int iVar2;

  

  while (*(int *)(param_1 + 4) != 0) {

    FUN_006823d0();

    pvVar1 = *(void **)(param_1 + 4);

    if (pvVar1 != (void *)0x0) {

      iVar2 = *(int *)((int)pvVar1 + 0x84);

      *(int *)(param_1 + 4) = iVar2;

      if (iVar2 == 0) {

        *(undefined4 *)(param_1 + 8) = 0;

      }

      else {

        *(undefined4 *)(iVar2 + 0x88) = 0;

      }

      FUN_00682400(pvVar1);

      FUN_00681f60();

      operator_delete(pvVar1);

      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + -1;

    }

    FUN_00681f60();

  }

  return;

}





// --- FUN_00477380 at 0x00477380 (size: 60) ---


uint * __thiscall FUN_00477380(int param_1,uint *param_2)



{

  uint *puVar1;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 100) + (*param_2 % *(uint *)(param_1 + 0x6c)) * 4);

  while( true ) {

    if (puVar1 == (uint *)0x0) {

      return (uint *)0x0;

    }

    if (*puVar1 == *param_2) break;

    puVar1 = (uint *)puVar1[1];

  }

  if (puVar1 == (uint *)0x0) {

    return (uint *)0x0;

  }

  return puVar1 + 2;

}





// --- FUN_004773c0 at 0x004773C0 (size: 100) ---


undefined4 __thiscall FUN_004773c0(int param_1,uint *param_2,int param_3)



{

  uint *puVar1;

  uint uVar2;

  

  puVar1 = *(uint **)(*(int *)(param_1 + 100) + (*param_2 % *(uint *)(param_1 + 0x6c)) * 4);

  while( true ) {

    if (puVar1 == (uint *)0x0) {

      return 0;

    }

    if (*puVar1 == *param_2) break;

    puVar1 = (uint *)puVar1[1];

  }

  if (puVar1 == (uint *)0x0) {

    return 0;

  }

  FUN_00682400(puVar1 + 2);

  *(uint *)(param_3 + 0x78) = puVar1[0x20];

  uVar2 = puVar1[0x21];

  *(uint *)(param_3 + 0x7c) = uVar2;

  *(uint *)(param_3 + 0x80) = puVar1[0x22];

  return CONCAT31((int3)(uVar2 >> 8),1);

}





// --- FUN_00477430 at 0x00477430 (size: 36) ---


undefined4 * __thiscall FUN_00477430(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f0d8;

  FUN_004772d0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00477460 at 0x00477460 (size: 71) ---


undefined4 FUN_00477460(int param_1)



{

  int iVar1;

  

  if (param_1 == 0) {

    iVar1 = DAT_00819e98;

    if (DAT_00819f20 != 0) {

      return 1;

    }

  }

  else {

    if (param_1 == 1) {

      return CONCAT31((int3)((uint)DAT_00819f20 >> 8),DAT_00819f20 != 0);

    }

    iVar1 = FUN_00477380(&param_1);

    if (iVar1 == 0) {

      return 0;

    }

    iVar1 = *(int *)(iVar1 + 0x78);

  }

  if (iVar1 == 0) {

    return 0;

  }

  return 1;

}





// --- FUN_004774b0 at 0x004774B0 (size: 143) ---


undefined4 * __thiscall FUN_004774b0(undefined4 *param_1,undefined4 param_2)



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_0079f0dc;

  puVar1 = PTR_DAT_00818558;

  puVar2 = (uint *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

  if (puVar2 == (uint *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

  param_1[0x19] = (undefined4 *)param_1[0x18] + param_1[0x1a];

  puVar6 = (undefined4 *)param_1[0x18];

  for (uVar4 = param_1[0x1a] & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

  for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

    *(undefined1 *)puVar6 = 0;

    puVar6 = (undefined4 *)((int)puVar6 + 1);

  }

  return param_1;

}





// --- FUN_00477540 at 0x00477540 (size: 143) ---


undefined4 * __thiscall FUN_00477540(undefined4 *param_1,undefined4 param_2)



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_0079f0e0;

  puVar1 = PTR_DAT_00818558;

  puVar2 = (uint *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

  if (puVar2 == (uint *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

  param_1[0x19] = (undefined4 *)param_1[0x18] + param_1[0x1a];

  puVar6 = (undefined4 *)param_1[0x18];

  for (uVar4 = param_1[0x1a] & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

  for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

    *(undefined1 *)puVar6 = 0;

    puVar6 = (undefined4 *)((int)puVar6 + 1);

  }

  return param_1;

}





// --- FUN_004775d0 at 0x004775D0 (size: 143) ---


undefined4 * __thiscall FUN_004775d0(undefined4 *param_1,undefined4 param_2)



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_0079f0e4;

  puVar1 = PTR_DAT_00818558;

  puVar2 = (uint *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

  if (puVar2 == (uint *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

  param_1[0x19] = (undefined4 *)param_1[0x18] + param_1[0x1a];

  puVar6 = (undefined4 *)param_1[0x18];

  for (uVar4 = param_1[0x1a] & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

  for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

    *(undefined1 *)puVar6 = 0;

    puVar6 = (undefined4 *)((int)puVar6 + 1);

  }

  return param_1;

}





// --- FUN_00477660 at 0x00477660 (size: 136) ---


void __fastcall FUN_00477660(int param_1)



{

  int iVar1;

  void *pvVar2;

  void *pvVar3;

  int *piVar4;

  void *pvVar5;

  

  iVar1 = *(int *)(param_1 + 0x6c);

  do {

    if (iVar1 == 0) {

      return;

    }

    piVar4 = *(int **)(param_1 + 100);

    while (piVar4 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

      if (**(int **)(param_1 + 100) != 0) {

        piVar4 = *(int **)(param_1 + 100);

        pvVar5 = (void *)*piVar4;

        goto LAB_0047769f;

      }

      piVar4 = *(int **)(param_1 + 100) + 1;

      *(int **)(param_1 + 100) = piVar4;

    }

    piVar4 = (int *)0x0;

    pvVar5 = (void *)0x0;

LAB_0047769f:

    pvVar3 = (void *)*piVar4;

    if (pvVar3 == pvVar5) {

LAB_004776b2:

      *piVar4 = *(int *)((int)pvVar3 + 4);

    }

    else {

      do {

        pvVar2 = pvVar3;

        pvVar3 = *(void **)((int)pvVar2 + 4);

      } while (pvVar3 != pvVar5);

      if (pvVar2 == (void *)0x0) goto LAB_004776b2;

      *(undefined4 *)((int)pvVar2 + 4) = *(undefined4 *)((int)pvVar3 + 4);

    }

    *(int *)(param_1 + 0x6c) = *(int *)(param_1 + 0x6c) + -1;

    if (pvVar5 != (void *)0x0) {

      *(undefined ***)((int)pvVar5 + 8) = &PTR_FUN_0079f0d8;

      FUN_004772d0();

      operator_delete(pvVar5);

    }

    iVar1 = *(int *)(param_1 + 0x6c);

  } while( true );

}





// --- FUN_004776f0 at 0x004776F0 (size: 130) ---


void __fastcall FUN_004776f0(int param_1)



{

  int iVar1;

  void *pvVar2;

  void *pvVar3;

  int *piVar4;

  void *pvVar5;

  

  iVar1 = *(int *)(param_1 + 0x6c);

  do {

    if (iVar1 == 0) {

      return;

    }

    piVar4 = *(int **)(param_1 + 100);

    while (piVar4 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

      if (**(int **)(param_1 + 100) != 0) {

        piVar4 = *(int **)(param_1 + 100);

        pvVar5 = (void *)*piVar4;

        goto LAB_0047772f;

      }

      piVar4 = *(int **)(param_1 + 100) + 1;

      *(int **)(param_1 + 100) = piVar4;

    }

    piVar4 = (int *)0x0;

    pvVar5 = (void *)0x0;

LAB_0047772f:

    pvVar3 = (void *)*piVar4;

    if (pvVar3 == pvVar5) {

LAB_00477742:

      *piVar4 = *(int *)((int)pvVar3 + 4);

    }

    else {

      do {

        pvVar2 = pvVar3;

        pvVar3 = *(void **)((int)pvVar2 + 4);

      } while (pvVar3 != pvVar5);

      if (pvVar2 == (void *)0x0) goto LAB_00477742;

      *(undefined4 *)((int)pvVar2 + 4) = *(undefined4 *)((int)pvVar3 + 4);

    }

    *(int *)(param_1 + 0x6c) = *(int *)(param_1 + 0x6c) + -1;

    if (pvVar5 != (void *)0x0) {

      FUN_00681f60();

      operator_delete(pvVar5);

    }

    iVar1 = *(int *)(param_1 + 0x6c);

  } while( true );

}





// --- FUN_00477780 at 0x00477780 (size: 55) ---


undefined4 FUN_00477780(undefined4 param_1)



{

  void *pvVar1;

  

  pvVar1 = (void *)FUN_004171e0(param_1);

  if (pvVar1 != (void *)0x0) {

    *(undefined ***)((int)pvVar1 + 8) = &PTR_FUN_0079f0d8;

    FUN_004772d0();

    operator_delete(pvVar1);

    return 1;

  }

  return 0;

}





// --- FUN_004777c0 at 0x004777C0 (size: 168) ---


void FUN_004777c0(int param_1)



{

  undefined4 *puVar1;

  uint *puVar2;

  int iVar3;

  undefined4 *puVar4;

  void *pvVar5;

  

  iVar3 = param_1;

  puVar1 = (undefined4 *)(param_1 + 0x80);

  puVar2 = *(uint **)(DAT_00819f04 + (*(uint *)(param_1 + 0x80) % DAT_00819f0c) * 4);

  do {

    if (puVar2 == (uint *)0x0) {

LAB_0047782b:

      FUN_00693450(*puVar1,*(int *)(iVar3 + 0x78) + 0x5fc);

      param_1 = *(int *)(iVar3 + 0x78);

      if (param_1 != 0) {

        (**(code **)(**(int **)(iVar3 + 0x7c) + 0x20))(&param_1);

        (**(code **)(**(int **)(iVar3 + 0x78) + 0x138))(0);

      }

      return;

    }

    if (*puVar2 == *(uint *)(param_1 + 0x80)) {

      if (puVar2 != (uint *)0x0) {

        puVar4 = (undefined4 *)FUN_00477380(puVar1);

        (*(code *)*puVar4)(*(int *)(iVar3 + 0x78) + 0x5fc);

        pvVar5 = (void *)FUN_004171e0(puVar1);

        if (pvVar5 != (void *)0x0) {

          operator_delete(pvVar5);

        }

      }

      goto LAB_0047782b;

    }

    puVar2 = (uint *)puVar2[1];

  } while( true );

}





// --- FUN_00477870 at 0x00477870 (size: 82) ---


undefined4 * __thiscall FUN_00477870(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f0e8;

  FUN_00477660();

  param_1[1] = &PTR_FUN_0079f0dc;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004778d0 at 0x004778D0 (size: 82) ---


undefined4 * __thiscall FUN_004778d0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f0ec;

  FUN_004776f0();

  param_1[1] = &PTR_FUN_0079f0e0;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00477930 at 0x00477930 (size: 82) ---


undefined4 * __thiscall FUN_00477930(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f0f0;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_0079f0e4;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00477990 at 0x00477990 (size: 259) ---


void FUN_00477990(void)



{

  int iVar1;

  uint *puVar2;

  int *piVar3;

  undefined4 *puVar4;

  uint *puVar5;

  undefined1 local_90 [12];

  undefined **local_84;

  undefined **local_80;

  uint local_c;

  uint local_8;

  uint local_4;

  

  piVar3 = (int *)FUN_0052dcf0(local_90);

  puVar5 = (uint *)piVar3[2];

  iVar1 = *piVar3;

  puVar4 = (undefined4 *)piVar3[1];

  do {

    if (puVar5 == (uint *)0x0) {

      return;

    }

    do {

      local_84 = &PTR_FUN_0079d098;

      local_80 = &PTR_FUN_00798700;

      FUN_00428580(0);

      local_80 = &PTR_FUN_00798700;

      FUN_00682400(puVar5 + 2);

      local_c = puVar5[0x20];

      local_8 = puVar5[0x21];

      local_4 = puVar5[0x22];

      if (local_c != 0) {

        for (puVar2 = *(uint **)(DAT_00819e14 + (*puVar5 % DAT_00819e1c) * 4); puVar2 != (uint *)0x0

            ; puVar2 = (uint *)puVar2[1]) {

          if (*puVar2 == *puVar5) {

            if ((puVar2 != (uint *)0x0) && (puVar2 != (uint *)0xfffffff8)) {

              FUN_00476cf0(puVar2[5]);

            }

            break;

          }

        }

      }

      FUN_00681f60();

      puVar5 = (uint *)puVar5[1];

    } while (puVar5 != (uint *)0x0);

    do {

      puVar4 = puVar4 + 1;

      if (puVar4 == (undefined4 *)(*(int *)(iVar1 + 0x60) + *(int *)(iVar1 + 0x68) * 4)) {

        return;

      }

      puVar5 = (uint *)*puVar4;

    } while (puVar5 == (uint *)0x0);

  } while( true );

}





// --- FUN_00477aa0 at 0x00477AA0 (size: 97) ---


undefined4 * __thiscall FUN_00477aa0(undefined4 *param_1,undefined4 *param_2,int param_3)



{

  *param_1 = *param_2;

  param_1[1] = 0;

  param_1[2] = &PTR_FUN_0079d098;

  param_1[3] = &PTR_FUN_00798700;

  FUN_00428580(0);

  param_1[3] = &PTR_FUN_00798700;

  FUN_00682400(param_3);

  param_1[0x20] = *(undefined4 *)(param_3 + 0x78);

  param_1[0x21] = *(undefined4 *)(param_3 + 0x7c);

  param_1[0x22] = *(undefined4 *)(param_3 + 0x80);

  return param_1;

}





// --- FUN_00477b10 at 0x00477B10 (size: 97) ---


undefined4 * __thiscall FUN_00477b10(undefined4 *param_1,int param_2)



{

  *param_1 = &PTR_FUN_0079d098;

  param_1[1] = &PTR_FUN_00798700;

  FUN_00428580(0);

  param_1[1] = &PTR_FUN_00798700;

  FUN_00682400(param_2);

  param_1[0x1e] = *(undefined4 *)(param_2 + 0x78);

  param_1[0x1f] = *(undefined4 *)(param_2 + 0x7c);

  param_1[0x20] = *(undefined4 *)(param_2 + 0x80);

  param_1[0x21] = 0;

  param_1[0x22] = 0;

  return param_1;

}





// --- FUN_00477b80 at 0x00477B80 (size: 135) ---


undefined4 __thiscall FUN_00477b80(int param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  

  iVar1 = FUN_005df0f5(0x8c);

  if (iVar1 != 0) {

    iVar1 = FUN_00477b10(param_3);

    if (iVar1 != 0) {

      if (*(int *)(param_1 + 4) == 0) {

        *(int *)(param_1 + 4) = iVar1;

        *(int *)(param_1 + 8) = iVar1;

        *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

        return 1;

      }

      *(int *)(iVar1 + 0x84) = param_2;

      *(undefined4 *)(iVar1 + 0x88) = *(undefined4 *)(param_2 + 0x88);

      if (*(int *)(param_2 + 0x88) != 0) {

        *(int *)(*(int *)(param_2 + 0x88) + 0x84) = iVar1;

        *(int *)(param_2 + 0x88) = iVar1;

        *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

        return 1;

      }

      *(int *)(param_1 + 4) = iVar1;

      *(int *)(param_2 + 0x88) = iVar1;

      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

      return 1;

    }

  }

  return 0;

}





// --- FUN_00477c10 at 0x00477C10 (size: 92) ---


undefined4 FUN_00477c10(undefined4 param_1,undefined4 param_2)



{

  char cVar1;

  int iVar2;

  void *pvVar3;

  

  iVar2 = FUN_005df0f5(0x8c);

  if (iVar2 == 0) {

    pvVar3 = (void *)0x0;

  }

  else {

    pvVar3 = (void *)FUN_00477aa0(param_1,param_2);

  }

  cVar1 = FUN_0042bd40(pvVar3);

  if (cVar1 == '\0') {

    if (pvVar3 != (void *)0x0) {

      FUN_00681f60();

      operator_delete(pvVar3);

    }

    return 0;

  }

  return 1;

}





// --- FUN_00477c70 at 0x00477C70 (size: 91) ---


undefined4 __thiscall FUN_00477c70(int param_1,undefined4 param_2)



{

  int iVar1;

  int iVar2;

  

  iVar2 = FUN_005df0f5(0x8c);

  if (iVar2 != 0) {

    iVar2 = FUN_00477b10(param_2);

    if (iVar2 != 0) {

      if (*(int *)(param_1 + 4) == 0) {

        *(int *)(param_1 + 4) = iVar2;

        *(int *)(param_1 + 8) = iVar2;

        *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

        return 1;

      }

      iVar1 = *(int *)(param_1 + 8);

      *(int *)(iVar1 + 0x84) = iVar2;

      *(int *)(iVar2 + 0x88) = iVar1;

      *(int *)(param_1 + 8) = iVar2;

      *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

      return 1;

    }

  }

  return 0;

}





// --- FUN_00477cd0 at 0x00477CD0 (size: 109) ---


int __thiscall FUN_00477cd0(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  int iVar3;

  

  if (param_1 != param_2) {

    FUN_004772d0();

    for (iVar1 = *(int *)(param_2 + 4); iVar1 != 0; iVar1 = *(int *)(iVar1 + 0x84)) {

      iVar3 = FUN_005df0f5(0x8c);

      if ((iVar3 != 0) && (iVar3 = FUN_00477b10(iVar1), iVar3 != 0)) {

        if (*(int *)(param_1 + 4) == 0) {

          *(int *)(param_1 + 4) = iVar3;

        }

        else {

          iVar2 = *(int *)(param_1 + 8);

          *(int *)(iVar2 + 0x84) = iVar3;

          *(int *)(iVar3 + 0x88) = iVar2;

        }

        *(int *)(param_1 + 8) = iVar3;

        *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + 1;

      }

      if (iVar1 == 0) {

        return param_1;

      }

    }

  }

  return param_1;

}





// --- FUN_00477d50 at 0x00477D50 (size: 383) ---


/* WARNING: Removing unreachable block (ram,0x00477e67) */

/* WARNING: Removing unreachable block (ram,0x00477e74) */



void FUN_00477d50(void)



{

  int *piVar1;

  int iVar2;

  

  for (iVar2 = DAT_00819f18; (iVar2 != 0 && (FUN_004777c0(iVar2), iVar2 != 0));

      iVar2 = *(int *)(iVar2 + 0x84)) {

  }

  FUN_004772d0();

  for (; DAT_00819e90 != (int *)(DAT_00819e8c + DAT_00819e94 * 4); DAT_00819e90 = DAT_00819e90 + 1)

  {

    if (*DAT_00819e90 != 0) {

      iVar2 = *DAT_00819e90;

      piVar1 = DAT_00819e90;

      goto joined_r0x00477db5;

    }

  }

  iVar2 = 0;

  piVar1 = (int *)0x0;

joined_r0x00477db5:

  while (iVar2 != 0) {

    do {

      FUN_004777c0(iVar2 + 8);

      iVar2 = *(int *)(iVar2 + 4);

    } while (iVar2 != 0);

    do {

      piVar1 = piVar1 + 1;

      if (piVar1 == (int *)(DAT_00819e8c + DAT_00819e94 * 4)) goto LAB_00477deb;

      iVar2 = *piVar1;

    } while (iVar2 == 0);

  }

LAB_00477deb:

  FUN_004776f0();

  do {

    if (DAT_00819e18 == (int *)(DAT_00819e14 + DAT_00819e1c * 4)) {

      iVar2 = 0;

      piVar1 = (int *)0x0;

joined_r0x00477e2d:

      while (iVar2 != 0) {

        do {

          FUN_00477cd0(iVar2 + 8);

          FUN_004772d0();

          iVar2 = *(int *)(iVar2 + 4);

        } while (iVar2 != 0);

        do {

          piVar1 = piVar1 + 1;

          if (piVar1 == (int *)(DAT_00819e14 + DAT_00819e1c * 4)) goto LAB_00477eb4;

          iVar2 = *piVar1;

        } while (iVar2 == 0);

      }

LAB_00477eb4:

      FUN_00477660();

      FUN_005870f0();

      return;

    }

    if (*DAT_00819e18 != 0) {

      iVar2 = *DAT_00819e18;

      piVar1 = DAT_00819e18;

      goto joined_r0x00477e2d;

    }

    DAT_00819e18 = DAT_00819e18 + 1;

  } while( true );

}





// --- FUN_00477ed0 at 0x00477ED0 (size: 564) ---


/* WARNING: Removing unreachable block (ram,0x0047801a) */

/* WARNING: Removing unreachable block (ram,0x00478035) */

/* WARNING: Removing unreachable block (ram,0x0047807c) */

/* WARNING: Removing unreachable block (ram,0x0047806c) */

/* WARNING: Removing unreachable block (ram,0x0047809c) */

/* WARNING: Removing unreachable block (ram,0x0047808c) */

/* WARNING: Removing unreachable block (ram,0x0047805c) */

/* WARNING: Removing unreachable block (ram,0x0047804c) */

/* WARNING: Removing unreachable block (ram,0x0047803c) */

/* WARNING: Removing unreachable block (ram,0x004780aa) */

/* WARNING: Recovered jumptable eliminated as dead code */



void FUN_00477ed0(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  undefined1 local_108 [120];

  undefined4 local_90;

  undefined4 local_8c;

  undefined4 local_88;

  undefined1 local_84 [120];

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if (param_2 == 0) {

    return;

  }

  if (param_2 == 1) {

    FUN_006823d0();

    local_90 = 0;

    local_8c = 0;

    local_88 = 0;

    FUN_00477c70(local_108);

    iVar2 = DAT_00819f1c;

  }

  else {

    iVar2 = FUN_00477380(&param_2);

    if (iVar2 != 0) goto LAB_00477f97;

    FUN_006823d0();

    local_c = 0;

    local_8 = 0;

    local_4 = 0;

    FUN_00477c10(&param_2,local_84);

    iVar2 = FUN_00477380(&param_2);

  }

  FUN_00681f60();

LAB_00477f97:

  if (*(int *)(iVar2 + 0x78) == 0) {

    FUN_00682400(param_1);

    *(undefined4 *)(iVar2 + 0x78) = *(undefined4 *)(param_1 + 0x78);

    *(undefined4 *)(iVar2 + 0x7c) = *(undefined4 *)(param_1 + 0x7c);

    *(undefined4 *)(iVar2 + 0x80) = *(undefined4 *)(param_1 + 0x80);

    for (piVar1 = *(int **)(*(int *)(iVar2 + 0x68) +

                           (int)(0x8e % (ulonglong)*(uint *)(iVar2 + 0x70)) * 4);

        piVar1 != (int *)0x0; piVar1 = (int *)piVar1[1]) {

      if (*piVar1 == 0x8e) {

        if (piVar1 != (int *)0x0) {

          FUN_00429ab0(piVar1 + 2);

        }

        break;

      }

    }

    if (*(int **)(iVar2 + 0x78) != (int *)0x0) {

      (**(code **)(**(int **)(iVar2 + 0x78) + 0x138))(*(undefined4 *)(iVar2 + 0x80));

      (**(code **)(**(int **)(iVar2 + 0x78) + 0x13c))(iVar2);

      FUN_0069fca0();

      FUN_00477990();

      FUN_006935a0(*(undefined4 *)(iVar2 + 0x80));

    }

    FUN_004234d0();

  }

  return;

}





// --- FUN_00478130 at 0x00478130 (size: 212) ---


void FUN_00478130(uint param_1)



{

  uint uVar1;

  char cVar2;

  uint *puVar3;

  undefined1 local_84 [120];

  int local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  uVar1 = param_1;

  if ((param_1 != 1) &&

     (puVar3 = *(uint **)(DAT_00819e14 + (param_1 % DAT_00819e1c) * 4), puVar3 != (uint *)0x0)) {

    while (*puVar3 != param_1) {

      puVar3 = (uint *)puVar3[1];

      if (puVar3 == (uint *)0x0) {

        return;

      }

    }

    if ((puVar3 != (uint *)0x0) && (puVar3 != (uint *)0xfffffff8)) {

      FUN_006823d0();

      local_c = 0;

      local_8 = 0;

      local_4 = 0;

      cVar2 = FUN_004771d0(local_84);

      if ((cVar2 != '\0') && ((local_c == 0 && (FUN_00477ed0(local_84,uVar1), puVar3[3] == 0)))) {

        FUN_00477780(&param_1);

      }

      FUN_00681f60();

    }

  }

  return;

}





// --- FUN_00478210 at 0x00478210 (size: 122) ---


undefined4 FUN_00478210(undefined4 *param_1,undefined4 param_2)



{

  char cVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0x18);

  if (puVar2 == (undefined4 *)0x0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = *param_1;

    puVar2[1] = 0;

    puVar2[2] = &PTR_FUN_0079f0d8;

    puVar2[3] = 0;

    puVar2[4] = 0;

    puVar2[5] = 0;

    FUN_00477cd0(param_2);

  }

  cVar1 = FUN_0042bd40(puVar2);

  if (cVar1 == '\0') {

    if (puVar2 != (undefined4 *)0x0) {

      puVar2[2] = &PTR_FUN_0079f0d8;

      FUN_004772d0();

      operator_delete(puVar2);

    }

    return 0;

  }

  return 1;

}





// --- FUN_00478290 at 0x00478290 (size: 707) ---


int FUN_00478290(undefined4 param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  int iVar3;

  uint *puVar4;

  char local_129;

  uint local_128;

  undefined4 *local_124;

  int *local_120;

  int local_11c;

  undefined **local_118;

  undefined4 local_114;

  undefined4 local_110;

  undefined4 local_10c;

  undefined1 local_108 [120];

  undefined4 local_90;

  undefined4 local_8c;

  int local_88;

  undefined1 local_84 [120];

  int local_c;

  int *local_8;

  undefined4 local_4;

  

  DAT_0083e718 = DAT_0083e718 + 1;

  FUN_006823d0();

  local_90 = 0;

  local_8c = 0;

  local_88 = 0;

  FUN_00682400(param_2);

  local_8c = param_1;

  local_90 = 0;

  local_88 = DAT_0083e718;

  local_129 = '\0';

  local_124 = (undefined4 *)0x0;

  local_120 = (int *)0x0;

  for (piVar1 = *(int **)(*(int *)(param_2 + 0x68) +

                         (int)(0x8d % (ulonglong)*(uint *)(param_2 + 0x70)) * 4);

      piVar1 != (int *)0x0; piVar1 = (int *)piVar1[1]) {

    if (*piVar1 == 0x8d) {

      if ((piVar1 != (int *)0x0) && (FUN_00429ab0(piVar1 + 2), local_120 != (int *)0x0)) {

        (**(code **)(*local_120 + 0x70))(&local_129);

      }

      break;

    }

  }

  local_128 = 2;

  for (piVar1 = *(int **)(*(int *)(param_2 + 0x68) +

                         (int)(0xc3 % (ulonglong)*(uint *)(param_2 + 0x70)) * 4);

      piVar1 != (int *)0x0; piVar1 = (int *)piVar1[1]) {

    if (*piVar1 == 0xc3) {

      if (piVar1 != (int *)0x0) {

        FUN_00429ab0(piVar1 + 2);

        if (local_120 != (int *)0x0) {

          (**(code **)(*local_120 + 0xa8))(&local_128);

        }

        if (local_128 == 1) {

          FUN_00477ed0(local_108,1);

          goto LAB_004784f7;

        }

      }

      break;

    }

  }

  FUN_006823d0();

  local_c = 0;

  local_8 = (int *)0x0;

  local_4 = 0;

  FUN_004773c0(&local_128,local_84);

  puVar4 = *(uint **)(DAT_00819e14 + (local_128 % DAT_00819e1c) * 4);

  do {

    if (puVar4 == (uint *)0x0) {

LAB_00478432:

      local_118 = &PTR_FUN_0079f0d8;

      local_114 = 0;

      local_110 = 0;

      local_10c = 0;

      FUN_00478210(&local_128,&local_118);

      local_118 = &PTR_FUN_0079f0d8;

      FUN_004772d0();

      puVar4 = (uint *)FUN_00477380(&local_128);

LAB_0047847d:

      if (local_c == 0) {

        FUN_00477ed0(local_108,local_128);

      }

      else if (local_129 == '\0') {

        FUN_00477c70(local_108);

        FUN_00477990();

      }

      else {

        local_11c = local_c;

        (**(code **)(*local_8 + 0x20))(&local_11c);

        FUN_00477b80(puVar4[1],local_84);

        FUN_00477ed0(local_108,local_128);

      }

      FUN_00681f60();

LAB_004784f7:

      iVar3 = DAT_0083e718;

      if (local_124 != (undefined4 *)0x0) {

        iVar2 = local_124[1];

        local_124[1] = iVar2 + -1;

        if (iVar2 + -1 == 0) {

          (**(code **)*local_124)(1);

        }

        local_124 = (undefined4 *)0x0;

      }

      if (local_120 != (int *)0x0) {

        iVar2 = local_120[1];

        local_120[1] = iVar2 + -1;

        if (iVar2 + -1 == 0) {

          (**(code **)*local_120)(1);

        }

        local_120 = (int *)0x0;

      }

      FUN_00681f60();

      return iVar3;

    }

    if (*puVar4 == local_128) {

      if ((puVar4 != (uint *)0x0) && (puVar4 = puVar4 + 2, puVar4 != (uint *)0x0))

      goto LAB_0047847d;

      goto LAB_00478432;

    }

    puVar4 = (uint *)puVar4[1];

  } while( true );

}





// --- FUN_00478560 at 0x00478560 (size: 665) ---


/* WARNING: Removing unreachable block (ram,0x00478765) */

/* WARNING: Removing unreachable block (ram,0x00478770) */

/* WARNING: Removing unreachable block (ram,0x004787d2) */

/* WARNING: Removing unreachable block (ram,0x0047877f) */



void FUN_00478560(int param_1)



{

  undefined4 uVar1;

  int *piVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  undefined4 *puVar5;

  int *piVar6;

  int iVar7;

  undefined **local_84;

  undefined **local_80;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  iVar7 = DAT_00819f18;

  if (param_1 != 0) {

    for (; iVar7 != 0; iVar7 = *(int *)(iVar7 + 0x84)) {

      if (param_1 == *(int *)(iVar7 + 0x80)) {

        FUN_004777c0(iVar7);

        FUN_00477240(iVar7);

        return;

      }

    }

    piVar2 = (int *)(DAT_00819e8c + DAT_00819e94 * 4);

    for (; DAT_00819e90 != piVar2; DAT_00819e90 = DAT_00819e90 + 1) {

      if (*DAT_00819e90 != 0) {

        puVar5 = (undefined4 *)*DAT_00819e90;

        piVar6 = DAT_00819e90;

        goto joined_r0x004785eb;

      }

    }

    puVar5 = (undefined4 *)0x0;

    piVar6 = (int *)0x0;

joined_r0x004785eb:

    while (puVar5 != (undefined4 *)0x0) {

      do {

        if (param_1 == puVar5[0x22]) {

          local_84 = &PTR_FUN_0079d098;

          local_80 = &PTR_FUN_00798700;

          FUN_00428580(0);

          local_80 = &PTR_FUN_00798700;

          FUN_00682400(puVar5 + 2);

          local_c = puVar5[0x20];

          local_8 = puVar5[0x21];

          local_4 = puVar5[0x22];

          uVar1 = *puVar5;

          if (puVar5[1] != 0) goto LAB_004786c3;

          piVar2 = piVar6;

          goto LAB_004786b7;

        }

        puVar5 = (undefined4 *)puVar5[1];

      } while (puVar5 != (undefined4 *)0x0);

      do {

        piVar6 = piVar6 + 1;

        if (piVar6 == piVar2) goto LAB_00478613;

        puVar5 = (undefined4 *)*piVar6;

      } while (puVar5 == (undefined4 *)0x0);

    }

LAB_00478613:

    for (; DAT_00819e18 != (int *)(DAT_00819e14 + DAT_00819e1c * 4); DAT_00819e18 = DAT_00819e18 + 1

        ) {

      if (*DAT_00819e18 != 0) {

        iVar7 = *DAT_00819e18;

        piVar2 = DAT_00819e18;

        goto LAB_0047872b;

      }

    }

    iVar7 = 0;

    piVar2 = (int *)0x0;

LAB_0047872b:

    if (iVar7 != 0) {

      do {

        do {

          FUN_00477cd0(iVar7 + 8);

          FUN_004772d0();

          iVar7 = *(int *)(iVar7 + 4);

        } while (iVar7 != 0);

        do {

          piVar2 = piVar2 + 1;

          if (piVar2 == (int *)(DAT_00819e14 + DAT_00819e1c * 4)) {

            return;

          }

          iVar7 = *piVar2;

        } while (iVar7 == 0);

      } while (iVar7 != 0);

      return;

    }

  }

  return;

  while (*piVar2 == 0) {

LAB_004786b7:

    piVar2 = piVar2 + 1;

    if (piVar2 == (int *)(DAT_00819e8c + DAT_00819e94 * 4)) break;

  }

LAB_004786c3:

  puVar4 = (undefined4 *)*piVar6;

  if (puVar4 != puVar5) {

    do {

      puVar3 = puVar4;

      puVar4 = (undefined4 *)puVar3[1];

    } while (puVar4 != puVar5);

    if (puVar3 != (undefined4 *)0x0) {

      puVar3[1] = puVar4[1];

      goto LAB_004786ea;

    }

  }

  *piVar6 = puVar4[1];

LAB_004786ea:

  DAT_00819e98 = DAT_00819e98 + -1;

  FUN_00681f60();

  operator_delete(puVar5);

  FUN_004777c0(&local_84);

  FUN_00478130(uVar1);

  FUN_00681f60();

  return;

}





// --- FUN_00478810 at 0x00478810 (size: 26) ---


void FUN_00478810(undefined4 param_1)



{

  FUN_00478290(*(undefined4 *)(DAT_0083e72c + 0x94),param_1);

  return;

}





// --- FUN_00478830 at 0x00478830 (size: 65) ---


int FUN_00478830(undefined4 param_1)



{

  int iVar1;

  int local_4;

  

  iVar1 = FUN_00478290(*(undefined4 *)(DAT_0083e72c + 0x94),param_1);

  if (iVar1 == 0) {

    return 0;

  }

  local_4 = iVar1;

  FUN_006891f0(&local_4,&stack0x00000008);

  return iVar1;

}





// --- FUN_00478880 at 0x00478880 (size: 677) ---


int * FUN_00478880(undefined4 *param_1)



{

  short *psVar1;

  char cVar2;

  uint uVar3;

  int iVar4;

  int *piVar5;

  undefined4 extraout_ECX;

  undefined4 extraout_ECX_00;

  short *psVar6;

  uint uVar7;

  undefined4 uVar8;

  int local_20;

  int local_1c;

  int local_18;

  int local_14;

  undefined **local_10;

  uint local_c;

  uint local_8;

  undefined4 *local_4;

  

  psVar1 = (short *)*param_1;

  uVar3 = *(uint *)(psVar1 + -2);

  if (uVar3 - 1 < 2) {

    return (int *)0x0;

  }

  psVar6 = psVar1 + (uVar3 - 1);

  if (uVar3 != 0) {

    psVar6 = psVar1;

  }

  uVar7 = uVar3 - 1;

  if (uVar3 - 2 < uVar3) {

    uVar7 = uVar3 - 2;

  }

  if (*psVar6 != 0x3c) {

    return (int *)0x0;

  }

  if (psVar1[uVar7] != 0x3e) {

    return (int *)0x0;

  }

  local_10 = &PTR_FUN_0079549c;

  local_4 = param_1;

  local_8 = 0;

  local_c = 0;

  FUN_0040b150(1);

  local_8 = local_c;

  cVar2 = FUN_0040b620(0x3a,0);

  if (cVar2 == '\0') {

    return (int *)0x0;

  }

  FUN_0040b9a0(&param_1);

  if (param_1[-1] == 1) goto LAB_00478aef;

  piVar5 = &local_14;

  local_14 = 0;

  uVar8 = extraout_ECX;

  FUN_0041ab80(&param_1);

  cVar2 = FUN_0041ba30(0x18,uVar8,piVar5);

  if (cVar2 == '\0') goto LAB_00478aef;

  uVar7 = local_c + 1;

  uVar3 = (*(code *)*local_10)();

  if (uVar3 < uVar7) {

    uVar7 = (*(code *)*local_10)();

  }

  local_c = uVar7;

  local_8 = uVar7;

  cVar2 = FUN_0040b620(0x3a,0);

  if (cVar2 == '\0') goto LAB_00478aef;

  FUN_0040b9a0(&local_20);

  if (*(int *)(local_20 + -4) != 1) {

    piVar5 = &local_18;

    local_18 = 0;

    FUN_0041ab80(&local_20);

    cVar2 = FUN_0041ba30(0x18,local_20,piVar5);

    if (cVar2 != '\0') {

      switch(local_18) {

      case 1:

        iVar4 = FUN_005df0f5(0x14);

        if (iVar4 != 0) {

          piVar5 = (int *)FUN_00478b60();

LAB_00478a4b:

          if (piVar5 != (int *)0x0) {

            piVar5[2] = local_14;

            piVar5[3] = local_18;

            uVar7 = local_c + 1;

            uVar3 = (*(code *)*local_10)();

            if (uVar3 < uVar7) {

              uVar7 = (*(code *)*local_10)();

            }

            local_c = uVar7;

            local_8 = uVar7;

            iVar4 = (*(code *)*local_10)();

            if (iVar4 == 0) {

              local_c = 0;

            }

            else {

              local_c = iVar4 - 1;

              FUN_0040b9a0(&local_1c);

              if (*(int *)(local_1c + -4) != 1) {

                iVar4 = *piVar5;

                uVar8 = extraout_ECX_00;

                FUN_0041ab80(&local_1c);

                cVar2 = (**(code **)(iVar4 + 8))(uVar8);

                if (cVar2 != '\0') {

                  FUN_004011b0();

                  FUN_004011b0();

                  FUN_004011b0();

                  return piVar5;

                }

                FUN_00405f70();

              }

              FUN_004011b0();

            }

          }

        }

        break;

      case 2:

        iVar4 = FUN_005df0f5(0x14);

        if (iVar4 != 0) {

          piVar5 = (int *)FUN_00479260();

          goto LAB_00478a4b;

        }

        break;

      case 3:

        iVar4 = FUN_005df0f5(0x18);

        if (iVar4 != 0) {

          piVar5 = (int *)FUN_00478f20();

          goto LAB_00478a4b;

        }

        break;

      case 4:

        iVar4 = FUN_005df0f5(0x18);

        if (iVar4 != 0) {

          piVar5 = (int *)FUN_00478c60();

          goto LAB_00478a4b;

        }

      }

    }

  }

  FUN_004011b0();

LAB_00478aef:

  FUN_004011b0();

  return (int *)0x0;

}





// --- FUN_00478b60 at 0x00478B60 (size: 26) ---


undefined4 * __fastcall FUN_00478b60(undefined4 *param_1)



{

  FUN_00479380();

  *param_1 = &PTR_FUN_0079f0f4;

  param_1[4] = DAT_0083e724;

  return param_1;

}





// --- FUN_00478b80 at 0x00478B80 (size: 31) ---


void __fastcall FUN_00478b80(undefined4 *param_1)



{

  wchar_t *_Str;

  int *piVar1;

  

  _Str = (wchar_t *)*param_1;

  piVar1 = _errno();

  *piVar1 = 0;

  wcstoul(_Str,(wchar_t **)0x0,0);

  return;

}





// --- FUN_00478ba0 at 0x00478BA0 (size: 36) ---


undefined4 * __thiscall FUN_00478ba0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f0f4;

  FUN_004793a0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00478bd0 at 0x00478BD0 (size: 106) ---


undefined1 FUN_00478bd0(wchar_t *param_1)



{

  int *piVar1;

  LONG LVar2;

  undefined1 uVar3;

  wchar_t *local_4;

  

  local_4 = (wchar_t *)0x0;

  piVar1 = _errno();

  *piVar1 = 0;

  wcstoul(param_1,&local_4,0);

  if (*local_4 == L'\0') {

    piVar1 = _errno();

    if (*piVar1 != 0x22) {

      uVar3 = 1;

      goto LAB_00478c16;

    }

  }

  uVar3 = 0;

LAB_00478c16:

  LVar2 = InterlockedDecrement((LONG *)(param_1 + -8));

  if ((LVar2 == 0) && (param_1 + -10 != (wchar_t *)0x0)) {

    (*(code *)**(undefined4 **)(param_1 + -10))(1);

  }

  return uVar3;

}





// --- FUN_00478c60 at 0x00478C60 (size: 45) ---


undefined4 * __fastcall FUN_00478c60(undefined4 *param_1)



{

  LONG *lpAddend;

  

  FUN_00479380();

  *param_1 = &PTR_FUN_0079f120;

  param_1[4] = 0;

  lpAddend = (LONG *)(PTR_DAT_00818340 + -0x10);

  param_1[5] = PTR_DAT_00818340;

  InterlockedIncrement(lpAddend);

  return param_1;

}





// --- FUN_00478c90 at 0x00478C90 (size: 72) ---


undefined4 * __thiscall FUN_00478c90(undefined4 *param_1,byte param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)(param_1[5] + -0x14);

  *param_1 = &PTR_FUN_0079f120;

  LVar1 = InterlockedDecrement((LONG *)(param_1[5] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  FUN_004793a0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00478f20 at 0x00478F20 (size: 26) ---


undefined4 * __fastcall FUN_00478f20(undefined4 *param_1)



{

  FUN_00479380();

  param_1[4] = 0;

  param_1[5] = 0;

  *param_1 = &PTR_FUN_0079f154;

  return param_1;

}





// --- FUN_00478f60 at 0x00478F60 (size: 36) ---


undefined4 * __thiscall FUN_00478f60(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f154;

  FUN_004793a0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00479030 at 0x00479030 (size: 550) ---


undefined4 __thiscall FUN_00479030(int param_1,int param_2)



{

  char cVar1;

  LONG LVar2;

  uint uVar3;

  undefined4 uVar4;

  undefined4 extraout_ECX;

  undefined4 *puVar5;

  uint uVar6;

  int iVar7;

  int local_1c;

  int local_18;

  undefined4 local_14;

  undefined **local_10;

  uint local_c;

  uint local_8;

  undefined4 *local_4;

  

  local_4 = &param_2;

  local_10 = &PTR_FUN_0079549c;

  local_c = 0;

  local_8 = 0;

  cVar1 = FUN_0040b620(0x3a,0);

  if (cVar1 == '\0') {

    puVar5 = (undefined4 *)(param_2 + -0x14);

    local_10 = &PTR_LAB_00795478;

    LVar2 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar2 == 0) && (puVar5 != (undefined4 *)0x0)) {

      (**(code **)*puVar5)(1);

      return 0;

    }

  }

  else {

    FUN_0040b9a0(&local_18);

    if (*(int *)(local_18 + -4) == 1) {

      LVar2 = InterlockedDecrement((LONG *)(local_18 + -0x10));

      if ((LVar2 == 0) && ((undefined4 *)(local_18 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(local_18 + -0x14))(1);

      }

      puVar5 = (undefined4 *)(param_2 + -0x14);

      local_10 = &PTR_LAB_00795478;

      LVar2 = InterlockedDecrement((LONG *)(param_2 + -0x10));

      if ((LVar2 == 0) && (puVar5 != (undefined4 *)0x0)) {

        (**(code **)*puVar5)(1);

        return 0;

      }

    }

    else {

      iVar7 = local_18;

      InterlockedIncrement((LONG *)(local_18 + -0x10));

      cVar1 = FUN_00478bd0(iVar7);

      if (cVar1 != '\0') {

        uVar6 = local_c + 1;

        uVar3 = (*(code *)*local_10)();

        if (uVar3 < uVar6) {

          uVar6 = (*(code *)*local_10)();

        }

        local_c = uVar6;

        local_8 = uVar6;

        local_c = (*(code *)*local_10)();

        FUN_0040b9a0(&local_1c);

        if (*(int *)(local_1c + -4) != 1) {

          puVar5 = &local_14;

          local_14 = 0;

          uVar4 = extraout_ECX;

          FUN_0041ab80(&local_1c);

          cVar1 = FUN_0041ba30(0x18,uVar4,puVar5);

          if (cVar1 != '\0') {

            uVar4 = FUN_00478b80();

            *(undefined4 *)(param_1 + 0x10) = uVar4;

            *(undefined4 *)(param_1 + 0x14) = local_14;

            FUN_004011b0();

            FUN_004011b0();

            local_10 = &PTR_LAB_00795478;

            FUN_004011b0();

            return 1;

          }

        }

        FUN_004011b0();

        FUN_004011b0();

        local_10 = &PTR_LAB_00795478;

        FUN_004011b0();

        return 0;

      }

      LVar2 = InterlockedDecrement((LONG *)(local_18 + -0x10));

      if ((LVar2 == 0) && ((undefined4 *)(local_18 + -0x14) != (undefined4 *)0x0)) {

        (*(code *)**(undefined4 **)(local_18 + -0x14))(1);

      }

      puVar5 = (undefined4 *)(param_2 + -0x14);

      local_10 = &PTR_LAB_00795478;

      LVar2 = InterlockedDecrement((LONG *)(param_2 + -0x10));

      if ((LVar2 == 0) && (puVar5 != (undefined4 *)0x0)) {

        (**(code **)*puVar5)(1);

      }

    }

  }

  return 0;

}





// --- FUN_00479260 at 0x00479260 (size: 25) ---


undefined4 * __fastcall FUN_00479260(undefined4 *param_1)



{

  FUN_00479380();

  *param_1 = &PTR_FUN_0079f170;

  param_1[4] = 0;

  return param_1;

}





// --- FUN_004792a0 at 0x004792A0 (size: 36) ---


undefined4 * __thiscall FUN_004792a0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f170;

  FUN_004793a0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004792d0 at 0x004792D0 (size: 136) ---


undefined4 __thiscall FUN_004792d0(int param_1,wchar_t *param_2)



{

  char cVar1;

  LONG LVar2;

  int *piVar3;

  ulong uVar4;

  wchar_t *pwVar5;

  

  pwVar5 = param_2;

  InterlockedIncrement((LONG *)(param_2 + -8));

  cVar1 = FUN_00478bd0(pwVar5);

  if (cVar1 == '\0') {

    LVar2 = InterlockedDecrement((LONG *)(param_2 + -8));

    if ((LVar2 == 0) && (param_2 + -10 != (wchar_t *)0x0)) {

      (*(code *)**(undefined4 **)(param_2 + -10))(1);

    }

    return 0;

  }

  piVar3 = _errno();

  *piVar3 = 0;

  uVar4 = wcstoul(param_2,(wchar_t **)0x0,0);

  *(ulong *)(param_1 + 0x10) = uVar4;

  LVar2 = InterlockedDecrement((LONG *)(param_2 + -8));

  if ((LVar2 == 0) && (param_2 + -10 != (wchar_t *)0x0)) {

    (*(code *)**(undefined4 **)(param_2 + -10))(1);

  }

  return 1;

}





// --- FUN_00479380 at 0x00479380 (size: 24) ---


void __fastcall FUN_00479380(undefined4 *param_1)



{

  param_1[1] = 1;

  *param_1 = &PTR_FUN_0079f18c;

  param_1[2] = 0;

  param_1[3] = 0;

  return;

}





// --- FUN_004793a0 at 0x004793A0 (size: 7) ---


void __fastcall FUN_004793a0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007952f4;

  return;

}





// --- FUN_004793b0 at 0x004793B0 (size: 40) ---


uint FUN_004793b0(int param_1)



{

  uint uVar1;

  

  uVar1 = InterlockedDecrement((LONG *)(param_1 + -0x10));

  if ((uVar1 == 0) && ((undefined4 *)(param_1 + -0x14) != (undefined4 *)0x0)) {

    uVar1 = (*(code *)**(undefined4 **)(param_1 + -0x14))(1);

  }

  return uVar1 & 0xffffff00;

}





// --- FUN_004797c0 at 0x004797C0 (size: 38) ---


void __thiscall FUN_004797c0(int param_1,undefined4 param_2)



{

  *(undefined4 *)(param_1 + 0x90) = 0;

  FUN_0042dd10();

  *(undefined4 *)(param_1 + 0x90) = param_2;

  return;

}





// --- FUN_004797f0 at 0x004797F0 (size: 54) ---


void __thiscall FUN_004797f0(int param_1,undefined4 param_2,undefined4 param_3)



{

  *(undefined4 *)(param_1 + 0x90) = 0;

  FUN_0042dd10();

  *(undefined4 *)(param_1 + 0x90) = param_2;

  FUN_0042de30(param_3);

  return;

}





// --- FUN_00479840 at 0x00479840 (size: 158) ---


void __fastcall FUN_00479840(undefined4 *param_1)



{

  void *pvVar1;

  

  param_1[-2] = &PTR_LAB_0079f870;

  param_1[-1] = &PTR_FUN_00801670;

  *param_1 = &PTR_FUN_0079f24c;

  DAT_0083e72c = 0;

  if ((undefined4 *)param_1[0x23] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[0x23])(1);

  }

  pvVar1 = (void *)param_1[0x24];

  param_1[0x23] = 0;

  if (pvVar1 != (void *)0x0) {

    FUN_00479e40();

    operator_delete(pvVar1);

  }

  param_1[0x24] = 0;

  FUN_00465fb0(3);

  FUN_0042e590();

  param_1[0x1f] = &PTR_LAB_00793b6c;

  FUN_004663b0();

  FUN_0043c610();

  return;

}





// --- FUN_00479950 at 0x00479950 (size: 40) ---


int __fastcall FUN_00479950(int param_1)



{

  int iVar1;

  

  iVar1 = FUN_00401ea0();

  if ((iVar1 == 0) && (param_1 != 0)) {

    (*(code *)**(undefined4 **)(param_1 + 8))(1);

  }

  return iVar1;

}





// --- FUN_00479980 at 0x00479980 (size: 64) ---


undefined4 * __thiscall FUN_00479980(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f264;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_004799c0 at 0x004799C0 (size: 166) ---


undefined4 * __fastcall FUN_004799c0(undefined4 *param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  param_1[1] = &PTR_FUN_00801670;

  FUN_00466380();

  *param_1 = &PTR_LAB_0079f870;

  param_1[1] = &PTR_FUN_00801670;

  param_1[2] = &PTR_FUN_0079f24c;

  param_1[0x22] = 1;

  param_1[0x21] = &PTR_LAB_00793b6c;

  param_1[0x23] = 0;

  param_1[0x24] = 0;

  param_1[0x25] = 0;

  param_1[0x26] = 0;

  FUN_0042dc80();

  FUN_00465f90(3);

  iVar1 = FUN_005df0f5(0x50);

  if (iVar1 != 0) {

    uVar2 = FUN_00479e00();

    param_1[0x26] = uVar2;

    DAT_0083e72c = param_1;

    return param_1;

  }

  param_1[0x26] = 0;

  DAT_0083e72c = param_1;

  return param_1;

}





// --- FUN_00479a70 at 0x00479A70 (size: 34) ---


int __thiscall FUN_00479a70(int param_1,byte param_2)



{

  FUN_00479840();

  if ((param_2 & 1) != 0) {

    operator_delete((void *)(param_1 + -8));

  }

  return param_1 + -8;

}





// --- FUN_00479aa0 at 0x00479AA0 (size: 250) ---


void __fastcall FUN_00479aa0(int param_1)



{

  uint uVar1;

  code *pcVar2;

  char cVar3;

  uint *puVar4;

  int iVar5;

  undefined1 auStack_90 [144];

  

  uVar1 = *(uint *)(param_1 + 0x90);

  if ((uVar1 != 0) &&

     (puVar4 = *(uint **)(DAT_00819fec + (uVar1 % DAT_00819ff4) * 4), puVar4 != (uint *)0x0)) {

    while (*puVar4 != uVar1) {

      puVar4 = (uint *)puVar4[1];

      if (puVar4 == (uint *)0x0) {

        return;

      }

    }

    if (puVar4 != (uint *)0x0) {

      pcVar2 = (code *)puVar4[2];

      if (*(int **)(param_1 + 0x94) != (int *)0x0) {

        (**(code **)(**(int **)(param_1 + 0x94) + 0x24))(0);

      }

      if (*(undefined4 **)(param_1 + 0x94) != (undefined4 *)0x0) {

        (**(code **)**(undefined4 **)(param_1 + 0x94))(1);

      }

      *(undefined4 *)(param_1 + 0x8c) = *(undefined4 *)(param_1 + 0x90);

      *(undefined4 *)(param_1 + 0x94) = 0;

      *(undefined4 *)(param_1 + 0x90) = 0;

      FUN_0042e510(param_1 + 0x9c);

      FUN_0042dd10();

      if ((pcVar2 != (code *)0x0) && (iVar5 = (*pcVar2)(), iVar5 != 0)) {

        *(int *)(param_1 + 0x94) = iVar5;

        cVar3 = FUN_0042ce00(1);

        if (cVar3 != '\0') {

          (**(code **)(**(int **)(param_1 + 0x94) + 0x3c))(auStack_90);

        }

        (**(code **)(**(int **)(param_1 + 0x94) + 0x24))(1);

      }

      FUN_0042e590();

    }

  }

  return;

}





// --- FUN_00479bc0 at 0x00479BC0 (size: 143) ---


undefined4 * __thiscall FUN_00479bc0(undefined4 *param_1,undefined4 param_2)



{

  undefined *puVar1;

  uint *puVar2;

  undefined4 uVar3;

  uint uVar4;

  int iVar5;

  undefined4 *puVar6;

  

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  *param_1 = &PTR_FUN_0079f264;

  puVar1 = PTR_DAT_00818558;

  puVar2 = (uint *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_2,param_2,0);

  if (puVar2 == (uint *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  uVar4 = *puVar2;

  param_1[0x1a] = uVar4;

  if (uVar4 < 0x18) {

    param_1[0x18] = param_1 + 1;

  }

  else {

    uVar3 = thunk_FUN_005df0f5(uVar4 << 2);

    param_1[0x18] = uVar3;

  }

  param_1[0x19] = (undefined4 *)param_1[0x18] + param_1[0x1a];

  puVar6 = (undefined4 *)param_1[0x18];

  for (uVar4 = param_1[0x1a] & 0x3fffffff; uVar4 != 0; uVar4 = uVar4 - 1) {

    *puVar6 = 0;

    puVar6 = puVar6 + 1;

  }

  for (iVar5 = 0; iVar5 != 0; iVar5 = iVar5 + -1) {

    *(undefined1 *)puVar6 = 0;

    puVar6 = (undefined4 *)((int)puVar6 + 1);

  }

  return param_1;

}





// --- FUN_00479c50 at 0x00479C50 (size: 71) ---


void FUN_00479c50(undefined4 param_1,undefined4 param_2)



{

  char cVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0xc);

  if (puVar2 == (undefined4 *)0x0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    *puVar2 = param_1;

    puVar2[1] = 0;

    puVar2[2] = param_2;

  }

  cVar1 = FUN_0042bd40(puVar2);

  if ((cVar1 == '\0') && (puVar2 != (undefined4 *)0x0)) {

    operator_delete(puVar2);

  }

  return;

}





// --- FUN_00479ca0 at 0x00479CA0 (size: 82) ---


undefined4 * __thiscall FUN_00479ca0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f268;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_0079f264;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00479d30 at 0x00479D30 (size: 77) ---


undefined4 * __fastcall FUN_00479d30(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_0079f27c;

  param_1[3] = 0;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  param_1[10] = 5;

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[0xb] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[2] = 0;

  return param_1;

}





// --- FUN_00479d80 at 0x00479D80 (size: 117) ---


void __fastcall FUN_00479d80(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  puVar1 = (undefined4 *)param_1[0xb];

  LVar2 = InterlockedDecrement(puVar1 + 1);

  if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

    (**(code **)*puVar1)(1);

  }

  puVar1 = (undefined4 *)param_1[6];

  if (puVar1 != (undefined4 *)0x0) {

    if (puVar1[-1] == 0) {

      operator_delete__(puVar1 + -1);

    }

    else {

      (**(code **)*puVar1)(3);

    }

  }

  puVar1 = (undefined4 *)param_1[3];

  if (puVar1 != (undefined4 *)0x0) {

    if (puVar1[-1] != 0) {

      (**(code **)*puVar1)(3);

      *param_1 = &PTR_FUN_0079385c;

      return;

    }

    operator_delete__(puVar1 + -1);

  }

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_00479e00 at 0x00479E00 (size: 54) ---


undefined4 * __fastcall FUN_00479e00(undefined4 *param_1)



{

  int *piVar1;

  

  *param_1 = &PTR_FUN_0079f290;

  FUN_00479d30();

  *(undefined1 *)(param_1 + 0x12) = 0;

  param_1[0x13] = 0;

  piVar1 = (int *)FUN_0043c680();

  if (piVar1 != (int *)0x0) {

    (**(code **)(*piVar1 + 4))(0x186a6,param_1);

  }

  return param_1;

}





// --- FUN_00479e40 at 0x00479E40 (size: 42) ---


void __fastcall FUN_00479e40(undefined4 *param_1)



{

  int *piVar1;

  

  *param_1 = &PTR_FUN_0079f290;

  piVar1 = (int *)FUN_0043c680();

  if (piVar1 != (int *)0x0) {

    (**(code **)(*piVar1 + 0xc))(param_1);

  }

  FUN_00479d80();

  FUN_0043c610();

  return;

}





// --- FUN_00479e70 at 0x00479E70 (size: 30) ---


void * __thiscall FUN_00479e70(void *param_1,byte param_2)



{

  FUN_00479d80();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_00479e90 at 0x00479E90 (size: 75) ---


undefined4 FUN_00479e90(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd252);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x214))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_00479ee0 at 0x00479EE0 (size: 82) ---


undefined4 FUN_00479ee0(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd251);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x218))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_00479f40 at 0x00479F40 (size: 75) ---


undefined4 FUN_00479f40(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1e2);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x21c))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_00479f90 at 0x00479F90 (size: 82) ---


undefined4 FUN_00479f90(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd259);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x220))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_00479ff0 at 0x00479FF0 (size: 82) ---


undefined4 FUN_00479ff0(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd267);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x224))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_0047a050 at 0x0047A050 (size: 82) ---


undefined4 FUN_0047a050(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1e8);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x228))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_0047a0b0 at 0x0047A0B0 (size: 82) ---


undefined4 FUN_0047a0b0(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd26e);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x22c))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_0047a110 at 0x0047A110 (size: 75) ---


undefined4 FUN_0047a110(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd284);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x230))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a160 at 0x0047A160 (size: 75) ---


undefined4 FUN_0047a160(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1f6);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x238))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a1b0 at 0x0047A1B0 (size: 75) ---


undefined4 FUN_0047a1b0(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd266);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x23c))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a200 at 0x0047A200 (size: 82) ---


undefined4 FUN_0047a200(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1f0);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x240))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_0047a260 at 0x0047A260 (size: 75) ---


undefined4 FUN_0047a260(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd21f);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x244))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a2b0 at 0x0047A2B0 (size: 70) ---


undefined4 FUN_0047a2b0(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd217);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x248))();

      }

    }

  }

  return 1;

}





// --- FUN_0047a300 at 0x0047A300 (size: 75) ---


undefined4 FUN_0047a300(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd283);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x24c))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a350 at 0x0047A350 (size: 70) ---


undefined4 FUN_0047a350(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1ef);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x250))();

      }

    }

  }

  return 1;

}





// --- FUN_0047a3a0 at 0x0047A3A0 (size: 82) ---


undefined4 FUN_0047a3a0(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd270);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x254))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_0047a400 at 0x0047A400 (size: 75) ---


undefined4 FUN_0047a400(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1f2);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 600))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a450 at 0x0047A450 (size: 75) ---


undefined4 FUN_0047a450(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1ff);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x25c))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a4a0 at 0x0047A4A0 (size: 82) ---


undefined4 FUN_0047a4a0(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1f8);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x260))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_0047a500 at 0x0047A500 (size: 75) ---


undefined4 FUN_0047a500(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd244);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x264))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a550 at 0x0047A550 (size: 82) ---


undefined4 FUN_0047a550(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd264);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x268))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_0047a5b0 at 0x0047A5B0 (size: 75) ---


undefined4 FUN_0047a5b0(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd271);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x26c))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a600 at 0x0047A600 (size: 75) ---


undefined4 FUN_0047a600(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd26d);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x270))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a6a0 at 0x0047A6A0 (size: 70) ---


undefined4 FUN_0047a6a0(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd27c);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x27c))();

      }

    }

  }

  return 1;

}





// --- FUN_0047a6f0 at 0x0047A6F0 (size: 70) ---


undefined4 FUN_0047a6f0(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd25e);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x280))();

      }

    }

  }

  return 1;

}





// --- FUN_0047a740 at 0x0047A740 (size: 75) ---


undefined4 FUN_0047a740(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd21e);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x284))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_0047a790 at 0x0047A790 (size: 87) ---


undefined4 FUN_0047a790(undefined4 param_1,undefined4 param_2)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd276);

  if (iVar4 != 0) {

    piVar3 = *(int **)(iVar4 + 4);

    while (piVar3 != (int *)0x0) {

      piVar1 = (int *)*piVar3;

      piVar3 = (int *)piVar3[1];

      if ((piVar1 != (int *)0x0) && (cVar2 = (**(code **)*piVar1)(), cVar2 == '\0')) {

        (**(code **)(*piVar1 + 0x288))(unaff_retaddr,param_1,param_2);

      }

    }

  }

  return 1;

}





// --- FUN_0047a7f0 at 0x0047A7F0 (size: 18) ---


undefined4 * __fastcall FUN_0047a7f0(undefined4 *param_1)



{

  FUN_0043c640();

  *param_1 = &PTR_FUN_0079f33c;

  return param_1;

}





// --- thunk_FUN_0043c680 at 0x0047A810 (size: 5) ---


undefined4 thunk_FUN_0043c680(void)



{

  return DAT_00838374;

}





// --- FUN_0047a820 at 0x0047A820 (size: 36) ---


undefined4 * __thiscall FUN_0047a820(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_0079f33c;

  FUN_0043c660();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0047a860 at 0x0047A860 (size: 420) ---


void FUN_0047a860(void)



{

  FUN_004e7950();

  FUN_004e76c0();

  FUN_004e73a0();

  FUN_004e7180();

  FUN_004e6f70();

  FUN_004e6c50();

  FUN_004e60a0();

  FUN_004e5400();

  FUN_004e2000();

  FUN_004df290();

  FUN_004ddc00();

  FUN_004db190();

  FUN_004d97e0();

  FUN_004d71e0();

  FUN_004d6a30();

  FUN_004d5d10();

  FUN_004d5720();

  FUN_004d4b30();

  FUN_004d3e20();

  FUN_004d3280();

  FUN_004d2840();

  FUN_004d1d10();

  FUN_004d1240();

  FUN_004d0450();

  FUN_004cf9a0();

  FUN_004cf040();

  FUN_004cdfc0();

  FUN_004cd910();

  FUN_004cd670();

  FUN_004cd000();

  FUN_004ccbd0();

  FUN_004cbf50();

  FUN_004ca8b0();

  FUN_004c90c0();

  FUN_004c6c20();

  FUN_004c3bf0();

  FUN_004c0a90();

  FUN_004c0780();

  FUN_004be730();

  FUN_004bd630();

  FUN_004bcce0();

  FUN_004bbb00();

  FUN_004b98b0();

  FUN_004b84c0();

  FUN_004abb00();

  FUN_004ab200();

  FUN_004a84a0();

  FUN_004a7ca0();

  FUN_004a7760();

  FUN_004a74f0();

  FUN_004a71f0();

  FUN_004a6dd0();

  FUN_004a48d0();

  FUN_004a2ac0();

  FUN_004a1ec0();

  FUN_004a0590();

  FUN_0049ff00();

  FUN_0049eb50();

  FUN_0049e370();

  FUN_0049cd10();

  FUN_0049b290();

  FUN_0049ae10();

  FUN_00499f60();

  FUN_00495410();

  FUN_004945a0();

  FUN_004914d0();

  FUN_0048e980();

  FUN_0048e4f0();

  FUN_0048d320();

  FUN_0048b700();

  FUN_0048b0d0();

  FUN_00488bf0();

  FUN_00487000();

  FUN_00486830();

  FUN_00486290();

  FUN_004855e0();

  FUN_00484df0();

  FUN_00484720();

  FUN_004835b0();

  FUN_00482550();

  FUN_00481b80();

  FUN_0047d840();

  FUN_0047c580();

  FUN_0047b1c0();

  return;

}





// --- FUN_0047aa10 at 0x0047AA10 (size: 269) ---


undefined4 * __fastcall FUN_0047aa10(undefined4 *param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  undefined4 *puStack_4;

  

  puStack_4 = param_1;

  FUN_004799c0();

  param_1[0x4b] = &PTR_FUN_007ccb60;

  puVar1 = param_1 + 0x4b;

  *param_1 = &PTR_LAB_0079f870;

  param_1[1] = &PTR_FUN_0079f810;

  param_1[2] = &PTR_FUN_0079f7f8;

  *puVar1 = &PTR_FUN_0079f550;

  FUN_004ef100();

  FUN_0047a860();

  FUN_004ef0e0(0x10000003);

  FUN_004eeaa0(0x10000001);

  FUN_004ed780(0x1000000a);

  FUN_004eb010(0x10000008);

  FUN_004ea8a0(0x10000009);

  FUN_004ea770(0x10000002);

  FUN_004e90d0(0x1000000b);

  FUN_004e8190(0x10000005);

  FUN_004797c0(0x10000003);

  FUN_00415640(&puStack_4,1,6);

  FUN_0045a910(puStack_4,0,0,1);

  piVar2 = (int *)FUN_0043c680();

  if (piVar2 != (int *)0x0) {

    (**(code **)(*piVar2 + 4))(0x186a1,puVar1);

    (**(code **)(*piVar2 + 4))(100000,puVar1);

    if (DAT_00837ff4 != (int *)0x0) {

      (**(code **)(*DAT_00837ff4 + 0x34))(0xe,param_1 + 2,4000);

    }

  }

  return param_1;

}





// --- FUN_0047ab20 at 0x0047AB20 (size: 98) ---


void __fastcall FUN_0047ab20(undefined4 *param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x49;

  param_1[-2] = &PTR_LAB_0079f870;

  param_1[-1] = &PTR_FUN_0079f810;

  *param_1 = &PTR_FUN_0079f7f8;

  *puVar1 = &PTR_FUN_0079f550;

  piVar2 = (int *)FUN_0043c680();

  if (piVar2 != (int *)0x0) {

    (**(code **)(*piVar2 + 0xc))(-(uint)(param_1 != (undefined4 *)0x8) & (uint)puVar1);

    FUN_004ef1b0();

  }

  *(undefined ***)(-(uint)(param_1 != (undefined4 *)0x8) & (uint)puVar1) = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_00479840();

  return;

}





// --- FUN_0047ab90 at 0x0047AB90 (size: 34) ---


int __thiscall FUN_0047ab90(int param_1,byte param_2)



{

  FUN_0047ab20();

  if ((param_2 & 1) != 0) {

    operator_delete((void *)(param_1 + -8));

  }

  return param_1 + -8;

}





// --- FUN_0047af90 at 0x0047AF90 (size: 145) ---


void __thiscall FUN_0047af90(int *param_1,undefined4 *param_2,int *param_3)



{

  int iVar1;

  int *piVar2;

  int *piVar3;

  int *unaff_ESI;

  int *local_4;

  

  local_4 = param_1;

  if (param_3 == (int *)0x0) {

    FUN_00403770(0);

    *param_2 = 0x80004002;

    return;

  }

  iVar1 = *param_3;

  param_3 = (int *)0x0;

  piVar3 = (int *)(**(code **)(iVar1 + 0xc))(&local_4,&DAT_0079f538,&param_3);

  piVar2 = local_4;

  iVar1 = *piVar3;

  piVar3 = (int *)*param_1;

  if (iVar1 < 0) {

    if (piVar3 != (int *)0x0) {

      (**(code **)(*piVar3 + 0x14))();

    }

    *param_1 = 0;

    param_1[1] = 0;

    *unaff_ESI = iVar1;

    return;

  }

  if (piVar3 != (int *)0x0) {

    (**(code **)(*piVar3 + 0x14))();

  }

  *param_1 = (int)piVar2;

  param_1[1] = 0;

  *unaff_ESI = iVar1;

  return;

}





// --- FUN_0047b030 at 0x0047B030 (size: 108) ---


undefined4 * __thiscall FUN_0047b030(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  FUN_00472670(param_2,param_3);

  param_1[0x17e] = &PTR_FUN_007ccb60;

  param_1[0x17f] = 0;

  param_1[0x181] = 0;

  param_1[0x182] = 0;

  param_1[0x183] = 0;

  param_1[0x184] = 0;

  param_1[0x185] = 0;

  param_1[0x186] = 0;

  *(undefined1 *)(param_1 + 0x187) = 0;

  param_1[0x188] = 0;

  *param_1 = &PTR_FUN_007a0080;

  param_1[0x17e] = &PTR_FUN_0079fdd8;

  return param_1;

}





// --- FUN_0047b0d0 at 0x0047B0D0 (size: 55) ---


void __fastcall FUN_0047b0d0(int param_1)



{

  int *piVar1;

  

  FUN_004639a0();

  piVar1 = (int *)FUN_0043c680();

  if (param_1 != 0) {

    (**(code **)(*piVar1 + 4))(0x186a4,param_1 + 0x5f8);

    return;

  }

  (**(code **)(*piVar1 + 4))(0x186a4,0);

  return;

}





// --- FUN_0047b160 at 0x0047B160 (size: 82) ---


undefined4 * __thiscall FUN_0047b160(undefined4 *param_1,byte param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a0080;

  *puVar1 = &PTR_FUN_0079fdd8;

  piVar2 = (int *)FUN_0043c680();

  if (piVar2 != (int *)0x0) {

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0047b1c0 at 0x0047B1C0 (size: 19) ---


void FUN_0047b1c0(void)



{

  FUN_00460270(0x1000003e,&LAB_0047b110);

  return;

}





// --- FUN_0047b1e0 at 0x0047B1E0 (size: 780) ---


void FUN_0047b1e0(void)



{

  char cVar1;

  undefined4 uVar2;

  int iVar3;

  int iVar4;

  LONG LVar5;

  undefined4 *puVar6;

  char *pcVar7;

  undefined4 uVar8;

  undefined *local_1b8;

  undefined *local_1b4 [109];

  

  FUN_0042dc80();

  uVar8 = 0x10000002;

  uVar2 = FUN_004016b0("ID_CharGen_SummaryHowTo",0x10000002);

  FUN_0042c9c0(uVar2,uVar8);

  FUN_0042dc80();

  uVar8 = 0x10000002;

  uVar2 = FUN_004016b0("ID_CharGen_SummaryHowToEnd",0x10000002);

  FUN_0042c9c0(uVar2,uVar8);

  iVar3 = FUN_0055e1e0();

  iVar3 = *(int *)(iVar3 + 0xd8);

  iVar4 = FUN_0055e1e0();

  uVar2 = *(undefined4 *)(iVar4 + 0xd4);

  FUN_0042dc80();

  switch(uVar2) {

  case 1:

    if (iVar3 == 2) {

      pcVar7 = "ID_CharGen_AluFemaleNames";

    }

    else {

      pcVar7 = "ID_CharGen_AluMaleNames";

    }

    break;

  case 2:

    if (iVar3 == 2) {

      pcVar7 = "ID_CharGen_GharuFemaleNames";

    }

    else {

      pcVar7 = "ID_CharGen_GharuMaleNames";

    }

    break;

  case 3:

    if (iVar3 == 2) {

      pcVar7 = "ID_CharGen_ShoFemaleNames";

    }

    else {

      pcVar7 = "ID_CharGen_ShoMaleNames";

    }

    break;

  case 4:

    if (iVar3 == 2) {

      pcVar7 = "ID_CharGen_ViaFemaleNames";

    }

    else {

      pcVar7 = "ID_CharGen_ViaMaleNames";

    }

    break;

  case 5:

  case 10:

    uVar2 = 0x10000002;

    if (iVar3 == 2) {

      uVar8 = FUN_004016b0("ID_CharGen_ShadFemaleNames",0x10000002);

    }

    else {

      uVar8 = FUN_004016b0("ID_CharGen_ShadMaleNames",0x10000002);

    }

    goto LAB_0047b3b2;

  case 6:

    if (iVar3 == 2) {

      pcVar7 = "ID_CharGen_GearFemaleNames";

    }

    else {

      pcVar7 = "ID_CharGen_GearMaleNames";

    }

    break;

  case 7:

    if (iVar3 == 2) {

      pcVar7 = "ID_CharGen_AunTFemaleNames";

    }

    else {

      pcVar7 = "ID_CharGen_AunTMaleNames";

    }

    break;

  case 8:

    if (iVar3 == 2) {

      pcVar7 = "ID_CharGen_LugFemaleNames";

    }

    else {

      pcVar7 = "ID_CharGen_LugMaleNames";

    }

    break;

  case 9:

    if (iVar3 == 2) {

      pcVar7 = "ID_CharGen_EmpFemaleNames";

    }

    else {

      pcVar7 = "ID_CharGen_EmpMaleNames";

    }

    break;

  case 0xb:

    if (iVar3 == 2) {

      pcVar7 = "ID_CharGen_UndFemaleNames";

    }

    else {

      pcVar7 = "ID_CharGen_UndMaleNames";

    }

    break;

  case 0xc:

  case 0xd:

    if (iVar3 == 2) {

      pcVar7 = "ID_CharGen_OlthoiFemaleNames";

    }

    else {

      pcVar7 = "ID_CharGen_OlthoiMaleNames";

    }

    break;

  default:

    goto switchD_0047b278_default;

  }

  uVar2 = 0x10000002;

  uVar8 = FUN_00401a20(pcVar7,0x10000002);

LAB_0047b3b2:

  FUN_0042c9c0(uVar8,uVar2);

switchD_0047b278_default:

  local_1b4[0] = PTR_DAT_00818340;

  InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

  local_1b8 = PTR_DAT_00818340;

  InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

  cVar1 = FUN_0042e6b0(&local_1b8,0);

  if (cVar1 != '\0') {

    if (*(int *)(local_1b8 + -4) != 1) {

      FUN_00402490(local_1b8,*(int *)(local_1b8 + -4) + -1);

    }

    cVar1 = FUN_0042e6b0(&local_1b8,0);

    if (cVar1 != '\0') {

      if (*(int *)(local_1b8 + -4) != 1) {

        FUN_00402490(local_1b8,*(int *)(local_1b8 + -4) + -1);

      }

      cVar1 = FUN_0042e6b0(&local_1b8,0);

      if (cVar1 != '\0') {

        if (*(int *)(local_1b8 + -4) != 1) {

          FUN_00402490(local_1b8,*(int *)(local_1b8 + -4) + -1);

        }

        FUN_0046a740(local_1b4);

      }

    }

  }

  puVar6 = (undefined4 *)(local_1b8 + -0x14);

  LVar5 = InterlockedDecrement((LONG *)(local_1b8 + -0x10));

  if ((LVar5 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  puVar6 = (undefined4 *)(local_1b4[0] + -0x14);

  LVar5 = InterlockedDecrement((LONG *)(local_1b4[0] + -0x10));

  if ((LVar5 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  FUN_0042e590();

  FUN_0042e590();

  FUN_0042e590();

  return;

}





// --- FUN_0047b520 at 0x0047B520 (size: 106) ---


void FUN_0047b520(undefined4 param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  undefined *local_4;

  

  local_4 = PTR_DAT_00818340;

  InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

  FUN_004027b0(&local_4,&DAT_0079fdd0,param_1);

  if (*(int *)(local_4 + -4) != 1) {

    FUN_00402490(local_4,*(int *)(local_4 + -4) + -1);

  }

  puVar1 = (undefined4 *)(local_4 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(local_4 + -0x10));

  if ((LVar2 == 0) && (puVar1 != (undefined4 *)0x0)) {

    (**(code **)*puVar1)(1);

  }

  return;

}





// --- FUN_0047b590 at 0x0047B590 (size: 2187) ---


void FUN_0047b590(void)



{

  uint uVar1;

  int iVar2;

  size_t sVar3;

  int *piVar4;

  int iVar5;

  LONG LVar6;

  int iVar7;

  undefined4 uVar8;

  int *piVar9;

  int iVar10;

  undefined4 *puVar11;

  uint *puVar12;

  wchar_t *pwVar13;

  undefined *puStack_1c;

  undefined *puStack_18;

  int iStack_14;

  int iStack_10;

  int iStack_8;

  int iStack_4;

  

  FUN_0046e460();

  puStack_1c = PTR_DAT_00818340;

  InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

  iVar2 = FUN_0055e1e0();

  iVar5 = *(int *)(iVar2 + 0x180);

  iStack_8 = iVar2;

  sVar3 = wcslen(L"Profession: ");

  FUN_00402490(L"Profession: ",sVar3);

  if ((((-1 < iVar5) && (iVar5 < 7)) &&

      (pwVar13 = (wchar_t *)(&PTR_u_Custom_0081a1a8)[iVar5], pwVar13 != (wchar_t *)0x0)) &&

     (*pwVar13 != L'\0')) {

    sVar3 = wcslen(pwVar13);

    FUN_00402490(pwVar13,sVar3);

  }

  FUN_0046f670(0,0);

  piVar4 = (int *)FUN_00463c00(0x100002f9);

  if ((piVar4 != (int *)0x0) && (iVar5 = (**(code **)(*piVar4 + 0x94))(0xc), iVar5 != 0)) {

    FUN_0046a740(&puStack_1c);

    if (puStack_1c != PTR_DAT_00818340) {

      puVar11 = (undefined4 *)(puStack_1c + -0x14);

      LVar6 = InterlockedDecrement((LONG *)(puStack_1c + -0x10));

      if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

        (**(code **)*puVar11)(1);

      }

      puStack_1c = PTR_DAT_00818340;

      InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

    }

    uVar1 = *(uint *)(iVar2 + 0xd8);

    sVar3 = wcslen(L"Gender: ");

    FUN_00402490(L"Gender: ",sVar3);

    if (((uVar1 < 3) && (pwVar13 = (wchar_t *)(&PTR_DAT_0081a1c4)[uVar1], pwVar13 != (wchar_t *)0x0)

        ) && (*pwVar13 != L'\0')) {

      sVar3 = wcslen(pwVar13);

      FUN_00402490(pwVar13,sVar3);

    }

    FUN_0046f670(0,0);

    piVar4 = (int *)FUN_00463c00(0x100002f9);

    if ((piVar4 != (int *)0x0) && (iVar5 = (**(code **)(*piVar4 + 0x94))(0xc), iVar5 != 0)) {

      FUN_0046a740(&puStack_1c);

      FUN_0040b220();

      uVar1 = *(uint *)(iVar2 + 0xd4);

      sVar3 = wcslen(L"Heritage: ");

      FUN_00402490(L"Heritage: ",sVar3);

      if (uVar1 < 5) {

        FUN_0040b8f0((&PTR_DAT_0081a1d0)[uVar1]);

      }

      FUN_0046f670(0,0);

      piVar4 = (int *)FUN_00463c00(0x100002f9);

      if ((piVar4 != (int *)0x0) && (iVar5 = (**(code **)(*piVar4 + 0x94))(0xc), iVar5 != 0)) {

        FUN_0046a740(&puStack_1c);

        FUN_0040b220();

        iVar5 = *(int *)(iVar2 + 0x1f8);

        sVar3 = wcslen(L"Starting Town: ");

        FUN_00402490(L"Starting Town: ",sVar3);

        if ((-1 < iVar5) && (iVar5 < 4)) {

          FUN_0040b8f0((&PTR_u_Holtburg_0081a1e4)[iVar5]);

        }

        FUN_0046f670(0,0);

        piVar4 = (int *)FUN_00463c00(0x100002f9);

        if ((piVar4 != (int *)0x0) && (iVar5 = (**(code **)(*piVar4 + 0x94))(0xc), iVar5 != 0)) {

          FUN_0046a740(&puStack_1c);

          FUN_0040b220();

          FUN_0040b8f0(L"Attributes");

          FUN_0046f670(1,0);

          piVar4 = (int *)FUN_00463c00(0x100000fe);

          if ((piVar4 != (int *)0x0) && (iVar5 = (**(code **)(*piVar4 + 0x94))(0xc), iVar5 != 0)) {

            FUN_0046a740(&puStack_1c);

            FUN_0040b220();

            iVar10 = 0;

            iVar5 = iStack_4;

            do {

              puStack_18 = PTR_DAT_00818340;

              InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

              FUN_0040b220();

              FUN_0040b220();

              switch(iVar10) {

              case 0:

                FUN_0040b8f0(L"Strength");

                iVar5 = *(int *)(iVar2 + 0x184);

                break;

              case 1:

                FUN_0040b8f0(L"Endurance");

                iVar5 = *(int *)(iVar2 + 0x188);

                break;

              case 2:

                FUN_0040b8f0(L"Coordination");

                iVar5 = *(int *)(iVar2 + 0x18c);

                break;

              case 3:

                FUN_0040b8f0(L"Quickness");

                iVar5 = *(int *)(iVar2 + 400);

                break;

              case 4:

                FUN_0040b8f0(L"Focus");

                iVar5 = *(int *)(iVar2 + 0x194);

                break;

              case 5:

                FUN_0040b8f0(L"Self");

                iVar5 = *(int *)(iVar2 + 0x198);

                break;

              case 6:

                FUN_0040b8f0(L"Health");

                iStack_10 = FUN_005c4990(2);

                iVar5 = FUN_005df4c4();

                break;

              case 7:

                FUN_0040b8f0(L"Stamina");

                iVar5 = FUN_005c4990(2);

                break;

              case 8:

                FUN_0040b8f0(L"Mana");

                iVar5 = FUN_005c4990(6);

                break;

              case 9:

                FUN_0040b8f0(L"Skill Credits");

                iVar5 = *(int *)(iVar2 + 0x1b8);

              }

              FUN_0046f670(2,0);

              piVar4 = (int *)FUN_00463c00(0x100002fc);

              if ((piVar4 == (int *)0x0) || (iVar7 = (**(code **)(*piVar4 + 0x94))(0xc), iVar7 == 0)

                 ) {

LAB_0047bad7:

                FUN_004011b0();

                goto LAB_0047bae0;

              }

              FUN_0046a740(&puStack_1c);

              piVar4 = (int *)FUN_00463c00(0x100002fd);

              if ((piVar4 == (int *)0x0) || (iVar7 = (**(code **)(*piVar4 + 0x94))(0xc), iVar7 == 0)

                 ) goto LAB_0047bad7;

              FUN_0047b520(iVar5);

              FUN_0046a740(&puStack_18);

              FUN_004011b0();

              iVar10 = iVar10 + 1;

            } while (iVar10 < 10);

            iStack_4 = *(int *)(iVar2 + 0x248) + 0x38;

            iStack_10 = 0;

            do {

              iVar5 = iStack_10;

              if (puStack_1c != PTR_DAT_00818340) {

                puVar11 = (undefined4 *)(puStack_1c + -0x14);

                LVar6 = InterlockedDecrement((LONG *)(puStack_1c + -0x10));

                if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                  (**(code **)*puVar11)(1);

                }

                puStack_1c = PTR_DAT_00818340;

                InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

              }

              switch(iVar5) {

              case 0:

                FUN_0040b8f0(L"Specialized Skills");

                iStack_14 = 3;

                break;

              case 1:

                FUN_0040b8f0(L"Trained Skills");

                iStack_14 = 2;

                break;

              case 2:

                pwVar13 = L"Useable Untrained Skills";

                goto LAB_0047bb2d;

              case 3:

                pwVar13 = L"Unuseable Untrained Skills";

LAB_0047bb2d:

                FUN_0040b8f0(pwVar13);

                iStack_14 = 1;

              }

              FUN_0046f670(1,0);

              piVar4 = (int *)FUN_00463c00(0x100000fe);

              if ((piVar4 == (int *)0x0) || (iVar5 = (**(code **)(*piVar4 + 0x94))(0xc), iVar5 == 0)

                 ) {

                puVar11 = (undefined4 *)(puStack_1c + -0x14);

                iVar5 = InterlockedDecrement((LONG *)(puStack_1c + -0x10));

                goto LAB_0047be03;

              }

              FUN_0046a740(&puStack_1c);

              if (puStack_1c != PTR_DAT_00818340) {

                puVar11 = (undefined4 *)(puStack_1c + -0x14);

                LVar6 = InterlockedDecrement((LONG *)(puStack_1c + -0x10));

                if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                  (**(code **)*puVar11)(1);

                }

                puStack_1c = PTR_DAT_00818340;

                InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

              }

              piVar4 = *(int **)(iStack_8 + 0x1c4);

              while (piVar4 != (int *)0x0) {

                puStack_18 = PTR_DAT_00818340;

                InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

                if (puStack_1c != PTR_DAT_00818340) {

                  puVar11 = (undefined4 *)(puStack_1c + -0x14);

                  LVar6 = InterlockedDecrement((LONG *)(puStack_1c + -0x10));

                  if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                    (**(code **)*puVar11)(1);

                  }

                  puStack_1c = PTR_DAT_00818340;

                  InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

                }

                if (puStack_18 != PTR_DAT_00818340) {

                  puVar11 = (undefined4 *)(puStack_18 + -0x14);

                  LVar6 = InterlockedDecrement((LONG *)(puStack_18 + -0x10));

                  if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                    (**(code **)*puVar11)(1);

                  }

                  puStack_18 = PTR_DAT_00818340;

                  InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

                }

                iVar5 = *piVar4;

                if ((*(uint *)(iStack_4 + 0xc) != 0) && (*(int *)(iStack_4 + 8) != 0)) {

                  for (puVar12 = *(uint **)(*(int *)(iStack_4 + 8) +

                                           (*(uint *)(iVar5 + 0x20) % *(uint *)(iStack_4 + 0xc)) * 4

                                           ); puVar12 != (uint *)0x0;

                      puVar12 = (uint *)puVar12[0x18]) {

                    if (*(uint *)(iVar5 + 0x20) == *puVar12) {

                      puVar12 = puVar12 + 2;

                      goto LAB_0047bc82;

                    }

                  }

                }

                puVar12 = (uint *)0x0;

LAB_0047bc82:

                iVar2 = FUN_005c4be0(*(undefined4 *)(iVar5 + 0x20));

                if (iVar2 != iStack_14) goto LAB_0047bd6b;

                if (iStack_10 < 2) {

LAB_0047bcca:

                  FUN_004300a0(&puStack_1c,&DAT_007a0440,iVar5);

                  uVar8 = FUN_005c5b30(*(undefined4 *)(iVar5 + 0x20));

                  FUN_0046f670(2,0);

                  piVar9 = (int *)FUN_00463c00(0x100002fc);

                  if ((piVar9 != (int *)0x0) &&

                     (iVar5 = (**(code **)(*piVar9 + 0x94))(0xc), iVar5 != 0)) {

                    FUN_0046a740(&puStack_1c);

                    piVar9 = (int *)FUN_00463c00(0x100002fd);

                    if ((piVar9 != (int *)0x0) &&

                       (iVar5 = (**(code **)(*piVar9 + 0x94))(0xc), iVar5 != 0)) {

                      FUN_0047b520(uVar8);

                      FUN_0046a740(&puStack_18);

                      goto LAB_0047bd6b;

                    }

                  }

                  puVar11 = (undefined4 *)(puStack_18 + -0x14);

                  LVar6 = InterlockedDecrement((LONG *)(puStack_18 + -0x10));

                  if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                    (**(code **)*puVar11)(1);

                  }

                  puVar11 = (undefined4 *)(puStack_1c + -0x14);

                  iVar5 = InterlockedDecrement((LONG *)(puStack_1c + -0x10));

                  goto LAB_0047be03;

                }

                if (iStack_10 == 2) {

                  if ((int)puVar12[8] < 2) goto LAB_0047bcca;

                }

                else if ((iStack_10 != 3) || (1 < (int)puVar12[8])) goto LAB_0047bcca;

LAB_0047bd6b:

                piVar4 = (int *)piVar4[1];

                puVar11 = (undefined4 *)(puStack_18 + -0x14);

                LVar6 = InterlockedDecrement((LONG *)(puStack_18 + -0x10));

                if ((LVar6 == 0) && (puVar11 != (undefined4 *)0x0)) {

                  (**(code **)*puVar11)(1);

                }

              }

              iStack_10 = iStack_10 + 1;

            } while (iStack_10 < 4);

            goto LAB_0047bdf2;

          }

        }

LAB_0047bae0:

        FUN_004011b0();

        return;

      }

    }

  }

LAB_0047bdf2:

  puVar11 = (undefined4 *)(puStack_1c + -0x14);

  iVar5 = InterlockedDecrement((LONG *)(puStack_1c + -0x10));

LAB_0047be03:

  if ((iVar5 == 0) && (puVar11 != (undefined4 *)0x0)) {

    (**(code **)*puVar11)(1);

  }

  return;

}





// --- FUN_0047be60 at 0x0047BE60 (size: 331) ---


void __fastcall FUN_0047be60(int param_1)



{

  char cVar1;

  int iVar2;

  undefined4 uVar3;

  undefined4 *puVar4;

  undefined4 *puVar5;

  undefined4 uVar6;

  undefined4 local_a8;

  undefined4 local_a4;

  undefined4 local_a0;

  undefined4 local_9c;

  undefined4 local_98;

  undefined4 local_94;

  undefined1 auStack_90 [144];

  

  cVar1 = FUN_004603a0();

  if (cVar1 != '\0') {

    iVar2 = FUN_0055e1e0();

    if (*(int *)(iVar2 + 0xd4) == 0xc) {

      puVar5 = &local_9c;

      puVar4 = &local_a8;

      local_98 = 0;

      local_94 = 0;

      local_a4 = 0xc0733333;

      local_a0 = 0x3f933333;

    }

    else {

      local_a0 = 0;

      local_a4 = 0;

      if (*(int *)(iVar2 + 0xd4) == 0xd) {

        puVar5 = &local_a8;

        puVar4 = &local_9c;

        local_98 = 0xc0b66666;

        local_94 = 0x3fd33333;

      }

      else {

        puVar5 = &local_a8;

        puVar4 = &local_9c;

        local_98 = 0xc0200000;

        local_94 = 0x3f733333;

      }

    }

    local_a8 = 0;

    local_9c = 0;

    FUN_004ef240(puVar4,puVar5);

    FUN_005c7110();

    FUN_0047b590();

    FUN_0047b1e0();

    FUN_004ef660();

    (**(code **)(**(int **)(param_1 + 0x608) + 0x104))();

    if (*(char *)(param_1 + 0x61c) == '\0') {

      FUN_0042dc80();

      uVar6 = 0x10000002;

      uVar3 = FUN_004016b0("ID_CharGen_NamePrompt",0x10000002);

      FUN_0042c9c0(uVar3,uVar6);

      FUN_0046a350(auStack_90);

      FUN_00467b60();

      FUN_0042e590();

    }

  }

  return;

}





// --- FUN_0047bfb0 at 0x0047BFB0 (size: 397) ---


void __thiscall FUN_0047bfb0(int param_1,undefined4 param_2)



{

  char cVar1;

  undefined4 uVar2;

  int *piVar3;

  int iVar4;

  undefined4 uStack_18;

  undefined4 uStack_14;

  undefined4 uStack_10;

  undefined4 uStack_c;

  undefined4 uStack_8;

  undefined4 uStack_4;

  

  *(undefined4 *)(param_1 + 0x600) = param_2;

  uVar2 = FUN_0055e1d0();

  *(undefined4 *)(param_1 + 0x5fc) = uVar2;

  piVar3 = (int *)FUN_00463c00(0x10000400);

  if (piVar3 == (int *)0x0) {

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar3 + 0x94))(5);

  }

  *(undefined4 *)(param_1 + 0x604) = uVar2;

  piVar3 = (int *)FUN_00463c00(0x10000402);

  if (piVar3 == (int *)0x0) {

    iVar4 = 0;

  }

  else {

    iVar4 = (**(code **)(*piVar3 + 0x94))(0xc);

  }

  *(int *)(param_1 + 0x608) = iVar4;

  *(undefined1 **)(iVar4 + 0x6a0) = &LAB_004664e0;

  piVar3 = (int *)FUN_00463c00(0x10000404);

  if (piVar3 == (int *)0x0) {

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar3 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x60c) = uVar2;

  piVar3 = (int *)FUN_00463c00(0x10000401);

  if (piVar3 == (int *)0x0) {

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar3 + 0x94))(0xb);

  }

  *(undefined4 *)(param_1 + 0x610) = uVar2;

  piVar3 = (int *)FUN_00463c00(0x10000406);

  if (piVar3 == (int *)0x0) {

    uVar2 = 0;

  }

  else {

    uVar2 = (**(code **)(*piVar3 + 0x94))(0xd);

  }

  *(undefined4 *)(param_1 + 0x614) = uVar2;

  iVar4 = FUN_005df0f5(0x60);

  if (iVar4 == 0) {

    iVar4 = 0;

  }

  else {

    iVar4 = FUN_004ef310();

  }

  *(int *)(param_1 + 0x618) = iVar4;

  if (iVar4 != 0) {

    FUN_004ef3f0(*(undefined4 *)(param_1 + 0x614));

  }

  uStack_18 = 0;

  uStack_14 = 0;

  uStack_10 = 0;

  uStack_c = 0;

  uStack_8 = 0xc0200000;

  uStack_4 = 0x3f733333;

  FUN_004ef240(&uStack_c,&uStack_18);

  FUN_004ef220(0x43340000);

  FUN_004ef290();

  cVar1 = FUN_004603a0();

  if (cVar1 != '\0') {

    FUN_0047be60();

  }

  return;

}





// --- FUN_0047c140 at 0x0047C140 (size: 440) ---


void __fastcall FUN_0047c140(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 *local_114;

  int *local_110;

  undefined4 uStack_10c;

  undefined1 local_108 [120];

  undefined1 local_90 [144];

  

  if (*(int *)(param_1 + 0x620) == 0) {

    FUN_006823d0();

    local_114 = (undefined4 *)0x0;

    local_110 = (int *)0x0;

    FUN_0042dc80();

    uVar3 = 0x10000002;

    uVar2 = FUN_004016b0("ID_CharGen_NameTooLong",0x10000002);

    FUN_0042c9c0(uVar2,uVar3);

    FUN_0042a2d0(0x8e);

    if (local_110 != (int *)0x0) {

      FUN_00429b10();

      (**(code **)(*local_110 + 0xac))(3);

    }

    uStack_10c = FUN_00429a00();

    FUN_0042c290(&uStack_10c,&local_114);

    FUN_0042a2d0(0xac);

    if (local_110 != (int *)0x0) {

      FUN_00429b10();

      (**(code **)(*local_110 + 0x74))(1);

    }

    uStack_10c = FUN_00429a00();

    FUN_0042c290(&uStack_10c,&local_114);

    FUN_0042a2d0(0xc5);

    if (local_110 != (int *)0x0) {

      FUN_00429b10();

      (**(code **)(*local_110 + 0xc4))(local_90);

    }

    uStack_10c = FUN_00429a00();

    FUN_0042c290(&uStack_10c,&local_114);

    uVar2 = FUN_00478290(*(undefined4 *)(param_1 + 0x600),local_108);

    *(undefined4 *)(param_1 + 0x620) = uVar2;

    FUN_0042e590();

    if (local_114 != (undefined4 *)0x0) {

      iVar1 = local_114[1];

      local_114[1] = iVar1 + -1;

      if (iVar1 + -1 == 0) {

        (**(code **)*local_114)(1);

      }

      local_114 = (undefined4 *)0x0;

    }

    if (local_110 != (int *)0x0) {

      iVar1 = local_110[1];

      local_110[1] = iVar1 + -1;

      if (iVar1 + -1 == 0) {

        (**(code **)*local_110)(1);

      }

      local_110 = (int *)0x0;

    }

    FUN_00681f60();

  }

  return;

}





// --- FUN_0047c520 at 0x0047C520 (size: 82) ---


undefined4 * __thiscall FUN_0047c520(undefined4 *param_1,byte param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a0738;

  *puVar1 = &PTR_FUN_007ccb60;

  piVar2 = (int *)FUN_0043c680();

  if (piVar2 != (int *)0x0) {

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0047c580 at 0x0047C580 (size: 19) ---


void FUN_0047c580(void)



{

  FUN_00460270(0x1000003d,&LAB_0047c4c0);

  return;

}





// --- FUN_0047c5a0 at 0x0047C5A0 (size: 352) ---


void FUN_0047c5a0(undefined4 param_1)



{

  undefined4 uVar1;

  LONG LVar2;

  undefined4 *puVar3;

  char *pcVar4;

  undefined4 uVar5;

  undefined *local_128;

  undefined *local_124 [73];

  

  FUN_0042dc80();

  uVar5 = 0x10000002;

  uVar1 = FUN_004016b0("ID_CharGen_TownHowTo",0x10000002);

  FUN_0042c9c0(uVar1,uVar5);

  FUN_0042dc80();

  switch(param_1) {

  case 1:

    pcVar4 = "ID_CharGen_HoltText";

    break;

  case 2:

    pcVar4 = "ID_CharGen_ShoushiText";

    break;

  case 3:

    pcVar4 = "ID_CharGen_YaraqText";

    break;

  case 4:

    pcVar4 = "ID_CharGen_SanamarText";

    break;

  default:

    goto switchD_0047c5eb_default;

  }

  uVar5 = 0x10000002;

  uVar1 = FUN_004016b0(pcVar4,0x10000002);

  FUN_0042c9c0(uVar1,uVar5);

switchD_0047c5eb_default:

  local_128 = PTR_DAT_00818340;

  InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

  FUN_0042e6b0(&local_128,0);

  local_124[0] = PTR_DAT_00818340;

  InterlockedIncrement((LONG *)(PTR_DAT_00818340 + -0x10));

  FUN_0042e6b0(local_124,0);

  FUN_004300a0(&local_128,L"\n\n%s\n",local_124[0]);

  FUN_0046a740(&local_128);

  puVar3 = (undefined4 *)(local_124[0] + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(local_124[0] + -0x10));

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  puVar3 = (undefined4 *)(local_128 + -0x14);

  LVar2 = InterlockedDecrement((LONG *)(local_128 + -0x10));

  if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

    (**(code **)*puVar3)(1);

  }

  FUN_0042e590();

  FUN_0042e590();

  return;

}





// --- FUN_0047c710 at 0x0047C710 (size: 233) ---


void __fastcall FUN_0047c710(int *param_1)



{

  int iVar1;

  int unaff_EDI;

  undefined4 uVar2;

  int iVar3;

  

  (**(code **)(*(int *)param_1[0x181] + 0x9c))(1);

  (**(code **)(*(int *)param_1[0x182] + 0x9c))(1);

  (**(code **)(*(int *)param_1[0x183] + 0x9c))(1);

  (**(code **)(*(int *)param_1[0x184] + 0x9c))(1);

  iVar3 = unaff_EDI + -1;

  switch(iVar3) {

  case 0:

    (**(code **)(*(int *)param_1[0x182] + 0x9c))(6);

    iVar1 = *param_1;

    uVar2 = 0x10000034;

    break;

  case 1:

    (**(code **)(*param_1 + 0x9c))(0x10000037);

    iVar1 = *(int *)param_1[0x184];

    uVar2 = 6;

    break;

  case 2:

    (**(code **)(*(int *)param_1[0x183] + 0x9c))(6);

    iVar1 = *param_1;

    uVar2 = 0x10000036;

    break;

  case 3:

    (**(code **)(*(int *)param_1[0x181] + 0x9c))(6);

    iVar1 = *param_1;

    uVar2 = 0x10000035;

    break;

  default:

    goto switchD_0047c761_default;

  }

  (**(code **)(iVar1 + 0x9c))(uVar2);

switchD_0047c761_default:

  FUN_0055e1e0(iVar3);

  FUN_005c4fe0(iVar3);

  FUN_0047c5a0(unaff_EDI);

  return;

}





// --- FUN_0047c810 at 0x0047C810 (size: 31) ---


void FUN_0047c810(void)



{

  int iVar1;

  

  iVar1 = FUN_0055e1e0();

  FUN_0047c710(*(int *)(iVar1 + 0x1f8) + 1);

  return;

}





// --- FUN_0047ca80 at 0x0047CA80 (size: 244) ---


void __thiscall FUN_0047ca80(int param_1,undefined4 param_2)



{

  undefined4 uVar1;

  int *piVar2;

  int iVar3;

  

  *(undefined4 *)(param_1 + 0x600) = param_2;

  uVar1 = FUN_0055e1d0();

  *(undefined4 *)(param_1 + 0x5fc) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x1000040b);

  if (piVar2 == (int *)0x0) {

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x604) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x1000040d);

  if (piVar2 == (int *)0x0) {

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x608) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x1000040e);

  if (piVar2 == (int *)0x0) {

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x60c) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x1000040f);

  if (piVar2 == (int *)0x0) {

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(1);

  }

  *(undefined4 *)(param_1 + 0x610) = uVar1;

  piVar2 = (int *)FUN_00463c00(0x10000409);

  if (piVar2 == (int *)0x0) {

    uVar1 = 0;

  }

  else {

    uVar1 = (**(code **)(*piVar2 + 0x94))(0xc);

  }

  *(undefined4 *)(param_1 + 0x614) = uVar1;

  iVar3 = FUN_0055e1e0();

  FUN_0047c710(*(int *)(iVar3 + 0x1f8) + 1);

  return;

}





// --- FUN_0047cb80 at 0x0047CB80 (size: 53) ---


void __fastcall FUN_0047cb80(int param_1)



{

  int *piVar1;

  

  FUN_004639a0();

  piVar1 = (int *)FUN_0043c680();

  if (param_1 == 0) {

    param_1 = 0;

  }

  else {

    param_1 = param_1 + 0x5f8;

  }

  (**(code **)(*piVar1 + 4))(0x186b0,param_1);

  FUN_00465f90(3);

  return;

}





// --- FUN_0047cbf0 at 0x0047CBF0 (size: 29) ---


void FUN_0047cbf0(void)



{

  char cVar1;

  

  cVar1 = FUN_004603a0();

  if (cVar1 != '\0') {

    FUN_004ef660();

    return;

  }

  return;

}





// --- FUN_0047cc10 at 0x0047CC10 (size: 213) ---


void __thiscall FUN_0047cc10(int param_1,undefined4 param_2,undefined4 param_3)



{

  char cVar1;

  int iVar2;

  

  FUN_00460760(0x86,(float)(double)CONCAT44(param_3,param_2));

  iVar2 = FUN_0055e1e0();

  switch(*(undefined4 *)(param_1 + 0x7d8)) {

  case 1:

    FUN_005c4860(param_2,param_3);

    break;

  case 3:

  case 4:

  case 5:

    FUN_005c4830(param_2,param_3);

    break;

  case 6:

    *(undefined4 *)(iVar2 + 0x158) = param_2;

    *(undefined4 *)(iVar2 + 0x15c) = param_3;

    break;

  case 7:

    *(undefined4 *)(iVar2 + 0x160) = param_2;

    *(undefined4 *)(iVar2 + 0x164) = param_3;

    break;

  case 8:

    *(undefined4 *)(iVar2 + 0x168) = param_2;

    *(undefined4 *)(iVar2 + 0x16c) = param_3;

    break;

  case 9:

    *(undefined4 *)(iVar2 + 0x170) = param_2;

    *(undefined4 *)(iVar2 + 0x174) = param_3;

  }

  cVar1 = FUN_004603a0();

  if (cVar1 != '\0') {

    FUN_004ef660();

  }

  return;

}





// --- FUN_0047cd10 at 0x0047CD10 (size: 276) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __fastcall FUN_0047cd10(int param_1)



{

  undefined4 uVar1;

  float10 fVar2;

  

  if (*(double *)(param_1 + 0x6d8) < _DAT_00795610) {

    *(undefined4 *)(param_1 + 0x6d8) = 0x33333333;

    *(undefined4 *)(param_1 + 0x6dc) = 0x3fe33333;

    uVar1 = DAT_008379ac;

    *(undefined4 *)(param_1 + 0x6d0) = DAT_008379a8;

    *(undefined4 *)(param_1 + 0x6d4) = uVar1;

  }

  fVar2 = (float10)(double)CONCAT44(DAT_008379ac,DAT_008379a8) -

          (float10)*(double *)(param_1 + 0x6d0);

  if ((float10)*(double *)(param_1 + 0x6d8) <= fVar2) {

    *(undefined1 *)(param_1 + 0x678) = 0;

    fVar2 = (float10)*(double *)(param_1 + 0x6d8);

  }

  fVar2 = fVar2 / (float10)*(double *)(param_1 + 0x6d8);

  *(float *)(param_1 + 0x694) =

       (float)(((float10)*(float *)(param_1 + 0x67c) - (float10)*(float *)(param_1 + 0x688)) * fVar2

              + (float10)*(float *)(param_1 + 0x688));

  *(float *)(param_1 + 0x698) =

       (float)(((float10)*(float *)(param_1 + 0x680) - (float10)*(float *)(param_1 + 0x68c)) * fVar2

              + (float10)*(float *)(param_1 + 0x68c));

  *(float *)(param_1 + 0x69c) =

       (float)(((float10)*(float *)(param_1 + 0x684) - (float10)*(float *)(param_1 + 0x690)) * fVar2

              + (float10)*(float *)(param_1 + 0x690));

  *(float *)(param_1 + 0x6b8) =

       (float)(((float10)*(float *)(param_1 + 0x6a0) - (float10)*(float *)(param_1 + 0x6ac)) * fVar2

              + (float10)*(float *)(param_1 + 0x6ac));

  *(float *)(param_1 + 0x6bc) =

       (float)(((float10)*(float *)(param_1 + 0x6a4) - (float10)*(float *)(param_1 + 0x6b0)) * fVar2

              + (float10)*(float *)(param_1 + 0x6b0));

  *(float *)(param_1 + 0x6c0) =

       (float)(((float10)*(float *)(param_1 + 0x6a8) - (float10)*(float *)(param_1 + 0x6b4)) * fVar2

              + (float10)*(float *)(param_1 + 0x6b4));

  FUN_004ef240((float *)(param_1 + 0x694),(float *)(param_1 + 0x6b8));

  return;

}





// --- FUN_0047ce30 at 0x0047CE30 (size: 208) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __fastcall FUN_0047ce30(int param_1)



{

  double dVar1;

  undefined4 uVar2;

  float10 fVar3;

  

  uVar2 = DAT_008379ac;

  if (*(double *)(param_1 + 0x6e0) < _DAT_00795610) {

    *(undefined4 *)(param_1 + 0x6e0) = DAT_008379a8;

    *(undefined4 *)(param_1 + 0x6e4) = uVar2;

  }

  dVar1 = (double)CONCAT44(DAT_008379ac,DAT_008379a8);

  fVar3 = (((float10)dVar1 - (float10)*(double *)(param_1 + 0x6e0)) /

          (float10)*(double *)(param_1 + 0x6e8)) * (float10)_DAT_0079c6b8;

  if (*(int *)(param_1 + 0x6f4) == 1) {

    *(float *)(param_1 + 0x6c4) = (float)(fVar3 + (float10)*(float *)(param_1 + 0x6c4));

  }

  else {

    *(float *)(param_1 + 0x6c4) = (float)((float10)*(float *)(param_1 + 0x6c4) - fVar3);

  }

  if (*(float *)(param_1 + 0x6c4) < DAT_00796344) {

    *(float *)(param_1 + 0x6c4) = *(float *)(param_1 + 0x6c4) + _DAT_0079cc60;

  }

  if (_DAT_0079cc60 < *(float *)(param_1 + 0x6c4)) {

    *(float *)(param_1 + 0x6c4) = *(float *)(param_1 + 0x6c4) - _DAT_0079cc60;

  }

  *(double *)(param_1 + 0x6e0) = dVar1;

  FUN_004ef220(*(undefined4 *)(param_1 + 0x6c4));

  return;

}





// --- FUN_0047cf00 at 0x0047CF00 (size: 118) ---


void __thiscall FUN_0047cf00(int param_1,int param_2)



{

  if ((*(char *)(param_1 + 0x679) != '\0') && (param_2 == *(int *)(param_1 + 0x6f4))) {

    *(undefined1 *)(param_1 + 0x679) = 0;

    return;

  }

  if (param_2 == 1) {

    (**(code **)(**(int **)(param_1 + 0x620) + 0x9c))(1);

  }

  else if (param_2 == 2) {

    (**(code **)(**(int **)(param_1 + 0x61c) + 0x9c))(1);

  }

  *(int *)(param_1 + 0x6f4) = param_2;

  *(undefined4 *)(param_1 + 0x6e0) = 0;

  *(undefined4 *)(param_1 + 0x6e4) = 0xbff00000;

  *(undefined1 *)(param_1 + 0x679) = 1;

  return;

}





// --- FUN_0047cf80 at 0x0047CF80 (size: 45) ---


float10 FUN_0047cf80(double param_1,double param_2,double param_3)



{

  if (param_3 < param_1) {

    return (float10)param_3;

  }

  if (param_1 < param_2) {

    return (float10)param_2;

  }

  return (float10)param_1;

}





// --- FUN_0047cfb0 at 0x0047CFB0 (size: 128) ---


undefined4 * __thiscall FUN_0047cfb0(undefined4 *param_1,byte param_2)



{

  undefined4 *puVar1;

  int iVar2;

  

  if ((param_2 & 2) == 0) {

    *param_1 = &PTR_FUN_007a0ad4;

    FUN_005aca00();

    FUN_005aca00();

    if ((param_2 & 1) != 0) {

      operator_delete(param_1);

    }

    return param_1;

  }

  iVar2 = param_1[-1];

  puVar1 = param_1 + iVar2 * 0x19;

  if (-1 < iVar2 + -1) {

    do {

      puVar1 = puVar1 + -0x19;

      *puVar1 = &PTR_FUN_007a0ad4;

      FUN_005aca00();

      FUN_005aca00();

      iVar2 = iVar2 + -1;

    } while (iVar2 != 0);

  }

  if ((param_2 & 1) != 0) {

    operator_delete__(param_1 + -1);

  }

  return param_1 + -1;

}





// --- FUN_0047d030 at 0x0047D030 (size: 19) ---


bool __fastcall FUN_0047d030(int param_1)



{

  return (*(uint *)(param_1 + 4) & 0x80000000) == 0x80000000;

}





// --- FUN_0047d050 at 0x0047D050 (size: 29) ---


void FUN_0047d050(undefined4 param_1)



{

  undefined4 uVar1;

  

  uVar1 = FUN_004220b0(param_1,0x18);

  FUN_00415430(uVar1);

  return;

}





// --- FUN_0047d070 at 0x0047D070 (size: 381) ---


undefined4 * __thiscall FUN_0047d070(undefined4 *param_1,undefined4 param_2,undefined4 param_3)



{

  undefined4 *puVar1;

  int iVar2;

  

  FUN_00472670(param_2,param_3);

  param_1[0x17e] = &PTR_FUN_007ccb60;

  *param_1 = &PTR_FUN_007a0d88;

  param_1[0x17e] = &PTR_FUN_007a0ae0;

  param_1[0x17f] = 0;

  param_1[0x181] = 0;

  param_1[0x182] = 0;

  param_1[0x183] = 0;

  param_1[0x184] = 0;

  param_1[0x185] = 0;

  param_1[0x186] = 0;

  param_1[0x187] = 0;

  param_1[0x188] = 0;

  param_1[0x192] = 0;

  param_1[0x195] = 0;

  param_1[0x196] = 0;

  param_1[0x197] = 0;

  param_1[0x198] = 0;

  param_1[0x19b] = 0xffffffff;

  param_1[0x19d] = 0xfffffc19;

  *(undefined1 *)(param_1 + 0x19e) = 0;

  *(undefined1 *)((int)param_1 + 0x679) = 0;

  param_1[0x19f] = 0;

  param_1[0x1a0] = 0;

  param_1[0x1a1] = 0;

  param_1[0x1a5] = 0;

  param_1[0x1a6] = 0;

  param_1[0x1a7] = 0;

  param_1[0x1a8] = 0;

  param_1[0x1a9] = 0;

  param_1[0x1aa] = 0;

  param_1[0x1ae] = 0;

  param_1[0x1af] = 0;

  param_1[0x1b0] = 0;

  param_1[0x1b1] = 0;

  param_1[0x1b4] = 0;

  param_1[0x1b5] = 0;

  param_1[0x1b6] = 0;

  param_1[0x1b7] = 0;

  param_1[0x1ba] = 0;

  param_1[0x1bb] = 0x40080000;

  param_1[0x1bd] = 0;

  puVar1 = param_1 + 0x1c0;

  iVar2 = 9;

  do {

    *puVar1 = 0;

    puVar1[1] = 0;

    puVar1[2] = 0;

    puVar1[3] = 0;

    puVar1[4] = 0;

    puVar1[5] = 0;

    puVar1 = puVar1 + 6;

    iVar2 = iVar2 + -1;

  } while (iVar2 != 0);

  param_1[0x1f6] = 1;

  puVar1 = param_1 + 0x1f7;

  iVar2 = 9;

  do {

    *puVar1 = 0;

    puVar1[1] = 0;

    puVar1[2] = 0;

    puVar1[3] = 0;

    puVar1[4] = 0;

    puVar1[5] = 0;

    puVar1[6] = 0;

    puVar1 = puVar1 + 7;

    iVar2 = iVar2 + -1;

  } while (iVar2 != 0);

  return param_1;

}





// --- FUN_0047d1f0 at 0x0047D1F0 (size: 82) ---


undefined4 * __thiscall FUN_0047d1f0(undefined4 *param_1,byte param_2)



{

  undefined4 *puVar1;

  int *piVar2;

  

  puVar1 = param_1 + 0x17e;

  *param_1 = &PTR_FUN_007a0d88;

  *puVar1 = &PTR_FUN_007a0ae0;

  piVar2 = (int *)FUN_0043c680();

  if (piVar2 != (int *)0x0) {

    (**(code **)(*piVar2 + 0xc))(puVar1);

  }

  *puVar1 = &PTR_FUN_007ccb60;

  FUN_0043c610();

  FUN_004726c0();

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0047d2b0 at 0x0047D2B0 (size: 325) ---


void __fastcall FUN_0047d2b0(int param_1)



{

  int iVar1;

  

  if (*(char *)(param_1 + 0x67a) == '\0') {

    *(undefined4 *)(param_1 + 0x6ac) = *(undefined4 *)(param_1 + 0x6b8);

    *(undefined4 *)(param_1 + 0x6b0) = *(undefined4 *)(param_1 + 0x6bc);

    *(undefined4 *)(param_1 + 0x6b4) = *(undefined4 *)(param_1 + 0x6c0);

    *(undefined4 *)(param_1 + 0x688) = *(undefined4 *)(param_1 + 0x694);

    *(undefined4 *)(param_1 + 0x68c) = *(undefined4 *)(param_1 + 0x698);

    *(undefined4 *)(param_1 + 0x690) = *(undefined4 *)(param_1 + 0x69c);

    iVar1 = FUN_0055e1e0();

    iVar1 = *(int *)(iVar1 + 0xd4);

    if (iVar1 == 0xc) {

      *(undefined4 *)(param_1 + 0x680) = 0xbfeccccd;

      *(undefined4 *)(param_1 + 0x684) = 0x3feccccd;

    }

    else if (iVar1 == 0xd) {

      *(undefined4 *)(param_1 + 0x680) = 0xc0433333;

      *(undefined4 *)(param_1 + 0x684) = 0x40300000;

    }

    else {

      *(undefined4 *)(param_1 + 0x684) = 0x3fd33333;

      if (iVar1 == 7) {

        *(undefined4 *)(param_1 + 0x680) = 0xbf59999a;

      }

      else {

        *(undefined4 *)(param_1 + 0x680) = 0xbf0ccccd;

      }

    }

    *(undefined4 *)(param_1 + 0x67c) = 0;

    *(undefined4 *)(param_1 + 0x6a0) = 0;

    *(undefined4 *)(param_1 + 0x6a4) = 0;

    *(undefined4 *)(param_1 + 0x6a8) = 0;

    *(undefined1 *)(param_1 + 0x678) = 1;

    *(undefined4 *)(param_1 + 0x6d8) = 0x9999999a;

    *(undefined4 *)(param_1 + 0x6dc) = 0xbfb99999;

    (**(code **)(**(int **)(param_1 + 0x614) + 0x9c))(6);

    (**(code **)(**(int **)(param_1 + 0x618) + 0x9c))(1);

    FUN_004ef2d0();

    *(undefined1 *)(param_1 + 0x67a) = 1;

    return;

  }

  (**(code **)(**(int **)(param_1 + 0x614) + 0x9c))(6);

  return;

}





// --- FUN_0047d400 at 0x0047D400 (size: 305) ---


void __fastcall FUN_0047d400(int param_1)



{

  int iVar1;

  

  if (*(char *)(param_1 + 0x67a) != '\0') {

    *(undefined4 *)(param_1 + 0x6ac) = *(undefined4 *)(param_1 + 0x6b8);

    *(undefined4 *)(param_1 + 0x6b0) = *(undefined4 *)(param_1 + 0x6bc);

    *(undefined4 *)(param_1 + 0x6b4) = *(undefined4 *)(param_1 + 0x6c0);

    *(undefined4 *)(param_1 + 0x688) = *(undefined4 *)(param_1 + 0x694);

    *(undefined4 *)(param_1 + 0x68c) = *(undefined4 *)(param_1 + 0x698);

    *(undefined4 *)(param_1 + 0x690) = *(undefined4 *)(param_1 + 0x69c);

    iVar1 = FUN_0055e1e0();

    if (*(int *)(iVar1 + 0xd4) == 0xc) {

      *(undefined4 *)(param_1 + 0x680) = 0xc0733333;

      *(undefined4 *)(param_1 + 0x684) = 0x3f933333;

    }

    else if (*(int *)(iVar1 + 0xd4) == 0xd) {

      *(undefined4 *)(param_1 + 0x680) = 0xc0b66666;

      *(undefined4 *)(param_1 + 0x684) = 0x3fd33333;

    }

    else {

      *(undefined4 *)(param_1 + 0x680) = 0xc0200000;

      *(undefined4 *)(param_1 + 0x684) = 0x3f733333;

    }

    *(undefined4 *)(param_1 + 0x67c) = 0;

    *(undefined4 *)(param_1 + 0x6a0) = 0;

    *(undefined4 *)(param_1 + 0x6a4) = 0;

    *(undefined4 *)(param_1 + 0x6a8) = 0;

    *(undefined1 *)(param_1 + 0x678) = 1;

    *(undefined4 *)(param_1 + 0x6d8) = 0x9999999a;

    *(undefined4 *)(param_1 + 0x6dc) = 0xbfb99999;

    (**(code **)(**(int **)(param_1 + 0x614) + 0x9c))(1);

    (**(code **)(**(int **)(param_1 + 0x618) + 0x9c))(6);

    FUN_004ef290();

    *(undefined1 *)(param_1 + 0x67a) = 0;

    return;

  }

  (**(code **)(**(int **)(param_1 + 0x618) + 0x9c))(6);

  return;

}





// --- FUN_0047d540 at 0x0047D540 (size: 64) ---


undefined4 * __thiscall FUN_0047d540(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a0ec4;

  if ((undefined4 *)param_1[0x18] != param_1 + 1) {

    operator_delete__((undefined4 *)param_1[0x18]);

  }

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0047d580 at 0x0047D580 (size: 32) ---


void __fastcall FUN_0047d580(int *param_1)



{

  if (((param_1[1] & 0x80000000U) == 0x80000000) && (*param_1 != 0)) {

    operator_delete__((void *)(*param_1 + -4));

  }

  return;

}





// --- FUN_0047d5a0 at 0x0047D5A0 (size: 64) ---


void __fastcall FUN_0047d5a0(int *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  int iVar3;

  

  if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar1 = *param_1, iVar1 != 0)) {

    iVar3 = *(int *)(iVar1 + -4);

    puVar2 = (undefined4 *)(iVar3 * 0x10 + iVar1);

    if (-1 < iVar3 + -1) {

      do {

        puVar2 = puVar2 + -4;

        iVar3 = iVar3 + -1;

        *puVar2 = &PTR_FUN_007a0acc;

      } while (iVar3 != 0);

    }

    operator_delete__((void *)(iVar1 + -4));

  }

  return;

}





// --- FUN_0047d5f0 at 0x0047D5F0 (size: 78) ---


void __fastcall FUN_0047d5f0(int *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  int iVar3;

  

  if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar1 = *param_1, iVar1 != 0)) {

    iVar3 = *(int *)(iVar1 + -4);

    puVar2 = (undefined4 *)(iVar3 * 0x3c + iVar1);

    if (-1 < iVar3 + -1) {

      do {

        puVar2 = puVar2 + -0xf;

        *puVar2 = &PTR_FUN_007a0ad0;

        FUN_005aca00();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

    operator_delete__((void *)(iVar1 + -4));

  }

  return;

}





// --- FUN_0047d650 at 0x0047D650 (size: 86) ---


void __fastcall FUN_0047d650(int *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  int iVar3;

  

  if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar1 = *param_1, iVar1 != 0)) {

    iVar3 = *(int *)(iVar1 + -4);

    puVar2 = (undefined4 *)(iVar3 * 100 + iVar1);

    if (-1 < iVar3 + -1) {

      do {

        puVar2 = puVar2 + -0x19;

        *puVar2 = &PTR_FUN_007a0ad4;

        FUN_005aca00();

        FUN_005aca00();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

    operator_delete__((void *)(iVar1 + -4));

  }

  return;

}





// --- FUN_0047d6b0 at 0x0047D6B0 (size: 78) ---


void __fastcall FUN_0047d6b0(int *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  int iVar3;

  

  if (((param_1[1] & 0x80000000U) == 0x80000000) && (iVar1 = *param_1, iVar1 != 0)) {

    iVar3 = *(int *)(iVar1 + -4);

    puVar2 = (undefined4 *)(iVar3 * 0x34 + iVar1);

    if (-1 < iVar3 + -1) {

      do {

        puVar2 = puVar2 + -0xd;

        *puVar2 = &PTR_LAB_007a0ad8;

        FUN_005aca00();

        iVar3 = iVar3 + -1;

      } while (iVar3 != 0);

    }

    operator_delete__((void *)(iVar1 + -4));

  }

  return;

}





// --- FUN_0047d710 at 0x0047D710 (size: 179) ---


undefined4 * __thiscall FUN_0047d710(undefined4 *param_1,byte param_2)



{

  int *piVar1;

  LONG LVar2;

  undefined4 *puVar3;

  undefined4 *puVar4;

  int local_4;

  

  if ((param_2 & 2) == 0) {

    puVar4 = (undefined4 *)(param_1[1] + -0x14);

    *param_1 = &PTR_FUN_007a0ec0;

    LVar2 = InterlockedDecrement((LONG *)(param_1[1] + -0x10));

    if ((LVar2 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

    if ((param_2 & 1) != 0) {

      operator_delete(param_1);

    }

    return param_1;

  }

  local_4 = param_1[-1];

  puVar4 = param_1 + local_4 * 4;

  if (-1 < local_4 + -1) {

    do {

      piVar1 = puVar4 + -3;

      puVar4 = puVar4 + -4;

      puVar3 = (undefined4 *)(*piVar1 + -0x14);

      *puVar4 = &PTR_FUN_007a0ec0;

      LVar2 = InterlockedDecrement((LONG *)(*piVar1 + -0x10));

      if ((LVar2 == 0) && (puVar3 != (undefined4 *)0x0)) {

        (**(code **)*puVar3)(1);

      }

      local_4 = local_4 + -1;

    } while (local_4 != 0);

  }

  if ((param_2 & 1) != 0) {

    operator_delete__(param_1 + -1);

  }

  return param_1 + -1;

}





// --- FUN_0047d7d0 at 0x0047D7D0 (size: 99) ---


void __fastcall FUN_0047d7d0(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  *param_1 = &PTR_LAB_007a0ec8;

  if ((param_1[0xe] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[0xd]);

  }

  if ((param_1[0xb] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[10]);

  }

  puVar2 = (undefined4 *)(param_1[1] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[1] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  return;

}





// --- FUN_0047d840 at 0x0047D840 (size: 19) ---


void FUN_0047d840(void)



{

  FUN_00460270(0x1000003c,&LAB_0047d250);

  return;

}





// --- FUN_0047d860 at 0x0047D860 (size: 335) ---


void __thiscall FUN_0047d860(int param_1,int param_2)



{

  int iVar1;

  undefined4 uVar2;

  

  *(int *)(param_1 + 0x6f8) = param_2;

  (**(code **)(**(int **)(param_1 + 0x650) + 0x18))(0);

  (**(code **)(**(int **)(param_1 + 0x64c) + 0x18))(0);

  if (param_2 == 1) {

    (**(code **)(**(int **)(param_1 + 0x60c) + 0x9c))(0x10000017);

    (**(code **)(**(int **)(param_1 + 0x610) + 0x9c))(0x10000016);

    iVar1 = FUN_0055e1e0();

    *(undefined4 *)(param_1 + 0x674) = *(undefined4 *)(iVar1 + 0xf4);

    uVar2 = 0xffffffff;

    FUN_0055e1e0(0xffffffff);

    FUN_005c6330(uVar2);

    (**(code **)(**(int **)(param_1 + 0x64c) + 0x18))(1);

    FUN_0047d2b0();

  }

  else if (param_2 == 2) {

    *(undefined4 *)(param_1 + 0x6ac) = *(undefined4 *)(param_1 + 0x6b8);

    *(undefined4 *)(param_1 + 0x6b0) = *(undefined4 *)(param_1 + 0x6bc);

    *(undefined4 *)(param_1 + 0x6b4) = *(undefined4 *)(param_1 + 0x6c0);

    *(undefined4 *)(param_1 + 0x688) = *(undefined4 *)(param_1 + 0x694);

    *(undefined4 *)(param_1 + 0x68c) = *(undefined4 *)(param_1 + 0x698);

    *(undefined4 *)(param_1 + 0x690) = *(undefined4 *)(param_1 + 0x69c);

    (**(code **)(**(int **)(param_1 + 0x60c) + 0x9c))(0x10000016);

    (**(code **)(**(int **)(param_1 + 0x610) + 0x9c))(0x10000017);

    iVar1 = *(int *)(param_1 + 0x674);

    if ((-2 < iVar1) && (iVar1 < *(int *)(param_1 + 0x778))) {

      FUN_0055e1e0(iVar1);

      FUN_005c6330(iVar1);

    }

    (**(code **)(**(int **)(param_1 + 0x650) + 0x18))(1);

    FUN_0047d400();

    return;

  }

  return;

}





// --- FUN_0047d9b0 at 0x0047D9B0 (size: 231) ---


void * __thiscall FUN_0047d9b0(void *param_1,byte param_2)



{

  LONG LVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  uint *puVar4;

  int local_8;

  

  if ((param_2 & 2) == 0) {

    FUN_0047d7d0();

    if ((param_2 & 1) != 0) {

      operator_delete(param_1);

    }

    return param_1;

  }

  local_8 = *(int *)((int)param_1 + -4);

  puVar2 = (undefined4 *)(local_8 * 0x40 + (int)param_1);

  if (-1 < local_8 + -1) {

    puVar4 = puVar2 + 0xb;

    do {

      puVar2 = puVar2 + -0x10;

      *puVar2 = &PTR_LAB_007a0ec8;

      if ((puVar4[-0xd] & 0x80000000) == 0x80000000) {

        operator_delete__((void *)puVar4[-0xe]);

      }

      if ((puVar4[-0x10] & 0x80000000) == 0x80000000) {

        operator_delete__((void *)puVar4[-0x11]);

      }

      puVar3 = (undefined4 *)(puVar4[-0x1a] - 0x14);

      LVar1 = InterlockedDecrement((LONG *)(puVar4[-0x1a] - 0x10));

      if ((LVar1 == 0) && (puVar3 != (undefined4 *)0x0)) {

        (**(code **)*puVar3)(1);

      }

      local_8 = local_8 + -1;

      puVar4 = puVar4 + -0x10;

    } while (local_8 != 0);

  }

  if ((param_2 & 1) != 0) {

    operator_delete__((void *)((int)param_1 + -4));

  }

  return (void *)((int)param_1 + -4);

}





// --- FUN_0047daa0 at 0x0047DAA0 (size: 338) ---


void __fastcall FUN_0047daa0(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  *param_1 = &PTR_LAB_007a0ecc;

  if ((param_1[0x35] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[0x34]);

  }

  if (((param_1[0x32] & 0x80000000) == 0x80000000) && (param_1[0x31] != 0)) {

    FUN_0047d710(3);

  }

  if (((param_1[0x2f] & 0x80000000) == 0x80000000) && (param_1[0x2e] != 0)) {

    FUN_0047d710(3);

  }

  if (((param_1[0x2c] & 0x80000000) == 0x80000000) && (param_1[0x2b] != 0)) {

    FUN_0047d710(3);

  }

  if (((param_1[0x29] & 0x80000000) == 0x80000000) && (param_1[0x28] != 0)) {

    FUN_0047d710(3);

  }

  FUN_0047d6b0();

  FUN_0047d6b0();

  FUN_0047d650();

  if (((param_1[0x1d] & 0x80000000) == 0x80000000) && (param_1[0x1c] != 0)) {

    operator_delete__((void *)(param_1[0x1c] + -4));

  }

  FUN_0047d5f0();

  if (((param_1[0x17] & 0x80000000) == 0x80000000) && (param_1[0x16] != 0)) {

    operator_delete__((void *)(param_1[0x16] + -4));

  }

  FUN_005aca00();

  puVar2 = (undefined4 *)(param_1[1] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[1] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  return;

}





// --- FUN_0047dc00 at 0x0047DC00 (size: 565) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_0047dc00(int param_1,int param_2)



{

  undefined4 uVar1;

  int *piVar2;

  int *piVar3;

  int *piVar4;

  int iVar5;

  int *piVar6;

  int local_4c;

  undefined4 local_48;

  undefined4 local_44;

  int iStack_40;

  int iStack_3c;

  int *piStack_38;

  int local_34;

  float fStack_20;

  float fStack_1c;

  float fStack_18;

  undefined4 uStack_14;

  undefined4 uStack_10;

  undefined4 uStack_c;

  undefined4 uStack_8;

  undefined4 uStack_4;

  

  local_4c = 0;

  piVar6 = (int *)(param_1 + 0x7f0);

  local_34 = param_1;

  do {

    FUN_00415640(&local_48,0x1000000d,7);

    FUN_00415640(&local_44,0x1000000f,7);

    (**(code **)(*(int *)piVar6[-2] + 0x18))(1);

    uVar1 = FUN_004220b0(local_48,0xc);

    piVar2 = (int *)FUN_00415430(uVar1);

    uVar1 = FUN_004220b0(local_44,0xc);

    piVar3 = (int *)FUN_00415430(uVar1);

    piStack_38 = piVar3;

    if (piVar2 != (int *)0x0) {

      fStack_20 = (float)piVar6[-5];

      uStack_10 = 0;

      uStack_c = 0;

      uStack_8 = 0;

      uStack_4 = 0x3f800000;

      if (piVar6[-5] < 0) {

        fStack_20 = fStack_20 + _DAT_0079920c;

      }

      fStack_20 = fStack_20 * _DAT_00799208;

      fStack_1c = (float)piVar6[-4];

      if (piVar6[-4] < 0) {

        fStack_1c = fStack_1c + _DAT_0079920c;

      }

      fStack_1c = fStack_1c * _DAT_00799208;

      fStack_18 = (float)piVar6[-3];

      if (piVar6[-3] < 0) {

        fStack_18 = fStack_18 + _DAT_0079920c;

      }

      fStack_18 = fStack_18 * _DAT_00799208;

      uStack_14 = 0x3f800000;

      if (*piVar6 == 0) {

        piVar4 = (int *)(**(code **)(*DAT_00870340 + 0xc))();

        if (piVar4 != (int *)0x0) {

          iStack_3c = piVar2[0x28];

          iStack_40 = piVar2[0x29];

          iVar5 = *piVar4;

          uVar1 = FUN_0054fe80(1);

          (**(code **)(iVar5 + 0x58))(iStack_3c,iStack_40,uVar1);

          iVar5 = FUN_005df0f5(0xc);

          if (iVar5 == 0) {

            iVar5 = 0;

          }

          else {

            iVar5 = FUN_00694d80(piVar4);

          }

          *piVar6 = iVar5;

          piVar3 = piStack_38;

        }

      }

      if (local_4c < *(int *)(local_34 + (param_2 * 3 + 0xe1) * 8)) {

        FUN_00442c70(piVar2 + 0x2b,0,0x3f800000);

        FUN_004416d0(&uStack_10,&fStack_20);

      }

      else {

        FUN_00442c70(piVar3 + 0x2b,0,0x3f800000);

      }

      FUN_006a0660();

      iVar5 = FUN_005df0f5(0xc);

      if (iVar5 == 0) {

        uVar1 = 0;

      }

      else {

        uVar1 = FUN_00694d80(*(undefined4 *)(*piVar6 + 8));

      }

      FUN_006a0610(uVar1);

    }

    if (piVar3 != (int *)0x0) {

      (**(code **)(*piVar3 + 0x14))();

    }

    if (piVar2 != (int *)0x0) {

      (**(code **)(*piVar2 + 0x14))();

    }

    local_4c = local_4c + 1;

    piVar6 = piVar6 + 7;

  } while (local_4c < 9);

  return;

}





// --- FUN_0047de40 at 0x0047DE40 (size: 699) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_0047de40(int param_1,char param_2)



{

  int iVar1;

  undefined4 uVar2;

  int *piVar3;

  int *piVar4;

  int *piVar5;

  int iVar6;

  undefined4 local_2c;

  undefined4 local_28;

  int local_24;

  float local_10;

  float local_c;

  float local_8;

  undefined4 local_4;

  

  FUN_00415640(&local_2c,0x1000000e,7);

  FUN_00415640(&local_28,0x10000010,7);

  uVar2 = FUN_004220b0(local_2c,0xc);

  piVar3 = (int *)FUN_00415430(uVar2);

  uVar2 = FUN_004220b0(local_28,0xc);

  piVar4 = (int *)FUN_00415430(uVar2);

  if (piVar3 != (int *)0x0) {

    if (piVar4 == (int *)0x0) goto LAB_0047e0e6;

    iVar6 = *(int *)(param_1 + 0x66c) * 0x1c;

    local_10 = (float)*(int *)(iVar6 + 0x7dc + param_1);

    if (*(int *)(iVar6 + 0x7dc + param_1) < 0) {

      local_10 = local_10 + _DAT_0079920c;

    }

    local_10 = local_10 * _DAT_00799208;

    iVar1 = *(int *)((*(int *)(param_1 + 0x66c) + 0x48) * 0x1c + param_1);

    local_c = (float)iVar1;

    if (iVar1 < 0) {

      local_c = local_c + _DAT_0079920c;

    }

    local_c = local_c * _DAT_00799208;

    local_24 = *(int *)(iVar6 + param_1 + 0x7e4);

    local_8 = (float)local_24;

    if (local_24 < 0) {

      local_8 = local_8 + _DAT_0079920c;

    }

    local_8 = local_8 * _DAT_00799208;

    local_4 = 0x3f800000;

    if (*(int *)(param_1 + 0x658) == 0) {

      piVar5 = (int *)(**(code **)(*DAT_00870340 + 0xc))();

      if (piVar5 != (int *)0x0) {

        local_24 = piVar3[0x28];

        iVar6 = piVar3[0x29];

        iVar1 = *piVar5;

        uVar2 = FUN_0054fe80(1);

        (**(code **)(iVar1 + 0x58))(local_24,iVar6,uVar2);

        iVar6 = FUN_005df0f5(0xc);

        if (iVar6 == 0) {

          uVar2 = 0;

        }

        else {

          uVar2 = FUN_00694d80(piVar5);

        }

        *(undefined4 *)(param_1 + 0x658) = uVar2;

      }

    }

    if (*(int *)(param_1 + 0x65c) == 0) {

      piVar5 = (int *)(**(code **)(*DAT_00870340 + 0xc))();

      if (piVar5 != (int *)0x0) {

        local_24 = piVar4[0x28];

        iVar6 = piVar4[0x29];

        iVar1 = *piVar5;

        uVar2 = FUN_0054fe80(1);

        (**(code **)(iVar1 + 0x58))(local_24,iVar6,uVar2);

        iVar6 = FUN_005df0f5(0xc);

        if (iVar6 == 0) {

          uVar2 = 0;

        }

        else {

          uVar2 = FUN_00694d80(piVar5);

        }

        *(undefined4 *)(param_1 + 0x65c) = uVar2;

      }

    }

    if (param_2 == '\0') {

      uVar2 = FUN_00424000();

      FUN_004428b0(piVar3 + 0x2b,0,0x3f800000,0,4,uVar2);

      FUN_006a0660();

      iVar6 = FUN_005df0f5(0xc);

      if (iVar6 == 0) {

LAB_0047e0cd:

        uVar2 = 0;

      }

      else {

        uVar2 = FUN_00694d80(*(undefined4 *)(*(int *)(param_1 + 0x658) + 8));

      }

    }

    else {

      FUN_00442c70(piVar4 + 0x2b,0,0x3f800000);

      FUN_006a0660();

      iVar6 = FUN_005df0f5(0xc);

      if (iVar6 == 0) goto LAB_0047e0cd;

      uVar2 = FUN_00694d80(*(undefined4 *)(*(int *)(param_1 + 0x65c) + 8));

    }

    FUN_006a0610(uVar2);

  }

  if (piVar4 != (int *)0x0) {

    (**(code **)(*piVar4 + 0x14))();

  }

LAB_0047e0e6:

  if (piVar3 != (int *)0x0) {

    (**(code **)(*piVar3 + 0x14))();

  }

  return;

}





// --- FUN_0047e100 at 0x0047E100 (size: 231) ---


void __thiscall FUN_0047e100(int param_1,int param_2)



{

  char cVar1;

  int iVar2;

  

  if (*(int *)(param_1 + 0x66c) != -1) {

    (**(code **)(**(int **)(*(int *)(param_1 + 0x66c) * 0x1c + 0x7ec + param_1) + 0x18))(0);

  }

  if (param_2 != -1) {

    (**(code **)(**(int **)(param_2 * 0x1c + 0x7ec + param_1) + 0x18))(1);

  }

  *(int *)(param_1 + 0x66c) = param_2;

  iVar2 = FUN_0055e1e0();

  param_2 = 0;

  switch(*(undefined4 *)(param_1 + 0x7d8)) {

  case 1:

    FUN_005c4890(*(undefined4 *)(param_1 + 0x66c));

    break;

  case 2:

    FUN_005c48b0(*(undefined4 *)(param_1 + 0x66c));

    param_2 = 1;

    break;

  case 6:

    *(undefined4 *)(iVar2 + 0xf8) = *(undefined4 *)(param_1 + 0x66c);

    break;

  case 7:

    *(undefined4 *)(iVar2 + 0x100) = *(undefined4 *)(param_1 + 0x66c);

    break;

  case 8:

    *(undefined4 *)(iVar2 + 0x108) = *(undefined4 *)(param_1 + 0x66c);

    break;

  case 9:

    *(undefined4 *)(iVar2 + 0x110) = *(undefined4 *)(param_1 + 0x66c);

  }

  FUN_0047de40(param_2);

  cVar1 = FUN_004603a0();

  if (cVar1 != '\0') {

    FUN_004ef660();

  }

  return;

}





// --- FUN_0047e210 at 0x0047E210 (size: 130) ---


void __fastcall FUN_0047e210(int param_1)



{

  int iVar1;

  void *pvVar2;

  void *pvVar3;

  int *piVar4;

  void *pvVar5;

  

  iVar1 = *(int *)(param_1 + 0x6c);

  do {

    if (iVar1 == 0) {

      return;

    }

    piVar4 = *(int **)(param_1 + 100);

    while (piVar4 != (int *)(*(int *)(param_1 + 0x60) + *(int *)(param_1 + 0x68) * 4)) {

      if (**(int **)(param_1 + 100) != 0) {

        piVar4 = *(int **)(param_1 + 100);

        pvVar5 = (void *)*piVar4;

        goto LAB_0047e24f;

      }

      piVar4 = *(int **)(param_1 + 100) + 1;

      *(int **)(param_1 + 100) = piVar4;

    }

    piVar4 = (int *)0x0;

    pvVar5 = (void *)0x0;

LAB_0047e24f:

    pvVar3 = (void *)*piVar4;

    if (pvVar3 == pvVar5) {

LAB_0047e262:

      *piVar4 = *(int *)((int)pvVar3 + 4);

    }

    else {

      do {

        pvVar2 = pvVar3;

        pvVar3 = *(void **)((int)pvVar2 + 4);

      } while (pvVar3 != pvVar5);

      if (pvVar2 == (void *)0x0) goto LAB_0047e262;

      *(undefined4 *)((int)pvVar2 + 4) = *(undefined4 *)((int)pvVar3 + 4);

    }

    *(int *)(param_1 + 0x6c) = *(int *)(param_1 + 0x6c) + -1;

    if (pvVar5 != (void *)0x0) {

      FUN_0047daa0();

      operator_delete(pvVar5);

    }

    iVar1 = *(int *)(param_1 + 0x6c);

  } while( true );

}





// --- FUN_0047e2a0 at 0x0047E2A0 (size: 82) ---


undefined4 * __thiscall FUN_0047e2a0(undefined4 *param_1,byte param_2)



{

  *param_1 = &PTR_FUN_007a0ed0;

  FUN_0047e210();

  param_1[1] = &PTR_FUN_007a0ec4;

  if ((undefined4 *)param_1[0x19] != param_1 + 2) {

    operator_delete__((undefined4 *)param_1[0x19]);

  }

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  if ((param_2 & 1) != 0) {

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_0047e300 at 0x0047E300 (size: 198) ---


void __fastcall FUN_0047e300(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  *param_1 = &PTR_LAB_007a0ed4;

  param_1[0x13] = &PTR_FUN_007a0ed0;

  FUN_0047e210();

  param_1[0x14] = &PTR_FUN_007a0ec4;

  if ((undefined4 *)param_1[0x2c] != param_1 + 0x15) {

    operator_delete__((undefined4 *)param_1[0x2c]);

  }

  param_1[0x2c] = 0;

  param_1[0x2d] = 0;

  param_1[0x2e] = 0;

  param_1[0x2f] = 0;

  if (((param_1[0x11] & 0x80000000) == 0x80000000) && (param_1[0x10] != 0)) {

    FUN_0047d9b0(3);

  }

  FUN_0047d5a0();

  if ((param_1[0xb] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[10]);

  }

  if ((param_1[8] & 0x80000000) == 0x80000000) {

    operator_delete__((void *)param_1[7]);

  }

  puVar2 = (undefined4 *)(param_1[1] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[1] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  return;

}





// --- FUN_0047e3d0 at 0x0047E3D0 (size: 571) ---


void __fastcall FUN_0047e3d0(int param_1)



{

  undefined4 uVar1;

  int iVar2;

  undefined1 local_1a8 [96];

  undefined4 local_148;

  undefined4 local_13c;

  undefined4 local_130;

  undefined4 local_124;

  undefined4 local_118;

  undefined4 local_10c;

  undefined4 local_100;

  undefined4 local_f4;

  undefined4 local_e8;

  undefined4 local_dc;

  undefined1 local_c8 [196];

  

  iVar2 = FUN_0055e1e0();

  FUN_005c3380(local_c8,*(undefined4 *)(iVar2 + 0xd4));

  FUN_005c2b30(local_1a8,*(undefined4 *)(iVar2 + 0xd8));

  uVar1 = *(undefined4 *)(iVar2 + 0xf0);

  *(undefined4 *)(param_1 + 0x700) = local_13c;

  *(undefined4 *)(param_1 + 0x704) = uVar1;

  *(undefined4 *)(param_1 + 0x70c) = *(undefined4 *)(iVar2 + 0xe8);

  *(undefined4 *)(param_1 + 0x708) = local_148;

  *(undefined8 *)(param_1 + 0x710) = *(undefined8 *)(iVar2 + 0x150);

  *(undefined4 *)(param_1 + 0x71c) = *(undefined4 *)(iVar2 + 0xdc);

  *(undefined4 *)(param_1 + 0x718) = local_124;

  uVar1 = *(undefined4 *)(iVar2 + 0xec);

  *(undefined4 *)(param_1 + 0x720) = local_130;

  *(undefined4 *)(param_1 + 0x724) = uVar1;

  *(undefined4 *)(param_1 + 0x728) = 0;

  *(undefined4 *)(param_1 + 0x72c) = 0;

  *(undefined4 *)(param_1 + 0x734) = *(undefined4 *)(iVar2 + 0xe0);

  *(undefined4 *)(param_1 + 0x730) = local_118;

  *(undefined4 *)(param_1 + 0x738) = 0;

  *(undefined4 *)(param_1 + 0x740) = 0;

  *(undefined4 *)(param_1 + 0x744) = 0;

  *(undefined4 *)(param_1 + 0x73c) = 0xffffffff;

  *(undefined4 *)(param_1 + 0x74c) = *(undefined4 *)(iVar2 + 0xe4);

  *(undefined4 *)(param_1 + 0x748) = local_10c;

  *(undefined4 *)(param_1 + 0x754) = 0xffffffff;

  *(undefined4 *)(param_1 + 0x750) = 0;

  *(undefined4 *)(param_1 + 0x758) = 0;

  *(undefined4 *)(param_1 + 0x75c) = 0;

  *(undefined4 *)(param_1 + 0x77c) = *(undefined4 *)(iVar2 + 0xf4);

  *(undefined4 *)(param_1 + 0x778) = local_100;

  *(undefined4 *)(param_1 + 0x784) = *(undefined4 *)(iVar2 + 0xf8);

  *(undefined4 *)(param_1 + 0x780) = *(undefined4 *)(iVar2 + 0x114);

  *(undefined8 *)(param_1 + 0x788) = *(undefined8 *)(iVar2 + 0x158);

  *(undefined4 *)(param_1 + 0x794) = *(undefined4 *)(iVar2 + 0xfc);

  *(undefined4 *)(param_1 + 0x790) = local_f4;

  *(undefined4 *)(param_1 + 0x79c) = *(undefined4 *)(iVar2 + 0x100);

  *(undefined4 *)(param_1 + 0x798) = *(undefined4 *)(iVar2 + 0x118);

  *(undefined8 *)(param_1 + 0x7a0) = *(undefined8 *)(iVar2 + 0x160);

  *(undefined4 *)(param_1 + 0x7ac) = *(undefined4 *)(iVar2 + 0x104);

  *(undefined4 *)(param_1 + 0x7a8) = local_e8;

  *(undefined4 *)(param_1 + 0x7b4) = *(undefined4 *)(iVar2 + 0x108);

  *(undefined4 *)(param_1 + 0x7b0) = *(undefined4 *)(iVar2 + 0x11c);

  *(undefined8 *)(param_1 + 0x7b8) = *(undefined8 *)(iVar2 + 0x168);

  uVar1 = *(undefined4 *)(iVar2 + 0x10c);

  *(undefined4 *)(param_1 + 0x7c0) = local_dc;

  *(undefined4 *)(param_1 + 0x7c4) = uVar1;

  *(undefined4 *)(param_1 + 0x7cc) = *(undefined4 *)(iVar2 + 0x110);

  *(undefined4 *)(param_1 + 0x7c8) = *(undefined4 *)(iVar2 + 0x120);

  *(undefined8 *)(param_1 + 2000) = *(undefined8 *)(iVar2 + 0x170);

  FUN_0047daa0();

  FUN_0047e300();

  return;

}





// --- FUN_0047e610 at 0x0047E610 (size: 1610) ---


void __thiscall FUN_0047e610(int param_1,undefined4 param_2)



{

  int iVar1;

  undefined4 uVar2;

  int iVar3;

  undefined4 *puVar4;

  uint uVar5;

  undefined4 unaff_EBX;

  undefined4 unaff_EBP;

  int iVar6;

  uint *puVar7;

  int unaff_retaddr;

  int local_1e0;

  int local_1dc;

  undefined4 local_1d8;

  uint local_1d4;

  int iStack_1d0;

  int iStack_1cc;

  int iStack_1c8;

  int aiStack_1c4 [9];

  undefined1 auStack_1a0 [4];

  undefined1 local_19c [84];

  undefined4 uStack_148;

  int iStack_144;

  int iStack_13c;

  int iStack_12c;

  int iStack_124;

  undefined1 local_c0 [192];

  

  local_1dc = 0;

  local_1d8 = 0;

  local_1e0 = 0;

  local_1d4 = 0;

  iVar1 = FUN_0055e1e0();

  FUN_005c3380(local_c0,*(undefined4 *)(iVar1 + 0xd4));

  FUN_005c2b30(local_19c,*(undefined4 *)(iVar1 + 0xd8));

  *(undefined4 *)(param_1 + 0x7d8) = param_2;

  *(undefined4 *)(param_1 + 0x6f0) = *(undefined4 *)(iVar1 + 0xd4);

  puVar4 = (undefined4 *)(param_1 + 0x7ec);

  iVar6 = 9;

  do {

    (**(code **)(*(int *)puVar4[-1] + 0x18))(1);

    (**(code **)(*(int *)*puVar4 + 0x18))(0);

    puVar4 = puVar4 + 7;

    iVar6 = iVar6 + -1;

  } while (iVar6 != 0);

  iVar6 = 0;

  if (*(int **)(param_1 + 0x660) != (int *)0x0) {

    (**(code **)(**(int **)(param_1 + 0x660) + 0x9c))(1);

  }

  switch(param_2) {

  case 1:

    local_1e0 = iStack_13c;

    if (0 < iStack_13c) {

      do {

        uVar2 = FUN_004220b0(*(undefined4 *)(iStack_144 + iVar6 * 4),0x18);

        iVar3 = FUN_00415430(uVar2);

        aiStack_1c4[iVar6] = iVar3;

        iVar6 = iVar6 + 1;

      } while (iVar6 < iStack_13c);

    }

    *(undefined4 *)(param_1 + 0x660) = *(undefined4 *)(param_1 + 0x624);

    local_1d8 = 0xd0;

    local_1dc = 0;

    local_1d4 = (*(uint *)(iVar1 + 0xe8) == 0xffffffff) - 1 & *(uint *)(iVar1 + 0xe8);

    break;

  case 2:

    iVar6 = 0;

    if (0 < iStack_124) {

      puVar7 = (uint *)(param_1 + 0x7e0);

      do {

        uVar5 = FUN_00564730(*(undefined4 *)(iStack_12c + iVar6 * 4),0x103);

        puVar7[-1] = uVar5 >> 0x10 & 0xff;

        puVar7[1] = uVar5 & 0xff;

        *puVar7 = uVar5 >> 8 & 0xff;

        iVar6 = iVar6 + 1;

        puVar7 = puVar7 + 7;

      } while (iVar6 < iStack_124);

    }

    *(undefined4 *)(param_1 + 0x660) = *(undefined4 *)(param_1 + 0x628);

    local_1d4 = *(uint *)(iVar1 + 0xec);

    local_1dc = 1;

    local_1e0 = iStack_124;

    goto LAB_0047ebc5;

  case 3:

    local_1e0 = 1;

    uVar2 = FUN_004220b0(uStack_148,0x18);

    aiStack_1c4[0] = FUN_00415430(uVar2);

    *(undefined4 *)(param_1 + 0x660) = *(undefined4 *)(param_1 + 0x62c);

    local_1d8 = 0xb0;

    local_1dc = 2;

    local_1d4 = 0;

    break;

  case 4:

    local_1e0 = 1;

    uVar2 = FUN_004220b0(uStack_148,0x18);

    aiStack_1c4[0] = FUN_00415430(uVar2);

    *(undefined4 *)(param_1 + 0x660) = *(undefined4 *)(param_1 + 0x630);

    local_1d8 = 0xb0;

    local_1dc = 3;

    local_1d4 = 0;

    break;

  case 5:

    local_1e0 = 1;

    uVar2 = FUN_004220b0(uStack_148,0x18);

    aiStack_1c4[0] = FUN_00415430(uVar2);

    *(undefined4 *)(param_1 + 0x660) = *(undefined4 *)(param_1 + 0x634);

    local_1d8 = 0xb0;

    local_1dc = 4;

    local_1d4 = 0;

    break;

  case 6:

    local_1e0 = *(int *)(iVar1 + 0x114);

    iVar6 = 0;

    if (0 < local_1e0) {

      do {

        puVar4 = (undefined4 *)FUN_005c4d50(&iStack_1c8,iVar6);

        uVar2 = FUN_004220b0(*puVar4,0x18);

        iVar3 = FUN_00415430(uVar2);

        aiStack_1c4[iVar6] = iVar3;

        iVar6 = iVar6 + 1;

      } while (iVar6 < local_1e0);

    }

    *(undefined4 *)(param_1 + 0x660) = *(undefined4 *)(param_1 + 0x638);

    local_1d4 = *(uint *)(iVar1 + 0xf8);

    local_1dc = 5;

    goto LAB_0047eae3;

  case 7:

    local_1e0 = *(int *)(iVar1 + 0x118);

    iVar6 = 0;

    if (0 < local_1e0) {

      do {

        puVar4 = (undefined4 *)FUN_005c4d70(&iStack_1d0,iVar6);

        uVar2 = FUN_004220b0(*puVar4,0x18);

        iVar3 = FUN_00415430(uVar2);

        aiStack_1c4[iVar6] = iVar3;

        iVar6 = iVar6 + 1;

      } while (iVar6 < local_1e0);

    }

    *(undefined4 *)(param_1 + 0x660) = *(undefined4 *)(param_1 + 0x63c);

    local_1d4 = *(uint *)(iVar1 + 0x100);

    local_1d8 = 0x520;

    local_1dc = 6;

    break;

  case 8:

    local_1e0 = *(int *)(iVar1 + 0x11c);

    iVar6 = 0;

    if (0 < local_1e0) {

      do {

        puVar4 = (undefined4 *)FUN_005c4d90(&iStack_1cc,iVar6);

        uVar2 = FUN_004220b0(*puVar4,0x18);

        iVar3 = FUN_00415430(uVar2);

        aiStack_1c4[iVar6] = iVar3;

        iVar6 = iVar6 + 1;

      } while (iVar6 < local_1e0);

    }

    *(undefined4 *)(param_1 + 0x660) = *(undefined4 *)(param_1 + 0x640);

    local_1d4 = *(uint *)(iVar1 + 0x108);

    local_1d8 = 0x520;

    local_1dc = 7;

    break;

  case 9:

    local_1e0 = *(int *)(iVar1 + 0x120);

    iVar6 = 0;

    if (0 < local_1e0) {

      do {

        puVar4 = (undefined4 *)FUN_005c4db0(&local_1d8,iVar6);

        uVar2 = FUN_004220b0(*puVar4,0x18);

        iVar3 = FUN_00415430(uVar2);

        aiStack_1c4[iVar6] = iVar3;

        iVar6 = iVar6 + 1;

      } while (iVar6 < local_1e0);

    }

    *(undefined4 *)(param_1 + 0x660) = *(undefined4 *)(param_1 + 0x644);

    local_1d4 = *(uint *)(iVar1 + 0x110);

    local_1dc = 8;

LAB_0047eae3:

    local_1d8 = 0x520;

  }

  iStack_1d0 = 0;

  if (0 < local_1e0) {

    puVar7 = (uint *)(param_1 + 0x7e0);

    do {

      iStack_1cc = aiStack_1c4[iStack_1d0];

      iVar1 = 0;

      if (iStack_1cc != 0) {

        puVar7[1] = 0;

        *puVar7 = 0;

        puVar7[-1] = 0;

        iVar6 = iStack_1cc;

        if (0 < *(int *)(iStack_1cc + 0x38)) {

          do {

            iStack_1c8 = iVar6;

            puVar4 = (undefined4 *)FUN_005ad6a0(auStack_1a0,iVar1);

            uVar5 = FUN_00564730(*puVar4,local_1d8);

            puVar7[-1] = puVar7[-1] + (uVar5 >> 0x10 & 0xff);

            *puVar7 = *puVar7 + (uVar5 >> 8 & 0xff);

            puVar7[1] = puVar7[1] + (uVar5 & 0xff);

            iVar1 = iVar1 + 1;

            iVar6 = iStack_1c8;

          } while (iVar1 < *(int *)(iStack_1c8 + 0x38));

        }

        puVar7[-1] = puVar7[-1] / *(uint *)(iStack_1cc + 0x38);

        *puVar7 = *puVar7 / *(uint *)(iStack_1cc + 0x38);

        puVar7[1] = puVar7[1] / *(uint *)(iStack_1cc + 0x38);

      }

      iStack_1d0 = iStack_1d0 + 1;

      puVar7 = puVar7 + 7;

    } while (iStack_1d0 < local_1e0);

  }

LAB_0047ebc5:

  uVar5 = local_1d4;

  *(uint *)(param_1 + 0x66c) = local_1d4;

  *(int *)(param_1 + 0x670) = local_1dc;

  *(int *)(param_1 + (local_1dc * 3 + 0xe1) * 8) = local_1e0;

  (**(code **)(**(int **)(param_1 + 0x660) + 0x9c))(6);

  FUN_0047dc00(local_1dc);

  if (unaff_retaddr == 2) {

    FUN_0047de40(1);

    (**(code **)(**(int **)(param_1 + 0x648) + 0x18))(0);

  }

  else {

    FUN_0047de40(0);

    (**(code **)(**(int **)(param_1 + 0x648) + 0x18))(1);

    FUN_0047cc10(unaff_EBP,unaff_EBX);

  }

  FUN_0047e100(uVar5);

  FUN_0047daa0();

  FUN_0047e300();

  return;

}





// --- FUN_0047eca0 at 0x0047ECA0 (size: 1585) ---


void __fastcall FUN_0047eca0(int param_1)



{

  char cVar1;

  int iVar2;

  undefined4 uVar3;

  int iVar4;

  undefined4 uVar5;

  char *pcStack_1c4;

  undefined4 uStack_1c0;

  undefined1 auStack_12c [12];

  undefined1 auStack_120 [132];

  undefined1 auStack_9c [12];

  undefined1 auStack_90 [144];

  

  uStack_1c0 = 0x47ecb6;

  iVar2 = FUN_0055e1e0();

  if (*(int *)(iVar2 + 0xd8) == 1) {

    uStack_1c0 = 0x10000016;

    pcStack_1c4 = "h\x17";

    (**(code **)(**(int **)(param_1 + 0x604) + 0x9c))();

    pcStack_1c4 = (char *)0x10000017;

  }

  else {

    if (*(int *)(iVar2 + 0xd8) != 2) goto LAB_0047ed04;

    uStack_1c0 = 0x10000017;

    pcStack_1c4 = "h\x16";

    (**(code **)(**(int **)(param_1 + 0x604) + 0x9c))();

    pcStack_1c4 = (char *)0x10000016;

  }

  (**(code **)(**(int **)(param_1 + 0x608) + 0x9c))();

LAB_0047ed04:

  iVar4 = *(int *)(iVar2 + 0xd4);

  if (iVar4 == 6) {

    if (*(int *)(param_1 + 0x6f0) != 6) {

      uStack_1c0 = 0;

      pcStack_1c4 = (char *)0x47ed28;

      FUN_005c5ef0();

      uStack_1c0 = 1;

      pcStack_1c4 = (char *)0x47ed31;

      FUN_005c7750();

    }

    *(undefined4 *)(param_1 + 0x6f0) = *(undefined4 *)(iVar2 + 0xd4);

    uStack_1c0 = 0;

    pcStack_1c4 = (char *)0x47ed4a;

    (**(code **)(**(int **)(param_1 + 0x610) + 0x18))();

    pcStack_1c4 = (char *)0x0;

    (**(code **)(**(int **)(param_1 + 0x62c) + 0x18))();

    (**(code **)(**(int **)(param_1 + 0x630) + 0x18))(0);

    FUN_0042dc80();

    FUN_0042dc80();

    FUN_0042dc80();

    uVar5 = 0x10000002;

    uVar3 = FUN_004016b0("ID_CharGen_GearText_HairButton",0x10000002);

    FUN_0042c9c0(uVar3,uVar5);

    FUN_0046a370(auStack_9c,0,1);

    uVar5 = 0x10000002;

    uVar3 = FUN_004016b0("ID_CharGen_GearText_EyesButton",0x10000002);

    FUN_0042c9c0(uVar3,uVar5);

    FUN_0046a370(auStack_12c,0,1);

    if (*(int *)(param_1 + 0x628) != 0) {

      iVar2 = FUN_00463c00(0x1000030a);

      if (iVar2 != 0) {

        FUN_00460820(0xd,1);

      }

      iVar2 = FUN_00463c00(0x1000030b);

      if (iVar2 != 0) {

        FUN_00460820(0xd,1);

      }

    }

    (**(code **)(**(int **)(param_1 + 0x634) + 0x2c))(0,0x5a);

    uVar5 = 0x10000002;

    uVar3 = FUN_004016b0("ID_CharGen_GearText_SkinButton",0x10000002);

    FUN_0042c9c0(uVar3,uVar5);

    FUN_0046a370(&pcStack_1c4,0,1);

    FUN_0047d860(1);

    FUN_0047e610(1);

    *(undefined4 *)(param_1 + 0x67c) = 0;

    *(undefined4 *)(param_1 + 0x680) = 0xbf0ccccd;

    *(undefined4 *)(param_1 + 0x684) = 0x3fd33333;

    *(undefined4 *)(param_1 + 0x694) = 0;

    *(undefined4 *)(param_1 + 0x698) = 0xbf0ccccd;

    *(undefined4 *)(param_1 + 0x69c) = 0x3fd33333;

    FUN_004ef240((undefined4 *)(param_1 + 0x67c),param_1 + 0x6b8);

    FUN_0042e590();

    FUN_0042e590();

  }

  else {

    if ((iVar4 == 0xc) || (iVar4 == 0xd)) {

      uStack_1c0 = 0;

      pcStack_1c4 = (char *)0x47f0b6;

      (**(code **)(**(int **)(param_1 + 0x610) + 0x18))();

      pcStack_1c4 = (char *)0x0;

      (**(code **)(**(int **)(param_1 + 0x62c) + 0x18))();

      (**(code **)(**(int **)(param_1 + 0x630) + 0x18))(0);

      FUN_0042dc80();

      FUN_0042dc80();

      FUN_0042dc80();

      uVar5 = 0x10000002;

      uVar3 = FUN_004016b0("ID_CharGen_OlthoiText_HairButton",0x10000002);

      FUN_0042c9c0(uVar3,uVar5);

      FUN_0046a370(auStack_12c,0,1);

      uVar5 = 0x10000002;

      uVar3 = FUN_004016b0("ID_CharGen_OlthoiText_EyesButton",0x10000002);

      FUN_0042c9c0(uVar3,uVar5);

      FUN_0046a370(auStack_9c,0,1);

      if (*(int *)(param_1 + 0x628) != 0) {

        iVar4 = FUN_00463c00(0x1000030a);

        if (iVar4 != 0) {

          FUN_00460820(0xd,1);

        }

        iVar4 = FUN_00463c00(0x1000030b);

        if (iVar4 != 0) {

          FUN_00460820(0xd,1);

        }

      }

      (**(code **)(**(int **)(param_1 + 0x634) + 0x2c))(0,0x5a);

      uVar5 = 0x10000002;

      uVar3 = FUN_004016b0("ID_CharGen_OlthoiText_SkinButton",0x10000002);

      FUN_0042c9c0(uVar3,uVar5);

      FUN_0046a370(&pcStack_1c4,0,1);

      FUN_0047d860(1);

      FUN_0047e610(1);

      iVar2 = *(int *)(iVar2 + 0xd4);

      *(undefined4 *)(param_1 + 0x67c) = 0;

      if (iVar2 == 0xc) {

        uVar5 = 0xbfeccccd;

        uVar3 = 0x3feccccd;

      }

      else {

        uVar5 = 0xc0433333;

        uVar3 = 0x40300000;

      }

      *(undefined4 *)(param_1 + 0x684) = uVar3;

      *(undefined4 *)(param_1 + 0x680) = uVar5;

      *(undefined4 *)(param_1 + 0x694) = 0;

      *(undefined4 *)(param_1 + 0x698) = uVar5;

      *(undefined4 *)(param_1 + 0x69c) = uVar3;

    }

    else {

      if (*(int *)(param_1 + 0x6f0) == 6) {

        uStack_1c0 = 0;

        pcStack_1c4 = (char *)0x47ef0d;

        FUN_005c5ef0();

        uStack_1c0 = 1;

        pcStack_1c4 = (char *)0x47ef16;

        FUN_005c7750();

      }

      *(undefined4 *)(param_1 + 0x6f0) = *(undefined4 *)(iVar2 + 0xd4);

      uStack_1c0 = 0x47ef2e;

      FUN_0042dc80();

      uStack_1c0 = 0x47ef37;

      FUN_0042dc80();

      uStack_1c0 = 0x47ef43;

      FUN_0042dc80();

      uStack_1c0 = 0x10000002;

      pcStack_1c4 = "ID_CharGen_HairStyle";

      pcStack_1c4 = (char *)FUN_004016b0();

      FUN_0042c9c0();

      uStack_1c0 = 1;

      pcStack_1c4 = (char *)0x0;

      FUN_0046a370(auStack_120);

      uStack_1c0 = 0x10000002;

      pcStack_1c4 = "ID_CharGen_Eyes";

      pcStack_1c4 = (char *)FUN_004016b0();

      FUN_0042c9c0();

      uStack_1c0 = 1;

      pcStack_1c4 = (char *)0x0;

      FUN_0046a370(auStack_90);

      if (*(int *)(param_1 + 0x628) != 0) {

        uStack_1c0 = 0x1000030a;

        pcStack_1c4 = (char *)0x47efc3;

        iVar2 = FUN_00463c00();

        if (iVar2 != 0) {

          uStack_1c0 = 0;

          pcStack_1c4 = (char *)0xd;

          FUN_00460820();

        }

        uStack_1c0 = 0x1000030b;

        pcStack_1c4 = (char *)0x47efe2;

        iVar2 = FUN_00463c00();

        if (iVar2 != 0) {

          uStack_1c0 = 0;

          pcStack_1c4 = (char *)0xd;

          FUN_00460820();

        }

      }

      uStack_1c0 = 0xb4;

      pcStack_1c4 = (char *)0x0;

      (**(code **)(**(int **)(param_1 + 0x634) + 0x2c))();

      uVar5 = 0x10000002;

      uVar3 = FUN_004016b0("ID_CharGen_Skin",0x10000002);

      FUN_0042c9c0(uVar3,uVar5);

      FUN_0046a370(&stack0xfffffe48,0,1);

      (**(code **)(**(int **)(param_1 + 0x610) + 0x18))(1);

      (**(code **)(**(int **)(param_1 + 0x62c) + 0x18))(1);

      (**(code **)(**(int **)(param_1 + 0x630) + 0x18))(1);

      *(undefined4 *)(param_1 + 0x67c) = 0;

      *(undefined4 *)(param_1 + 0x684) = 0x3fd33333;

      uVar3 = 0xbf59999a;

      if (*(int *)(param_1 + 0x6f0) != 7) {

        uVar3 = 0xbf0ccccd;

      }

      *(undefined4 *)(param_1 + 0x680) = uVar3;

      *(undefined4 *)(param_1 + 0x69c) = 0x3fd33333;

      *(undefined4 *)(param_1 + 0x698) = uVar3;

      *(undefined4 *)(param_1 + 0x694) = 0;

    }

    FUN_004ef240(param_1 + 0x67c,param_1 + 0x6b8);

    FUN_0042e590();

    FUN_0042e590();

  }

  FUN_0042e590();

  FUN_0047e3d0();

  FUN_0047e610(*(undefined4 *)(param_1 + 0x7d8));

  cVar1 = FUN_004603a0();

  if (cVar1 != '\0') {

    FUN_004ef660();

    FUN_004ef240(param_1 + 0x67c,param_1 + 0x6b8);

    if (*(char *)(param_1 + 0x67a) == '\0') {

      FUN_004ef290();

      return;

    }

    FUN_004ef2d0();

  }

  return;

}





// --- FUN_0047f2e0 at 0x0047F2E0 (size: 3356) ---


/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */



void __thiscall FUN_0047f2e0(int param_1,undefined4 *param_2)



{

  float fVar1;

  char cVar2;

  int iVar3;

  int iVar4;

  float10 fVar5;

  

  switch(*param_2) {

  case 0x1000030a:

    if (param_2[2] == 1) {

      iVar4 = (**(code **)(*(int *)param_2[1] + 0xa0))();

      switch(*(undefined4 *)(iVar4 + 0x2e4)) {

      case 0x100003af:

        iVar3 = *(int *)(param_1 + 0x700);

        iVar4 = *(int *)(param_1 + 0x704) + -1;

        *(int *)(param_1 + 0x704) = iVar4;

        if (iVar4 < iVar3) goto LAB_0047f415;

        *(undefined4 *)(param_1 + 0x704) = 0;

        goto LAB_0047f420;

      case 0x100003b0:

        iVar4 = *(int *)(param_1 + 0x71c) + -1;

LAB_0047fa9f:

        *(int *)(param_1 + 0x71c) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x718)) {

          if (iVar4 < 0) {

            *(int *)(param_1 + 0x71c) = *(int *)(param_1 + 0x718) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x71c) = 0;

        }

        iVar4 = FUN_0055e1e0();

        *(undefined4 *)(iVar4 + 0xdc) = *(undefined4 *)(param_1 + 0x71c);

        break;

      case 0x100003b1:

        iVar4 = *(int *)(param_1 + 0x734) + -1;

LAB_0047faed:

        *(int *)(param_1 + 0x734) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x730)) {

          if (iVar4 < 0) {

            *(int *)(param_1 + 0x734) = *(int *)(param_1 + 0x730) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x734) = 0;

        }

        iVar4 = FUN_0055e1e0();

        *(undefined4 *)(iVar4 + 0xe0) = *(undefined4 *)(param_1 + 0x734);

        break;

      case 0x100003b2:

        iVar4 = *(int *)(param_1 + 0x74c) + -1;

LAB_0047fb3b:

        *(int *)(param_1 + 0x74c) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x748)) {

          if (iVar4 < 0) {

            *(int *)(param_1 + 0x74c) = *(int *)(param_1 + 0x748) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x74c) = 0;

        }

        iVar4 = FUN_0055e1e0();

        *(undefined4 *)(iVar4 + 0xe4) = *(undefined4 *)(param_1 + 0x74c);

        break;

      default:

        goto switchD_0047f302_caseD_1000030c;

      case 0x100003b5:

        iVar4 = *(int *)(param_1 + 0x77c) + -1;

        *(int *)(param_1 + 0x77c) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x778)) {

          if ((iVar4 < 0) && (iVar4 != -1)) {

            *(int *)(param_1 + 0x77c) = *(int *)(param_1 + 0x778) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x77c) = 0xffffffff;

        }

        iVar4 = FUN_0055e1e0();

        FUN_005c6330();

        *(undefined4 *)(param_1 + 0x784) = *(undefined4 *)(iVar4 + 0xf8);

        *(undefined4 *)(param_1 + 0x780) = *(undefined4 *)(iVar4 + 0x114);

        *(undefined8 *)(param_1 + 0x788) = *(undefined8 *)(iVar4 + 0x158);

        break;

      case 0x100003b6:

        iVar4 = *(int *)(param_1 + 0x794) + -1;

        *(int *)(param_1 + 0x794) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x790)) {

          if (iVar4 < 0) {

            *(int *)(param_1 + 0x794) = *(int *)(param_1 + 0x790) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x794) = 0;

        }

        iVar4 = FUN_0055e1e0();

        FUN_005c6460();

        *(undefined4 *)(param_1 + 0x79c) = *(undefined4 *)(iVar4 + 0x100);

        *(undefined4 *)(param_1 + 0x798) = *(undefined4 *)(iVar4 + 0x118);

        *(undefined8 *)(param_1 + 0x7a0) = *(undefined8 *)(iVar4 + 0x160);

        break;

      case 0x100003b7:

        iVar4 = *(int *)(param_1 + 0x7ac) + -1;

        *(int *)(param_1 + 0x7ac) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x7a8)) {

          if (iVar4 < 0) {

            *(int *)(param_1 + 0x7ac) = *(int *)(param_1 + 0x7a8) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x7ac) = 0;

        }

        iVar4 = FUN_0055e1e0();

        FUN_005c6580();

        *(undefined4 *)(param_1 + 0x7b4) = *(undefined4 *)(iVar4 + 0x108);

        *(undefined4 *)(param_1 + 0x7b0) = *(undefined4 *)(iVar4 + 0x11c);

        *(undefined8 *)(param_1 + 0x7b8) = *(undefined8 *)(iVar4 + 0x168);

        break;

      case 0x100003b8:

        iVar4 = *(int *)(param_1 + 0x7c4) + -1;

        *(int *)(param_1 + 0x7c4) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x7c0)) {

          if (iVar4 < 0) {

            *(int *)(param_1 + 0x7c4) = *(int *)(param_1 + 0x7c0) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x7c4) = 0;

        }

        iVar4 = FUN_0055e1e0();

        FUN_005c66a0();

        *(undefined4 *)(param_1 + 0x7cc) = *(undefined4 *)(iVar4 + 0x110);

        *(undefined4 *)(param_1 + 0x7c8) = *(undefined4 *)(iVar4 + 0x120);

        *(undefined8 *)(param_1 + 2000) = *(undefined8 *)(iVar4 + 0x170);

      }

LAB_0047f439:

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x1000030b:

    if (param_2[2] == 1) {

      iVar4 = (**(code **)(*(int *)param_2[1] + 0xa0))();

      switch(*(undefined4 *)(iVar4 + 0x2e4)) {

      case 0x100003af:

        iVar3 = *(int *)(param_1 + 0x700);

        iVar4 = *(int *)(param_1 + 0x704) + 1;

        *(int *)(param_1 + 0x704) = iVar4;

        if (iVar3 <= iVar4) goto LAB_0047fa89;

LAB_0047f415:

        if (iVar4 < 0) {

          *(int *)(param_1 + 0x704) = iVar3 + -1;

        }

        goto LAB_0047f420;

      case 0x100003b0:

        iVar4 = *(int *)(param_1 + 0x71c) + 1;

        goto LAB_0047fa9f;

      case 0x100003b1:

        iVar4 = *(int *)(param_1 + 0x734) + 1;

        goto LAB_0047faed;

      case 0x100003b2:

        iVar4 = *(int *)(param_1 + 0x74c) + 1;

        goto LAB_0047fb3b;

      default:

        goto switchD_0047f302_caseD_1000030c;

      case 0x100003b5:

        iVar4 = *(int *)(param_1 + 0x77c) + 1;

        *(int *)(param_1 + 0x77c) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x778)) {

          if ((iVar4 < 0) && (iVar4 != -1)) {

            *(int *)(param_1 + 0x77c) = *(int *)(param_1 + 0x778) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x77c) = 0xffffffff;

        }

        iVar4 = FUN_0055e1e0();

        FUN_005c6330();

        *(undefined4 *)(param_1 + 0x784) = *(undefined4 *)(iVar4 + 0xf8);

        *(undefined4 *)(param_1 + 0x780) = *(undefined4 *)(iVar4 + 0x114);

        *(undefined8 *)(param_1 + 0x788) = *(undefined8 *)(iVar4 + 0x158);

        break;

      case 0x100003b6:

        iVar4 = *(int *)(param_1 + 0x794) + 1;

        *(int *)(param_1 + 0x794) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x790)) {

          if (iVar4 < 0) {

            *(int *)(param_1 + 0x794) = *(int *)(param_1 + 0x790) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x794) = 0;

        }

        iVar4 = FUN_0055e1e0();

        FUN_005c6460();

        *(undefined4 *)(param_1 + 0x79c) = *(undefined4 *)(iVar4 + 0x100);

        *(undefined4 *)(param_1 + 0x798) = *(undefined4 *)(iVar4 + 0x118);

        *(undefined8 *)(param_1 + 0x7a0) = *(undefined8 *)(iVar4 + 0x160);

        break;

      case 0x100003b7:

        iVar4 = *(int *)(param_1 + 0x7ac) + 1;

        *(int *)(param_1 + 0x7ac) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x7a8)) {

          if (iVar4 < 0) {

            *(int *)(param_1 + 0x7ac) = *(int *)(param_1 + 0x7a8) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x7ac) = 0;

        }

        iVar4 = FUN_0055e1e0();

        FUN_005c6580();

        *(undefined4 *)(param_1 + 0x7b4) = *(undefined4 *)(iVar4 + 0x108);

        *(undefined4 *)(param_1 + 0x7b0) = *(undefined4 *)(iVar4 + 0x11c);

        *(undefined8 *)(param_1 + 0x7b8) = *(undefined8 *)(iVar4 + 0x168);

        break;

      case 0x100003b8:

        iVar4 = *(int *)(param_1 + 0x7c4) + 1;

        *(int *)(param_1 + 0x7c4) = iVar4;

        if (iVar4 < *(int *)(param_1 + 0x7c0)) {

          if (iVar4 < 0) {

            *(int *)(param_1 + 0x7c4) = *(int *)(param_1 + 0x7c0) + -1;

          }

        }

        else {

          *(undefined4 *)(param_1 + 0x7c4) = 0;

        }

        iVar4 = FUN_0055e1e0();

        FUN_005c66a0();

        *(undefined4 *)(param_1 + 0x7cc) = *(undefined4 *)(iVar4 + 0x110);

        *(undefined4 *)(param_1 + 0x7c8) = *(undefined4 *)(iVar4 + 0x120);

        *(undefined8 *)(param_1 + 2000) = *(undefined8 *)(iVar4 + 0x170);

      }

      goto LAB_0047f439;

    }

    break;

  case 0x1000030c:

  case 0x1000030d:

  case 0x1000030e:

  case 0x10000318:

  case 0x10000319:

  case 0x1000031a:

  case 0x1000031b:

  case 0x1000031c:

  case 0x1000031d:

  case 0x1000031e:

  case 0x1000031f:

  case 0x10000320:

  case 0x10000322:

  case 0x10000327:

  case 0x10000328:

  case 0x10000329:

  case 0x1000032a:

  case 0x1000032b:

  case 0x1000032c:

  case 0x1000032d:

  case 0x1000032e:

  case 0x1000032f:

  case 0x10000330:

  case 0x10000331:

  case 0x10000332:

  case 0x10000333:

  case 0x10000334:

  case 0x10000335:

  case 0x10000336:

  case 0x10000337:

  case 0x10000338:

  case 0x10000339:

  case 0x1000033a:

  case 0x1000033b:

  case 0x1000033c:

  case 0x1000033d:

  case 0x1000033e:

  case 0x1000033f:

  case 0x10000340:

  case 0x10000341:

  case 0x10000342:

  case 0x10000343:

  case 0x10000344:

  case 0x10000345:

  case 0x10000346:

  case 0x10000347:

  case 0x10000348:

  case 0x10000349:

  case 0x1000034a:

  case 0x1000034b:

  case 0x1000034c:

  case 0x1000034d:

  case 0x1000034e:

  case 0x1000034f:

  case 0x10000350:

  case 0x10000351:

  case 0x10000352:

  case 0x10000353:

  case 0x10000354:

  case 0x10000355:

  case 0x10000356:

  case 0x10000357:

  case 0x10000358:

  case 0x10000359:

  case 0x1000035a:

  case 0x1000035b:

  case 0x1000035c:

  case 0x1000035d:

  case 0x1000035e:

  case 0x1000035f:

  case 0x10000360:

  case 0x10000361:

  case 0x10000362:

  case 0x10000363:

  case 0x10000364:

  case 0x10000365:

  case 0x10000366:

  case 0x10000367:

  case 0x10000368:

  case 0x10000369:

  case 0x1000036a:

  case 0x1000036b:

  case 0x1000036c:

  case 0x1000036d:

  case 0x1000036e:

  case 0x1000036f:

  case 0x10000370:

  case 0x10000371:

  case 0x10000372:

  case 0x10000373:

  case 0x10000374:

  case 0x10000375:

  case 0x10000376:

  case 0x10000377:

  case 0x10000378:

  case 0x10000379:

  case 0x1000037a:

  case 0x1000037b:

  case 0x1000037c:

  case 0x1000037d:

  case 0x1000037e:

  case 0x1000037f:

  case 0x10000380:

  case 0x10000381:

  case 0x10000382:

  case 0x10000383:

  case 0x10000384:

  case 0x10000385:

  case 0x10000386:

  case 0x10000387:

  case 0x10000388:

  case 0x10000389:

  case 0x1000038a:

  case 0x1000038b:

  case 0x1000038c:

  case 0x1000038d:

  case 0x1000038e:

  case 0x1000038f:

  case 0x10000390:

  case 0x10000391:

  case 0x10000392:

  case 0x10000393:

  case 0x10000394:

  case 0x10000395:

  case 0x10000396:

  case 0x10000397:

  case 0x10000398:

  case 0x10000399:

  case 0x1000039a:

  case 0x1000039b:

  case 0x1000039c:

  case 0x1000039d:

  case 0x1000039e:

  case 0x1000039f:

  case 0x100003a0:

  case 0x100003a1:

  case 0x100003a2:

  case 0x100003a3:

  case 0x100003a4:

  case 0x100003a5:

  case 0x100003a6:

  case 0x100003ab:

  case 0x100003ac:

  case 0x100003ad:

  case 0x100003ae:

  case 0x100003b4:

    break;

  case 0x1000030f:

    if ((param_2[2] == 1) && (0 < *(int *)(param_1 + (*(int *)(param_1 + 0x670) + 0x4b) * 0x18))) {

      FUN_0047e100();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000310:

    if ((param_2[2] == 1) && (1 < *(int *)(param_1 + (*(int *)(param_1 + 0x670) + 0x4b) * 0x18))) {

      FUN_0047e100();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000311:

    if ((param_2[2] == 1) && (2 < *(int *)(param_1 + (*(int *)(param_1 + 0x670) + 0x4b) * 0x18))) {

      FUN_0047e100();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000312:

    if ((param_2[2] == 1) && (3 < *(int *)(param_1 + (*(int *)(param_1 + 0x670) + 0x4b) * 0x18))) {

      FUN_0047e100();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000313:

    if ((param_2[2] == 1) && (4 < *(int *)(param_1 + (*(int *)(param_1 + 0x670) + 0x4b) * 0x18))) {

      FUN_0047e100();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000314:

    if ((param_2[2] == 1) && (5 < *(int *)(param_1 + (*(int *)(param_1 + 0x670) + 0x4b) * 0x18))) {

      FUN_0047e100();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000315:

    if ((param_2[2] == 1) && (6 < *(int *)(param_1 + (*(int *)(param_1 + 0x670) + 0x4b) * 0x18))) {

      FUN_0047e100();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000316:

    if ((param_2[2] == 1) && (7 < *(int *)(param_1 + (*(int *)(param_1 + 0x670) + 0x4b) * 0x18))) {

      FUN_0047e100();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000317:

    if ((param_2[2] == 1) && (8 < *(int *)(param_1 + (*(int *)(param_1 + 0x670) + 0x4b) * 0x18))) {

      FUN_0047e100();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000321:

    if (param_2[2] == 10) {

      fVar1 = (float)(int)param_2[3];

      if ((int)param_2[3] < 0) {

        fVar1 = fVar1 + _DAT_0079920c;

      }

      fVar5 = (float10)FUN_0047cf80((double)(fVar1 * _DAT_0079a76c),0,0,0,0x3ff00000);

      FUN_0047cc10((double)fVar5);

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000323:

    iVar4 = param_2[2];

    goto joined_r0x0047ffe3;

  case 0x10000324:

    iVar4 = param_2[2];

joined_r0x0047ffe3:

    if (iVar4 == 1) {

      FUN_0047cf00();

    }

    break;

  case 0x10000325:

    if (param_2[2] == 1) {

      FUN_0047d2b0();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x10000326:

    if (param_2[2] == 1) {

      FUN_0047d400();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x100003a7:

    if (param_2[2] == 1) {

      FUN_0055e1e0();

      FUN_005c7480();

      FUN_0047eca0();

      cVar2 = FUN_004603a0();

      if (cVar2 != '\0') {

        FUN_004ef660();

        FUN_00462420(param_2);

        return;

      }

    }

    break;

  case 0x100003a8:

    if (param_2[2] == 1) {

      FUN_0055e1e0();

      FUN_005c7480();

      FUN_0047eca0();

      cVar2 = FUN_004603a0();

      if (cVar2 != '\0') {

        FUN_004ef660();

        FUN_00462420(param_2);

        return;

      }

    }

    break;

  case 0x100003a9:

    if (param_2[2] == 1) {

      FUN_0047d860();

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x100003aa:

    if (param_2[2] == 1) {

      FUN_0047d860();

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x100003af:

    if (param_2[2] == 1) {

      iVar4 = *(int *)(param_1 + 0x704);

      iVar3 = *(int *)(param_1 + 0x700);

      if (iVar4 < iVar3) goto LAB_0047f415;

LAB_0047fa89:

      *(undefined4 *)(param_1 + 0x704) = 0;

LAB_0047f420:

      iVar4 = FUN_0055e1e0();

      *(undefined4 *)(iVar4 + 0xf0) = *(undefined4 *)(param_1 + 0x704);

      goto LAB_0047f439;

    }

    break;

  case 0x100003b0:

    if (param_2[2] == 1) {

      if (*(int *)(param_1 + 0x71c) < *(int *)(param_1 + 0x718)) {

        if (*(int *)(param_1 + 0x71c) < 0) {

          *(int *)(param_1 + 0x71c) = *(int *)(param_1 + 0x718) + -1;

        }

      }

      else {

        *(undefined4 *)(param_1 + 0x71c) = 0;

      }

      iVar4 = FUN_0055e1e0();

      *(undefined4 *)(iVar4 + 0xdc) = *(undefined4 *)(param_1 + 0x71c);

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x100003b1:

    if (param_2[2] == 1) {

      if (*(int *)(param_1 + 0x734) < *(int *)(param_1 + 0x730)) {

        if (*(int *)(param_1 + 0x734) < 0) {

          *(int *)(param_1 + 0x734) = *(int *)(param_1 + 0x730) + -1;

        }

      }

      else {

        *(undefined4 *)(param_1 + 0x734) = 0;

      }

      iVar4 = FUN_0055e1e0();

      *(undefined4 *)(iVar4 + 0xe0) = *(undefined4 *)(param_1 + 0x734);

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x100003b2:

    if (param_2[2] == 1) {

      if (*(int *)(param_1 + 0x74c) < *(int *)(param_1 + 0x748)) {

        if (*(int *)(param_1 + 0x74c) < 0) {

          *(int *)(param_1 + 0x74c) = *(int *)(param_1 + 0x748) + -1;

        }

      }

      else {

        *(undefined4 *)(param_1 + 0x74c) = 0;

      }

      iVar4 = FUN_0055e1e0();

      *(undefined4 *)(iVar4 + 0xe4) = *(undefined4 *)(param_1 + 0x74c);

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x100003b3:

    if (param_2[2] == 1) {

      if (*(int *)(param_1 + 0x764) < *(int *)(param_1 + 0x760)) {

        if (*(int *)(param_1 + 0x764) < 0) {

          *(int *)(param_1 + 0x764) = *(int *)(param_1 + 0x760) + -1;

        }

      }

      else {

        *(undefined4 *)(param_1 + 0x764) = 0;

      }

      FUN_0055e1e0();

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x100003b5:

    if (param_2[2] == 1) {

      iVar4 = *(int *)(param_1 + 0x77c);

      if (iVar4 < *(int *)(param_1 + 0x778)) {

        if ((iVar4 < 0) && (iVar4 != -1)) {

          *(int *)(param_1 + 0x77c) = *(int *)(param_1 + 0x778) + -1;

        }

      }

      else {

        *(undefined4 *)(param_1 + 0x77c) = 0xffffffff;

      }

      iVar4 = FUN_0055e1e0();

      FUN_005c6330();

      *(undefined4 *)(param_1 + 0x784) = *(undefined4 *)(iVar4 + 0xf8);

      *(undefined4 *)(param_1 + 0x780) = *(undefined4 *)(iVar4 + 0x114);

      *(undefined8 *)(param_1 + 0x788) = *(undefined8 *)(iVar4 + 0x158);

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x100003b6:

    if (param_2[2] == 1) {

      if (*(int *)(param_1 + 0x794) < *(int *)(param_1 + 0x790)) {

        if (*(int *)(param_1 + 0x794) < 0) {

          *(int *)(param_1 + 0x794) = *(int *)(param_1 + 0x790) + -1;

        }

      }

      else {

        *(undefined4 *)(param_1 + 0x794) = 0;

      }

      iVar4 = FUN_0055e1e0();

      FUN_005c6460();

      *(undefined4 *)(param_1 + 0x79c) = *(undefined4 *)(iVar4 + 0x100);

      *(undefined4 *)(param_1 + 0x798) = *(undefined4 *)(iVar4 + 0x118);

      *(undefined8 *)(param_1 + 0x7a0) = *(undefined8 *)(iVar4 + 0x160);

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x100003b7:

    if (param_2[2] == 1) {

      if (*(int *)(param_1 + 0x7ac) < *(int *)(param_1 + 0x7a8)) {

        if (*(int *)(param_1 + 0x7ac) < 0) {

          *(int *)(param_1 + 0x7ac) = *(int *)(param_1 + 0x7a8) + -1;

        }

      }

      else {

        *(undefined4 *)(param_1 + 0x7ac) = 0;

      }

      iVar4 = FUN_0055e1e0();

      FUN_005c6580();

      *(undefined4 *)(param_1 + 0x7b4) = *(undefined4 *)(iVar4 + 0x108);

      *(undefined4 *)(param_1 + 0x7b0) = *(undefined4 *)(iVar4 + 0x11c);

      *(undefined8 *)(param_1 + 0x7b8) = *(undefined8 *)(iVar4 + 0x168);

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  case 0x100003b8:

    if (param_2[2] == 1) {

      if (*(int *)(param_1 + 0x7c4) < *(int *)(param_1 + 0x7c0)) {

        if (*(int *)(param_1 + 0x7c4) < 0) {

          *(int *)(param_1 + 0x7c4) = *(int *)(param_1 + 0x7c0) + -1;

        }

      }

      else {

        *(undefined4 *)(param_1 + 0x7c4) = 0;

      }

      iVar4 = FUN_0055e1e0();

      FUN_005c66a0();

      *(undefined4 *)(param_1 + 0x7cc) = *(undefined4 *)(iVar4 + 0x110);

      *(undefined4 *)(param_1 + 0x7c8) = *(undefined4 *)(iVar4 + 0x120);

      *(undefined8 *)(param_1 + 2000) = *(undefined8 *)(iVar4 + 0x170);

      FUN_0047e610();

      FUN_00462420(param_2);

      return;

    }

    break;

  default:

    goto switchD_0047f302_default;

  }

switchD_0047f302_caseD_1000030c:

switchD_0047f302_default:

  FUN_00462420(param_2);

  return;

}





