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

// --- FUN_006b0000 at 0x006B0000 (size: 69) ---


undefined4 FUN_006b0000(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  if ((param_1 != 0) && (*(int *)(param_1 + 0x30) != 0)) {

    if (*param_2 == 0x2ce) {

      uVar1 = FUN_005599a0((char)param_2[1],*(undefined4 *)((int)param_2 + 5),

                           *(undefined4 *)((int)param_2 + 9),*(undefined4 *)((int)param_2 + 0xd));

      return uVar1;

    }

  }

  return 0;

}





// --- FUN_006b0050 at 0x006B0050 (size: 75) ---


undefined4 FUN_006b0050(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  if ((param_1 != 0) && (*(int *)(param_1 + 0x30) != 0)) {

    if (*param_2 == 0x2d0) {

      uVar1 = FUN_005599c0((char)param_2[1],*(undefined4 *)((int)param_2 + 5),

                           *(undefined4 *)((int)param_2 + 9),*(undefined4 *)((int)param_2 + 0xd),

                           *(undefined4 *)((int)param_2 + 0x11));

      return uVar1;

    }

  }

  return 0;

}





// --- FUN_006b00a0 at 0x006B00A0 (size: 175) ---


undefined4 FUN_006b00a0(int param_1,int *param_2,int param_3)



{

  undefined4 uVar1;

  int iVar2;

  undefined4 uVar3;

  int iVar4;

  undefined **local_20;

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  if ((param_1 != 0) && (*(int *)(param_1 + 0x30) != 0)) {

    if (*param_2 == 0x2de) {

      iVar2 = param_2[1];

      uVar3 = *(undefined4 *)((int)param_2 + 5);

      uVar1 = *(undefined4 *)((int)param_2 + 9);

      local_1c = 0;

      local_18 = 0;

      local_14 = 0;

      local_10 = 0;

      local_c = 0;

      iVar4 = (int)param_2 + (param_3 - ((int)param_2 + 0xd));

      local_20 = &PTR_FUN_007a8458;

      local_8 = 0;

      local_4 = 0;

      param_2 = (int *)((int)param_2 + 0xd);

      FUN_005cba30(&param_2,iVar4);

      uVar3 = FUN_00559940((char)iVar2,uVar3,uVar1,&local_20);

      return uVar3;

    }

  }

  return 0;

}





// --- FUN_006b0150 at 0x006B0150 (size: 69) ---


undefined4 FUN_006b0150(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  if ((param_1 != 0) && (*(int *)(param_1 + 0x30) != 0)) {

    if (*param_2 == 0x2e2) {

      uVar1 = FUN_00559980((char)param_2[1],*(undefined4 *)((int)param_2 + 5),

                           *(undefined4 *)((int)param_2 + 9),*(undefined4 *)((int)param_2 + 0xd));

      return uVar1;

    }

  }

  return 0;

}





// --- FUN_006b01a0 at 0x006B01A0 (size: 69) ---


undefined4 FUN_006b01a0(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  if ((param_1 != 0) && (*(int *)(param_1 + 0x30) != 0)) {

    if (*param_2 == 0x2e0) {

      uVar1 = FUN_00559960((char)param_2[1],*(undefined4 *)((int)param_2 + 5),

                           *(undefined4 *)((int)param_2 + 9),*(undefined4 *)((int)param_2 + 0xd));

      return uVar1;

    }

  }

  return 0;

}





// --- FUN_006b01f0 at 0x006B01F0 (size: 60) ---


undefined4 FUN_006b01f0(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  if ((param_1 != 0) && (*(int *)(param_1 + 0x30) != 0)) {

    if (*param_2 == 0x2d7) {

      uVar1 = FUN_00559d00((char)param_2[1],*(undefined4 *)((int)param_2 + 5),

                           *(undefined4 *)((int)param_2 + 9));

      return uVar1;

    }

  }

  return 0;

}





// --- FUN_006b0230 at 0x006B0230 (size: 141) ---


undefined4 FUN_006b0230(int param_1,int *param_2,int param_3)



{

  int iVar1;

  int *piVar2;

  undefined4 uVar3;

  undefined1 local_48 [72];

  

  piVar2 = param_2;

  if ((param_1 != 0) && (*(int *)(param_1 + 0x30) != 0)) {

    if (*param_2 != 0x2db) {

      return 0;

    }

    iVar1 = param_2[1];

    uVar3 = *(undefined4 *)((int)param_2 + 5);

    param_2 = (int *)((int)param_2 + 9);

    FUN_00424d10();

    FUN_005aa740(&param_2,(int)piVar2 + (param_3 - (int)param_2));

    uVar3 = FUN_00559d60((char)iVar1,uVar3,local_48);

    return uVar3;

  }

  return 0;

}





// --- FUN_006b02c0 at 0x006B02C0 (size: 69) ---


undefined4 FUN_006b02c0(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  if ((param_1 != 0) && (*(int *)(param_1 + 0x30) != 0)) {

    if (*param_2 == 0x2d8) {

      uVar1 = FUN_00559a60((char)param_2[1],*(undefined4 *)((int)param_2 + 5),

                           *(undefined4 *)((int)param_2 + 9),*(undefined4 *)((int)param_2 + 0xd));

      return uVar1;

    }

  }

  return 0;

}





// --- FUN_006b0310 at 0x006B0310 (size: 153) ---


undefined4 FUN_006b0310(int param_1,int *param_2,int param_3)



{

  undefined4 uVar1;

  int iVar2;

  int *piVar3;

  undefined4 uVar4;

  undefined1 local_48 [72];

  

  piVar3 = param_2;

  if ((param_1 != 0) && (*(int *)(param_1 + 0x30) != 0)) {

    if (*param_2 != 0x2dc) {

      return 0;

    }

    iVar2 = param_2[1];

    uVar4 = *(undefined4 *)((int)param_2 + 5);

    uVar1 = *(undefined4 *)((int)param_2 + 9);

    param_2 = (int *)((int)param_2 + 0xd);

    FUN_00424d10();

    FUN_005aa740(&param_2,(int)piVar3 + (param_3 - (int)param_2));

    uVar4 = FUN_00559aa0((char)iVar2,uVar4,uVar1,local_48);

    return uVar4;

  }

  return 0;

}





// --- FUN_006b03b0 at 0x006B03B0 (size: 35) ---


undefined4 FUN_006b03b0(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  if (((param_1 != 0) && (*(int *)(param_1 + 0x34) != 0)) && (*param_2 == 0x2cb)) {

    uVar1 = FUN_00565f10();

    return uVar1;

  }

  return 0;

}





// --- FUN_006b03e0 at 0x006B03E0 (size: 46) ---


undefined4 FUN_006b03e0(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  if (((param_1 != 0) && (*(int *)(param_1 + 0x34) != 0)) && (*param_2 == 0x2c9)) {

    uVar1 = FUN_00565d70(param_2[1]);

    return uVar1;

  }

  return 0;

}





// --- FUN_006b0410 at 0x006B0410 (size: 46) ---


undefined4 FUN_006b0410(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  if (((param_1 != 0) && (*(int *)(param_1 + 0x34) != 0)) && (*param_2 == 0x2ca)) {

    uVar1 = FUN_00565e40(param_2[1]);

    return uVar1;

  }

  return 0;

}





// --- FUN_006b0440 at 0x006B0440 (size: 35) ---


undefined4 FUN_006b0440(int param_1,int *param_2)



{

  undefined4 uVar1;

  

  if (((param_1 != 0) && (*(int *)(param_1 + 0x34) != 0)) && (*param_2 == 0x2cc)) {

    uVar1 = FUN_00565cd0();

    return uVar1;

  }

  return 0;

}





// --- FUN_006b0470 at 0x006B0470 (size: 70) ---


undefined4 FUN_006b0470(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd21c);

  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 + 0x1b0))();

      }

    }

  }

  return 1;

}





// --- FUN_006b04c0 at 0x006B04C0 (size: 75) ---


undefined4 FUN_006b04c0(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd21b);

  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 + 0x1b4))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_006b0510 at 0x006B0510 (size: 75) ---


undefined4 FUN_006b0510(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1ed);

  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 + 0xd4))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_006b0560 at 0x006B0560 (size: 75) ---


undefined4 FUN_006b0560(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1ee);

  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 + 0xd8))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_006b05b0 at 0x006B05B0 (size: 82) ---


undefined4 FUN_006b05b0(undefined4 param_1)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd1e7);

  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 + 0xdc))(unaff_retaddr,param_1);

      }

    }

  }

  return 1;

}





// --- FUN_006b0610 at 0x006B0610 (size: 72) ---


undefined4 FUN_006b0610(void)



{

  int *piVar1;

  char cVar2;

  int *piVar3;

  int iVar4;

  undefined4 unaff_retaddr;

  

  piVar3 = (int *)thunk_FUN_0043c680();

  iVar4 = (**(code **)(*piVar3 + 0x10))(0x4dd22c);

  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 + 0x74))(unaff_retaddr);

      }

    }

  }

  return 1;

}





// --- FUN_006b0660 at 0x006B0660 (size: 179) ---


char FUN_006b0660(int *param_1)



{

  char cVar1;

  int iVar2;

  int iVar3;

  undefined4 *puVar4;

  undefined4 local_c;

  undefined **local_8;

  undefined4 local_4;

  

  local_4 = FUN_005473a0();

  local_8 = &PTR_FUN_00802c2c;

  local_c = 0;

  iVar2 = (**(code **)(*param_1 + 0xc))(&local_c,0);

  iVar3 = FUN_006b4010(&stack0xffffffec,0);

  iVar3 = iVar2 + 4 + iVar3;

  puVar4 = (undefined4 *)thunk_FUN_005df0f5(iVar3);

  FUN_006b4010(&stack0xffffffec,iVar3);

  *puVar4 = 0xf753;

  (**(code **)(*param_1 + 0xc))(&stack0xffffffec,(int)puVar4 + (iVar3 - (int)(puVar4 + 1)));

  cVar1 = FUN_005473d0(puVar4,iVar3);

  if (cVar1 == '\0') {

    FUN_005473b0(puVar4 + 1);

  }

  return cVar1;

}





// --- FUN_006b0720 at 0x006B0720 (size: 201) ---


char FUN_006b0720(undefined4 param_1)



{

  char cVar1;

  int iVar2;

  undefined4 *puVar3;

  uint uVar4;

  int iVar5;

  undefined4 *local_c;

  undefined **local_8;

  undefined4 local_4;

  

  local_4 = FUN_005473a0();

  local_8 = &PTR_FUN_00802c2c;

  local_c = (undefined4 *)0x0;

  iVar2 = FUN_006b4010(&local_c,0);

  iVar2 = iVar2 + 8;

  puVar3 = (undefined4 *)thunk_FUN_005df0f5(iVar2);

  local_c = puVar3;

  FUN_006b4010(&local_c,iVar2);

  *local_c = 0xf752;

  local_c[1] = param_1;

  local_c = local_c + 2;

  uVar4 = (uint)local_c & 0x80000003;

  if ((int)uVar4 < 0) {

    uVar4 = (uVar4 - 1 | 0xfffffffc) + 1;

  }

  if (uVar4 != 0) {

    for (iVar5 = 4 - uVar4; iVar5 != 0; iVar5 = iVar5 + -1) {

      *(undefined1 *)local_c = 0;

      local_c = (undefined4 *)((int)local_c + 1);

    }

  }

  cVar1 = FUN_005473d0(puVar3,iVar2);

  if (cVar1 == '\0') {

    FUN_005473b0(local_4);

  }

  return cVar1;

}





// --- FUN_006b07f0 at 0x006B07F0 (size: 322) ---


char FUN_006b07f0(undefined4 param_1,undefined4 param_2,undefined4 param_3)



{

  char cVar1;

  int iVar2;

  undefined4 *puVar3;

  uint uVar4;

  int iVar5;

  undefined4 *local_c;

  undefined **local_8;

  undefined4 local_4;

  

  local_4 = FUN_005473a0();

  local_8 = &PTR_FUN_00802c2c;

  local_c = (undefined4 *)0x0;

  iVar2 = FUN_006b4010(&local_c,0);

  iVar2 = iVar2 + 0x10;

  puVar3 = (undefined4 *)thunk_FUN_005df0f5(iVar2);

  local_c = puVar3;

  FUN_006b4010(&local_c,iVar2);

  *local_c = 0xf61e;

  local_c[1] = param_1;

  local_c = local_c + 2;

  uVar4 = (uint)local_c & 0x80000003;

  if ((int)uVar4 < 0) {

    uVar4 = (uVar4 - 1 | 0xfffffffc) + 1;

  }

  if (uVar4 != 0) {

    for (iVar5 = 4 - uVar4; iVar5 != 0; iVar5 = iVar5 + -1) {

      *(undefined1 *)local_c = 0;

      local_c = (undefined4 *)((int)local_c + 1);

    }

  }

  *local_c = param_2;

  local_c = local_c + 1;

  uVar4 = (uint)local_c & 0x80000003;

  if ((int)uVar4 < 0) {

    uVar4 = (uVar4 - 1 | 0xfffffffc) + 1;

  }

  if (uVar4 != 0) {

    for (iVar5 = 4 - uVar4; iVar5 != 0; iVar5 = iVar5 + -1) {

      *(undefined1 *)local_c = 0;

      local_c = (undefined4 *)((int)local_c + 1);

    }

  }

  *local_c = param_3;

  local_c = local_c + 1;

  uVar4 = (uint)local_c & 0x80000003;

  if ((int)uVar4 < 0) {

    uVar4 = (uVar4 - 1 | 0xfffffffc) + 1;

  }

  if (uVar4 != 0) {

    for (iVar5 = 4 - uVar4; iVar5 != 0; iVar5 = iVar5 + -1) {

      *(undefined1 *)local_c = 0;

      local_c = (undefined4 *)((int)local_c + 1);

    }

  }

  cVar1 = FUN_005473d0(puVar3,iVar2);

  if (cVar1 == '\0') {

    FUN_005473b0(local_4);

  }

  return cVar1;

}





// --- FUN_006b0940 at 0x006B0940 (size: 179) ---


char FUN_006b0940(int *param_1)



{

  char cVar1;

  int iVar2;

  int iVar3;

  undefined4 *puVar4;

  undefined4 local_c;

  undefined **local_8;

  undefined4 local_4;

  

  local_4 = FUN_005473a0();

  local_8 = &PTR_FUN_00802c2c;

  local_c = 0;

  iVar2 = (**(code **)(*param_1 + 0xc))(&local_c,0);

  iVar3 = FUN_006b4010(&stack0xffffffec,0);

  iVar3 = iVar2 + 4 + iVar3;

  puVar4 = (undefined4 *)thunk_FUN_005df0f5(iVar3);

  FUN_006b4010(&stack0xffffffec,iVar3);

  *puVar4 = 0xf61b;

  (**(code **)(*param_1 + 0xc))(&stack0xffffffec,(int)puVar4 + (iVar3 - (int)(puVar4 + 1)));

  cVar1 = FUN_005473d0(puVar4,iVar3);

  if (cVar1 == '\0') {

    FUN_005473b0(puVar4 + 1);

  }

  return cVar1;

}





// --- FUN_006b0a00 at 0x006B0A00 (size: 201) ---


char FUN_006b0a00(undefined4 param_1)



{

  char cVar1;

  int iVar2;

  undefined4 *puVar3;

  uint uVar4;

  int iVar5;

  undefined4 *local_c;

  undefined **local_8;

  undefined4 local_4;

  

  local_4 = FUN_005473a0();

  local_8 = &PTR_FUN_00802c2c;

  local_c = (undefined4 *)0x0;

  iVar2 = FUN_006b4010(&local_c,0);

  iVar2 = iVar2 + 8;

  puVar3 = (undefined4 *)thunk_FUN_005df0f5(iVar2);

  local_c = puVar3;

  FUN_006b4010(&local_c,iVar2);

  *local_c = 0xf7c9;

  local_c[1] = param_1;

  local_c = local_c + 2;

  uVar4 = (uint)local_c & 0x80000003;

  if ((int)uVar4 < 0) {

    uVar4 = (uVar4 - 1 | 0xfffffffc) + 1;

  }

  if (uVar4 != 0) {

    for (iVar5 = 4 - uVar4; iVar5 != 0; iVar5 = iVar5 + -1) {

      *(undefined1 *)local_c = 0;

      local_c = (undefined4 *)((int)local_c + 1);

    }

  }

  cVar1 = FUN_005473d0(puVar3,iVar2);

  if (cVar1 == '\0') {

    FUN_005473b0(local_4);

  }

  return cVar1;

}





// --- FUN_006b0ad0 at 0x006B0AD0 (size: 179) ---


char FUN_006b0ad0(int *param_1)



{

  char cVar1;

  int iVar2;

  int iVar3;

  undefined4 *puVar4;

  undefined4 local_c;

  undefined **local_8;

  undefined4 local_4;

  

  local_4 = FUN_005473a0();

  local_8 = &PTR_FUN_00802c2c;

  local_c = 0;

  iVar2 = (**(code **)(*param_1 + 0xc))(&local_c,0);

  iVar3 = FUN_006b4010(&stack0xffffffec,0);

  iVar3 = iVar2 + 4 + iVar3;

  puVar4 = (undefined4 *)thunk_FUN_005df0f5(iVar3);

  FUN_006b4010(&stack0xffffffec,iVar3);

  *puVar4 = 0xf61c;

  (**(code **)(*param_1 + 0xc))(&stack0xffffffec,(int)puVar4 + (iVar3 - (int)(puVar4 + 1)));

  cVar1 = FUN_005473d0(puVar4,iVar3);

  if (cVar1 == '\0') {

    FUN_005473b0(puVar4 + 1);

  }

  return cVar1;

}





// --- FUN_006b0b90 at 0x006B0B90 (size: 265) ---


char FUN_006b0b90(undefined4 param_1,undefined4 param_2)



{

  char cVar1;

  int iVar2;

  undefined4 *puVar3;

  uint uVar4;

  int iVar5;

  undefined4 *local_c;

  undefined **local_8;

  undefined4 local_4;

  

  local_4 = FUN_005473a0();

  local_8 = &PTR_FUN_00802c2c;

  local_c = (undefined4 *)0x0;

  iVar2 = FUN_006b4010(&local_c,0);

  iVar2 = iVar2 + 0xc;

  puVar3 = (undefined4 *)thunk_FUN_005df0f5(iVar2);

  local_c = puVar3;

  FUN_006b4010(&local_c,iVar2);

  *local_c = 0xf661;

  local_c[1] = param_1;

  local_c = local_c + 2;

  uVar4 = (uint)local_c & 0x80000003;

  if ((int)uVar4 < 0) {

    uVar4 = (uVar4 - 1 | 0xfffffffc) + 1;

  }

  if (uVar4 != 0) {

    for (iVar5 = 4 - uVar4; iVar5 != 0; iVar5 = iVar5 + -1) {

      *(undefined1 *)local_c = 0;

      local_c = (undefined4 *)((int)local_c + 1);

    }

  }

  *local_c = param_2;

  local_c = local_c + 1;

  uVar4 = (uint)local_c & 0x80000003;

  if ((int)uVar4 < 0) {

    uVar4 = (uVar4 - 1 | 0xfffffffc) + 1;

  }

  if (uVar4 != 0) {

    for (iVar5 = 4 - uVar4; iVar5 != 0; iVar5 = iVar5 + -1) {

      *(undefined1 *)local_c = 0;

      local_c = (undefined4 *)((int)local_c + 1);

    }

  }

  cVar1 = FUN_005473d0(puVar3,iVar2);

  if (cVar1 == '\0') {

    FUN_005473b0(local_4);

  }

  return cVar1;

}





// --- FUN_006b0ca0 at 0x006B0CA0 (size: 179) ---


char FUN_006b0ca0(int *param_1)



{

  char cVar1;

  int iVar2;

  int iVar3;

  undefined4 *puVar4;

  undefined4 local_c;

  undefined **local_8;

  undefined4 local_4;

  

  local_4 = FUN_005473a0();

  local_8 = &PTR_FUN_00802c2c;

  local_c = 0;

  iVar2 = (**(code **)(*param_1 + 0xc))(&local_c,0);

  iVar3 = FUN_006b4010(&stack0xffffffec,0);

  iVar3 = iVar2 + 4 + iVar3;

  puVar4 = (undefined4 *)thunk_FUN_005df0f5(iVar3);

  FUN_006b4010(&stack0xffffffec,iVar3);

  *puVar4 = 0xf649;

  (**(code **)(*param_1 + 0xc))(&stack0xffffffec,(int)puVar4 + (iVar3 - (int)(puVar4 + 1)));

  cVar1 = FUN_005473d0(puVar4,iVar3);

  if (cVar1 == '\0') {

    FUN_005473b0(puVar4 + 1);

  }

  return cVar1;

}





// --- FUN_006b0d60 at 0x006B0D60 (size: 32) ---


void FUN_006b0d60(undefined4 param_1,undefined4 param_2)



{

  FUN_0040e280(&DAT_008fb748,param_1,param_2,0x80000002);

  return;

}





// --- FUN_006b0d80 at 0x006B0D80 (size: 18) ---


bool __thiscall FUN_006b0d80(int param_1,int param_2)



{

  return *(int *)(param_1 + 4) == *(int *)(param_2 + 4);

}





// --- FUN_006b0da0 at 0x006B0DA0 (size: 25) ---


void __thiscall FUN_006b0da0(undefined4 *param_1,undefined4 param_2)



{

  *param_1 = &PTR_FUN_007cd42c;

  param_1[1] = param_2;

  param_1[2] = 0;

  return;

}





// --- FUN_006b0dc0 at 0x006B0DC0 (size: 17) ---


void __fastcall FUN_006b0dc0(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_007cd42c;

  param_1[1] = 0;

  param_1[2] = 0;

  return;

}





// --- FUN_006b0e10 at 0x006B0E10 (size: 35) ---


undefined4 FUN_006b0e10(undefined4 param_1)



{

  switch(param_1) {

  case 2:

  case 3:

  case 6:

  case 7:

  case 0xc:

  case 0x10:

  case 0x11:

  case 0x12:

  case 0x13:

  case 0x15:

  case 0x16:

  case 0x17:

  case 0x18:

  case 0x19:

    return 1;

  default:

    return 0;

  }

}





// --- FUN_006b0e60 at 0x006B0E60 (size: 1402) ---


undefined4 FUN_006b0e60(undefined4 param_1,char *param_2,uint param_3)



{

  undefined4 uVar1;

  

  switch(param_1) {

  case 0:

    uVar1 = 8;

    if (7 < param_3) {

      *(undefined4 *)param_2 = s_Default_00798924._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Default_00798924._4_4_;

      return 0;

    }

    break;

  case 1:

    uVar1 = 4;

    if (3 < param_3) {

      *(undefined **)param_2 = &DAT_006c6c41;

      return 0;

    }

    break;

  case 2:

    uVar1 = 7;

    if (6 < param_3) {

      *(undefined4 *)param_2 = s_Speech_00804c6c._0_4_;

      *(undefined2 *)(param_2 + 4) = s_Speech_00804c6c._4_2_;

      param_2[6] = s_Speech_00804c6c[6];

      return 0;

    }

    break;

  case 3:

    uVar1 = 5;

    if (4 < param_3) {

      *(undefined4 *)param_2 = DAT_00804c64;

      param_2[4] = DAT_00804c68;

      return 0;

    }

    break;

  case 4:

    uVar1 = 0x13;

    if (0x12 < param_3) {

      *(undefined4 *)param_2 = s_Speech_Direct_Send_00804c50._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Speech_Direct_Send_00804c50._4_4_;

      *(undefined4 *)(param_2 + 8) = s_Speech_Direct_Send_00804c50._8_4_;

      *(undefined4 *)(param_2 + 0xc) = s_Speech_Direct_Send_00804c50._12_4_;

      *(undefined2 *)(param_2 + 0x10) = s_Speech_Direct_Send_00804c50._16_2_;

      param_2[0x12] = s_Speech_Direct_Send_00804c50[0x12];

      return 0;

    }

    break;

  case 5:

    uVar1 = 7;

    if (6 < param_3) {

      *(undefined4 *)param_2 = s_System_00804c38._0_4_;

      *(undefined2 *)(param_2 + 4) = s_System_00804c38._4_2_;

      param_2[6] = s_System_00804c38[6];

      return 0;

    }

    break;

  case 6:

    uVar1 = 7;

    if (6 < param_3) {

      *(undefined4 *)param_2 = s_Combat_00804c30._0_4_;

      *(undefined2 *)(param_2 + 4) = s_Combat_00804c30._4_2_;

      param_2[6] = s_Combat_00804c30[6];

      return 0;

    }

    break;

  case 7:

    uVar1 = 6;

    if (5 < param_3) {

      *(undefined4 *)param_2 = s_Magic_00804c0c._0_4_;

      *(undefined2 *)(param_2 + 4) = s_Magic_00804c0c._4_2_;

      return 0;

    }

    break;

  case 8:

    uVar1 = 8;

    if (7 < param_3) {

      *(undefined4 *)param_2 = s_Channel_00804c04._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Channel_00804c04._4_4_;

      return 0;

    }

    break;

  case 9:

    uVar1 = 0xd;

    if (0xc < param_3) {

      *(undefined4 *)param_2 = s_Channel_Send_00804bf4._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Channel_Send_00804bf4._4_4_;

      *(undefined4 *)(param_2 + 8) = s_Channel_Send_00804bf4._8_4_;

      param_2[0xc] = s_Channel_Send_00804bf4[0xc];

      return 0;

    }

    break;

  case 10:

    uVar1 = 7;

    if (6 < param_3) {

      *(undefined4 *)param_2 = s_Social_00804bec._0_4_;

      *(undefined2 *)(param_2 + 4) = s_Social_00804bec._4_2_;

      param_2[6] = s_Social_00804bec[6];

      return 0;

    }

    break;

  case 0xb:

    uVar1 = 0xc;

    if (0xb < param_3) {

      *(undefined4 *)param_2 = s_Social_Send_00804be0._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Social_Send_00804be0._4_4_;

      *(undefined4 *)(param_2 + 8) = s_Social_Send_00804be0._8_4_;

      return 0;

    }

    break;

  case 0xc:

    uVar1 = 6;

    if (5 < param_3) {

      *(undefined4 *)param_2 = s_Emote_00804bd8._0_4_;

      *(undefined2 *)(param_2 + 4) = s_Emote_00804bd8._4_2_;

      return 0;

    }

    break;

  case 0xd:

    uVar1 = 0xc;

    if (0xb < param_3) {

      *(undefined4 *)param_2 = s_Advancement_00804bcc._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Advancement_00804bcc._4_4_;

      *(undefined4 *)(param_2 + 8) = s_Advancement_00804bcc._8_4_;

      return 0;

    }

    break;

  case 0xe:

    uVar1 = 6;

    if (5 < param_3) {

      *(undefined4 *)param_2 = s_Abuse_007e967c._0_4_;

      *(undefined2 *)(param_2 + 4) = s_Abuse_007e967c._4_2_;

      return 0;

    }

    break;

  case 0xf:

    uVar1 = 5;

    if (4 < param_3) {

      *(undefined4 *)param_2 = DAT_00799518;

      param_2[4] = DAT_0079951c;

      return 0;

    }

    break;

  case 0x10:

    uVar1 = 10;

    if (9 < param_3) {

      *(undefined4 *)param_2 = s_Appraisal_00804bb0._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Appraisal_00804bb0._4_4_;

      *(undefined2 *)(param_2 + 8) = s_Appraisal_00804bb0._8_2_;

      return 0;

    }

    break;

  case 0x11:

    uVar1 = 0xd;

    if (0xc < param_3) {

      *(undefined4 *)param_2 = s_Spellcasting_00804bbc._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Spellcasting_00804bbc._4_4_;

      *(undefined4 *)(param_2 + 8) = s_Spellcasting_00804bbc._8_4_;

      param_2[0xc] = s_Spellcasting_00804bbc[0xc];

      return 0;

    }

    break;

  case 0x12:

    uVar1 = 0xb;

    if (10 < param_3) {

      *(undefined4 *)param_2 = s_Allegiance_007d1498._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Allegiance_007d1498._4_4_;

      *(undefined2 *)(param_2 + 8) = s_Allegiance_007d1498._8_2_;

      param_2[10] = s_Allegiance_007d1498[10];

      return 0;

    }

    break;

  case 0x13:

    uVar1 = 0xb;

    if (10 < param_3) {

      *(undefined4 *)param_2 = s_Fellowship_007e9630._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Fellowship_007e9630._4_4_;

      *(undefined2 *)(param_2 + 8) = s_Fellowship_007e9630._8_2_;

      param_2[10] = s_Fellowship_007e9630[10];

      return 0;

    }

    break;

  case 0x14:

    uVar1 = 0x10;

    if (0xf < param_3) {

      *(undefined4 *)param_2 = s_World_Broadcast_00804c40._0_4_;

      *(undefined4 *)(param_2 + 4) = s_World_Broadcast_00804c40._4_4_;

      *(undefined4 *)(param_2 + 8) = s_World_Broadcast_00804c40._8_4_;

      *(undefined4 *)(param_2 + 0xc) = s_World_Broadcast_00804c40._12_4_;

      return 0;

    }

    break;

  case 0x15:

    uVar1 = 0xd;

    if (0xc < param_3) {

      *(undefined4 *)param_2 = s_Combat_Enemy_00804c20._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Combat_Enemy_00804c20._4_4_;

      *(undefined4 *)(param_2 + 8) = s_Combat_Enemy_00804c20._8_4_;

      param_2[0xc] = s_Combat_Enemy_00804c20[0xc];

      return 0;

    }

    break;

  case 0x16:

    uVar1 = 0xc;

    if (0xb < param_3) {

      *(undefined4 *)param_2 = s_Combat_Self_00804c14._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Combat_Self_00804c14._4_4_;

      *(undefined4 *)(param_2 + 8) = s_Combat_Self_00804c14._8_4_;

      return 0;

    }

    break;

  case 0x17:

    uVar1 = 7;

    if (6 < param_3) {

      *(undefined4 *)param_2 = s_Recall_00804ba8._0_4_;

      *(undefined2 *)(param_2 + 4) = s_Recall_00804ba8._4_2_;

      param_2[6] = s_Recall_00804ba8[6];

      return 0;

    }

    break;

  case 0x18:

    uVar1 = 6;

    if (5 < param_3) {

      *(undefined4 *)param_2 = s_Craft_00804ba0._0_4_;

      *(undefined2 *)(param_2 + 4) = s_Craft_00804ba0._4_2_;

      return 0;

    }

    break;

  case 0x19:

    uVar1 = 10;

    if (9 < param_3) {

      *(undefined4 *)param_2 = s_Salvaging_007e797c._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Salvaging_007e797c._4_4_;

      *(undefined2 *)(param_2 + 8) = s_Salvaging_007e797c._8_2_;

      return 0;

    }

    break;

  default:

    uVar1 = 8;

    if (7 < param_3) {

      *(undefined4 *)param_2 = s_Unknown_0079aa78._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Unknown_0079aa78._4_4_;

      uVar1 = 0;

    }

    break;

  case 0x1f:

    uVar1 = 0xb;

    if (10 < param_3) {

      *(undefined4 *)param_2 = s_Admin_Tell_00804b94._0_4_;

      *(undefined4 *)(param_2 + 4) = s_Admin_Tell_00804b94._4_4_;

      *(undefined2 *)(param_2 + 8) = s_Admin_Tell_00804b94._8_2_;

      param_2[10] = s_Admin_Tell_00804b94[10];

      return 0;

    }

  }

  return uVar1;

}





// --- FUN_006b1460 at 0x006B1460 (size: 949) ---


undefined4 FUN_006b1460(char *param_1,undefined4 *param_2)



{

  int iVar1;

  

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

    return 0;

  }

  iVar1 = _stricmp(param_1,"Default");

  if (iVar1 == 0) {

    *param_2 = 0;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Speech");

  if (iVar1 == 0) {

    *param_2 = 2;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Tell");

  if (iVar1 == 0) {

    *param_2 = 3;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Speech_Direct_Send");

  if (iVar1 == 0) {

    *param_2 = 4;

    return 1;

  }

  iVar1 = _stricmp(param_1,"World_Broadcast");

  if (iVar1 == 0) {

    *param_2 = 0x14;

    return 1;

  }

  iVar1 = _stricmp(param_1,"System");

  if (iVar1 == 0) {

    *param_2 = 5;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Combat");

  if (iVar1 == 0) {

    *param_2 = 6;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Combat_Enemy");

  if (iVar1 == 0) {

    *param_2 = 0x15;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Combat_Self");

  if (iVar1 == 0) {

    *param_2 = 0x16;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Magic");

  if (iVar1 == 0) {

    *param_2 = 7;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Channel");

  if (iVar1 == 0) {

    *param_2 = 8;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Channel_Send");

  if (iVar1 == 0) {

    *param_2 = 9;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Social");

  if (iVar1 == 0) {

    *param_2 = 10;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Social_Send");

  if (iVar1 == 0) {

    *param_2 = 0xb;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Emote");

  if (iVar1 == 0) {

    *param_2 = 0xc;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Advancement");

  if (iVar1 == 0) {

    *param_2 = 0xd;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Abuse");

  if (iVar1 == 0) {

    *param_2 = 0xe;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Help");

  if (iVar1 == 0) {

    *param_2 = 0xf;

    return 1;

  }

  iVar1 = _stricmp(param_1,"All");

  if (iVar1 == 0) {

    *param_2 = 1;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Spellcasting");

  if (iVar1 == 0) {

    *param_2 = 0x11;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Appraisal");

  if (iVar1 == 0) {

    *param_2 = 0x10;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Assessment");

  if (iVar1 == 0) {

    *param_2 = 0x10;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Allegiance");

  if (iVar1 == 0) {

    *param_2 = 0x12;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Fellowship");

  if (iVar1 == 0) {

    *param_2 = 0x13;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Recall");

  if (iVar1 == 0) {

    *param_2 = 0x17;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Craft");

  if (iVar1 == 0) {

    *param_2 = 0x18;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Salvaging");

  if (iVar1 == 0) {

    *param_2 = 0x19;

    return 1;

  }

  iVar1 = _stricmp(param_1,"Admin_Tell");

  if (iVar1 == 0) {

    *param_2 = 0x1f;

    return 1;

  }

  return 0;

}





// --- FUN_006b1820 at 0x006B1820 (size: 86) ---


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



float10 FUN_006b1820(undefined4 param_1,int param_2,float param_3)



{

  float10 fVar1;

  float10 fVar2;

  

  fVar1 = (float10)FUN_004fd810(param_1);

  fVar2 = (float10)param_2;

  if (fVar2 == (float10)_DAT_00804cec) {

    return (float10)_DAT_00804ce8 / (float10)_DAT_00804cd8;

  }

  return (((fVar2 / ((float10)_DAT_00804ce4 + fVar2)) * (float10)_DAT_00804ce0 * fVar1 +

          (float10)_DAT_007c6f14) / (float10)param_3) / (float10)_DAT_00804cd8;

}





// --- FUN_006b1880 at 0x006B1880 (size: 141) ---


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



float10 FUN_006b1880(undefined4 param_1,int param_2,float param_3,float param_4)



{

  float10 fVar1;

  undefined4 local_4;

  

  local_4 = param_3;

  if (param_3 <= _DAT_007938b0) {

    if (param_3 < DAT_00796344) {

      local_4 = 0.0;

    }

  }

  else {

    local_4 = 1.0;

  }

  fVar1 = (float10)FUN_004fd810(param_1);

  fVar1 = ((((float10)param_2 / ((float10)param_2 + (float10)_DAT_00804cf4)) *

            (float10)_DAT_00804cf0 + (float10)_DAT_007c56dc) * fVar1 * (float10)local_4) /

          (float10)param_4;

  if (fVar1 < (float10)_DAT_00804c84) {

    fVar1 = (float10)_DAT_00804c84;

  }

  return fVar1;

}





// --- FUN_006b1910 at 0x006B1910 (size: 75) ---


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



void FUN_006b1910(float param_1,float param_2,int param_3)



{

  if (param_3 == 0) {

    ceil((double)((param_2 + _DAT_007938b8) * param_1 * _DAT_007938b4 + _DAT_007c6bc4));

    FUN_005df4c4();

    return;

  }

  FUN_005df4c4();

  return;

}





// --- FUN_006b1960 at 0x006B1960 (size: 6) ---


undefined4 FUN_006b1960(void)



{

  return 0xc;

}





// --- FUN_006b19b0 at 0x006B19B0 (size: 73) ---


undefined4 __thiscall FUN_006b19b0(int param_1,int *param_2)



{

  int *piVar1;

  int iVar2;

  

  piVar1 = (int *)*param_2;

  iVar2 = *piVar1;

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

  if (iVar2 != 0xf7b0) {

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

    *param_2 = (int)piVar1;

    return 0;

  }

  *(int *)(param_1 + 8) = piVar1[1];

  iVar2 = *param_2;

  *param_2 = iVar2 + 4;

  *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(iVar2 + 4);

  *param_2 = *param_2 + 4;

  return 1;

}





// --- FUN_006b1a00 at 0x006B1A00 (size: 33) ---


undefined4 * __fastcall FUN_006b1a00(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_0080468c;

  FUN_0048c3e0(&DAT_007938af);

  param_1[2] = 0;

  return param_1;

}





// --- FUN_006b1a30 at 0x006B1A30 (size: 33) ---


undefined4 * __fastcall FUN_006b1a30(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_008046a0;

  FUN_0048c3e0(&DAT_007938af);

  param_1[2] = 0;

  return param_1;

}





// --- FUN_006b1a60 at 0x006B1A60 (size: 64) ---


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



{

  int iVar1;

  uint uVar2;

  

  iVar1 = *param_2;

  uVar2 = (**(code **)(*param_1 + 8))();

  if (uVar2 <= param_3) {

    FUN_004fd290(param_2,(iVar1 + param_3) - *param_2);

    *(int *)*param_2 = param_1[2];

    *param_2 = *param_2 + 4;

  }

  return uVar2;

}





// --- FUN_006b1af0 at 0x006B1AF0 (size: 41) ---


undefined4 FUN_006b1af0(void)



{

  int iVar1;

  uint uVar2;

  

  uVar2 = 0;

  do {

    iVar1 = FUN_005b17b0(uVar2);

    if (iVar1 != 0) {

      return 0;

    }

    uVar2 = uVar2 + 1;

  } while (uVar2 < 0x80);

  return 1;

}





// --- FUN_006b1b20 at 0x006B1B20 (size: 72) ---


bool FUN_006b1b20(int param_1)



{

  int iVar1;

  uint uVar2;

  

  if (param_1 != 1) {

    iVar1 = FUN_005b17b0(param_1);

    return iVar1 != 0;

  }

  uVar2 = 0;

  do {

    iVar1 = FUN_005b17b0(uVar2);

    if (iVar1 == 0) {

      return false;

    }

    uVar2 = uVar2 + 1;

  } while (uVar2 < 0x80);

  return true;

}





// --- FUN_006b1c00 at 0x006B1C00 (size: 80) ---


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



{

  undefined4 uVar1;

  uint *puVar2;

  

  if ((*(uint *)(param_1 + 0x24) != 0) && (*(int *)(param_1 + 0x20) != 0)) {

    puVar2 = *(uint **)(*(int *)(param_1 + 0x20) + (param_2 % *(uint *)(param_1 + 0x24)) * 4);

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

      while (param_2 != *puVar2) {

        puVar2 = (uint *)puVar2[7];

        if (puVar2 == (uint *)0x0) {

          return 0;

        }

      }

      if (puVar2 != (uint *)0xfffffffc) {

        uVar1 = FUN_006b1b20(param_3);

        return uVar1;

      }

    }

  }

  return 0;

}





// --- FUN_006b1ce0 at 0x006B1CE0 (size: 91) ---


int __fastcall FUN_006b1ce0(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  undefined4 local_4;

  

  uVar3 = 0;

  iVar4 = 4;

  local_4 = 0;

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

    do {

      for (iVar1 = *(int *)(*(int *)(param_1 + 8) + uVar3 * 4); iVar1 != 0;

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

        iVar2 = (**(code **)(*(int *)(iVar1 + 4) + 0xc))(&local_4,0);

        iVar4 = iVar4 + 4 + iVar2;

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0xc));

  }

  return iVar4;

}





// --- FUN_006b1d40 at 0x006B1D40 (size: 89) ---


int __thiscall FUN_006b1d40(int param_1,int param_2)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  

  if (param_2 != param_1) {

    FUN_005b1970(param_2 + 4);

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

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

    if (puVar1 != *(undefined4 **)(param_2 + 0x14)) {

      LVar3 = InterlockedDecrement(puVar1 + 1);

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

        (**(code **)*puVar1)(1);

      }

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

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

      InterlockedIncrement((LONG *)(iVar2 + 4));

    }

  }

  return param_1;

}





// --- FUN_006b1da0 at 0x006B1DA0 (size: 110) ---


void __fastcall FUN_006b1da0(int param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  LONG *lpAddend;

  undefined1 local_c [12];

  

  FUN_005b1900(0);

  FUN_005b1970(local_c);

  FUN_005b19d0();

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

  if (puVar1 != DAT_008ef11c) {

    LVar2 = InterlockedDecrement(puVar1 + 1);

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

      (**(code **)*puVar1)(1);

    }

    lpAddend = DAT_008ef11c + 1;

    *(undefined4 **)(param_1 + 0x14) = DAT_008ef11c;

    InterlockedIncrement(lpAddend);

  }

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

  return;

}





// --- FUN_006b1e10 at 0x006B1E10 (size: 146) ---


int * __thiscall FUN_006b1e10(int param_1,int *param_2)



{

  byte bVar1;

  uint uVar2;

  uint uVar3;

  byte *pbVar4;

  int iVar5;

  byte *pbVar6;

  int *piVar7;

  bool bVar8;

  

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

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

    iVar5 = *param_2;

    uVar3 = *(uint *)(iVar5 + 0x10);

    if (uVar3 == 0xffffffff) {

      uVar3 = FUN_004fe440();

      *(uint *)(iVar5 + 0x10) = uVar3;

    }

    piVar7 = *(int **)(*(int *)(param_1 + 8) + (uVar3 % uVar2) * 4);

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

      do {

        pbVar4 = (byte *)(*piVar7 + 0x14);

        pbVar6 = (byte *)(*param_2 + 0x14);

        do {

          bVar1 = *pbVar6;

          bVar8 = bVar1 < *pbVar4;

          if (bVar1 != *pbVar4) {

LAB_006b1e7f:

            iVar5 = (1 - (uint)bVar8) - (uint)(bVar8 != 0);

            goto LAB_006b1e84;

          }

          if (bVar1 == 0) break;

          bVar1 = pbVar6[1];

          bVar8 = bVar1 < pbVar4[1];

          if (bVar1 != pbVar4[1]) goto LAB_006b1e7f;

          pbVar6 = pbVar6 + 2;

          pbVar4 = pbVar4 + 2;

        } while (bVar1 != 0);

        iVar5 = 0;

LAB_006b1e84:

        if (iVar5 == 0) {

          return piVar7 + 1;

        }

        piVar7 = (int *)piVar7[2];

      } while (piVar7 != (int *)0x0);

    }

  }

  return (int *)0x0;

}





// --- FUN_006b1eb0 at 0x006B1EB0 (size: 76) ---


int * __thiscall FUN_006b1eb0(int *param_1,int *param_2,int *param_3,uint param_4)



{

  int iVar1;

  uint uVar2;

  

  iVar1 = *param_2;

  *param_1 = iVar1;

  InterlockedIncrement((LONG *)(iVar1 + 4));

  param_1[1] = *param_3;

  param_1[2] = 0;

  iVar1 = *param_2;

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

  if (uVar2 == 0xffffffff) {

    uVar2 = FUN_004fe440();

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

  }

  param_1[3] = uVar2 % param_4;

  return param_1;

}





// --- FUN_006b1f00 at 0x006B1F00 (size: 50) ---


undefined4 * __fastcall FUN_006b1f00(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_007e3f00;

  FUN_005b1900(0);

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[5] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  FUN_006b1da0();

  return param_1;

}





// --- FUN_006b1f40 at 0x006B1F40 (size: 159) ---


undefined4 * __thiscall FUN_006b1f40(undefined4 *param_1,int *param_2,int param_3)



{

  undefined4 *puVar1;

  int iVar2;

  LONG LVar3;

  LONG *lpAddend;

  uint uVar4;

  

  *param_1 = &PTR_FUN_007e3f00;

  FUN_005b1900(0);

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[5] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  FUN_006b1da0();

  puVar1 = (undefined4 *)param_1[5];

  if (puVar1 != (undefined4 *)*param_2) {

    LVar3 = InterlockedDecrement(puVar1 + 1);

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

      (**(code **)*puVar1)(1);

    }

    iVar2 = *param_2;

    param_1[5] = iVar2;

    InterlockedIncrement((LONG *)(iVar2 + 4));

  }

  if (param_3 != 1) {

    FUN_005b17f0(param_3);

    return param_1;

  }

  uVar4 = 0;

  do {

    FUN_005b17f0(uVar4);

    uVar4 = uVar4 + 1;

  } while (uVar4 < 0x80);

  return param_1;

}





// --- FUN_006b1fe0 at 0x006B1FE0 (size: 61) ---


void __fastcall FUN_006b1fe0(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  *param_1 = &PTR_FUN_007e3f00;

  FUN_006b1da0();

  puVar1 = (undefined4 *)param_1[5];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

    (**(code **)*puVar1)(1);

  }

  FUN_005b19d0();

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_006b2120 at 0x006B2120 (size: 130) ---


void __fastcall FUN_006b2120(int param_1)



{

  undefined4 *puVar1;

  int *piVar2;

  int *piVar3;

  LONG LVar4;

  uint local_4;

  

  if ((*(int *)(param_1 + 8) != 0) && (local_4 = 0, *(int *)(param_1 + 0xc) != 0)) {

    do {

      piVar3 = *(int **)(*(int *)(param_1 + 8) + local_4 * 4);

      while (piVar3 != (int *)0x0) {

        puVar1 = (undefined4 *)*piVar3;

        piVar2 = (int *)piVar3[2];

        LVar4 = InterlockedDecrement(puVar1 + 1);

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

          (**(code **)*puVar1)(1);

        }

        operator_delete(piVar3);

        piVar3 = piVar2;

      }

      *(undefined4 *)(*(int *)(param_1 + 8) + local_4 * 4) = 0;

      local_4 = local_4 + 1;

    } while (local_4 < *(uint *)(param_1 + 0xc));

  }

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

  return;

}





// --- FUN_006b21b0 at 0x006B21B0 (size: 91) ---


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



{

  int iVar1;

  

  iVar1 = FUN_006b1e10(param_2);

  if (iVar1 == 0) {

    iVar1 = FUN_005df0f5(0x10);

    if (iVar1 != 0) {

      iVar1 = FUN_006b1eb0(param_2,param_3,*(undefined4 *)(param_1 + 0xc));

      if (iVar1 != 0) {

        *(undefined4 *)(iVar1 + 8) =

             *(undefined4 *)(*(int *)(param_1 + 8) + *(int *)(iVar1 + 0xc) * 4);

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

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

        return 1;

      }

    }

  }

  return 0;

}





// --- FUN_006b22a0 at 0x006B22A0 (size: 89) ---


int __fastcall FUN_006b22a0(int param_1)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  undefined4 local_4;

  

  uVar3 = 0;

  iVar4 = 4;

  local_4 = 0;

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

    do {

      for (iVar1 = *(int *)(*(int *)(param_1 + 8) + uVar3 * 4); iVar1 != 0;

          iVar1 = *(int *)(iVar1 + 8)) {

        iVar2 = FUN_004fd290(&local_4,0);

        iVar4 = iVar4 + 4 + iVar2;

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0xc));

  }

  return iVar4;

}





// --- FUN_006b2300 at 0x006B2300 (size: 84) ---


uint * __thiscall FUN_006b2300(uint *param_1,uint *param_2,int param_3,uint param_4)



{

  uint uVar1;

  

  *param_1 = *param_2;

  param_1[1] = (uint)&PTR_FUN_007e3f00;

  FUN_005b1950(param_3 + 4);

  param_1[5] = *(uint *)(param_3 + 0x10);

  uVar1 = *(uint *)(param_3 + 0x14);

  param_1[6] = uVar1;

  InterlockedIncrement((LONG *)(uVar1 + 4));

  param_1[7] = 0;

  param_1[8] = *param_2 % param_4;

  return param_1;

}





// --- FUN_006b2360 at 0x006B2360 (size: 84) ---


bool FUN_006b2360(undefined4 param_1,undefined4 param_2,int param_3)



{

  int iVar1;

  

  iVar1 = FUN_006b1b20(param_3);

  if (iVar1 == 0) {

    if (param_3 == 0x11) {

      return false;

    }

    iVar1 = FUN_006b1e10(param_2);

    if (iVar1 == 0) {

      iVar1 = FUN_006b1c00(param_1,param_3);

      return iVar1 != 0;

    }

  }

  return true;

}





// --- FUN_006b2510 at 0x006B2510 (size: 141) ---


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



{

  uint *puVar1;

  int iVar2;

  

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

    for (puVar1 = *(uint **)(*(int *)(param_1 + 8) + (*param_2 % *(uint *)(param_1 + 0xc)) * 4);

        puVar1 != (uint *)0x0; puVar1 = (uint *)puVar1[7]) {

      if (*param_2 == *puVar1) {

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

          return 0;

        }

        break;

      }

    }

  }

  iVar2 = FUN_005df0f5(0x24);

  if ((iVar2 != 0) &&

     (iVar2 = FUN_006b2300(param_2,param_3,*(undefined4 *)(param_1 + 0xc)), iVar2 != 0)) {

    *(undefined4 *)(iVar2 + 0x1c) =

         *(undefined4 *)(*(int *)(param_1 + 8) + *(int *)(iVar2 + 0x20) * 4);

    *(int *)(*(int *)(param_1 + 8) + *(int *)(iVar2 + 0x20) * 4) = iVar2;

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

    return 1;

  }

  return 0;

}





// --- FUN_006b25a0 at 0x006B25A0 (size: 260) ---


int __thiscall FUN_006b25a0(int param_1,int param_2)



{

  int *piVar1;

  uint uVar2;

  int *piVar3;

  int iVar4;

  int *piVar5;

  uint uVar6;

  uint local_c;

  

  if (param_1 != param_2) {

    FUN_006b2120();

    if (*(void **)(param_1 + 8) != (void *)0x0) {

      operator_delete__(*(void **)(param_1 + 8));

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

    }

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

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);

    FUN_005a8440();

    local_c = 0;

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

      do {

        piVar1 = *(int **)(*(int *)(param_2 + 8) + local_c * 4);

        while (piVar3 = piVar1, piVar3 != (int *)0x0) {

          piVar1 = (int *)piVar3[2];

          iVar4 = FUN_006b1e10(piVar3);

          if ((iVar4 == 0) && (piVar5 = (int *)FUN_005df0f5(0x10), piVar5 != (int *)0x0)) {

            iVar4 = *piVar3;

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

            *piVar5 = iVar4;

            InterlockedIncrement((LONG *)(iVar4 + 4));

            piVar5[1] = piVar3[1];

            piVar5[2] = 0;

            iVar4 = *piVar3;

            uVar6 = *(uint *)(iVar4 + 0x10);

            if (uVar6 == 0xffffffff) {

              uVar6 = FUN_004fe440();

              *(uint *)(iVar4 + 0x10) = uVar6;

            }

            uVar6 = uVar6 % uVar2;

            piVar5[3] = uVar6;

            piVar5[2] = *(int *)(*(int *)(param_1 + 8) + uVar6 * 4);

            *(int **)(*(int *)(param_1 + 8) + uVar6 * 4) = piVar5;

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

          }

        }

        local_c = local_c + 1;

      } while (local_c < *(uint *)(param_2 + 0xc));

    }

  }

  return param_1;

}





// --- FUN_006b26b0 at 0x006B26B0 (size: 171) ---


void __fastcall FUN_006b26b0(int param_1)



{

  void *pvVar1;

  undefined4 *puVar2;

  void *pvVar3;

  LONG LVar4;

  uint local_8;

  

  if ((*(int *)(param_1 + 8) != 0) && (local_8 = 0, *(int *)(param_1 + 0xc) != 0)) {

    do {

      pvVar3 = *(void **)(*(int *)(param_1 + 8) + local_8 * 4);

      while (pvVar3 != (void *)0x0) {

        pvVar1 = *(void **)((int)pvVar3 + 0x1c);

        *(undefined4 *)((int)pvVar3 + 4) = &PTR_FUN_007e3f00;

        FUN_006b1da0();

        puVar2 = *(undefined4 **)((int)pvVar3 + 0x18);

        LVar4 = InterlockedDecrement(puVar2 + 1);

        if ((LVar4 == 0) && (puVar2 != (undefined4 *)0x0)) {

          (**(code **)*puVar2)(1);

        }

        FUN_005b19d0();

        *(undefined4 *)((int)pvVar3 + 4) = &PTR_FUN_0079385c;

        operator_delete(pvVar3);

        pvVar3 = pvVar1;

      }

      *(undefined4 *)(*(int *)(param_1 + 8) + local_8 * 4) = 0;

      local_8 = local_8 + 1;

    } while (local_8 < *(uint *)(param_1 + 0xc));

  }

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

  return;

}





// --- FUN_006b2760 at 0x006B2760 (size: 72) ---


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



{

  *param_1 = &PTR_FUN_00804cf8;

  FUN_006b2120();

  if ((void *)param_1[2] != (void *)0x0) {

    operator_delete__((void *)param_1[2]);

    param_1[2] = 0;

  }

  param_1[3] = 0;

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b27b0 at 0x006B27B0 (size: 28) ---


void FUN_006b27b0(void)



{

  FUN_006b2120();

  FUN_006b26b0();

  FUN_006b1da0();

  return;

}





// --- FUN_006b27d0 at 0x006B27D0 (size: 148) ---


bool __thiscall FUN_006b27d0(int param_1,undefined4 param_2,uint param_3)



{

  undefined4 uVar1;

  int iVar2;

  undefined4 unaff_EBX;

  undefined4 unaff_retaddr;

  

  if (param_3 < 0x10) {

    return false;

  }

  FUN_006b2120();

  FUN_006b26b0();

  FUN_006b1da0();

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

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

  iVar2 = (**(code **)(*(int *)(param_1 + 4) + 0x10))(param_2,param_3);

  if (iVar2 != 0) {

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

    iVar2 = (**(code **)(*(int *)(param_1 + 0x18) + 0x10))(uVar1,unaff_retaddr);

    if (iVar2 != 0) {

      iVar2 = (**(code **)(*(int *)(param_1 + 0x2c) + 0x10))(uVar1,unaff_retaddr);

      return iVar2 != 0;

    }

  }

  return false;

}





// --- FUN_006b2870 at 0x006B2870 (size: 118) ---


int __thiscall FUN_006b2870(int param_1,int param_2)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  if (param_1 != param_2) {

    FUN_006b26b0();

    uVar3 = 0;

    if (*(void **)(param_1 + 8) != (void *)0x0) {

      operator_delete__(*(void **)(param_1 + 8));

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

    }

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

    *(undefined4 *)(param_1 + 0xc) = *(undefined4 *)(param_2 + 0xc);

    FUN_005a8440();

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

      do {

        iVar2 = *(int *)(*(int *)(param_2 + 8) + uVar3 * 4);

        while (iVar2 != 0) {

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

          FUN_006b2510(iVar2,iVar2 + 4);

          iVar2 = iVar1;

        }

        uVar3 = uVar3 + 1;

      } while (uVar3 < *(uint *)(param_2 + 0xc));

    }

  }

  return param_1;

}





// --- FUN_006b2a40 at 0x006B2A40 (size: 72) ---


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



{

  *param_1 = &PTR_FUN_00804d0c;

  FUN_006b26b0();

  if ((void *)param_1[2] != (void *)0x0) {

    operator_delete__((void *)param_1[2]);

    param_1[2] = 0;

  }

  param_1[3] = 0;

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b2a90 at 0x006B2A90 (size: 128) ---


undefined4 * __fastcall FUN_006b2a90(undefined4 *param_1)



{

  LONG *lpAddend;

  

  *param_1 = &PTR_FUN_00804d20;

  param_1[1] = &PTR_FUN_00804cf8;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0x80;

  param_1[5] = 0;

  FUN_005a8440();

  param_1[6] = &PTR_FUN_00804d0c;

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0x80;

  param_1[10] = 0;

  FUN_005a8440();

  param_1[0xb] = &PTR_FUN_007e3f00;

  FUN_005b1900(0);

  lpAddend = (LONG *)(DAT_008ef11c + 4);

  param_1[0x10] = DAT_008ef11c;

  InterlockedIncrement(lpAddend);

  FUN_006b1da0();

  FUN_006b1da0();

  return param_1;

}





// --- FUN_006b2b10 at 0x006B2B10 (size: 203) ---


void __fastcall FUN_006b2b10(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  *param_1 = &PTR_FUN_00804d20;

  FUN_006b2120();

  FUN_006b26b0();

  FUN_006b1da0();

  param_1[0xb] = &PTR_FUN_007e3f00;

  FUN_006b1da0();

  puVar1 = (undefined4 *)param_1[0x10];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

    (**(code **)*puVar1)(1);

  }

  FUN_005b19d0();

  param_1[0xb] = &PTR_FUN_0079385c;

  param_1[6] = &PTR_FUN_00804d0c;

  FUN_006b26b0();

  if ((void *)param_1[8] != (void *)0x0) {

    operator_delete__((void *)param_1[8]);

    param_1[8] = 0;

  }

  param_1[9] = 0;

  param_1[6] = &PTR_FUN_0079385c;

  param_1[1] = &PTR_FUN_00804cf8;

  FUN_006b2120();

  if ((void *)param_1[3] != (void *)0x0) {

    operator_delete__((void *)param_1[3]);

    param_1[3] = 0;

  }

  param_1[4] = 0;

  param_1[1] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_006b2be0 at 0x006B2BE0 (size: 55) ---


int __thiscall FUN_006b2be0(int param_1,int param_2)



{

  if (param_2 != param_1) {

    FUN_006b25a0(param_2 + 4);

    FUN_006b2870(param_2 + 0x18);

    FUN_006b1d40(param_2 + 0x2c);

  }

  return param_1;

}





// --- FUN_006b2c20 at 0x006B2C20 (size: 30) ---


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



{

  FUN_006b2b10();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b2c40 at 0x006B2C40 (size: 17) ---


void __fastcall FUN_006b2c40(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00804d34;

  param_1[1] = 0;

  param_1[2] = 0;

  return;

}





// --- FUN_006b2cb0 at 0x006B2CB0 (size: 144) ---


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



{

  int iVar1;

  undefined4 uVar2;

  uint uVar3;

  

  if (*(int *)(param_1 + 4) * 4 + 4U <= param_3) {

    iVar1 = *(int *)*param_2;

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

    if (iVar1 != *(int *)(param_1 + 4)) {

      if (*(void **)(param_1 + 8) != (void *)0x0) {

        operator_delete__(*(void **)(param_1 + 8));

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

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

      }

      if (iVar1 != 0) {

        uVar2 = thunk_FUN_005df0f5(iVar1 * 4);

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

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

      }

    }

    uVar3 = 0;

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

      do {

        *(undefined4 *)(*(int *)(param_1 + 8) + uVar3 * 4) = *(undefined4 *)*param_2;

        *param_2 = *param_2 + 4;

        uVar3 = uVar3 + 1;

      } while (uVar3 < *(uint *)(param_1 + 4));

    }

    return 1;

  }

  return 0;

}





// --- FUN_006b2d40 at 0x006B2D40 (size: 67) ---


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



{

  *param_1 = &PTR_FUN_00804d34;

  if ((void *)param_1[2] != (void *)0x0) {

    operator_delete__((void *)param_1[2]);

    param_1[2] = 0;

    param_1[1] = 0;

  }

  *param_1 = &PTR_FUN_0079385c;

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b2d90 at 0x006B2D90 (size: 161) ---


void __fastcall FUN_006b2d90(int param_1)



{

  if (*(void **)(param_1 + 0x38) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x38));

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

  }

  if (*(void **)(param_1 + 0x3c) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x3c));

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

  }

  if (*(void **)(param_1 + 0x40) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x40));

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

  }

  if (*(void **)(param_1 + 0x44) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x44));

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

  }

  if (*(void **)(param_1 + 0x48) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x48));

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

  }

  if (*(void **)(param_1 + 0x4c) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x4c));

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

  }

  if (*(void **)(param_1 + 0x50) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x50));

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

  }

  if (*(void **)(param_1 + 0x54) != (void *)0x0) {

    operator_delete__(*(void **)(param_1 + 0x54));

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

  }

  return;

}





// --- FUN_006b2e40 at 0x006B2E40 (size: 36) ---


undefined4 __thiscall FUN_006b2e40(int *param_1,uint param_2)



{

  uint uVar1;

  

  uVar1 = (**(code **)(*param_1 + 0x5c))();

  if ((param_2 < uVar1) && (param_1[0xe] != 0)) {

    return *(undefined4 *)(param_1[0xe] + param_2 * 4);

  }

  return 0;

}





// --- FUN_006b2e70 at 0x006B2E70 (size: 110) ---


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



{

  uint uVar1;

  int iVar2;

  undefined4 *puVar3;

  

  uVar1 = (**(code **)(*param_1 + 0x5c))();

  if (uVar1 <= param_2) {

    return 0;

  }

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

    iVar2 = (**(code **)(*param_1 + 0x5c))();

    iVar2 = thunk_FUN_005df0f5(iVar2 << 2);

    param_1[0xe] = iVar2;

    if (iVar2 == 0) {

      return 0;

    }

    uVar1 = (**(code **)(*param_1 + 0x5c))();

    puVar3 = (undefined4 *)param_1[0xe];

    for (uVar1 = uVar1 & 0x3fffffff; uVar1 != 0; uVar1 = uVar1 - 1) {

      *puVar3 = 0;

      puVar3 = puVar3 + 1;

    }

    for (iVar2 = 0; iVar2 != 0; iVar2 = iVar2 + -1) {

      *(undefined1 *)puVar3 = 0;

      puVar3 = (undefined4 *)((int)puVar3 + 1);

    }

  }

  *(undefined4 *)(param_1[0xe] + param_2 * 4) = param_3;

  return 1;

}





// --- FUN_006b2ee0 at 0x006B2EE0 (size: 36) ---


undefined4 __thiscall FUN_006b2ee0(int *param_1,uint param_2)



{

  uint uVar1;

  

  uVar1 = (**(code **)(*param_1 + 0x68))();

  if ((param_2 < uVar1) && (param_1[0x11] != 0)) {

    return *(undefined4 *)(param_1[0x11] + param_2 * 4);

  }

  return 0;

}





// --- FUN_006b2f10 at 0x006B2F10 (size: 6) ---


undefined4 FUN_006b2f10(void)



{

  return 0x1c;

}





// --- FUN_006b2f20 at 0x006B2F20 (size: 605) ---


int __thiscall

FUN_006b2f20(int *param_1,int *param_2,int *param_3,int *param_4,int *param_5,int *param_6,

            int *param_7,int *param_8,int *param_9)



{

  int iVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  

  *param_2 = 0;

  *param_3 = 0;

  *param_4 = 0;

  *param_5 = 0;

  *param_6 = 0;

  *param_7 = 0;

  *param_8 = 0;

  *param_9 = 0;

  iVar3 = 4;

  uVar4 = 0;

  iVar1 = (**(code **)(*param_1 + 0x5c))();

  if (0 < iVar1) {

    do {

      uVar2 = (**(code **)(*param_1 + 0x5c))();

      if (((uVar4 < uVar2) && (param_1[0xe] != 0)) && (*(int *)(param_1[0xe] + uVar4 * 4) != 0)) {

        iVar3 = iVar3 + 4;

        *param_2 = *param_2 + 1;

      }

      uVar4 = uVar4 + 1;

      iVar1 = (**(code **)(*param_1 + 0x5c))();

    } while ((int)uVar4 < iVar1);

  }

  iVar3 = iVar3 + 4;

  uVar4 = 0;

  iVar1 = (**(code **)(*param_1 + 0x60))();

  if (0 < iVar1) {

    do {

      uVar2 = (**(code **)(*param_1 + 0x60))();

      if (((uVar4 < uVar2) && (param_1[0xf] != 0)) && (*(int *)(param_1[0xf] + uVar4 * 4) != 0)) {

        iVar3 = iVar3 + 4;

        *param_3 = *param_3 + 1;

      }

      uVar4 = uVar4 + 1;

      iVar1 = (**(code **)(*param_1 + 0x60))();

    } while ((int)uVar4 < iVar1);

  }

  iVar3 = iVar3 + 4;

  uVar4 = 0;

  iVar1 = (**(code **)(*param_1 + 100))();

  if (0 < iVar1) {

    do {

      uVar2 = (**(code **)(*param_1 + 100))();

      if (((uVar4 < uVar2) && (param_1[0x10] != 0)) && (*(int *)(param_1[0x10] + uVar4 * 4) != 0)) {

        iVar3 = iVar3 + 4;

        *param_4 = *param_4 + 1;

      }

      uVar4 = uVar4 + 1;

      iVar1 = (**(code **)(*param_1 + 100))();

    } while ((int)uVar4 < iVar1);

  }

  iVar3 = iVar3 + 4;

  uVar4 = 0;

  iVar1 = (**(code **)(*param_1 + 0x68))();

  if (0 < iVar1) {

    do {

      uVar2 = (**(code **)(*param_1 + 0x68))();

      if (((uVar4 < uVar2) && (param_1[0x11] != 0)) && (*(int *)(param_1[0x11] + uVar4 * 4) != 0)) {

        iVar3 = iVar3 + 4;

        *param_5 = *param_5 + 1;

      }

      uVar4 = uVar4 + 1;

      iVar1 = (**(code **)(*param_1 + 0x68))();

    } while ((int)uVar4 < iVar1);

  }

  iVar3 = iVar3 + 4;

  uVar4 = 0;

  iVar1 = (**(code **)(*param_1 + 0x6c))();

  if (0 < iVar1) {

    do {

      uVar2 = (**(code **)(*param_1 + 0x6c))();

      if (((uVar4 < uVar2) && (param_1[0x13] != 0)) && (*(int *)(param_1[0x13] + uVar4 * 4) != 0)) {

        iVar3 = iVar3 + 4;

        *param_6 = *param_6 + 1;

      }

      uVar4 = uVar4 + 1;

      iVar1 = (**(code **)(*param_1 + 0x6c))();

    } while ((int)uVar4 < iVar1);

  }

  iVar3 = iVar3 + 4;

  uVar4 = 0;

  iVar1 = (**(code **)(*param_1 + 0x70))();

  if (0 < iVar1) {

    do {

      uVar2 = (**(code **)(*param_1 + 0x70))();

      if (((uVar4 < uVar2) && (param_1[0x14] != 0)) && (*(int *)(param_1[0x14] + uVar4 * 4) != 0)) {

        iVar3 = iVar3 + 4;

        *param_7 = *param_7 + 1;

      }

      uVar4 = uVar4 + 1;

      iVar1 = (**(code **)(*param_1 + 0x70))();

    } while ((int)uVar4 < iVar1);

  }

  iVar3 = iVar3 + 4;

  uVar4 = 0;

  iVar1 = (**(code **)(*param_1 + 0x74))();

  if (0 < iVar1) {

    do {

      uVar2 = (**(code **)(*param_1 + 0x74))();

      if (((uVar4 < uVar2) && (param_1[0x12] != 0)) && (*(int *)(param_1[0x12] + uVar4 * 4) != 0)) {

        iVar3 = iVar3 + 4;

        *param_8 = *param_8 + 1;

      }

      uVar4 = uVar4 + 1;

      iVar1 = (**(code **)(*param_1 + 0x74))();

    } while ((int)uVar4 < iVar1);

  }

  iVar3 = iVar3 + 4;

  uVar4 = 0;

  iVar1 = (**(code **)(*param_1 + 0x78))();

  if (0 < iVar1) {

    do {

      uVar2 = (**(code **)(*param_1 + 0x78))();

      if (((uVar4 < uVar2) && (param_1[0x15] != 0)) && (*(int *)(param_1[0x15] + uVar4 * 4) != 0)) {

        iVar3 = iVar3 + 4;

        *param_9 = *param_9 + 1;

      }

      uVar4 = uVar4 + 1;

      iVar1 = (**(code **)(*param_1 + 0x78))();

    } while ((int)uVar4 < iVar1);

  }

  return iVar3;

}





// --- FUN_006b3180 at 0x006B3180 (size: 65) ---


undefined4 * __thiscall FUN_006b3180(undefined4 *param_1,undefined4 param_2)



{

  FUN_00415460(param_2);

  param_1[0xc] = &PTR_FUN_0079385c;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  *param_1 = &PTR_LAB_007e93d0;

  param_1[0xc] = &PTR_LAB_007e93b8;

  return param_1;

}





// --- FUN_006b31d0 at 0x006B31D0 (size: 36) ---


void __fastcall FUN_006b31d0(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_007e93d0;

  param_1[0xc] = &PTR_LAB_007e93b8;

  FUN_006b2d90();

  param_1[0xc] = &PTR_FUN_0079385c;

  FUN_004154b0();

  return;

}





// --- FUN_006b3200 at 0x006B3200 (size: 647) ---


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



{

  int *piVar1;

  uint uVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  undefined4 local_20;

  undefined4 local_1c;

  undefined4 local_18;

  undefined4 local_14;

  undefined4 local_10;

  undefined4 local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  piVar1 = (int *)(param_1 + -0x30);

  uVar2 = FUN_006b2f20(&local_20,&local_1c,&local_18,&local_14,&local_10,&local_c,&local_8,&local_4)

  ;

  if (uVar2 <= param_3) {

    *(undefined4 *)*param_2 = local_20;

    iVar3 = *param_2;

    *param_2 = iVar3 + 4;

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

    iVar3 = *param_2;

    *param_2 = iVar3 + 4;

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

    iVar3 = *param_2;

    *param_2 = iVar3 + 4;

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

    iVar3 = *param_2;

    *param_2 = iVar3 + 4;

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

    iVar3 = *param_2;

    *param_2 = iVar3 + 4;

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

    iVar3 = *param_2;

    *param_2 = iVar3 + 4;

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

    iVar3 = *param_2;

    *param_2 = iVar3 + 4;

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

    *param_2 = *param_2 + 4;

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 0x5c))();

    if (0 < iVar3) {

      do {

        uVar4 = (**(code **)(*piVar1 + 0x5c))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 8) != 0)) &&

           (*(int *)(*(int *)(param_1 + 8) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        iVar3 = (**(code **)(*piVar1 + 0x5c))();

      } while ((int)uVar5 < iVar3);

    }

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 0x60))();

    if (0 < iVar3) {

      do {

        uVar4 = (**(code **)(*piVar1 + 0x60))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 0xc) != 0)) &&

           (*(int *)(*(int *)(param_1 + 0xc) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        iVar3 = (**(code **)(*piVar1 + 0x60))();

      } while ((int)uVar5 < iVar3);

    }

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 100))();

    if (0 < iVar3) {

      do {

        uVar4 = (**(code **)(*piVar1 + 100))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 0x10) != 0)) &&

           (*(int *)(*(int *)(param_1 + 0x10) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        iVar3 = (**(code **)(*piVar1 + 100))();

      } while ((int)uVar5 < iVar3);

    }

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 0x68))();

    if (0 < iVar3) {

      do {

        uVar4 = (**(code **)(*piVar1 + 0x68))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 0x14) != 0)) &&

           (*(int *)(*(int *)(param_1 + 0x14) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        iVar3 = (**(code **)(*piVar1 + 0x68))();

      } while ((int)uVar5 < iVar3);

    }

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 0x6c))();

    if (0 < iVar3) {

      do {

        uVar4 = (**(code **)(*piVar1 + 0x6c))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 0x1c) != 0)) &&

           (*(int *)(*(int *)(param_1 + 0x1c) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        iVar3 = (**(code **)(*piVar1 + 0x6c))();

      } while ((int)uVar5 < iVar3);

    }

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 0x70))();

    if (0 < iVar3) {

      do {

        uVar4 = (**(code **)(*piVar1 + 0x70))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 0x20) != 0)) &&

           (*(int *)(*(int *)(param_1 + 0x20) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        iVar3 = (**(code **)(*piVar1 + 0x70))();

      } while ((int)uVar5 < iVar3);

    }

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 0x74))();

    if (0 < iVar3) {

      do {

        uVar4 = (**(code **)(*piVar1 + 0x74))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 0x18) != 0)) &&

           (*(int *)(*(int *)(param_1 + 0x18) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        iVar3 = (**(code **)(*piVar1 + 0x74))();

      } while ((int)uVar5 < iVar3);

    }

    uVar5 = 0;

    iVar3 = (**(code **)(*piVar1 + 0x78))();

    if (0 < iVar3) {

      do {

        uVar4 = (**(code **)(*piVar1 + 0x78))();

        if (((uVar5 < uVar4) && (*(int *)(param_1 + 0x24) != 0)) &&

           (*(int *)(*(int *)(param_1 + 0x24) + uVar5 * 4) != 0)) {

          *(uint *)*param_2 = uVar5;

          *param_2 = *param_2 + 4;

        }

        uVar5 = uVar5 + 1;

        iVar3 = (**(code **)(*piVar1 + 0x78))();

      } while ((int)uVar5 < iVar3);

    }

  }

  return uVar2;

}





// --- FUN_006b3490 at 0x006B3490 (size: 967) ---


bool __thiscall FUN_006b3490(int param_1,int *param_2,uint param_3)



{

  int *piVar1;

  int iVar2;

  int *piVar3;

  int iVar4;

  int iVar5;

  int iVar6;

  int iVar7;

  int iVar8;

  int iVar9;

  int iVar10;

  undefined4 uVar11;

  uint uVar12;

  int *piVar13;

  uint uVar14;

  int iVar15;

  undefined4 *puVar16;

  

  piVar13 = param_2;

  if (param_3 < 0x1c) {

    return false;

  }

  iVar2 = *param_2;

  piVar1 = (int *)(param_1 + -0x30);

  (**(code **)(*(int *)(param_1 + -0x30) + 0x58))();

  piVar3 = (int *)*param_2;

  iVar15 = *piVar3;

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

  iVar4 = piVar3[1];

  *param_2 = (int)(piVar3 + 2);

  iVar5 = piVar3[2];

  *param_2 = (int)(piVar3 + 3);

  iVar6 = piVar3[3];

  *param_2 = (int)(piVar3 + 4);

  iVar7 = piVar3[4];

  *param_2 = (int)(piVar3 + 5);

  iVar8 = piVar3[5];

  *param_2 = (int)(piVar3 + 6);

  iVar9 = piVar3[6];

  *param_2 = (int)(piVar3 + 7);

  iVar10 = piVar3[7];

  *param_2 = (int)(piVar3 + 8);

  param_2 = (int *)iVar15;

  if (0 < iVar15) {

    do {

      uVar11 = *(undefined4 *)*piVar13;

      *piVar13 = (int)((undefined4 *)*piVar13 + 1);

      FUN_006b2e70(uVar11,1);

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

    } while (param_2 != (int *)0x0);

  }

  param_2 = (int *)iVar4;

  if (0 < iVar4) {

    do {

      uVar12 = *(uint *)*piVar13;

      *piVar13 = (int)((uint *)*piVar13 + 1);

      uVar14 = (**(code **)(*piVar1 + 0x60))();

      if (uVar12 < uVar14) {

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

          iVar15 = (**(code **)(*piVar1 + 0x60))();

          iVar15 = thunk_FUN_005df0f5(iVar15 << 2);

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

          if (iVar15 == 0) goto LAB_006b3596;

          uVar14 = (**(code **)(*piVar1 + 0x60))();

          puVar16 = *(undefined4 **)(param_1 + 0xc);

          for (uVar14 = uVar14 & 0x3fffffff; uVar14 != 0; uVar14 = uVar14 - 1) {

            *puVar16 = 0;

            puVar16 = puVar16 + 1;

          }

          for (iVar15 = 0; iVar15 != 0; iVar15 = iVar15 + -1) {

            *(undefined1 *)puVar16 = 0;

            puVar16 = (undefined4 *)((int)puVar16 + 1);

          }

        }

        *(undefined4 *)(*(int *)(param_1 + 0xc) + uVar12 * 4) = 1;

      }

LAB_006b3596:

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

    } while (param_2 != (int *)0x0);

  }

  param_2 = (int *)iVar5;

  if (0 < iVar5) {

    do {

      uVar12 = *(uint *)*piVar13;

      *piVar13 = (int)((uint *)*piVar13 + 1);

      uVar14 = (**(code **)(*piVar1 + 100))();

      if (uVar12 < uVar14) {

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

          iVar15 = (**(code **)(*piVar1 + 100))();

          iVar15 = thunk_FUN_005df0f5(iVar15 << 2);

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

          if (iVar15 == 0) goto LAB_006b3606;

          uVar14 = (**(code **)(*piVar1 + 100))();

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

          for (uVar14 = uVar14 & 0x3fffffff; uVar14 != 0; uVar14 = uVar14 - 1) {

            *puVar16 = 0;

            puVar16 = puVar16 + 1;

          }

          for (iVar15 = 0; iVar15 != 0; iVar15 = iVar15 + -1) {

            *(undefined1 *)puVar16 = 0;

            puVar16 = (undefined4 *)((int)puVar16 + 1);

          }

        }

        *(undefined4 *)(*(int *)(param_1 + 0x10) + uVar12 * 4) = 1;

      }

LAB_006b3606:

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

    } while (param_2 != (int *)0x0);

  }

  param_2 = (int *)iVar6;

  if (0 < iVar6) {

    do {

      uVar12 = *(uint *)*piVar13;

      *piVar13 = (int)((uint *)*piVar13 + 1);

      uVar14 = (**(code **)(*piVar1 + 0x68))();

      if (uVar12 < uVar14) {

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

          iVar15 = (**(code **)(*piVar1 + 0x68))();

          iVar15 = thunk_FUN_005df0f5(iVar15 << 2);

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

          if (iVar15 == 0) goto LAB_006b3676;

          uVar14 = (**(code **)(*piVar1 + 0x68))();

          puVar16 = *(undefined4 **)(param_1 + 0x14);

          for (uVar14 = uVar14 & 0x3fffffff; uVar14 != 0; uVar14 = uVar14 - 1) {

            *puVar16 = 0;

            puVar16 = puVar16 + 1;

          }

          for (iVar15 = 0; iVar15 != 0; iVar15 = iVar15 + -1) {

            *(undefined1 *)puVar16 = 0;

            puVar16 = (undefined4 *)((int)puVar16 + 1);

          }

        }

        *(undefined4 *)(*(int *)(param_1 + 0x14) + uVar12 * 4) = 1;

      }

LAB_006b3676:

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

    } while (param_2 != (int *)0x0);

  }

  param_2 = (int *)iVar7;

  if (0 < iVar7) {

    do {

      uVar12 = *(uint *)*piVar13;

      *piVar13 = (int)((uint *)*piVar13 + 1);

      uVar14 = (**(code **)(*piVar1 + 0x6c))();

      if (uVar12 < uVar14) {

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

          iVar15 = (**(code **)(*piVar1 + 0x6c))();

          iVar15 = thunk_FUN_005df0f5(iVar15 << 2);

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

          if (iVar15 == 0) goto LAB_006b36e6;

          uVar14 = (**(code **)(*piVar1 + 0x6c))();

          puVar16 = *(undefined4 **)(param_1 + 0x1c);

          for (uVar14 = uVar14 & 0x3fffffff; uVar14 != 0; uVar14 = uVar14 - 1) {

            *puVar16 = 0;

            puVar16 = puVar16 + 1;

          }

          for (iVar15 = 0; iVar15 != 0; iVar15 = iVar15 + -1) {

            *(undefined1 *)puVar16 = 0;

            puVar16 = (undefined4 *)((int)puVar16 + 1);

          }

        }

        *(undefined4 *)(*(int *)(param_1 + 0x1c) + uVar12 * 4) = 1;

      }

LAB_006b36e6:

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

    } while (param_2 != (int *)0x0);

  }

  param_2 = (int *)iVar8;

  if (0 < iVar8) {

    do {

      uVar12 = *(uint *)*piVar13;

      *piVar13 = (int)((uint *)*piVar13 + 1);

      uVar14 = (**(code **)(*piVar1 + 0x70))();

      if (uVar12 < uVar14) {

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

          iVar15 = (**(code **)(*piVar1 + 0x70))();

          iVar15 = thunk_FUN_005df0f5(iVar15 << 2);

          *(int *)(param_1 + 0x20) = iVar15;

          if (iVar15 == 0) goto LAB_006b3756;

          uVar14 = (**(code **)(*piVar1 + 0x70))();

          puVar16 = *(undefined4 **)(param_1 + 0x20);

          for (uVar14 = uVar14 & 0x3fffffff; uVar14 != 0; uVar14 = uVar14 - 1) {

            *puVar16 = 0;

            puVar16 = puVar16 + 1;

          }

          for (iVar15 = 0; iVar15 != 0; iVar15 = iVar15 + -1) {

            *(undefined1 *)puVar16 = 0;

            puVar16 = (undefined4 *)((int)puVar16 + 1);

          }

        }

        *(undefined4 *)(*(int *)(param_1 + 0x20) + uVar12 * 4) = 1;

      }

LAB_006b3756:

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

    } while (param_2 != (int *)0x0);

  }

  param_2 = (int *)iVar9;

  if (0 < iVar9) {

    do {

      uVar12 = *(uint *)*piVar13;

      *piVar13 = (int)((uint *)*piVar13 + 1);

      uVar14 = (**(code **)(*piVar1 + 0x74))();

      if (uVar12 < uVar14) {

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

          iVar15 = (**(code **)(*piVar1 + 0x74))();

          iVar15 = thunk_FUN_005df0f5(iVar15 << 2);

          *(int *)(param_1 + 0x18) = iVar15;

          if (iVar15 == 0) goto LAB_006b37c6;

          uVar14 = (**(code **)(*piVar1 + 0x74))();

          puVar16 = *(undefined4 **)(param_1 + 0x18);

          for (uVar14 = uVar14 & 0x3fffffff; uVar14 != 0; uVar14 = uVar14 - 1) {

            *puVar16 = 0;

            puVar16 = puVar16 + 1;

          }

          for (iVar15 = 0; iVar15 != 0; iVar15 = iVar15 + -1) {

            *(undefined1 *)puVar16 = 0;

            puVar16 = (undefined4 *)((int)puVar16 + 1);

          }

        }

        *(undefined4 *)(*(int *)(param_1 + 0x18) + uVar12 * 4) = 1;

      }

LAB_006b37c6:

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

    } while (param_2 != (int *)0x0);

  }

  param_2 = (int *)iVar10;

  if (0 < iVar10) {

    do {

      uVar12 = *(uint *)*piVar13;

      *piVar13 = (int)((uint *)*piVar13 + 1);

      uVar14 = (**(code **)(*piVar1 + 0x78))();

      if (uVar12 < uVar14) {

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

          iVar15 = (**(code **)(*piVar1 + 0x78))();

          iVar15 = thunk_FUN_005df0f5(iVar15 << 2);

          *(int *)(param_1 + 0x24) = iVar15;

          if (iVar15 == 0) goto LAB_006b3836;

          uVar14 = (**(code **)(*piVar1 + 0x78))();

          puVar16 = *(undefined4 **)(param_1 + 0x24);

          for (uVar14 = uVar14 & 0x3fffffff; uVar14 != 0; uVar14 = uVar14 - 1) {

            *puVar16 = 0;

            puVar16 = puVar16 + 1;

          }

          for (iVar15 = 0; iVar15 != 0; iVar15 = iVar15 + -1) {

            *(undefined1 *)puVar16 = 0;

            puVar16 = (undefined4 *)((int)puVar16 + 1);

          }

        }

        *(undefined4 *)(*(int *)(param_1 + 0x24) + uVar12 * 4) = 1;

      }

LAB_006b3836:

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

    } while (param_2 != (int *)0x0);

  }

  return (uint)(*piVar13 - iVar2) <= param_3;

}





// --- FUN_006b3860 at 0x006B3860 (size: 63) ---


undefined4 __thiscall FUN_006b3860(int param_1,byte param_2)



{

  byte bVar1;

  uint uVar2;

  bool bVar3;

  

  bVar1 = *(byte *)(param_1 + 0x7c);

  uVar2 = (int)((uint)param_2 - (uint)bVar1) >> 0x1f;

  if ((int)(((uint)param_2 - (uint)bVar1 ^ uVar2) - uVar2) < 0x80) {

    bVar3 = param_2 < bVar1;

  }

  else {

    bVar3 = bVar1 < param_2;

  }

  if (bVar3) {

    return 0;

  }

  *(byte *)(param_1 + 0x7c) = param_2;

  return 1;

}





// --- FUN_006b3920 at 0x006B3920 (size: 93) ---


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



{

  undefined1 *puVar1;

  uint uVar2;

  int iVar3;

  

  puVar1 = (undefined1 *)*param_2;

  *(undefined1 *)(param_1 + 0x7c) = *puVar1;

  uVar2 = *param_2;

  *param_2 = uVar2 + 1;

  uVar2 = (uVar2 + 1) - (int)puVar1;

  if (uVar2 < param_3) {

    iVar3 = param_3 - uVar2;

  }

  else {

    iVar3 = 0;

  }

  (**(code **)(*(int *)(param_1 + 0x78) + 0x10))(param_2,iVar3);

  uVar2 = *param_2 & 0x80000003;

  if ((int)uVar2 < 0) {

    uVar2 = (uVar2 - 1 | 0xfffffffc) + 1;

  }

  if (uVar2 != 0) {

    for (iVar3 = 4 - uVar2; iVar3 != 0; iVar3 = iVar3 + -1) {

      *(undefined1 *)*param_2 = 0;

      *param_2 = *param_2 + 1;

    }

  }

  return 1;

}





// --- FUN_006b3980 at 0x006B3980 (size: 64) ---


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



{

  *param_1 = &PTR_FUN_00804d48;

  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_006b39c0 at 0x006B39C0 (size: 82) ---


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



{

  *param_1 = &PTR_FUN_00804d4c;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_00804d48;

  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_006b3a20 at 0x006B3A20 (size: 46) ---


undefined * __fastcall FUN_006b3a20(undefined4 param_1)



{

  undefined *puVar1;

  undefined *puVar2;

  

  puVar1 = PTR_DAT_00818558;

  puVar2 = (undefined *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&stack0x00000004,param_1,0);

  if (puVar2 == puVar1) {

    puVar2 = puVar2 + -4;

  }

  return puVar2;

}





// --- FUN_006b3a50 at 0x006B3A50 (size: 53) ---


undefined4 FUN_006b3a50(undefined4 param_1)



{

  undefined *puVar1;

  undefined4 *puVar2;

  

  puVar1 = PTR_DAT_00818558;

  puVar2 = (undefined4 *)FUN_00422d20(PTR_DAT_00818554,PTR_DAT_00818558,&param_1,param_1,0);

  if (puVar2 == (undefined4 *)puVar1) {

    puVar2 = puVar2 + -1;

  }

  return *puVar2;

}





// --- FUN_006b3aa0 at 0x006B3AA0 (size: 96) ---


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



{

  param_1[0x1d] = &PTR_LAB_00804d50;

  param_1[0x1d] = &PTR_FUN_0079385c;

  *param_1 = &PTR_FUN_00804d4c;

  FUN_005870f0();

  param_1[1] = &PTR_FUN_00804d48;

  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_006b3b00 at 0x006B3B00 (size: 143) ---


undefined4 * __thiscall FUN_006b3b00(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_00804d48;

  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_006b3b90 at 0x006B3B90 (size: 89) ---


void __fastcall FUN_006b3b90(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00804d68;

  param_1[0x1e] = &PTR_LAB_00804d50;

  param_1[0x1e] = &PTR_FUN_0079385c;

  param_1[1] = &PTR_FUN_00804d4c;

  FUN_005870f0();

  param_1[2] = &PTR_FUN_00804d48;

  if ((undefined4 *)param_1[0x1a] != param_1 + 3) {

    operator_delete__((undefined4 *)param_1[0x1a]);

  }

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_006b3bf0 at 0x006B3BF0 (size: 30) ---


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



{

  FUN_006b3b90();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b3c10 at 0x006B3C10 (size: 55) ---


undefined4 * __fastcall FUN_006b3c10(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_00804d68;

  param_1[1] = &PTR_FUN_00804d4c;

  FUN_006b3b00(0x17);

  param_1[0x1e] = &PTR_FUN_007cab80;

  param_1[1] = &PTR_FUN_00804d7c;

  param_1[0x1e] = &PTR_LAB_00804d50;

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

  return param_1;

}





// --- FUN_006b3c50 at 0x006B3C50 (size: 88) ---


undefined4 FUN_006b3c50(undefined4 *param_1,undefined1 *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;

    *(undefined1 *)(puVar2 + 2) = *param_2;

  }

  cVar1 = FUN_0042bd40(puVar2);

  if (cVar1 == '\0') {

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

      operator_delete(puVar2);

    }

    return 0;

  }

  return 1;

}





// --- FUN_006b3cb0 at 0x006B3CB0 (size: 148) ---


undefined1 __thiscall FUN_006b3cb0(int param_1,uint param_2,byte param_3)



{

  byte bVar1;

  uint *puVar2;

  undefined1 uVar3;

  uint uVar4;

  bool bVar5;

  

  puVar2 = *(uint **)(*(int *)(param_1 + 0x68) + (param_2 % *(uint *)(param_1 + 0x70)) * 4);

  do {

    if (puVar2 == (uint *)0x0) {

LAB_006b3cdb:

      uVar3 = FUN_006b3c50(&param_2,&param_3);

      return uVar3;

    }

    if (*puVar2 == param_2) {

      if ((puVar2 != (uint *)0x0) && (puVar2 = puVar2 + 2, puVar2 != (uint *)0x0)) {

        bVar1 = (byte)*puVar2;

        uVar4 = (int)((uint)param_3 - (uint)bVar1) >> 0x1f;

        if ((int)(((uint)param_3 - (uint)bVar1 ^ uVar4) - uVar4) < 0x80) {

          bVar5 = param_3 < bVar1;

        }

        else {

          bVar5 = bVar1 < param_3;

        }

        if (bVar5) {

          DAT_008fb76c = DAT_008fb76c + 1;

          return 0;

        }

        *(byte *)puVar2 = param_3;

        return 1;

      }

      goto LAB_006b3cdb;

    }

    puVar2 = (uint *)puVar2[1];

  } while( true );

}





// --- FUN_006b3f40 at 0x006B3F40 (size: 25) ---


void __thiscall FUN_006b3f40(undefined4 *param_1,undefined4 *param_2)



{

  *param_1 = *param_2;

  param_1[1] = param_2[1];

  param_1[2] = param_2[2];

  return;

}





// --- FUN_006b3f60 at 0x006B3F60 (size: 17) ---


void __thiscall FUN_006b3f60(undefined4 param_1,undefined4 *param_2)



{

  *param_2 = param_1;

  param_2[1] = 0;

  param_2[2] = 0;

  return;

}





// --- FUN_006b3f80 at 0x006B3F80 (size: 131) ---


undefined4 FUN_006b3f80(int param_1,undefined1 *param_2,int *param_3,int *param_4)



{

  undefined1 *puVar1;

  

  if (param_1 != 0) {

    if (param_1 != 1) {

      if (param_1 != 2) {

        return 0;

      }

      puVar1 = (undefined1 *)*param_3;

      if (*param_4 != 0) {

        *param_2 = *puVar1;

        *param_3 = *param_3 + 1;

        *param_4 = (int)(puVar1 + (*param_4 - *param_3));

        return 1;

      }

      *param_4 = *param_4;

      return 0;

    }

    if (*param_4 != 0) {

      *(undefined1 *)*param_3 = *param_2;

      *param_3 = *param_3 + 1;

      *param_4 = *param_4 + -1;

      return 1;

    }

  }

  *param_4 = *param_4 + -1;

  return 1;

}





// --- FUN_006b4010 at 0x006B4010 (size: 42) ---


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



{

  int iVar1;

  

  if (7 < param_3) {

    *(undefined4 *)*param_2 = 0xf7b1;

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  return 8;

}





// --- FUN_006b40b0 at 0x006B40B0 (size: 39) ---


void __fastcall FUN_006b40b0(int *param_1)



{

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

    param_1[0xd] = 1;

    (**(code **)(*param_1 + 0xcc))(0,0);

                    /* WARNING: Could not recover jumptable at 0x006b40d2. Too many branches */

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_006b40e0 at 0x006B40E0 (size: 28) ---


void FUN_006b40e0(void)



{

  FUN_006b59b0();

  FUN_006b59b0();

  FUN_006b59b0();

  return;

}





// --- FUN_006b4130 at 0x006B4130 (size: 81) ---


void __fastcall FUN_006b4130(int *param_1)



{

  FUN_006b5a10();

  FUN_006b5a10();

  FUN_006b5a10();

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

  param_1[0xf] = 0;

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

  if ((param_1[0xc] != 0) && (param_1[0xd] == 0)) {

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

                    /* WARNING: Could not recover jumptable at 0x006b417c. Too many branches */

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_006b4190 at 0x006B4190 (size: 57) ---


void __fastcall FUN_006b4190(int *param_1)



{

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

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

  param_1[0xf] = 0;

  if (((param_1[0xc] != 0) && (param_1[2] != 0)) && (param_1[0xd] == 0)) {

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

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

  }

  param_1[0x11] = 0;

  return;

}





// --- FUN_006b41f0 at 0x006B41F0 (size: 23) ---


void __fastcall FUN_006b41f0(int *param_1)



{

  (**(code **)(*param_1 + 0xcc))(0,1);

                    /* WARNING: Could not recover jumptable at 0x006b4204. Too many branches */

                    /* WARNING: Treating indirect jump as call */

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

  return;

}





// --- FUN_006b4210 at 0x006B4210 (size: 85) ---


void __fastcall FUN_006b4210(int *param_1)



{

  int iVar1;

  

  if ((param_1[0xd] != 0) && (param_1[0xc] != 0)) {

    iVar1 = (**(code **)(*param_1 + 0x78))();

    if (iVar1 == 0) {

      param_1[0xd] = 0;

      if (param_1[2] != 0) {

        *(undefined4 *)(param_1[2] + 0xcc) = 1;

        FUN_00510c50(1);

        FUN_0050f610();

      }

      (**(code **)(*param_1 + 0x20))(param_1[0xe]);

                    /* WARNING: Could not recover jumptable at 0x006b4260. Too many branches */

                    /* WARNING: Treating indirect jump as call */

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

      return;

    }

  }

  return;

}





// --- FUN_006b42b0 at 0x006B42B0 (size: 146) ---


void __thiscall FUN_006b42b0(int *param_1,int param_2)



{

  int iVar1;

  uint uVar2;

  undefined4 uVar3;

  

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

    param_1[0xe] = (uint)(param_2 != 0);

    iVar1 = (**(code **)(*param_1 + 0x3c))();

    uVar2 = (uint)((param_1[0xe] == 0) != (iVar1 == 0));

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

      uVar3 = 1;

      FUN_00512b90(uVar2,1);

      FUN_00529780(uVar2,uVar3);

      return;

    }

    if (uVar2 != 0) {

      (**(code **)(*param_1 + 0xe8))(0x85000001,0x3f800000);

      return;

    }

    (**(code **)(*param_1 + 0xec))(0x85000001,0);

  }

  return;

}





// --- FUN_006b4350 at 0x006B4350 (size: 32) ---


void __fastcall FUN_006b4350(int *param_1)



{

  int unaff_retaddr;

  

  (**(code **)(*param_1 + 0x30))(param_1 + 6);

  param_1[0xf] = unaff_retaddr;

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

  return;

}





// --- FUN_006b4370 at 0x006B4370 (size: 222) ---


void __fastcall FUN_006b4370(int *param_1)



{

  int iVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  

  if (param_1[2] == 0) {

    return;

  }

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

    iVar1 = FUN_006b5980();

    if (iVar1 != 0) {

      (**(code **)(*param_1 + 0x2c))(param_1 + 3);

      goto LAB_006b43d0;

    }

    if (param_1[0x10] != 0) goto LAB_006b43d0;

    uVar4 = 0;

    uVar3 = 0;

    iVar1 = 0x3f800000;

    uVar2 = 0x41000003;

  }

  else {

    iVar1 = param_1[0x15];

    uVar4 = 1;

    uVar3 = 1;

    uVar2 = 0x45000005;

  }

  (**(code **)(*param_1 + 0xa0))(uVar2,1,iVar1,uVar3,uVar4);

LAB_006b43d0:

  iVar1 = FUN_006b5980();

  if (iVar1 == 0) {

    (**(code **)(*param_1 + 0xa0))(0x6500000f,0,0x3f800000,0,0);

    (**(code **)(*param_1 + 0xa0))(0x6500000d,0,0x3f800000,0,0);

  }

  else {

    (**(code **)(*param_1 + 0x2c))(param_1 + 6);

  }

  iVar1 = FUN_006b5980();

  if (iVar1 == 0) {

    (**(code **)(*param_1 + 0xa0))(0x6500000f,0,0x3f800000,0,0);

    return;

  }

  (**(code **)(*param_1 + 0x2c))(param_1 + 9);

  return;

}





// --- FUN_006b4890 at 0x006B4890 (size: 62) ---


int __thiscall FUN_006b4890(int param_1,uint param_2)



{

  int iVar1;

  

  iVar1 = 0;

  switch(param_2) {

  case 0x6500000d:

  case 0x6500000e:

    return param_1 + 0x18;

  case 0x6500000f:

  case 0x65000010:

    return param_1 + 0x24;

  }

  if (((param_2 & 0x40000000) != 0) && ((param_2 & 0x4000000) != 0)) {

    iVar1 = param_1 + 0xc;

  }

  return iVar1;

}





// --- FUN_006b4960 at 0x006B4960 (size: 164) ---


undefined4 __thiscall

FUN_006b4960(int *param_1,undefined4 *param_2,undefined4 *param_3,undefined4 *param_4,

            undefined4 *param_5)



{

  int *piVar1;

  int iVar2;

  undefined4 uVar3;

  

  piVar1 = (int *)(**(code **)(*param_1 + 0xc))(*param_2);

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

    return 0;

  }

  iVar2 = FUN_006b58a0(*param_2,*param_3,*param_4);

  if (((iVar2 != 0) && (param_1[0x10] == 0)) && ((param_1[0x12] == 0 || (piVar1 != param_1 + 3)))) {

    iVar2 = FUN_006b5980();

    if (iVar2 != 0) {

      *param_2 = *(undefined4 *)(iVar2 + 8);

      *param_3 = *(undefined4 *)(iVar2 + 0xc);

      *param_2 = 1;

      uVar3 = FUN_006b5990();

      *param_4 = uVar3;

      *param_5 = *(undefined4 *)(iVar2 + 0x10);

    }

    return 1;

  }

  return 0;

}





// --- FUN_006b4a90 at 0x006B4A90 (size: 64) ---


undefined4 __fastcall FUN_006b4a90(int *param_1)



{

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

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

    (**(code **)(*param_1 + 0xcc))(0,0);

    FUN_00510c50(1);

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

    return 1;

  }

  return 0;

}





// --- FUN_006b4b20 at 0x006B4B20 (size: 4) ---


undefined4 __fastcall FUN_006b4b20(int param_1)



{

  return *(undefined4 *)(param_1 + 0x30);

}





// --- FUN_006b4b30 at 0x006B4B30 (size: 117) ---


void __fastcall FUN_006b4b30(int *param_1)



{

  int iVar1;

  

  iVar1 = (**(code **)(*param_1 + 0xac))();

  if (iVar1 != 0) {

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

  }

  if ((((param_1[2] != 0) && (param_1[0x11] != 0)) && (param_1[0xd] != 0)) &&

     ((iVar1 = FUN_0050f580(), iVar1 == 0 && (iVar1 = FUN_0050f5e0(), iVar1 == 0)))) {

    iVar1 = FUN_006b5980();

    if (((iVar1 == 0) &&

        ((iVar1 = FUN_006b5980(), iVar1 == 0 && (iVar1 = FUN_006b5980(), iVar1 == 0)))) &&

       (param_1[0x12] == 0)) {

      return;

    }

                    /* WARNING: Could not recover jumptable at 0x006b4ba0. Too many branches */

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_006b4bc0 at 0x006B4BC0 (size: 22) ---


void __fastcall FUN_006b4bc0(int *param_1)



{

  (**(code **)(*param_1 + 0x20))(param_1[0xe]);

                    /* WARNING: Could not recover jumptable at 0x006b4bd3. Too many branches */

                    /* WARNING: Treating indirect jump as call */

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

  return;

}





// --- FUN_006b4ca0 at 0x006B4CA0 (size: 13) ---


void __fastcall FUN_006b4ca0(int *param_1)



{

  (**(code **)(*param_1 + 0xcc))(0,1);

  return;

}





// --- FUN_006b4cb0 at 0x006B4CB0 (size: 49) ---


bool __fastcall FUN_006b4cb0(int param_1)



{

  int iVar1;

  

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

    iVar1 = FUN_005108d0();

    if (iVar1 != 0) {

      iVar1 = FUN_005108d0();

      return *(int *)(iVar1 + 8) == 0x40000011;

    }

  }

  return false;

}





// --- FUN_006b4d00 at 0x006B4D00 (size: 5) ---


undefined4 FUN_006b4d00(void)



{

  return 0;

}





// --- FUN_006b4d10 at 0x006B4D10 (size: 101) ---


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



undefined4 __thiscall FUN_006b4d10(float *param_1,float *param_2)



{

  if ((((ABS(*param_1 - *param_2) < _DAT_00804e10 != (ABS(*param_1 - *param_2) == _DAT_00804e10)) &&

       (ABS(param_1[1] - param_2[1]) < _DAT_00804e10 !=

        (ABS(param_1[1] - param_2[1]) == _DAT_00804e10))) &&

      (ABS(param_1[2] - param_2[2]) < _DAT_00804e10 !=

       (ABS(param_1[2] - param_2[2]) == _DAT_00804e10))) &&

     (ABS(param_1[3] - param_2[3]) < _DAT_00804e10)) {

    return 1;

  }

  return 0;

}





// --- FUN_006b4d80 at 0x006B4D80 (size: 204) ---


undefined4 * __fastcall FUN_006b4d80(undefined4 *param_1)



{

  undefined4 uVar1;

  

  *param_1 = &PTR_FUN_00804e18;

  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] = 0;

  param_1[0xb] = 0;

  param_1[0xc] = 2;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0x3f800000;

  param_1[0xd] = 1;

  param_1[0x11] = 1;

  param_1[0x16] = 1;

  uVar1 = DAT_008379a8;

  param_1[0x19] = DAT_008379ac;

  param_1[0x18] = uVar1;

  param_1[0x1a] = &PTR_LAB_00797910;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0x3f800000;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

  param_1[0x29] = 0;

  param_1[0x2a] = 0;

  param_1[0x2b] = 0;

  FUN_00535b30();

  param_1[0x2c] = 0;

  param_1[0x2d] = 0;

  param_1[0x2f] = 0;

  param_1[0x2e] = 0;

  param_1[0x30] = 0;

  param_1[0x31] = 0x3ff00000;

  return param_1;

}





// --- FUN_006b4e50 at 0x006B4E50 (size: 43) ---


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



{

  *param_1 = &PTR_FUN_00804e18;

  param_1[0x1a] = &PTR_FUN_0079385c;

  FUN_00411470();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b5520 at 0x006B5520 (size: 158) ---


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



bool __fastcall FUN_006b5520(int *param_1)



{

  int iVar1;

  bool bVar2;

  

  iVar1 = (**(code **)(*param_1 + 0x90))();

  if ((((iVar1 != 0) && (param_1[0xc] == 2)) && (param_1[1] != 0)) &&

     (iVar1 = param_1[2], iVar1 != 0)) {

    if (*(double *)(param_1 + 0x30) + *(double *)(param_1 + 0x18) < _DAT_008379a8) {

      if (param_1[0x1b] == *(int *)(iVar1 + 0x4c)) {

        iVar1 = FUN_00424e90(iVar1 + 0x50);

        if (iVar1 != 0) {

          return false;

        }

      }

      bVar2 = true;

    }

    else {

      bVar2 = param_1[0x1b] != *(int *)(iVar1 + 0x4c);

      if (!bVar2) {

        iVar1 = FUN_006b4d10(iVar1 + 0x130);

        return iVar1 == 0;

      }

    }

    return bVar2;

  }

  return false;

}





// --- FUN_006b58a0 at 0x006B58A0 (size: 210) ---


bool __thiscall FUN_006b58a0(int *param_1,int param_2,undefined4 param_3,int param_4)



{

  int *piVar1;

  int iVar2;

  int *piVar3;

  

  if (param_4 != 0) {

    piVar3 = (int *)param_1[1];

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

      return false;

    }

    piVar1 = (int *)*param_1;

    if ((int *)piVar3[1] == (int *)0x0) {

      iVar2 = *piVar3;

      *param_1 = iVar2;

      if (iVar2 == 0) goto LAB_006b58ed;

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

    }

    else {

      *(int *)piVar3[1] = *piVar3;

    }

    if (*piVar3 != 0) {

      *(int *)(*piVar3 + 4) = piVar3[1];

    }

LAB_006b58ed:

    *piVar3 = 0;

    piVar3[1] = 0;

    if ((void *)param_1[1] != (void *)0x0) {

      operator_delete((void *)param_1[1]);

    }

    param_1[1] = 0;

    return piVar3 == piVar1;

  }

  piVar3 = (int *)*param_1;

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

    return false;

  }

  while ((piVar3[2] != param_2 || (piVar3 == (int *)param_1[1]))) {

    piVar3 = (int *)*piVar3;

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

      return false;

    }

  }

  piVar1 = (int *)*param_1;

  if ((int *)piVar3[1] == (int *)0x0) {

    iVar2 = *piVar3;

    *param_1 = iVar2;

    if (iVar2 == 0) goto LAB_006b595c;

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

  }

  else {

    *(int *)piVar3[1] = *piVar3;

  }

  if (*piVar3 != 0) {

    *(int *)(*piVar3 + 4) = piVar3[1];

  }

LAB_006b595c:

  *piVar3 = 0;

  piVar3[1] = 0;

  operator_delete(piVar3);

  return piVar3 == piVar1;

}





// --- FUN_006b5980 at 0x006B5980 (size: 3) ---


undefined4 __fastcall FUN_006b5980(undefined4 *param_1)



{

  return *param_1;

}





// --- FUN_006b5990 at 0x006B5990 (size: 24) ---


bool __fastcall FUN_006b5990(int *param_1)



{

  if (*param_1 != 0) {

    return *param_1 == param_1[1];

  }

  return false;

}





// --- FUN_006b59b0 at 0x006B59B0 (size: 82) ---


void __fastcall FUN_006b59b0(int *param_1)



{

  int iVar1;

  int *piVar2;

  

  iVar1 = *param_1;

  do {

    if (iVar1 == 0) {

      param_1[1] = 0;

      return;

    }

    piVar2 = (int *)*param_1;

    if ((int *)piVar2[1] == (int *)0x0) {

      iVar1 = *piVar2;

      *param_1 = iVar1;

      if (iVar1 != 0) {

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

        goto LAB_006b59da;

      }

    }

    else {

      *(int *)piVar2[1] = *piVar2;

LAB_006b59da:

      if (*piVar2 != 0) {

        *(int *)(*piVar2 + 4) = piVar2[1];

      }

    }

    *piVar2 = 0;

    piVar2[1] = 0;

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

      operator_delete(piVar2);

    }

    iVar1 = *param_1;

  } while( true );

}





// --- FUN_006b5a10 at 0x006B5A10 (size: 160) ---


void __fastcall FUN_006b5a10(int *param_1)



{

  int *piVar1;

  int iVar2;

  

  if (*param_1 != 0) {

    do {

      piVar1 = (int *)*param_1;

      if (piVar1 == (int *)param_1[1]) break;

      if ((int *)piVar1[1] == (int *)0x0) {

        iVar2 = *piVar1;

        *param_1 = iVar2;

        if (iVar2 != 0) {

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

          goto LAB_006b5a3f;

        }

      }

      else {

        *(int *)piVar1[1] = *piVar1;

LAB_006b5a3f:

        if (*piVar1 != 0) {

          *(int *)(*piVar1 + 4) = piVar1[1];

        }

      }

      *piVar1 = 0;

      piVar1[1] = 0;

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

        operator_delete(piVar1);

      }

    } while (*param_1 != 0);

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

      iVar2 = *(int *)*param_1;

      while (iVar2 != 0) {

        piVar1 = *(int **)*param_1;

        if ((int *)piVar1[1] == (int *)0x0) {

          iVar2 = *piVar1;

          *param_1 = iVar2;

          if (iVar2 != 0) {

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

            goto LAB_006b5a8c;

          }

        }

        else {

          *(int *)piVar1[1] = *piVar1;

LAB_006b5a8c:

          if (*piVar1 != 0) {

            *(int *)(*piVar1 + 4) = piVar1[1];

          }

        }

        *piVar1 = 0;

        piVar1[1] = 0;

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

          operator_delete(piVar1);

        }

        iVar2 = *(int *)*param_1;

      }

    }

  }

  return;

}





// --- FUN_006b5ac0 at 0x006B5AC0 (size: 160) ---


void __thiscall FUN_006b5ac0(int *param_1,int param_2,int param_3,int param_4,int param_5)



{

  int *piVar1;

  int iVar2;

  int *piVar3;

  

  piVar3 = (int *)FUN_005df0f5(0x14);

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

    piVar3 = (int *)0x0;

  }

  else {

    *piVar3 = 0;

    piVar3[1] = 0;

    piVar3[2] = 0;

    piVar3[3] = 0x3f800000;

  }

  piVar3[2] = param_2;

  piVar3[3] = param_3;

  piVar3[4] = param_5;

  if (param_4 == 0) goto LAB_006b5b48;

  piVar1 = (int *)param_1[1];

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

    if ((int *)piVar1[1] == (int *)0x0) {

      iVar2 = *piVar1;

      *param_1 = iVar2;

      if (iVar2 != 0) {

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

        goto LAB_006b5b24;

      }

    }

    else {

      *(int *)piVar1[1] = *piVar1;

LAB_006b5b24:

      if (*piVar1 != 0) {

        *(int *)(*piVar1 + 4) = piVar1[1];

      }

    }

    *piVar1 = 0;

    piVar1[1] = 0;

    if ((void *)param_1[1] != (void *)0x0) {

      operator_delete((void *)param_1[1]);

    }

  }

  param_1[1] = (int)piVar3;

LAB_006b5b48:

  piVar3[1] = 0;

  *piVar3 = *param_1;

  if (*param_1 != 0) {

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

  }

  *param_1 = (int)piVar3;

  return;

}





// --- FUN_006b5b60 at 0x006B5B60 (size: 83) ---


undefined4 FUN_006b5b60(char *param_1)



{

  char cVar1;

  char *pcVar2;

  int iVar3;

  uint uVar4;

  

  pcVar2 = param_1;

  do {

    cVar1 = *pcVar2;

    pcVar2 = pcVar2 + 1;

  } while (cVar1 != '\0');

  uVar4 = 0;

  do {

    iVar3 = _strnicmp(param_1,(&PTR_s_Invalid_00804f48)[uVar4],

                      (size_t)(pcVar2 + (1 - (int)(param_1 + 1))));

    if (iVar3 == 0) {

      return (&DAT_008055b8)[uVar4];

    }

    uVar4 = uVar4 + 1;

  } while (uVar4 < 0x19c);

  return 0;

}





// --- FUN_006b5bc0 at 0x006B5BC0 (size: 61) ---


undefined4 * __thiscall FUN_006b5bc0(undefined4 *param_1,undefined4 param_2)



{

  param_1[1] = 0;

  param_1[2] = param_2;

  *param_1 = &PTR_FUN_008073a8;

  FUN_005aedb0();

  FUN_005aedb0();

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0xf] = &PTR_FUN_007cd7b0;

  return param_1;

}





// --- FUN_006b5c00 at 0x006B5C00 (size: 94) ---


void __fastcall FUN_006b5c00(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_008073a8;

  FUN_005aef10();

  FUN_005aef10();

  FUN_0055a0c0();

  param_1[0xf] = &PTR_FUN_007cd7b0;

  FUN_0055a0c0();

  param_1[0xf] = &PTR_FUN_0079385c;

  FUN_005af120();

  FUN_005af120();

  *param_1 = &PTR_LAB_007c78e0;

  param_1[1] = 0;

  param_1[2] = 0;

  return;

}





// --- FUN_006b5c60 at 0x006B5C60 (size: 30) ---


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



{

  FUN_006b5c00();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b5c80 at 0x006B5C80 (size: 90) ---


void __thiscall FUN_006b5c80(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    FUN_006b5ce0(param_2);

    return;

  }

  iVar1 = thunk_FUN_005df0f5(param_2 * 4);

  uVar2 = 0;

  if (param_1[3] != 0) {

    do {

      *(undefined4 *)(iVar1 + uVar2 * 4) = *(undefined4 *)(*param_1 + uVar2 * 4);

      uVar2 = uVar2 + 1;

    } while (uVar2 < (uint)param_1[3]);

  }

  operator_delete__((void *)*param_1);

  *param_1 = iVar1;

  param_1[3] = param_2;

  return;

}





// --- FUN_006b5ce0 at 0x006B5CE0 (size: 123) ---


void __thiscall FUN_006b5ce0(int *param_1,uint param_2)



{

  int iVar1;

  uint uVar2;

  

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

    if (param_2 == 0) {

      param_1[3] = 0;

      operator_delete__((void *)*param_1);

      *param_1 = 0;

    }

    else {

      iVar1 = thunk_FUN_005df0f5(param_2 * 4);

      uVar2 = 0;

      param_1[3] = param_2;

      if (param_2 != 0) {

        do {

          *(undefined4 *)(iVar1 + uVar2 * 4) = *(undefined4 *)(*param_1 + uVar2 * 4);

          uVar2 = uVar2 + 1;

        } while (uVar2 < (uint)param_1[3]);

      }

      operator_delete__((void *)*param_1);

      *param_1 = iVar1;

    }

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

      param_1[2] = param_2;

    }

    return;

  }

  FUN_006b5c80(param_2);

  return;

}





// --- FUN_006b5d60 at 0x006B5D60 (size: 87) ---


void __thiscall FUN_006b5d60(int param_1,int param_2,int param_3)



{

  uint uVar1;

  uint uVar2;

  int *piVar3;

  

  uVar1 = *(uint *)(param_1 + 100);

  uVar2 = 0;

  if (uVar1 != 0) {

    piVar3 = *(int **)(param_1 + 0x68);

    do {

      if (param_2 == *piVar3) {

        return;

      }

      uVar2 = uVar2 + 1;

      piVar3 = piVar3 + 1;

    } while (uVar2 < *(uint *)(param_1 + 100));

  }

  if (*(uint *)(param_1 + 0x74) <= uVar1) {

    FUN_006b5c80(uVar1 + 10);

  }

  *(int *)(*(int *)(param_1 + 0x68) + *(int *)(param_1 + 100) * 4) = param_2;

  *(int *)(param_1 + 100) = *(int *)(param_1 + 100) + 1;

  if (param_3 != 1) {

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

  }

  return;

}





// --- FUN_006b5dc0 at 0x006B5DC0 (size: 43) ---


void __thiscall FUN_006b5dc0(int param_1,int param_2)



{

  int iVar1;

  

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

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

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

    *(undefined4 *)(*(int *)(param_1 + 0xc) + param_2 * 8) =

         *(undefined4 *)(*(int *)(param_1 + 0xc) + iVar1 * 8);

    *(undefined4 *)(*(int *)(param_1 + 0xc) + 4 + param_2 * 8) =

         *(undefined4 *)(*(int *)(param_1 + 0xc) + 4 + *(int *)(param_1 + 8) * 8);

  }

  return;

}





// --- FUN_006b5df0 at 0x006B5DF0 (size: 133) ---


void __thiscall FUN_006b5df0(int *param_1,uint param_2)



{

  int iVar1;

  uint *puVar2;

  uint uVar3;

  uint *puVar4;

  

  if ((uint)param_1[3] < param_2) {

    puVar2 = (uint *)thunk_FUN_005df0f5(param_2 * 8 + 4);

    if (puVar2 == (uint *)0x0) {

      puVar4 = (uint *)0x0;

    }

    else {

      puVar4 = puVar2 + 1;

      *puVar2 = param_2;

      FUN_00401000(puVar4,8,param_2,FUN_0050a140);

    }

    uVar3 = 0;

    if (param_1[3] != 0) {

      do {

        iVar1 = *param_1;

        puVar4[uVar3 * 2] = *(uint *)(iVar1 + uVar3 * 8);

        puVar4[uVar3 * 2 + 1] = *(uint *)(iVar1 + 4 + uVar3 * 8);

        uVar3 = uVar3 + 1;

      } while (uVar3 < (uint)param_1[3]);

    }

    if (*param_1 != 0) {

      operator_delete__((void *)(*param_1 + -4));

    }

    *param_1 = (int)puVar4;

    param_1[3] = param_2;

    return;

  }

  FUN_006b5e80(param_2);

  return;

}





// --- FUN_006b5e80 at 0x006B5E80 (size: 170) ---


void __thiscall FUN_006b5e80(int *param_1,uint param_2)



{

  int iVar1;

  uint *puVar2;

  uint uVar3;

  uint *puVar4;

  

  if ((uint)param_1[3] < param_2) {

    FUN_006b5df0(param_2);

    return;

  }

  if (param_2 == 0) {

    param_1[3] = 0;

    if (*param_1 != 0) {

      operator_delete__((void *)(*param_1 + -4));

    }

    *param_1 = 0;

  }

  else {

    puVar2 = (uint *)thunk_FUN_005df0f5(param_2 * 8 + 4);

    if (puVar2 == (uint *)0x0) {

      puVar4 = (uint *)0x0;

    }

    else {

      puVar4 = puVar2 + 1;

      *puVar2 = param_2;

      FUN_00401000(puVar4,8,param_2,FUN_0050a140);

    }

    uVar3 = 0;

    param_1[3] = param_2;

    if (param_2 != 0) {

      do {

        iVar1 = *param_1;

        puVar4[uVar3 * 2] = *(uint *)(iVar1 + uVar3 * 8);

        puVar4[uVar3 * 2 + 1] = *(uint *)(iVar1 + 4 + uVar3 * 8);

        uVar3 = uVar3 + 1;

      } while (uVar3 < (uint)param_1[3]);

    }

    if (*param_1 != 0) {

      operator_delete__((void *)(*param_1 + -4));

    }

    *param_1 = (int)puVar4;

  }

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

    param_1[2] = param_2;

  }

  return;

}





// --- FUN_006b5f30 at 0x006B5F30 (size: 85) ---


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



{

  uint uVar1;

  uint uVar2;

  int *piVar3;

  

  uVar1 = *(uint *)(param_1 + 8);

  uVar2 = 0;

  if (uVar1 != 0) {

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

    do {

      if (param_2 == *piVar3) {

        return;

      }

      uVar2 = uVar2 + 1;

      piVar3 = piVar3 + 2;

    } while (uVar2 < *(uint *)(param_1 + 8));

  }

  if (*(uint *)(param_1 + 0x18) <= uVar1) {

    FUN_006b5df0(uVar1 + 8);

  }

  *(int *)(*(int *)(param_1 + 0xc) + *(int *)(param_1 + 8) * 8) = param_2;

  *(undefined4 *)(*(int *)(param_1 + 0xc) + 4 + *(int *)(param_1 + 8) * 8) = param_3;

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

  return;

}





// --- FUN_006b5f90 at 0x006B5F90 (size: 86) ---


uint * __thiscall FUN_006b5f90(uint *param_1,uint param_2,uint param_3,uint param_4)



{

  uint uVar1;

  

  param_1[3] = param_4;

  param_1[2] = param_3;

  *param_1 = param_2;

  if (param_2 == 0) {

    param_1[1] = 0;

    return param_1;

  }

  uVar1 = thunk_FUN_005df0f5(param_2 * 4);

  param_1[1] = uVar1;

  uVar1 = 0;

  if (param_2 != 0) {

    do {

      *(undefined4 *)(param_1[1] + uVar1 * 4) = 0;

      uVar1 = uVar1 + 1;

    } while (uVar1 < param_2);

  }

  return param_1;

}





// --- CRect at 0x006B5FF0 (size: 32) ---


/* Library Function - Single Match

    public: __thiscall CRect::CRect(int,int,int,int)

   

   Libraries: Visual Studio 2005 Release, Visual Studio 2008 Release */



void __thiscall CRect::CRect(CRect *this,int param_1,int param_2,int param_3,int param_4)



{

  *(int *)this = param_1;

  *(int *)(this + 4) = param_2;

  *(int *)(this + 8) = param_3;

  *(int *)(this + 0xc) = param_4;

  return;

}





// --- FUN_006b6010 at 0x006B6010 (size: 16) ---


void FUN_006b6010(void)



{

  undefined4 uStack00000004;

  

  uStack00000004 = 0;

  FUN_0050e270();

  return;

}





// --- FUN_006b6020 at 0x006B6020 (size: 69) ---


void __fastcall FUN_006b6020(uint *param_1)



{

  void *pvVar1;

  uint uVar2;

  

  if (param_1[1] != 0) {

    uVar2 = 0;

    if (*param_1 != 0) {

      do {

        pvVar1 = *(void **)(param_1[1] + uVar2 * 4);

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

          FUN_0053c760();

          operator_delete(pvVar1);

        }

        uVar2 = uVar2 + 1;

      } while (uVar2 < *param_1);

    }

    operator_delete__((void *)param_1[1]);

  }

  return;

}





// --- FUN_006b6070 at 0x006B6070 (size: 116) ---


void FUN_006b6070(uint *param_1,int param_2)



{

  int iVar1;

  int *piVar2;

  int *piVar3;

  int *piVar4;

  int *piVar5;

  

  piVar2 = (int *)*param_1;

  piVar5 = piVar2 + param_2 + -2;

  if (piVar2 <= piVar5) {

    piVar4 = piVar5 + 1;

    do {

      iVar1 = *piVar5;

      piVar3 = piVar4;

      if (piVar4 <= piVar2 + param_2 + -1) {

        do {

          if (**(float **)(*piVar3 + 0xc) <= **(float **)(iVar1 + 0xc)) break;

          piVar3[-1] = *piVar3;

          piVar3 = piVar3 + 1;

        } while (piVar3 <= (int *)(*param_1 + param_2 * 4 + -4));

      }

      piVar3[-1] = iVar1;

      piVar2 = (int *)*param_1;

      piVar5 = piVar5 + -1;

      piVar4 = piVar4 + -1;

    } while (piVar2 <= piVar5);

  }

  return;

}





// --- FUN_006b60f0 at 0x006B60F0 (size: 71) ---


void __thiscall FUN_006b60f0(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  uint uVar1;

  

  uVar1 = 0;

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

    do {

      FUN_0053c8c0(param_2,param_3,param_4);

      uVar1 = uVar1 + 1;

    } while (uVar1 < *(uint *)(param_1 + 0x178));

  }

  return;

}





// --- FUN_006b6140 at 0x006B6140 (size: 36) ---


void __fastcall FUN_006b6140(int param_1)



{

  FUN_00534d90(param_1);

  FUN_0050ffc0(0);

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

  return;

}





// --- FUN_006b6170 at 0x006B6170 (size: 94) ---


void __thiscall

FUN_006b6170(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5

            ,undefined4 param_6)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  uVar3 = 0;

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

    do {

      iVar1 = *(int *)(*(int *)(param_1 + 0x17c) + uVar3 * 4);

      iVar2 = FUN_0053c990();

      if (iVar2 != 0) {

        FUN_0052d1e0(*(undefined4 *)(iVar1 + 8),param_2,param_3,param_4,param_5,param_6);

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0x178));

  }

  return;

}





// --- FUN_006b61e0 at 0x006B61E0 (size: 84) ---


void __thiscall FUN_006b61e0(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  

  uVar3 = 0;

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

    do {

      iVar1 = *(int *)(*(int *)(param_1 + 0x17c) + uVar3 * 4);

      iVar2 = FUN_0053c990();

      if (iVar2 != 0) {

        FUN_0052d290(*(undefined4 *)(iVar1 + 8),param_2,param_3,param_4);

      }

      uVar3 = uVar3 + 1;

    } while (uVar3 < *(uint *)(param_1 + 0x178));

  }

  return;

}





// --- FUN_006b6240 at 0x006B6240 (size: 72) ---


void __thiscall FUN_006b6240(int param_1,int param_2)



{

  int iVar1;

  

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

    *(undefined4 *)(param_2 + 0x1d4) = 1;

    iVar1 = FUN_0050e3a0(param_2);

    *(undefined4 *)(param_2 + 0x1d4) = 0;

    if ((iVar1 != 1) && ((*(byte *)(param_2 + 4) & 1) == 0)) {

      *(undefined4 *)(param_2 + 0x2ec) = 1;

    }

  }

  return;

}





// --- FUN_006b6290 at 0x006B6290 (size: 78) ---


undefined4 * __fastcall FUN_006b6290(undefined4 *param_1)



{

  FUN_00512ef0();

  param_1[0x5e] = 0;

  param_1[0x5f] = 0;

  param_1[0x60] = 0;

  param_1[0x61] = 0;

  param_1[0x62] = 0;

  *param_1 = &PTR_FUN_00807550;

  param_1[99] = 0;

  param_1[0x66] = 0;

  param_1[0x65] = 0;

  param_1[100] = 0x80;

  return param_1;

}





// --- FUN_006b62e0 at 0x006B62E0 (size: 244) ---


undefined4 * FUN_006b62e0(undefined4 param_1,int param_2,int param_3,int param_4)



{

  int iVar1;

  undefined4 *puVar2;

  undefined4 uVar3;

  uint uVar4;

  

  iVar1 = FUN_005df0f5(0x1a0);

  if (iVar1 == 0) {

    puVar2 = (undefined4 *)0x0;

  }

  else {

    puVar2 = (undefined4 *)FUN_006b6290();

  }

  iVar1 = FUN_00510a50(0,0);

  if ((iVar1 != 0) && (iVar1 = FUN_005131b0(param_1,1), iVar1 != 0)) {

    puVar2[0x60] = param_4;

    uVar3 = thunk_FUN_005df0f5(param_4 * 4);

    puVar2[0x61] = uVar3;

    uVar4 = 0;

    if (puVar2[0x60] != 0) {

      do {

        *(undefined4 *)(puVar2[0x61] + uVar4 * 4) = 0;

        uVar4 = uVar4 + 1;

      } while (uVar4 < (uint)puVar2[0x60]);

    }

    puVar2[0x5e] = param_2;

    uVar3 = thunk_FUN_005df0f5(param_2 << 2);

    puVar2[0x5f] = uVar3;

    uVar4 = 0;

    if (puVar2[0x5e] != 0) {

      do {

        *(undefined4 *)(puVar2[0x5f] + uVar4 * 4) = *(undefined4 *)(param_3 + uVar4 * 4);

        uVar4 = uVar4 + 1;

      } while (uVar4 < (uint)puVar2[0x5e]);

    }

    iVar1 = FUN_00510ab0();

    if (iVar1 != 0) {

      return puVar2;

    }

  }

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

    (**(code **)*puVar2)(1);

  }

  return (undefined4 *)0x0;

}





// --- FUN_006b63f0 at 0x006B63F0 (size: 159) ---


void __fastcall FUN_006b63f0(undefined4 *param_1)



{

  int *piVar1;

  uint uVar2;

  

  *param_1 = &PTR_FUN_00807550;

  if ((void *)param_1[0x5f] != (void *)0x0) {

    operator_delete__((void *)param_1[0x5f]);

    param_1[0x5f] = 0;

  }

  param_1[0x5e] = 0;

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

    uVar2 = 0;

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

      do {

        piVar1 = *(int **)(param_1[0x61] + uVar2 * 4);

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

          (**(code **)(*piVar1 + 8))(1);

        }

        uVar2 = uVar2 + 1;

      } while (uVar2 < (uint)param_1[0x60]);

    }

    operator_delete__((void *)param_1[0x61]);

    param_1[0x61] = 0;

  }

  param_1[0x60] = 0;

  param_1[0x62] = 0;

  operator_delete__((void *)param_1[99]);

  param_1[99] = 0;

  FUN_00514830();

  return;

}





// --- FUN_006b6490 at 0x006B6490 (size: 38) ---


void __thiscall FUN_006b6490(int param_1,int param_2)



{

  FUN_00534d70(param_1);

  FUN_0050ffc0(*(undefined4 *)(param_2 + 0x28));

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

  return;

}





// --- FUN_006b64c0 at 0x006B64C0 (size: 30) ---


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



{

  FUN_006b63f0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b64e0 at 0x006B64E0 (size: 215) ---


int __thiscall FUN_006b64e0(int param_1,undefined4 param_2)



{

  int iVar1;

  uint uVar2;

  undefined **local_14;

  undefined4 local_10;

  void *local_c;

  undefined4 local_8;

  undefined4 local_4;

  

  local_14 = &PTR_FUN_007e5500;

  local_10 = 0;

  local_c = (void *)0x0;

  local_8 = 0x20;

  local_4 = 0;

  FUN_005a8440();

  uVar2 = 0;

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

    do {

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

        iVar1 = FUN_0053c990();

        if (iVar1 != 0) {

          iVar1 = FUN_0052e500(param_2,&local_14);

          if (iVar1 != 0) {

            local_14 = &PTR_FUN_007e5500;

            FUN_005d59a0();

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

              operator_delete__(local_c);

            }

            return iVar1;

          }

        }

      }

      uVar2 = uVar2 + 1;

    } while (uVar2 < *(uint *)(param_1 + 0x178));

  }

  local_14 = &PTR_FUN_007e5500;

  FUN_005d59a0();

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

    operator_delete__(local_c);

  }

  return 0;

}





// --- FUN_006b65c0 at 0x006B65C0 (size: 86) ---


void __thiscall FUN_006b65c0(int param_1,wchar_t *param_2)



{

  size_t sVar1;

  uint uVar2;

  

  wcsncpy((wchar_t *)(param_1 + 0x112 + *(int *)(param_1 + 0xb1c) * 2),param_2,

          0x104 - *(int *)(param_1 + 0xb1c));

  sVar1 = wcslen(param_2);

  uVar2 = *(int *)(param_1 + 0xb1c) + sVar1 + 1;

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

  if (0x104 < uVar2) {

    *(undefined4 *)(param_1 + 0xb1c) = 0x104;

  }

  return;

}





// --- FUN_006b6620 at 0x006B6620 (size: 189) ---


void FUN_006b6620(void)



{

  BYTE BVar1;

  int iVar2;

  BYTE *pBVar3;

  LSTATUS LVar4;

  HKEY hKey;

  BYTE aBStack_230 [12];

  wchar_t local_208 [244];

  BYTE *pBStack_20;

  

  aBStack_230[8] = 'S';

  aBStack_230[9] = 'f';

  aBStack_230[10] = 'k';

  aBStack_230[0xb] = '\0';

  _snwprintf(local_208,0x104,L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\%s");

  aBStack_230[8] = '\0';

  aBStack_230[9] = '\0';

  aBStack_230[10] = '\0';

  aBStack_230[0xb] = '\0';

  aBStack_230[4] = '\0';

  aBStack_230[5] = '\0';

  aBStack_230[6] = '\0';

  aBStack_230[7] = '\0';

  aBStack_230[0] = '\0';

  aBStack_230[1] = '\0';

  aBStack_230[2] = '\0';

  aBStack_230[3] = '\0';

  hKey = (HKEY)0x80000002;

  iVar2 = (*(code *)PTR_FUN_00837348)(0x80000002,local_208);

  if (iVar2 == 0) {

    pBVar3 = pBStack_20;

    do {

      BVar1 = *pBVar3;

      pBVar3 = pBVar3 + 1;

    } while (BVar1 != '\0');

    LVar4 = RegSetValueExA(hKey,"EventMessageFile",0,1,pBStack_20,

                           (DWORD)(pBVar3 + (1 - (int)(pBStack_20 + 1))));

    if (LVar4 == 0) {

      aBStack_230[0] = '\a';

      aBStack_230[1] = '\0';

      aBStack_230[2] = '\0';

      aBStack_230[3] = '\0';

      RegSetValueExA(hKey,"TypesSupported",0,4,aBStack_230,4);

    }

  }

  return;

}





// --- FUN_006b66e0 at 0x006B66E0 (size: 16) ---


void FUN_006b66e0(undefined4 param_1)



{

  FUN_006b65c0(param_1);

  return;

}





// --- FUN_006b66f0 at 0x006B66F0 (size: 107) ---


void __fastcall FUN_006b66f0(int *param_1)



{

  int iVar1;

  size_t sVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  int *piVar6;

  

  piVar6 = param_1 + 199;

  for (iVar3 = 0x200; iVar3 != 0; iVar3 = iVar3 + -1) {

    *piVar6 = 0;

    piVar6 = piVar6 + 1;

  }

  iVar5 = 0;

  iVar4 = 0x400;

  for (iVar3 = param_1[2]; iVar3 != 0; iVar3 = iVar3 + -1) {

    iVar1 = (**(code **)(**(int **)(*param_1 + -4 + iVar3 * 4) + 8))

                      ((int)param_1 + iVar5 * 2 + 0x31c,iVar4 + -2);

    if (iVar1 != 0) {

      sVar2 = wcslen((wchar_t *)(param_1 + 199));

      *(undefined2 *)((int)param_1 + sVar2 * 2 + 0x31c) = 0x7c;

      iVar5 = sVar2 + 1;

      iVar4 = 0x401 - iVar5;

    }

  }

  return;

}





// --- FUN_006b6760 at 0x006B6760 (size: 1286) ---


undefined4 FUN_006b6760(int *param_1)



{

  char cVar1;

  bool bVar2;

  undefined4 uVar3;

  HANDLE hTargetProcessHandle;

  HANDLE hSourceHandle;

  HANDLE hSourceProcessHandle;

  char *pcVar4;

  LCID LVar5;

  int iVar6;

  undefined4 *lpBaseAddress;

  char *pcVar7;

  undefined4 *puVar8;

  _STARTUPINFOA *p_Var9;

  code *pcVar10;

  HANDLE *lpTargetHandle;

  DWORD DVar11;

  BOOL BVar12;

  DWORD dwOptions;

  HANDLE local_588;

  HANDLE local_584;

  HANDLE local_580;

  HANDLE local_57c;

  HANDLE local_578;

  _SECURITY_ATTRIBUTES local_574;

  _PROCESS_INFORMATION _Stack_568;

  _STARTUPINFOA _Stack_558;

  CHAR aCStack_514 [260];

  CHAR aCStack_410 [260];

  CHAR local_30c [260];

  CHAR aCStack_208 [520];

  

  _clearfp();

  lpBaseAddress = (undefined4 *)0x0;

  local_578 = (HANDLE)0x0;

  if ((*(int *)*param_1 == -0x7ffffffd) || (DAT_008fba30 != 0)) {

    if (DAT_008fc55c == (code *)0x0) {

      return 0;

    }

    uVar3 = (*DAT_008fc55c)();

    return uVar3;

  }

  local_574.lpSecurityDescriptor = (LPVOID)0x0;

  DAT_008fba30 = 1;

  local_574.nLength = 0xc;

  local_574.bInheritHandle = 1;

  local_57c = CreateFileMappingA((HANDLE)0xffffffff,&local_574,4,0,0x1c50,(LPCSTR)0x0);

  pcVar10 = CloseHandle_exref;

  if ((local_57c == (HANDLE)0x0) ||

     (lpBaseAddress = MapViewOfFile(local_57c,6,0,0,0), pcVar10 = CloseHandle_exref,

     lpBaseAddress == (undefined4 *)0x0)) goto LAB_006b6c35;

  puVar8 = lpBaseAddress;

  for (iVar6 = 0x714; iVar6 != 0; iVar6 = iVar6 + -1) {

    *puVar8 = 0;

    puVar8 = puVar8 + 1;

  }

  local_580 = CreateEventA(&local_574,0,0,(LPCSTR)0x0);

  local_588 = CreateEventA(&local_574,0,0,(LPCSTR)0x0);

  local_584 = CreateMutexA(&local_574,0,(LPCSTR)0x0);

  dwOptions = 0;

  BVar12 = 1;

  DVar11 = 0x1f0fff;

  lpTargetHandle = &local_578;

  hTargetProcessHandle = GetCurrentProcess();

  hSourceHandle = GetCurrentProcess();

  hSourceProcessHandle = GetCurrentProcess();

  BVar12 = DuplicateHandle(hSourceProcessHandle,hSourceHandle,hTargetProcessHandle,lpTargetHandle,

                           DVar11,BVar12,dwOptions);

  pcVar10 = CloseHandle_exref;

  if (BVar12 == 0) {

LAB_006b6a27:

    if (local_580 != (HANDLE)0x0) {

      (*pcVar10)();

    }

  }

  else if (local_580 != (HANDLE)0x0) {

    if (((local_588 != (HANDLE)0x0) && (local_584 != (HANDLE)0x0)) && (local_578 != (HANDLE)0x0)) {

      lpBaseAddress[9] = local_578;

      DVar11 = GetCurrentProcessId();

      lpBaseAddress[1] = DVar11;

      DVar11 = GetCurrentThreadId();

      lpBaseAddress[2] = DVar11;

      lpBaseAddress[5] = local_588;

      lpBaseAddress[7] = local_580;

      lpBaseAddress[8] = local_584;

      *lpBaseAddress = 0x1c50;

      lpBaseAddress[4] = param_1;

      lpBaseAddress[3] = *(undefined4 *)(*param_1 + 0xc);

      lpBaseAddress[0xd] = 1;

      lpBaseAddress[0xf] = 1;

      pcVar4 = &DAT_008fba44;

      lpBaseAddress[0xb] = 0x10;

      lpBaseAddress[10] = 0x114c;

      do {

        cVar1 = *pcVar4;

        *(char *)((int)(lpBaseAddress + -0x23eb03) + (int)pcVar4) = cVar1;

        pcVar4 = pcVar4 + 1;

      } while (cVar1 != '\0');

      pcVar4 = "Microsoft\\PCHealth\\ErrorReporting\\DW";

      pcVar7 = (char *)(lpBaseAddress + 0x452);

      for (iVar6 = 9; iVar6 != 0; iVar6 = iVar6 + -1) {

        *(undefined4 *)pcVar7 = *(undefined4 *)pcVar4;

        pcVar4 = pcVar4 + 4;

        pcVar7 = pcVar7 + 4;

      }

      *pcVar7 = *pcVar4;

      pcVar4 = "HKLM\\Software\\Microsoft\\Internet Explorer\\Registration\\DigitalProductID";

      puVar8 = lpBaseAddress + 0x410;

      for (iVar6 = 0x12; iVar6 != 0; iVar6 = iVar6 + -1) {

        *puVar8 = *(undefined4 *)pcVar4;

        pcVar4 = pcVar4 + 4;

        puVar8 = puVar8 + 1;

      }

      LVar5 = GetUserDefaultLCID();

      lpBaseAddress[0x451] = LVar5;

      wcsncpy((wchar_t *)(lpBaseAddress + 0x484),(wchar_t *)&DAT_008fbb4a,0x104);

      FUN_006b66f0();

      printf("%ls\n");

      wcsncpy((wchar_t *)(lpBaseAddress + 0x506),(wchar_t *)&DAT_008fbd54,0x400);

      GetModuleFileNameA((HMODULE)0x0,local_30c,0x104);

      (*(code *)PTR_FUN_00837394)(0,0,local_30c);

      GetModuleFileNameA((HMODULE)0x0,aCStack_514,0x104);

      pcVar4 = aCStack_514;

      do {

        pcVar7 = pcVar4;

        pcVar4 = pcVar7 + 1;

      } while (*pcVar7 != '\0');

      pcVar10 = CloseHandle_exref;

      if (aCStack_514 <= pcVar7) {

LAB_006b6a10:

        if (*pcVar7 != '\\') goto code_r0x006b6a15;

        if (pcVar7 < aCStack_514) goto LAB_006b6a27;

        _snwprintf((wchar_t *)(lpBaseAddress + 0x12),0x104,L"%hs");

        *pcVar7 = '\0';

        wsprintfA(aCStack_410,"%s\\watson\\dw15.exe",aCStack_514);

        wsprintfA(aCStack_208," -x -s %u",local_57c);

        p_Var9 = &_Stack_558;

        for (iVar6 = 0x11; iVar6 != 0; iVar6 = iVar6 + -1) {

          p_Var9->cb = 0;

          p_Var9 = (_STARTUPINFOA *)&p_Var9->lpReserved;

        }

        _Stack_568.hProcess = (HANDLE)0x0;

        _Stack_568.hThread = (HANDLE)0x0;

        _Stack_568.dwProcessId = 0;

        _Stack_558.cb = 0x44;

        _Stack_568.dwThreadId = 0;

        FUN_006b6620(aCStack_410,lpBaseAddress + 0x12);

        FUN_0040e560();

        FUN_0040e3a0();

        BVar12 = CreateProcessA(aCStack_410,aCStack_208,(LPSECURITY_ATTRIBUTES)0x0,

                                (LPSECURITY_ATTRIBUTES)0x0,1,0x4000020,(LPVOID)0x0,(LPCSTR)0x0,

                                &_Stack_558,&_Stack_568);

        pcVar10 = CloseHandle_exref;

        if (BVar12 != 0) {

          bVar2 = true;

          while (DVar11 = WaitForSingleObject(local_580,20000), DVar11 == 0) {

            DVar11 = WaitForSingleObject(local_588,1);

            if (DVar11 == 0) goto LAB_006b6b8e;

LAB_006b6b81:

            if (!bVar2) goto LAB_006b6b8e;

          }

          DVar11 = WaitForSingleObject(local_584,10000);

          if (DVar11 != 0x102) {

            if (DVar11 != 0x80) {

              DVar11 = WaitForSingleObject(local_580,1);

              if (DVar11 == 0) {

                DVar11 = WaitForSingleObject(local_588,1);

                if (DVar11 == 0) goto LAB_006b6b78;

              }

              else {

                SetEvent(local_588);

LAB_006b6b78:

                bVar2 = false;

              }

              ReleaseMutex(local_584);

              goto LAB_006b6b81;

            }

            ReleaseMutex(local_584);

          }

LAB_006b6b8e:

          pcVar10 = CloseHandle_exref;

          CloseHandle(local_580);

          local_580 = (HANDLE)0x0;

          CloseHandle(local_588);

          local_588 = (HANDLE)0x0;

          CloseHandle(local_584);

          local_584 = (HANDLE)0x0;

          CloseHandle(local_578);

          local_578 = (HANDLE)0x0;

        }

        iVar6 = lpBaseAddress[0xb];

        UnmapViewOfFile(lpBaseAddress);

        lpBaseAddress = (undefined4 *)0x0;

        (*pcVar10)();

        local_57c = (HANDLE)0x0;

        if (iVar6 == 0x10) {

          if (DAT_008fc55c == (code *)0x0) {

            return 0;

          }

          uVar3 = (*DAT_008fc55c)();

          return uVar3;

        }

      }

    }

    goto LAB_006b6a27;

  }

  if (local_588 != (HANDLE)0x0) {

    (*pcVar10)();

  }

  if (local_584 != (HANDLE)0x0) {

    (*pcVar10)();

  }

LAB_006b6c35:

  if (local_578 != (HANDLE)0x0) {

    (*pcVar10)();

  }

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

    UnmapViewOfFile(lpBaseAddress);

  }

  if (local_57c != (HANDLE)0x0) {

    (*pcVar10)();

  }

  return 1;

code_r0x006b6a15:

  pcVar7 = pcVar7 + -1;

  if (pcVar7 < aCStack_514) goto LAB_006b6a27;

  goto LAB_006b6a10;

}





// --- FUN_006b6c70 at 0x006B6C70 (size: 48) ---


void __fastcall FUN_006b6c70(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_008076a0;

  FUN_0040e340(param_1);

  *param_1 = &PTR_FUN_00795538;

  if (param_1[1] != 0) {

    FUN_0040e340(param_1);

    param_1[1] = 0;

  }

  return;

}





// --- FUN_006b6ca0 at 0x006B6CA0 (size: 68) ---


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



{

  *param_1 = &PTR_FUN_008076a0;

  FUN_0040e340(param_1);

  *param_1 = &PTR_FUN_00795538;

  if (param_1[1] != 0) {

    FUN_0040e340(param_1);

    param_1[1] = 0;

  }

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b6cf0 at 0x006B6CF0 (size: 144) ---


undefined4 * __thiscall FUN_006b6cf0(undefined4 *param_1,int param_2,char *param_3)



{

  LPTOP_LEVEL_EXCEPTION_FILTER pPVar1;

  int iVar2;

  char *pcVar3;

  undefined4 *puVar4;

  

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[0x2c7] = 0;

  param_1[0x2c8] = 0;

  param_1[0x2c9] = 0;

  pcVar3 = (char *)(param_1 + 3);

  for (iVar2 = 0x41; iVar2 != 0; iVar2 = iVar2 + -1) {

    pcVar3[0] = '\0';

    pcVar3[1] = '\0';

    pcVar3[2] = '\0';

    pcVar3[3] = '\0';

    pcVar3 = pcVar3 + 4;

  }

  *pcVar3 = '\0';

  puVar4 = (undefined4 *)((int)param_1 + 0x112);

  for (iVar2 = 0x82; iVar2 != 0; iVar2 = iVar2 + -1) {

    *puVar4 = 0;

    puVar4 = puVar4 + 1;

  }

  *(undefined2 *)puVar4 = 0;

  if ((param_2 != 0) && (param_1[0x2c8] == 0)) {

    pPVar1 = SetUnhandledExceptionFilter(FUN_006b6760);

    param_1[0x2c9] = pPVar1;

    param_1[0x2c8] = 1;

  }

  if ((param_3 != (char *)0x0) && (*param_3 != '\0')) {

    strncpy((char *)(param_1 + 3),param_3,0x104);

  }

  return param_1;

}





// --- FUN_006b6d80 at 0x006B6D80 (size: 31) ---


undefined4 * __fastcall FUN_006b6d80(undefined4 *param_1)



{

  param_1[1] = 0;

  *param_1 = &PTR_FUN_008076a0;

  FUN_0040e4e0(param_1);

  return param_1;

}





// --- FUN_006b6da0 at 0x006B6DA0 (size: 102) ---


void __thiscall FUN_006b6da0(undefined4 *param_1,int param_2)



{

  undefined4 uVar1;

  int iVar2;

  BSTR pOVar3;

  undefined4 *puVar4;

  

  if (param_2 != 0) {

    uVar1 = (*(code *)PTR_FUN_00820a9c)();

    puVar4 = (undefined4 *)0x0;

    iVar2 = (*(code *)PTR_FUN_00837394)(uVar1,0,param_2,0xffffffff,0,0);

    pOVar3 = SysAllocStringLen((OLECHAR *)0x0,iVar2 - 1);

    if (pOVar3 != (BSTR)0x0) {

      (*(code *)PTR_FUN_00837394)(uVar1,0,param_2,0xffffffff,pOVar3,iVar2);

    }

    *puVar4 = pOVar3;

    return;

  }

  *param_1 = 0;

  return;

}





// --- FUN_006b6e10 at 0x006B6E10 (size: 5) ---


undefined4 FUN_006b6e10(void)



{

  return 0;

}





// --- FUN_006b6e20 at 0x006B6E20 (size: 160) ---


undefined4 FUN_006b6e20(undefined4 param_1)



{

  int iVar1;

  int *piVar2;

  LONG LVar3;

  undefined4 *local_8;

  undefined4 *local_4;

  

  FUN_005444d0(L"3rd party API not in use.");

  iVar1 = FUN_0055b0a0();

  if (iVar1 != 0) {

    piVar2 = (int *)FUN_0055a740();

    (**(code **)(*piVar2 + 0xc))(piVar2,&local_4);

    FUN_0055f580(local_4);

  }

  FUN_00546290(&local_4,0);

  FUN_006ae970(param_1,&local_4);

  LVar3 = InterlockedDecrement(local_4 + 1);

  if ((LVar3 == 0) && (local_4 != (undefined4 *)0x0)) {

    (**(code **)*local_4)(1);

  }

  LVar3 = InterlockedDecrement(local_8 + 1);

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

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

  }

  return 0;

}





// --- FUN_006b6ec0 at 0x006B6EC0 (size: 416) ---


undefined4 FUN_006b6ec0(undefined4 param_1,BSTR param_2)



{

  BSTR pOVar1;

  BSTR bstrString;

  int iVar2;

  int *piVar3;

  LONG LVar4;

  undefined4 *local_18;

  undefined4 *local_14;

  undefined4 *local_10;

  undefined4 *local_c;

  undefined4 *local_8;

  undefined4 local_4;

  

  FUN_005444d0(L"Unknown");

  FUN_005444d0(L"Unknown");

  FUN_005444d0(L"Unknown");

  iVar2 = FUN_0055b0a0();

  pOVar1 = param_2;

  if (iVar2 != 0) {

    FUN_006b6da0(*(int *)param_2 + 0x14);

    piVar3 = (int *)FUN_0055a740();

    bstrString = param_2;

    (**(code **)(*piVar3 + 0x10))(piVar3,param_2,&local_8,&local_c,&local_4);

    FUN_0055f580(local_8);

    FUN_0055f580(local_c);

    FUN_0055f580(local_4);

    SysFreeString(bstrString);

  }

  FUN_00546290(&local_8,0);

  FUN_00546290(&local_c,0);

  FUN_00546290(&param_2,0);

  FUN_006aea60(param_1,iVar2 != 0,pOVar1,&param_2,&local_c,&local_8);

  pOVar1 = param_2;

  LVar4 = InterlockedDecrement((LONG *)(param_2 + 2));

  if ((LVar4 == 0) && (pOVar1 != (BSTR)0x0)) {

    (*(code *)**(undefined4 **)pOVar1)(1);

  }

  LVar4 = InterlockedDecrement(local_c + 1);

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

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

  }

  LVar4 = InterlockedDecrement(local_8 + 1);

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

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

  }

  LVar4 = InterlockedDecrement(local_18 + 1);

  if ((LVar4 == 0) && (local_18 != (undefined4 *)0x0)) {

    (**(code **)*local_18)(1);

  }

  LVar4 = InterlockedDecrement(local_14 + 1);

  if ((LVar4 == 0) && (local_14 != (undefined4 *)0x0)) {

    (**(code **)*local_14)(1);

  }

  LVar4 = InterlockedDecrement(local_10 + 1);

  if ((LVar4 == 0) && (local_10 != (undefined4 *)0x0)) {

    (**(code **)*local_10)(1);

  }

  return 0;

}





// --- FUN_006b7060 at 0x006B7060 (size: 90) ---


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



int FUN_006b7060(int param_1,int param_2,float param_3,int param_4)



{

  int iVar1;

  

  if (param_2 == 0x40000) {

    param_3 = _DAT_007938b0;

  }

  floor((double)(param_3 * (float)param_1 * (float)param_4 + (float)_DAT_008078c8));

  iVar1 = FUN_005df4c4();

  if (iVar1 != 0) {

    if (iVar1 < 0) {

      iVar1 = -1;

    }

    return iVar1;

  }

  return 1;

}





// --- FUN_006b70c0 at 0x006B70C0 (size: 90) ---


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



int FUN_006b70c0(int param_1,int param_2,float param_3,int param_4)



{

  int iVar1;

  

  if (param_2 == 0x40000) {

    param_3 = _DAT_007ea030;

  }

  ceil((double)(param_3 * (float)param_1 * (float)param_4 - (float)_DAT_008078c8));

  iVar1 = FUN_005df4c4();

  if (iVar1 != 0) {

    if (iVar1 < 1) {

      iVar1 = -1;

    }

    return iVar1;

  }

  return 1;

}





// --- FUN_006b7120 at 0x006B7120 (size: 79) ---


undefined4 __thiscall FUN_006b7120(float *param_1,float *param_2,float param_3,float param_4)



{

  undefined4 uVar1;

  

  param_3 = *param_2 * *param_1 + param_2[1] * param_1[1] + param_2[2] * param_1[2] + param_1[3] +

            param_3;

  if (param_4 < param_3) {

    return 0;

  }

  uVar1 = 1;

  if (-param_4 <= param_3) {

    uVar1 = 2;

  }

  return uVar1;

}





// --- FUN_006b7170 at 0x006B7170 (size: 73) ---


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



ushort FUN_006b7170(float param_1)



{

  ushort uVar1;

  

  if (param_1 < _DAT_00807960) {

    return CONCAT11(param_1 < _DAT_00807960 |

                    (byte)((ushort)((ushort)(NAN(param_1) || NAN(_DAT_00807960)) << 10) >> 8) |

                    (byte)((ushort)((ushort)(param_1 == _DAT_00807960) << 0xe) >> 8),0xff);

  }

  if (param_1 >= _DAT_00807964 && (param_1 == _DAT_00807964) == 0) {

    return (ushort)(param_1 < _DAT_00807964) << 8 |

           (ushort)(NAN(param_1) || NAN(_DAT_00807964)) << 10 |

           (ushort)(param_1 == _DAT_00807964) << 0xe;

  }

  uVar1 = FUN_005df4c4();

  return uVar1;

}





// --- FUN_006b71c0 at 0x006B71C0 (size: 149) ---


void FUN_006b71c0(int param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  iVar1 = FUN_0059d4c0();

  DAT_00867388 = (uint)(iVar1 != 0);

  uVar2 = 0;

  if (iVar1 != 0) {

    uVar2 = FUN_0053f310();

  }

  FUN_005a47d0(param_1,uVar2);

  FUN_005a4420(param_1,1,1);

  FUN_005a4460(param_1,2,2,2);

  if (param_1 == 0) {

    FUN_005a3ca0(DAT_0081fcb0,DAT_0081fcb4,1);

    FUN_005a3ba0(1);

    FUN_005a3e20(4,1);

  }

  return;

}





// --- FUN_006b7260 at 0x006B7260 (size: 1088) ---


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



void FUN_006b7260(int *param_1)



{

  undefined4 *puVar1;

  undefined1 uVar2;

  undefined1 uVar3;

  undefined1 uVar4;

  undefined1 uVar5;

  int iVar6;

  uint uVar7;

  uint uVar8;

  uint unaff_EBX;

  int iVar9;

  float *pfVar10;

  uint uVar11;

  undefined4 *puVar12;

  bool bVar13;

  int iStack_10;

  int *piStack_4;

  

  FUN_0054c9f0();

  if (DAT_00836c08 == 0) {

    uVar11 = ~(*(uint *)(DAT_00867380 + 0x58) >> 2) & 1;

  }

  else {

    uVar11 = 1;

  }

  if ((((DAT_00836c04 == 0) || (*(char *)(DAT_00870340 + 0x44) == '\0')) || (DAT_00867374 == 0)) ||

     (uVar11 == 0)) {

    iVar9 = 0;

  }

  else {

    iVar9 = 1;

  }

  FUN_0059e760(param_1,0,iVar9);

  FUN_005a41f0(0);

  if (iVar9 == 0) {

    (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x164))(*(int **)(DAT_00870340 + 0x468),0x142);

    iStack_10 = 0;

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

      puVar12 = &DAT_00902fdc;

      do {

        puVar1 = *(undefined4 **)(*param_1 + iStack_10 * 4);

        puVar12[-1] = *puVar1;

        *puVar12 = puVar1[1];

        puVar12[1] = (float)puVar1[2] - DAT_00836b64;

        uVar11 = FUN_005df4c4();

        uVar7 = FUN_005df4c4();

        uVar8 = FUN_005df4c4();

        bVar13 = DAT_00867388 != 0;

        puVar12[2] = ((uVar11 & 0xff | 0xffffff00) << 8 | uVar7 & 0xff) << 8 | uVar8 & 0xff;

        iVar9 = DAT_0086738c;

        if (bVar13) {

          puVar12[3] = _DAT_0081fccc *

                       *(float *)(puVar1[4] + *(char *)(DAT_0086738c + iStack_10) * 8);

          puVar12[4] = _DAT_0081fcd0 * *(float *)(puVar1[4] + 4 + *(char *)(iVar9 + iStack_10) * 8);

        }

        iStack_10 = iStack_10 + 1;

        puVar12 = puVar12 + 6;

        param_1 = piStack_4;

        uVar11 = unaff_EBX;

      } while (iStack_10 < (int)(uint)*(byte *)((int)piStack_4 + 0xe));

    }

    FUN_005a1520(4,1,&DAT_00902fd8,0x18);

    if ((DAT_00867374 != 0) && (uVar11 != 0)) {

      FUN_006b71c0(0);

      iVar9 = 0;

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

        pfVar10 = (float *)&DAT_00902fe8;

        do {

          iVar6 = FUN_0059c9a0(*(undefined4 *)(*param_1 + iVar9 * 4),0);

          if (*(float *)(iVar6 + 8) < _DAT_00807960) {

            iVar6 = 0xff;

          }

          else if (*(float *)(iVar6 + 8) <= _DAT_00807964) {

            iVar6 = FUN_005df4c4();

          }

          else {

            iVar6 = 0;

          }

          bVar13 = DAT_00867388 != 0;

          pfVar10[-1] = (float)(iVar6 << 0x18 | (uint)pfVar10[-1] & 0xffffff);

          if (bVar13) {

            *pfVar10 = DAT_0081fcc8 * *pfVar10;

            pfVar10[1] = DAT_0081fcc8 * pfVar10[1];

          }

          iVar9 = iVar9 + 1;

          pfVar10 = pfVar10 + 6;

        } while (iVar9 < (int)(uint)*(byte *)((int)param_1 + 0xe));

      }

      FUN_005a1520(4,1,&DAT_00902fd8,0x18);

    }

    return;

  }

  FUN_006b71c0(1);

  (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x164))(*(int **)(DAT_00870340 + 0x468),0x242);

  iVar9 = 0;

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

    puVar12 = &DAT_00903024;

    do {

      puVar1 = *(undefined4 **)(*param_1 + iVar9 * 4);

      puVar12[-1] = *puVar1;

      *puVar12 = puVar1[1];

      puVar12[1] = (float)puVar1[2] - DAT_00836b64;

      uVar2 = FUN_005df4c4();

      uVar3 = FUN_005df4c4();

      uVar4 = FUN_005df4c4();

      iVar6 = FUN_0059c9a0(puVar1,0);

      if (*(float *)(iVar6 + 8) < _DAT_00807960) {

        uVar5 = 0xff;

      }

      else if (*(float *)(iVar6 + 8) <= _DAT_00807964) {

        uVar5 = FUN_005df4c4();

      }

      else {

        uVar5 = 0;

      }

      if (DAT_00836c00 != 0) {

        uVar5 = FUN_005df4c4();

      }

      bVar13 = DAT_00867388 != 0;

      puVar12[2] = CONCAT31(CONCAT21(CONCAT11(uVar5,uVar2),uVar3),uVar4);

      iVar6 = DAT_0086738c;

      if (bVar13) {

        puVar12[3] = _DAT_0081fccc * *(float *)(puVar1[4] + *(char *)(DAT_0086738c + iVar9) * 8);

        puVar12[4] = _DAT_0081fcd0 * *(float *)(puVar1[4] + 4 + *(char *)(iVar6 + iVar9) * 8);

        puVar12[5] = DAT_0081fcc8 * (float)puVar12[3];

        puVar12[6] = DAT_0081fcc8 * (float)puVar12[4];

      }

      iVar9 = iVar9 + 1;

      puVar12 = puVar12 + 8;

    } while (iVar9 < (int)(uint)*(byte *)((int)param_1 + 0xe));

  }

  FUN_005a1520(4,1,&DAT_00903020,0x20);

  return;

}





// --- FUN_006b76a0 at 0x006B76A0 (size: 1356) ---


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



void FUN_006b76a0(int *param_1)



{

  undefined4 *puVar1;

  undefined1 uVar2;

  undefined1 uVar3;

  undefined1 uVar4;

  undefined1 uVar5;

  int *piVar6;

  uint uVar7;

  uint uVar8;

  uint uVar9;

  int iVar10;

  int unaff_EBX;

  int iVar11;

  bool bVar12;

  int *unaff_retaddr;

  int iStack_18;

  int iStack_14;

  int *piStack_4;

  

  FUN_0054c9f0();

  if (DAT_00836c14 == 0) {

    piVar6 = (int *)(~(*(uint *)(DAT_00867380 + 0x58) >> 2) & 1);

  }

  else {

    piVar6 = (int *)0x1;

  }

  if ((((DAT_00836c10 == 0) || (*(char *)(DAT_00870340 + 0x44) == '\0')) || (DAT_00867374 == 0)) ||

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

    iVar11 = 0;

  }

  else {

    iVar11 = 1;

  }

  FUN_0059e760(param_1,0,iVar11);

  FUN_005a41f0(0);

  if (iVar11 == 0) {

    (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x164))(*(int **)(DAT_00870340 + 0x468),0x142);

    iStack_14 = 0;

    do {

      switch(iStack_14) {

      case 0:

        unaff_EBX = 0;

        piVar6 = param_1;

        break;

      case 1:

        unaff_EBX = 1;

        piVar6 = param_1;

        break;

      case 2:

        goto LAB_006b79ac;

      case 3:

        unaff_EBX = 0;

        piVar6 = unaff_retaddr;

        break;

      case 4:

        unaff_EBX = 1;

        piVar6 = unaff_retaddr;

        break;

      case 5:

        param_1 = unaff_retaddr;

LAB_006b79ac:

        unaff_EBX = 2;

        piVar6 = param_1;

      }

      puVar1 = *(undefined4 **)(*piVar6 + unaff_EBX * 4);

      (&DAT_00903080)[iStack_14 * 6] = *puVar1;

      (&DAT_00903084)[iStack_14 * 6] = puVar1[1];

      (&DAT_00903088)[iStack_14 * 6] = (float)puVar1[2] - DAT_00836b64;

      uVar7 = FUN_005df4c4();

      uVar8 = FUN_005df4c4();

      uVar9 = FUN_005df4c4();

      bVar12 = DAT_00867388 != 0;

      (&DAT_0090308c)[iStack_14 * 6] =

           ((uVar7 & 0xff | 0xffffff00) << 8 | uVar8 & 0xff) << 8 | uVar9 & 0xff;

      if (bVar12) {

        (&DAT_00903090)[iStack_14 * 6] =

             _DAT_0081fccc * *(float *)(puVar1[4] + *(char *)(piVar6[5] + unaff_EBX) * 8);

        (&DAT_00903094)[iStack_14 * 6] =

             _DAT_0081fcd0 * *(float *)(puVar1[4] + 4 + *(char *)(piVar6[5] + unaff_EBX) * 8);

      }

      iStack_14 = iStack_14 + 1;

      param_1 = piStack_4;

    } while (iStack_14 < 6);

    FUN_005a1520(4,2,&DAT_00903080,0x18);

    if ((DAT_00867374 != 0) && (iStack_18 != 0)) {

      FUN_006b71c0(0);

      iVar11 = 0;

      do {

        switch(iVar11) {

        case 0:

          unaff_EBX = 0;

          piVar6 = piStack_4;

          break;

        case 1:

          unaff_EBX = 1;

          piVar6 = piStack_4;

          break;

        case 2:

          piVar6 = piStack_4;

          goto LAB_006b7b16;

        case 3:

          unaff_EBX = 0;

          piVar6 = unaff_retaddr;

          break;

        case 4:

          unaff_EBX = 1;

          piVar6 = unaff_retaddr;

          break;

        case 5:

          piVar6 = unaff_retaddr;

LAB_006b7b16:

          unaff_EBX = 2;

        }

        iVar10 = FUN_0059c9a0(*(undefined4 *)(*piVar6 + unaff_EBX * 4),0);

        if (*(float *)(iVar10 + 8) < _DAT_00807960) {

          iVar10 = 0xff;

        }

        else if (*(float *)(iVar10 + 8) <= _DAT_00807964) {

          iVar10 = FUN_005df4c4();

        }

        else {

          iVar10 = 0;

        }

        (&DAT_0090308c)[iVar11 * 6] = iVar10 << 0x18 | (&DAT_0090308c)[iVar11 * 6] & 0xffffff;

        if (DAT_00867388 != 0) {

          (&DAT_00903090)[iVar11 * 6] = DAT_0081fcc8 * (float)(&DAT_00903090)[iVar11 * 6];

          (&DAT_00903094)[iVar11 * 6] = DAT_0081fcc8 * (float)(&DAT_00903094)[iVar11 * 6];

        }

        iVar11 = iVar11 + 1;

      } while (iVar11 < 6);

      FUN_005a1520(4,2,&DAT_00903080,0x18);

    }

    return;

  }

  FUN_006b71c0(1);

  (**(code **)(**(int **)(DAT_00870340 + 0x468) + 0x164))(*(int **)(DAT_00870340 + 0x468),0x242);

  iStack_14 = 0;

  do {

    switch(iStack_14) {

    case 0:

      unaff_EBX = 0;

      piVar6 = param_1;

      break;

    case 1:

      unaff_EBX = 1;

      piVar6 = param_1;

      break;

    case 2:

      goto LAB_006b77a0;

    case 3:

      unaff_EBX = 0;

      piVar6 = unaff_retaddr;

      break;

    case 4:

      unaff_EBX = 1;

      piVar6 = unaff_retaddr;

      break;

    case 5:

      param_1 = unaff_retaddr;

LAB_006b77a0:

      unaff_EBX = 2;

      piVar6 = param_1;

    }

    puVar1 = *(undefined4 **)(*piVar6 + unaff_EBX * 4);

    (&DAT_00903110)[iStack_14 * 8] = *puVar1;

    (&DAT_00903114)[iStack_14 * 8] = puVar1[1];

    (&DAT_00903118)[iStack_14 * 8] = (float)puVar1[2] - DAT_00836b64;

    uVar2 = FUN_005df4c4();

    uVar3 = FUN_005df4c4();

    uVar4 = FUN_005df4c4();

    iVar11 = FUN_0059c9a0(puVar1,0);

    if (*(float *)(iVar11 + 8) < _DAT_00807960) {

      uVar5 = 0xff;

    }

    else if (*(float *)(iVar11 + 8) <= _DAT_00807964) {

      uVar5 = FUN_005df4c4();

    }

    else {

      uVar5 = 0;

    }

    if (DAT_00836c0c != 0) {

      uVar5 = FUN_005df4c4();

    }

    bVar12 = DAT_00867388 != 0;

    (&DAT_0090311c)[iStack_14 * 8] = CONCAT31(CONCAT21(CONCAT11(uVar5,uVar2),uVar3),uVar4);

    if (bVar12) {

      (&DAT_00903120)[iStack_14 * 8] =

           _DAT_0081fccc * *(float *)(puVar1[4] + *(char *)(piVar6[5] + unaff_EBX) * 8);

      (&DAT_00903124)[iStack_14 * 8] =

           _DAT_0081fcd0 * *(float *)(puVar1[4] + 4 + *(char *)(piVar6[5] + unaff_EBX) * 8);

      (&DAT_00903128)[iStack_14 * 8] = DAT_0081fcc8 * (float)(&DAT_00903120)[iStack_14 * 8];

      (&DAT_0090312c)[iStack_14 * 8] = DAT_0081fcc8 * (float)(&DAT_00903124)[iStack_14 * 8];

    }

    iStack_14 = iStack_14 + 1;

    param_1 = piStack_4;

    if (5 < iStack_14) {

      FUN_005a1520(4,2,&DAT_00903110,0x20);

      return;

    }

  } while( true );

}





// --- FUN_006b7c40 at 0x006B7C40 (size: 817) ---


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



void FUN_006b7c40(undefined4 *param_1,int param_2,undefined4 *param_3,int *param_4,int param_5)



{

  float fVar1;

  float fVar2;

  float *pfVar3;

  float fVar4;

  float fVar5;

  float *pfVar6;

  bool bVar7;

  float fVar8;

  float fVar9;

  float fVar10;

  float *pfVar11;

  bool bVar12;

  float *pfVar13;

  int iVar14;

  int iVar15;

  undefined4 *puVar16;

  int iVar17;

  float *pfVar18;

  undefined4 *puVar19;

  undefined4 *puVar20;

  undefined4 *puVar21;

  uint local_1c;

  undefined4 *local_18;

  undefined4 *local_8 [2];

  

  iVar14 = DAT_00847060;

  pfVar13 = DAT_00847050;

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

    _DAT_009064b4 = _DAT_009064b4 | 1;

  }

  local_8[0] = param_3;

  puVar16 = (undefined4 *)(param_5 << (0x1eU - (char)DAT_00847060 & 0x1f));

  iVar17 = param_2 + -1;

  local_1c = 0;

  local_8[1] = &DAT_009063d0;

  pfVar18 = (float *)&DAT_009031d0;

  iVar15 = iVar17;

  while( true ) {

    puVar21 = puVar16;

    if (iVar15 < 0) goto LAB_006b7cc2;

    if (*(float *)(param_1[iVar15] + 0xc) < _DAT_008fc788) break;

    iVar15 = iVar15 + -1;

  }

  local_1c = 1;

  fVar1 = ((float *)*param_1)[3] - _DAT_008fc788;

  local_18 = &DAT_009063d0;

  puVar21 = &DAT_009063d0;

  pfVar6 = (float *)*param_1;

  bVar12 = DAT_00796344 <= fVar1;

  for (; -1 < iVar17; iVar17 = iVar17 + -1) {

    pfVar3 = (float *)param_1[iVar17];

    fVar2 = pfVar3[3] - _DAT_008fc788;

    bVar7 = DAT_00796344 <= fVar2;

    puVar19 = puVar21;

    if (bVar12 != bVar7) {

      puVar19 = puVar21 + 1;

      fVar1 = fVar1 / (fVar1 - fVar2);

      *pfVar18 = (*pfVar3 - *pfVar6) * fVar1 + *pfVar6;

      pfVar18[1] = (pfVar3[1] - pfVar6[1]) * fVar1 + pfVar6[1];

      pfVar18[2] = (pfVar3[2] - pfVar6[2]) * fVar1 + pfVar6[2];

      pfVar18[3] = (pfVar3[3] - pfVar6[3]) * fVar1 + pfVar6[3];

      *puVar21 = pfVar18;

      pfVar18 = pfVar18 + 4;

    }

    if (bVar7) {

      *puVar19 = pfVar3;

      puVar19 = puVar19 + 1;

    }

    puVar21 = puVar19;

    pfVar6 = pfVar3;

    fVar1 = fVar2;

    bVar12 = bVar7;

  }

  param_2 = (int)(puVar21 + -0x2418f4) >> 2;

  if (param_2 < 3) {

    return;

  }

  param_1 = &DAT_009063d0;

LAB_006b7cc2:

  pfVar3 = pfVar13 + iVar14 * 6 + -6;

  puVar19 = param_1;

  pfVar6 = pfVar13;

  do {

    pfVar11 = pfVar3;

    if (pfVar11 < pfVar13) {

      *param_4 = param_2;

      if (local_1c != 0) {

        for (; local_18 < puVar21; puVar21 = puVar21 + -1) {

          *param_3 = puVar21[-1];

          param_3 = param_3 + 1;

        }

      }

      return;

    }

    puVar16 = (undefined4 *)((int)puVar16 << 1);

    param_1 = puVar19;

    if (-1 < (int)puVar16) {

      fVar1 = *pfVar11;

      pfVar3 = (float *)*puVar19;

      local_1c = local_1c ^ 1;

      param_1 = local_8[local_1c];

      fVar4 = *pfVar6;

      fVar5 = pfVar6[1];

      fVar2 = pfVar11[1];

      fVar8 = (*pfVar3 - fVar4 * pfVar3[3]) * (fVar2 - fVar5) -

              (pfVar3[1] - fVar5 * pfVar3[3]) * (fVar1 - fVar4);

      puVar21 = param_1;

      bVar12 = fVar8 < DAT_00796344 != (fVar8 == DAT_00796344);

      fVar10 = fVar8;

      while (param_2 = param_2 + -1, -1 < param_2) {

        pfVar6 = (float *)puVar19[param_2];

        fVar9 = fVar8;

        if (param_2 != 0) {

          fVar9 = (*pfVar6 - fVar4 * pfVar6[3]) * (fVar2 - fVar5) -

                  (pfVar6[1] - fVar5 * pfVar6[3]) * (fVar1 - fVar4);

        }

        bVar7 = fVar9 < DAT_00796344 != (fVar9 == DAT_00796344);

        puVar20 = puVar21;

        if (bVar12 != bVar7) {

          puVar20 = puVar21 + 1;

          fVar10 = fVar10 / (fVar10 - fVar9);

          *pfVar18 = (*pfVar6 - *pfVar3) * fVar10 + *pfVar3;

          pfVar18[1] = (pfVar6[1] - pfVar3[1]) * fVar10 + pfVar3[1];

          pfVar18[2] = (pfVar6[2] - pfVar3[2]) * fVar10 + pfVar3[2];

          pfVar18[3] = (pfVar6[3] - pfVar3[3]) * fVar10 + pfVar3[3];

          *puVar21 = pfVar18;

          pfVar18 = pfVar18 + 4;

        }

        pfVar3 = pfVar6;

        puVar21 = puVar20;

        bVar12 = bVar7;

        fVar10 = fVar9;

        if (bVar7) {

          *puVar20 = pfVar6;

          puVar21 = puVar20 + 1;

        }

      }

      param_2 = (int)puVar21 - (int)param_1 >> 2;

      local_18 = param_1;

      if (param_2 < 3) {

        return;

      }

    }

    pfVar3 = pfVar11 + -6;

    puVar19 = param_1;

    pfVar6 = pfVar11;

  } while( true );

}





// --- FUN_006b7f80 at 0x006B7F80 (size: 128) ---


void FUN_006b7f80(undefined4 *param_1,int param_2)



{

  undefined4 uVar1;

  undefined4 uVar2;

  undefined4 uVar3;

  undefined4 uVar4;

  int iVar5;

  int iVar6;

  

  uVar4 = DAT_00836b64;

  uVar3 = DAT_00807968;

  if (param_2 == 2) {

    uVar1 = *param_1;

    iVar5 = FUN_006b7120(DAT_00867334,DAT_00836b64,DAT_00807968);

    uVar2 = param_1[1];

    iVar6 = FUN_006b7120(DAT_00867334,uVar4,uVar3);

    if (iVar5 == 0) {

      if (iVar6 != 0) {

        FUN_006b7260(uVar1);

        return;

      }

      FUN_006b76a0(uVar1,uVar2);

      return;

    }

    if (iVar6 == 0) {

      FUN_006b7260(uVar2);

    }

  }

  return;

}





// --- FUN_006b8000 at 0x006B8000 (size: 103) ---


void __fastcall FUN_006b8000(undefined4 *param_1)



{

  undefined4 *puVar1;

  LONG LVar2;

  

  *param_1 = &PTR_FUN_0080797c;

  if ((undefined4 *)param_1[0x20] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[0x20])(1);

    param_1[0x20] = 0;

  }

  puVar1 = (undefined4 *)param_1[2];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

    (**(code **)*puVar1)(1);

  }

  puVar1 = (undefined4 *)param_1[1];

  LVar2 = InterlockedDecrement(puVar1 + 1);

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

    (**(code **)*puVar1)(1);

  }

  FUN_005aebf0();

  return;

}





// --- FUN_006b8070 at 0x006B8070 (size: 30) ---


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



{

  FUN_006b8000();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b8090 at 0x006B8090 (size: 364) ---


void __fastcall FUN_006b8090(undefined4 *param_1)



{

  undefined4 *puVar1;

  undefined4 uVar2;

  LONG LVar3;

  

  FUN_0048c3e0(&DAT_007938af);

  puVar1 = (undefined4 *)param_1[1];

  if (puVar1 != param_1) {

    LVar3 = InterlockedDecrement(puVar1 + 1);

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

      (**(code **)*puVar1)(1);

    }

    param_1[1] = param_1;

    InterlockedIncrement(param_1 + 1);

  }

  LVar3 = InterlockedDecrement(param_1 + 1);

  if ((LVar3 == 0) && (param_1 != (undefined4 *)0x0)) {

    (**(code **)*param_1)(1);

  }

  FUN_0048c3e0(&DAT_007938af);

  puVar1 = (undefined4 *)param_1[2];

  if (puVar1 != param_1) {

    LVar3 = InterlockedDecrement(puVar1 + 1);

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

      (**(code **)*puVar1)(1);

    }

    param_1[2] = param_1;

    InterlockedIncrement(param_1 + 1);

  }

  LVar3 = InterlockedDecrement(param_1 + 1);

  if ((LVar3 == 0) && (param_1 != (undefined4 *)0x0)) {

    (**(code **)*param_1)(1);

  }

  param_1[3] = DAT_009064bc;

  uVar2 = DAT_00807978;

  param_1[4] = DAT_009064bc;

  param_1[5] = DAT_009064bc;

  param_1[0xb] = 0;

  param_1[0xc] = 0;

  param_1[0xd] = 0;

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 0;

  param_1[0x13] = 0;

  param_1[0x14] = 0;

  param_1[0x15] = 0;

  param_1[0x16] = 0;

  param_1[0x17] = 0;

  param_1[0x18] = 0;

  param_1[6] = 0;

  param_1[7] = 0;

  param_1[10] = 0;

  param_1[9] = 0;

  param_1[8] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = uVar2;

  param_1[0x1d] = DAT_009064bc;

  param_1[0x1e] = 0;

  param_1[0x1f] = 0;

  param_1[0x21] = 0;

  if ((undefined4 *)param_1[0x20] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[0x20])(1);

    param_1[0x20] = 0;

  }

  param_1[0x22] = 0;

  param_1[0x23] = 0;

  param_1[0x24] = 0;

  param_1[0x25] = 0;

  return;

}





// --- FUN_006b8200 at 0x006B8200 (size: 76) ---


undefined4 * __fastcall FUN_006b8200(undefined4 *param_1)



{

  LONG *pLVar1;

  

  FUN_005aebe0();

  *param_1 = &PTR_FUN_0080797c;

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[1] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(DAT_008ef11c + 4);

  param_1[2] = DAT_008ef11c;

  InterlockedIncrement(pLVar1);

  param_1[0x20] = 0;

  FUN_006b8090();

  return param_1;

}





// --- FUN_006b8250 at 0x006B8250 (size: 842) ---


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



{

  char cVar1;

  byte bVar2;

  ushort uVar3;

  int iVar4;

  uint uVar5;

  int *piVar6;

  uint uVar7;

  int iVar8;

  int *piVar9;

  

  piVar6 = param_2;

  iVar4 = *param_2;

  FUN_006b8090();

  param_2 = (int *)0x0;

  iVar8 = FUN_004fd290(&param_2,0);

  if (iVar8 + 0x10U <= param_3) {

    uVar5 = *(uint *)*piVar6;

    *piVar6 = (int)((uint *)*piVar6 + 1);

    FUN_004fd460(piVar6,param_3);

    uVar7 = param_3;

    uVar3 = *(ushort *)*piVar6;

    *piVar6 = (int)((ushort *)*piVar6 + 1);

    *(uint *)(param_1 + 0xc) = (uint)uVar3;

    uVar3 = *(ushort *)*piVar6;

    *piVar6 = (int)((ushort *)*piVar6 + 1);

    *(uint *)(param_1 + 0x10) = uVar3 | 0x6000000;

    *(undefined4 *)(param_1 + 0x34) = *(undefined4 *)*piVar6;

    iVar8 = *piVar6;

    *piVar6 = iVar8 + 4;

    *(undefined4 *)(param_1 + 100) = *(undefined4 *)(iVar8 + 4);

    *piVar6 = *piVar6 + 4;

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

      FUN_004fd460(piVar6,param_3);

    }

    if ((uVar5 & 2) != 0) {

      cVar1 = *(char *)*piVar6;

      *piVar6 = (int)((char *)*piVar6 + 1);

      *(int *)(param_1 + 0x2c) = (int)cVar1;

    }

    if ((uVar5 & 4) != 0) {

      cVar1 = *(char *)*piVar6;

      *piVar6 = (int)((char *)*piVar6 + 1);

      *(int *)(param_1 + 0x30) = (int)cVar1;

    }

    if ((uVar5 & 8) != 0) {

      *(undefined4 *)(param_1 + 0x38) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x10) != 0) {

      *(undefined4 *)(param_1 + 0x3c) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x20) != 0) {

      *(undefined4 *)(param_1 + 0x40) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x80000) != 0) {

      *(undefined4 *)(param_1 + 0x44) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((char)uVar5 < '\0') {

      *(undefined4 *)(param_1 + 0x48) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x100) != 0) {

      bVar2 = *(byte *)*piVar6;

      *piVar6 = (int)((byte *)*piVar6 + 1);

      *(uint *)(param_1 + 0x4c) = (uint)bVar2;

    }

    if ((uVar5 & 0x200) != 0) {

      bVar2 = *(byte *)*piVar6;

      *piVar6 = (int)((byte *)*piVar6 + 1);

      *(uint *)(param_1 + 0x50) = (uint)bVar2;

    }

    if ((uVar5 & 0x400) != 0) {

      uVar3 = *(ushort *)*piVar6;

      *piVar6 = (int)((ushort *)*piVar6 + 1);

      *(uint *)(param_1 + 0x54) = (uint)uVar3;

    }

    if ((uVar5 & 0x800) != 0) {

      uVar3 = *(ushort *)*piVar6;

      *piVar6 = (int)((ushort *)*piVar6 + 1);

      *(uint *)(param_1 + 0x58) = (uint)uVar3;

    }

    if ((uVar5 & 0x1000) != 0) {

      uVar3 = *(ushort *)*piVar6;

      *piVar6 = (int)((ushort *)*piVar6 + 1);

      *(uint *)(param_1 + 0x5c) = (uint)uVar3;

    }

    if ((uVar5 & 0x2000) != 0) {

      uVar3 = *(ushort *)*piVar6;

      *piVar6 = (int)((ushort *)*piVar6 + 1);

      *(uint *)(param_1 + 0x60) = (uint)uVar3;

    }

    if ((uVar5 & 0x4000) != 0) {

      *(undefined4 *)(param_1 + 0x18) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((char)(uVar5 >> 8) < '\0') {

      *(undefined4 *)(param_1 + 0x1c) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x10000) != 0) {

      *(undefined4 *)(param_1 + 0x24) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x20000) != 0) {

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

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x40000) != 0) {

      *(undefined4 *)(param_1 + 0x20) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x100000) != 0) {

      bVar2 = *(byte *)*piVar6;

      *piVar6 = (int)((byte *)*piVar6 + 1);

      *(uint *)(param_1 + 0x68) = (uint)bVar2;

    }

    if ((uVar5 & 0x800000) != 0) {

      bVar2 = *(byte *)*piVar6;

      *piVar6 = (int)((byte *)*piVar6 + 1);

      *(uint *)(param_1 + 0x6c) = (uint)bVar2;

    }

    if ((uVar5 & 0x1000000) != 0) {

      *(undefined4 *)(param_1 + 0x70) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x200000) != 0) {

      uVar3 = *(ushort *)*piVar6;

      *piVar6 = (int)((ushort *)*piVar6 + 1);

      *(uint *)(param_1 + 0x74) = (uint)uVar3;

    }

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

      uVar3 = *(ushort *)*piVar6;

      *piVar6 = (int)((ushort *)*piVar6 + 1);

      *(uint *)(param_1 + 0x78) = (uint)uVar3;

    }

    if ((uVar5 & 0x2000000) != 0) {

      *(undefined4 *)(param_1 + 0x7c) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x8000000) != 0) {

      uVar3 = *(ushort *)*piVar6;

      *piVar6 = (int)((ushort *)*piVar6 + 1);

      *(uint *)(param_1 + 0x84) = (uint)uVar3;

    }

    if ((uVar5 & 0x4000000) != 0) {

      iVar8 = FUN_005df0f5(0x84);

      if (iVar8 == 0) {

        piVar9 = (int *)0x0;

      }

      else {

        piVar9 = (int *)FUN_005aff60();

      }

      *(int **)(param_1 + 0x80) = piVar9;

      (**(code **)(*piVar9 + 0x10))(piVar6,uVar7);

    }

    if ((uVar5 & 0x10000000) != 0) {

      uVar3 = *(ushort *)*piVar6;

      *piVar6 = (int)((ushort *)*piVar6 + 1);

      *(uint *)(param_1 + 0x88) = (uint)uVar3;

    }

    if ((uVar5 & 0x20000000) != 0) {

      *(undefined4 *)(param_1 + 0x8c) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x40) != 0) {

      *(undefined4 *)(param_1 + 0x90) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    if ((uVar5 & 0x40000000) != 0) {

      uVar3 = *(ushort *)*piVar6;

      *piVar6 = (int)((ushort *)*piVar6 + 1);

      *(uint *)(param_1 + 0x14) = uVar3 | 0x6000000;

    }

    if ((int)uVar5 < 0) {

      *(undefined4 *)(param_1 + 0x94) = *(undefined4 *)*piVar6;

      *piVar6 = *piVar6 + 4;

    }

    FUN_004fd1b0(piVar6);

    if ((uint)(*piVar6 - iVar4) <= uVar7) {

      return 1;

    }

    *piVar6 = iVar4;

  }

  return 0;

}





// --- FUN_006b85d0 at 0x006B85D0 (size: 166) ---


void __thiscall FUN_006b85d0(int *param_1,int *param_2,uint param_3)



{

  int iVar1;

  uint uVar2;

  int *piVar3;

  

  uVar2 = (**(code **)(*param_1 + 8))();

  if (uVar2 <= param_3) {

    *(int *)*param_2 = param_1[1];

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

    *(int *)(iVar1 + 4) = param_1[2];

    piVar3 = (int *)(*param_2 + 4);

    *param_2 = (int)piVar3;

    iVar1 = param_1[1];

    if (iVar1 == 4) {

      *piVar3 = param_1[3];

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      *param_2 = *param_2 + 4;

    }

    else {

      if (iVar1 == 5) {

        *piVar3 = param_1[3];

        iVar1 = *param_2;

        *param_2 = iVar1 + 4;

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

        iVar1 = *param_2;

        *param_2 = iVar1 + 4;

        *(int *)(iVar1 + 4) = param_1[5];

        iVar1 = *param_2;

        *param_2 = iVar1 + 4;

        *(int *)(iVar1 + 4) = param_1[6];

        *param_2 = *param_2 + 4;

        return;

      }

      if (iVar1 == 6) {

        *piVar3 = param_1[3];

        *param_2 = *param_2 + 4;

        return;

      }

    }

  }

  return;

}





// --- FUN_006b8680 at 0x006B8680 (size: 178) ---


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



{

  int iVar1;

  uint uVar2;

  int *piVar3;

  

  param_1[1] = *(int *)*param_2;

  uVar2 = (**(code **)(*param_1 + 8))();

  if (param_3 < uVar2) {

    return 0;

  }

  iVar1 = *param_2;

  *param_2 = iVar1 + 4;

  param_1[2] = *(int *)(iVar1 + 4);

  piVar3 = (int *)(*param_2 + 4);

  *param_2 = (int)piVar3;

  iVar1 = param_1[1];

  if (iVar1 == 4) {

    param_1[3] = *piVar3;

    iVar1 = *param_2;

    *param_2 = iVar1 + 4;

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

    *param_2 = *param_2 + 4;

  }

  else {

    if (iVar1 == 5) {

      param_1[3] = *piVar3;

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

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

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

      param_1[5] = *(int *)(iVar1 + 4);

      iVar1 = *param_2;

      *param_2 = iVar1 + 4;

      param_1[6] = *(int *)(iVar1 + 4);

      *param_2 = *param_2 + 4;

      return 1;

    }

    if (iVar1 == 6) {

      param_1[3] = *piVar3;

      *param_2 = *param_2 + 4;

      return 1;

    }

  }

  return 1;

}





// --- FUN_006b8740 at 0x006B8740 (size: 23) ---


void __fastcall FUN_006b8740(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_008079e0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  param_1[4] = 0;

  return;

}





// --- FUN_006b8760 at 0x006B8760 (size: 85) ---


void __fastcall FUN_006b8760(undefined4 *param_1)



{

  *param_1 = &PTR_FUN_008079e0;

  if ((undefined4 *)param_1[1] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[1])(1);

  }

  param_1[1] = 0;

  if ((undefined4 *)param_1[2] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[2])(1);

  }

  param_1[2] = 0;

  if ((undefined4 *)param_1[3] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[3])(1);

  }

  param_1[3] = 0;

  if ((undefined4 *)param_1[4] != (undefined4 *)0x0) {

    (*(code *)**(undefined4 **)param_1[4])(1);

  }

  param_1[4] = 0;

  *param_1 = &PTR_FUN_0079385c;

  return;

}





// --- FUN_006b8860 at 0x006B8860 (size: 30) ---


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



{

  FUN_006b8760();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006b8a30 at 0x006B8A30 (size: 44) ---


undefined4 __fastcall FUN_006b8a30(int param_1)



{

  int iVar1;

  

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

    iVar1 = FUN_005d5760(&stack0x00000004);

    if (iVar1 != 0) {

      FUN_0048a0a0(iVar1);

      return 1;

    }

  }

  return 0;

}





// --- FUN_006b8a60 at 0x006B8A60 (size: 211) ---


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



{

  uint uVar1;

  int iVar2;

  undefined4 *puVar3;

  undefined4 uVar4;

  uint *puVar5;

  

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

    puVar3 = (undefined4 *)FUN_005df0f5(0x14);

    if (puVar3 == (undefined4 *)0x0) {

      puVar3 = (undefined4 *)0x0;

    }

    else {

      *puVar3 = &PTR_FUN_007e553c;

      puVar3[1] = 0;

      puVar3[2] = 0;

      puVar3[3] = 8;

      puVar3[4] = 0;

      FUN_005a8440();

    }

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

    if (puVar3 == (undefined4 *)0x0) {

      return 0;

    }

  }

  uVar1 = *(uint *)(*(int *)(param_1 + 0x10) + 0xc);

  if (((uVar1 != 0) && (iVar2 = *(int *)(*(int *)(param_1 + 0x10) + 8), iVar2 != 0)) &&

     (puVar5 = *(uint **)(iVar2 + (param_2 % uVar1) * 4), puVar5 != (uint *)0x0)) {

    while (param_2 != *puVar5) {

      puVar5 = (uint *)puVar5[2];

      if (puVar5 == (uint *)0x0) {

        uVar4 = FUN_00591ae0(&param_2,param_3);

        return uVar4;

      }

    }

    if (puVar5 != (uint *)0xfffffffc) {

      FUN_0048a0a0(param_3);

      return 1;

    }

  }

  uVar4 = FUN_00591ae0(&param_2,param_3);

  return uVar4;

}





// --- _CxxThrowException at 0x006B8B8C (size: 6) ---


void _CxxThrowException(void *pExceptionObject,ThrowInfo *pThrowInfo)



{

                    /* WARNING: Could not recover jumptable at 0x006b8b8c. Too many branches */

                    /* WARNING: Subroutine does not return */

                    /* WARNING: Treating indirect jump as call */

  _CxxThrowException(pExceptionObject,pThrowInfo);

  return;

}





// --- report_failure at 0x006B8B92 (size: 41) ---


/* WARNING: Function: __SEH_prolog replaced with injection: SEH_prolog */

/* Library Function - Single Match

    _report_failure

   

   Library: Visual Studio 2003 Release */



void __cdecl report_failure(void)



{

  __security_error_handler(1,0);

                    /* WARNING: Subroutine does not return */

  ExitProcess(3);

}





// --- __security_check_cookie at 0x006B8BC3 (size: 14) ---


/* WARNING: This is an inlined function */



void __fastcall __security_check_cookie(uintptr_t _StackCookie)



{

  if (_StackCookie == DAT_00836f40) {

    return;

  }

  report_failure();

  return;

}





// --- FUN_006b8bd4 at 0x006B8BD4 (size: 31) ---


void FUN_006b8bd4(void)



{

  undefined1 auStack_c [12];

  

  ExceptionList = auStack_c;

  return;

}





// --- __aulldvrm at 0x006B8C00 (size: 149) ---


/* Library Function - Single Match

    __aulldvrm

   

   Library: Visual Studio */



undefined8 __aulldvrm(uint param_1,uint param_2,uint param_3,uint param_4)



{

  ulonglong uVar1;

  longlong lVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  uint uVar8;

  uint uVar9;

  

  uVar3 = param_1;

  uVar8 = param_4;

  uVar6 = param_2;

  uVar9 = param_3;

  if (param_4 == 0) {

    uVar3 = param_2 / param_3;

    iVar4 = (int)(((ulonglong)param_2 % (ulonglong)param_3 << 0x20 | (ulonglong)param_1) /

                 (ulonglong)param_3);

  }

  else {

    do {

      uVar5 = uVar8 >> 1;

      uVar9 = uVar9 >> 1 | (uint)((uVar8 & 1) != 0) << 0x1f;

      uVar7 = uVar6 >> 1;

      uVar3 = uVar3 >> 1 | (uint)((uVar6 & 1) != 0) << 0x1f;

      uVar8 = uVar5;

      uVar6 = uVar7;

    } while (uVar5 != 0);

    uVar1 = CONCAT44(uVar7,uVar3) / (ulonglong)uVar9;

    iVar4 = (int)uVar1;

    lVar2 = (ulonglong)param_3 * (uVar1 & 0xffffffff);

    uVar3 = (uint)((ulonglong)lVar2 >> 0x20);

    uVar8 = uVar3 + iVar4 * param_4;

    if (((CARRY4(uVar3,iVar4 * param_4)) || (param_2 < uVar8)) ||

       ((param_2 <= uVar8 && (param_1 < (uint)lVar2)))) {

      iVar4 = iVar4 + -1;

    }

    uVar3 = 0;

  }

  return CONCAT44(uVar3,iVar4);

}





// --- ~type_info at 0x006B8C96 (size: 6) ---


void __thiscall type_info::~type_info(type_info *this)



{

                    /* WARNING: Could not recover jumptable at 0x006b8c96. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  ~type_info(this);

  return;

}





// --- __security_error_handler at 0x006B8CF2 (size: 6) ---


void __security_error_handler(void)



{

                    /* WARNING: Could not recover jumptable at 0x006b8cf2. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  __security_error_handler();

  return;

}





// --- FUN_006b8d00 at 0x006B8D00 (size: 37) ---


void FUN_006b8d00(void)



{

  FUN_00405a60("kernel32.dll","CreateFileW",&PTR_FUN_00837374,DAT_00906788,&LAB_00405bb3);

                    /* WARNING: Could not recover jumptable at 0x006b8d1f. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00837374)();

  return;

}





// --- FUN_006b8ebc at 0x006B8EBC (size: 37) ---


void FUN_006b8ebc(void)



{

  FUN_00405a60("advapi32.dll","RegCreateKeyExW",&PTR_FUN_00837348,DAT_00906758,&DAT_00405dbc);

                    /* WARNING: Could not recover jumptable at 0x006b8edb. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (*(code *)PTR_FUN_00837348)();

  return;

}





// --- compress2 at 0x006BA9E0 (size: 6) ---


void compress2(void)



{

                    /* WARNING: Could not recover jumptable at 0x006ba9e0. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  compress2();

  return;

}





// --- uncompress at 0x006BA9E6 (size: 6) ---


void uncompress(void)



{

                    /* WARNING: Could not recover jumptable at 0x006ba9e6. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  uncompress();

  return;

}





// --- FUN_006ba9f0 at 0x006BA9F0 (size: 85) ---


void __fastcall FUN_006ba9f0(int param_1)



{

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

    RpcEpUnregister(*(RPC_IF_HANDLE *)(param_1 + 4),*(RPC_BINDING_VECTOR **)(param_1 + 0x18),

                    (UUID_VECTOR *)0x0);

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

  }

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

    RpcBindingVectorFree((RPC_BINDING_VECTOR **)(param_1 + 0x18));

    *(RPC_BINDING_VECTOR **)(param_1 + 0x18) = (RPC_BINDING_VECTOR *)0x0;

  }

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

    RpcServerUnregisterIf(*(RPC_IF_HANDLE *)(param_1 + 4),(UUID *)0x0,1);

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

  }

  return;

}





// --- FUN_006baa50 at 0x006BAA50 (size: 111) ---


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



void __fastcall FUN_006baa50(undefined4 *param_1)



{

  RPC_STATUS RVar1;

  

  if (param_1[5] != 0) {

    _DAT_009065d4 = _DAT_009065d4 + -1;

    if (_DAT_009065d4 == 0) {

      RVar1 = RpcMgmtStopServerListening((RPC_BINDING_HANDLE)0x0);

      if (RVar1 == 0) {

        RpcMgmtWaitServerListen();

      }

    }

    param_1[5] = 0;

  }

  FUN_006ba9f0();

  *param_1 = 0;

  param_1[1] = 0;

  _DAT_009065c0 = 0;

  _DAT_009065c4 = 0;

  _DAT_009065c8 = 0;

  _DAT_009065cc = 0;

  _DAT_009065d0 = 0;

  operator_delete__((void *)param_1[2]);

  param_1[2] = 0;

  return;

}





// --- FUN_006bab00 at 0x006BAB00 (size: 111) ---


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



{

  int iVar1;

  

  if (param_2 != 0) {

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

    FUN_0065cf90(param_2);

    iVar1 = FUN_0065c810();

    while (iVar1 != 0) {

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

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

      }

      FUN_006bb5c0(iVar1,param_3);

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

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

      }

      iVar1 = FUN_0065cb10();

    }

    FUN_0065cae0();

  }

  return 1;

}





// --- FUN_006bab90 at 0x006BAB90 (size: 94) ---


undefined1 FUN_006bab90(undefined4 *param_1)



{

  FILE *_File;

  int iVar1;

  int iVar2;

  undefined1 uVar3;

  

  if (*(int *)((char *)*param_1 + -4) != 1) {

    uVar3 = 0;

    _File = fopen((char *)*param_1,"rb");

    if (_File != (FILE *)0x0) {

      iVar1 = _getw(_File);

      iVar2 = ferror(_File);

      uVar3 = 0;

      if ((iVar2 == 0) && (iVar1 == -0x55555556)) {

        uVar3 = 1;

      }

      fclose(_File);

    }

    return uVar3;

  }

  return 0;

}





// --- FUN_006babf0 at 0x006BABF0 (size: 273) ---


uint FUN_006babf0(undefined4 param_1,uint param_2,int param_3)



{

  int iVar1;

  int iVar2;

  LONG LVar3;

  uint uVar4;

  undefined4 *puVar5;

  undefined *local_10 [4];

  

  if (param_3 == 0) {

    return param_2 + 1;

  }

  local_10[0] = PTR_DAT_00818344;

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

  FUN_00426020(local_10);

  iVar2 = *(int *)(local_10[0] + -4);

  uVar4 = iVar2 - 1;

  iVar1 = FUN_0065ca40();

  if ((iVar1 != 0) && (uVar4 = iVar2 + 5, uVar4 <= param_2)) {

    FUN_0065cf90(param_1);

    iVar2 = FUN_0065c810();

    while (iVar2 != 0) {

      if (*(int *)(*(int *)(iVar2 + 0x10) + -4) != 1) {

        FUN_0065cae0();

        puVar5 = (undefined4 *)(local_10[0] + -0x14);

        LVar3 = InterlockedDecrement((LONG *)(local_10[0] + -0x10));

        if ((LVar3 == 0) && (puVar5 != (undefined4 *)0x0)) {

          (**(code **)*puVar5)(1);

        }

        return param_2 + 1;

      }

      iVar2 = FUN_006babf0(iVar2,param_2 - uVar4,param_3 + -1);

      uVar4 = uVar4 + iVar2;

      if (param_2 < uVar4) break;

      iVar2 = FUN_0065cb10();

    }

    FUN_0065cae0();

  }

  puVar5 = (undefined4 *)(local_10[0] + -0x14);

  LVar3 = InterlockedDecrement((LONG *)(local_10[0] + -0x10));

  if ((LVar3 == 0) && (puVar5 != (undefined4 *)0x0)) {

    (**(code **)*puVar5)(1);

  }

  return uVar4;

}





// --- FUN_006bad10 at 0x006BAD10 (size: 203) ---


uint FUN_006bad10(int *param_1,int *param_2)



{

  int iVar1;

  undefined4 uVar2;

  LONG LVar3;

  int iVar4;

  uint local_4c [13];

  undefined4 local_18;

  

  FUN_006bd070();

  uVar2 = FUN_006bd140(*param_2,1,1,0,0,0,0);

  FUN_004f7a90(0,uVar2,local_18);

  FUN_00685780(0xaaaaaaaa,local_4c);

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

  FUN_0065d3f0(param_2);

  iVar1 = *param_2;

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

  iVar4 = iVar1;

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

  FUN_00427050(iVar4);

  LVar3 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

  if ((LVar3 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

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

  }

  FUN_0040b060();

  uVar2 = FUN_006bd0a0();

  return CONCAT31((int3)((uint)uVar2 >> 8),~(byte)(local_4c[0] >> 2)) & 0xffffff01;

}





// --- FUN_006bade0 at 0x006BADE0 (size: 97) ---


void __thiscall FUN_006bade0(int param_1,int param_2)



{

  char *_Str;

  uint uVar1;

  

  if ((*(char *)(param_1 + 0x1c) != '\0') &&

     (uVar1 = 0, _Str = (char *)DAT_00906660, *(int *)(param_1 + 0x18) != 0)) {

    do {

      if (*(char *)(param_2 + 4) == '\0') {

        fputs(_Str,*(FILE **)(param_2 + 8));

        _Str = (char *)DAT_00906660;

      }

      else if (*(int *)(_Str + -4) != 1) {

        FUN_00404ef0(_Str,*(int *)(_Str + -4) + -1);

        _Str = (char *)DAT_00906660;

      }

      uVar1 = uVar1 + 1;

    } while (uVar1 < *(uint *)(param_1 + 0x18));

  }

  return;

}





// --- FUN_006bae50 at 0x006BAE50 (size: 1009) ---


undefined4 FUN_006bae50(int *param_1)



{

  int *piVar1;

  char *pcVar2;

  int iVar3;

  int iVar4;

  char cVar5;

  undefined1 uVar6;

  undefined **ppuVar7;

  uint uVar8;

  LONG LVar9;

  char *pcVar10;

  char *pcVar11;

  undefined4 *unaff_EBX;

  int unaff_EBP;

  uint unaff_ESI;

  undefined4 *unaff_EDI;

  char unaff_retaddr;

  undefined **local_10;

  undefined4 local_8;

  int *local_4;

  

  local_4 = param_1;

  param_1 = (int *)CONCAT31(param_1._1_3_,*(int *)(*param_1 + -4) == 1);

  local_10 = &PTR_FUN_0079548c;

  local_8 = 0;

  cVar5 = (*(code *)PTR_FUN_00795494)(0);

  iVar4 = (int)param_1;

  while (cVar5 != '\0') {

    uVar6 = (*(code *)unaff_EBX[2])(local_10);

    switch(uVar6) {

    case 9:

    case 0x20:

    case 0x23:

    case 0x28:

    case 0x29:

    case 0x2c:

    case 0x5b:

    case 0x5d:

    case 0x7b:

    case 0x7d:

      goto LAB_006baeff;

    default:

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

      ppuVar7 = (undefined **)(*(code *)*unaff_EBX)();

      if (ppuVar7 < local_10) {

        local_10 = (undefined **)(*(code *)*unaff_EBX)();

      }

      cVar5 = (*(code *)unaff_EBX[2])(local_10);

    }

  }

  if (unaff_retaddr != '\0') {

LAB_006baeff:

    if (*(char *)(iVar4 + 4) == '\0') {

      putc(0x22,*(FILE **)(iVar4 + 8));

    }

    else {

      piVar1 = *(int **)(iVar4 + 0xc);

      pcVar2 = (char *)*piVar1;

      param_1 = (int *)CONCAT31(param_1._1_3_,0x22);

      iVar3 = *(int *)(pcVar2 + -4);

      if ((*(int *)(pcVar2 + -0x10) == 1) && (iVar3 + 1U <= *(uint *)(pcVar2 + -0xc))) {

        *(uint *)(pcVar2 + -4) = iVar3 + 1U;

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

      }

      else {

        FUN_00401280(iVar3);

        pcVar11 = (char *)*piVar1;

        pcVar10 = pcVar2;

        do {

          cVar5 = *pcVar10;

          pcVar10 = pcVar10 + 1;

          *pcVar11 = cVar5;

          pcVar11 = pcVar11 + 1;

        } while (cVar5 != '\0');

        LVar9 = InterlockedDecrement((LONG *)(pcVar2 + -0x10));

        if ((LVar9 == 0) && (pcVar2 + -0x14 != (char *)0x0)) {

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

        }

      }

      strncpy((char *)(*piVar1 + -1 + iVar3),(char *)&param_1,1);

      *(undefined1 *)(*(int *)(*piVar1 + -4) + -1 + *piVar1) = 0;

    }

  }

  cVar5 = (*(code *)unaff_EBX[2])(0);

  while (cVar5 != '\0') {

    uVar6 = (**(code **)(unaff_EBP + 8))(unaff_EBX);

    switch(uVar6) {

    case 10:

    case 0xd:

    case 0x22:

    case 0x5c:

      if (*(char *)(iVar4 + 4) == '\0') {

        putc(0x5c,*(FILE **)(iVar4 + 8));

      }

      else {

        piVar1 = *(int **)(iVar4 + 0xc);

        pcVar2 = (char *)*piVar1;

        local_4 = (int *)CONCAT31(local_4._1_3_,0x5c);

        iVar3 = *(int *)(pcVar2 + -4);

        if ((*(int *)(pcVar2 + -0x10) == 1) && (iVar3 + 1U <= *(uint *)(pcVar2 + -0xc))) {

          *(uint *)(pcVar2 + -4) = iVar3 + 1U;

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

        }

        else {

          FUN_00401280(iVar3);

          pcVar11 = (char *)*piVar1;

          pcVar10 = pcVar2;

          do {

            cVar5 = *pcVar10;

            pcVar10 = pcVar10 + 1;

            *pcVar11 = cVar5;

            pcVar11 = pcVar11 + 1;

          } while (cVar5 != '\0');

          LVar9 = InterlockedDecrement((LONG *)(pcVar2 + -0x10));

          if ((LVar9 == 0) && (pcVar2 + -0x14 != (char *)0x0)) {

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

          }

        }

        strncpy((char *)(*piVar1 + -1 + iVar3),(char *)&local_4,1);

        *(undefined1 *)(*(int *)(*piVar1 + -4) + -1 + *piVar1) = 0;

      }

    }

    cVar5 = (**(code **)(unaff_ESI + 8))(unaff_EBP);

    if (*(char *)(iVar4 + 4) == '\0') {

      putc((int)cVar5,*(FILE **)(iVar4 + 8));

    }

    else {

      piVar1 = *(int **)(iVar4 + 0xc);

      local_8 = CONCAT31(local_8._1_3_,cVar5);

      if (cVar5 != '\0') {

        pcVar2 = (char *)*piVar1;

        iVar3 = *(int *)(pcVar2 + -4);

        if ((*(int *)(pcVar2 + -0x10) == 1) && (iVar3 + 1U <= *(uint *)(pcVar2 + -0xc))) {

          *(uint *)(pcVar2 + -4) = iVar3 + 1U;

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

        }

        else {

          FUN_00401280(iVar3);

          pcVar11 = (char *)*piVar1;

          pcVar10 = pcVar2;

          do {

            cVar5 = *pcVar10;

            pcVar10 = pcVar10 + 1;

            *pcVar11 = cVar5;

            pcVar11 = pcVar11 + 1;

          } while (cVar5 != '\0');

          LVar9 = InterlockedDecrement((LONG *)(pcVar2 + -0x10));

          if ((LVar9 == 0) && (pcVar2 + -0x14 != (char *)0x0)) {

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

          }

        }

        strncpy((char *)(*piVar1 + -1 + iVar3),(char *)&local_8,1);

        *(undefined1 *)(*(int *)(*piVar1 + -4) + -1 + *piVar1) = 0;

      }

    }

    unaff_ESI = unaff_ESI + 1;

    uVar8 = (*(code *)*unaff_EDI)();

    if (uVar8 < unaff_ESI) {

      unaff_ESI = (*(code *)*unaff_EDI)();

    }

    cVar5 = (*(code *)unaff_EDI[2])(unaff_ESI);

  }

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

    if (*(char *)(iVar4 + 4) != '\0') {

      piVar1 = *(int **)(iVar4 + 0xc);

      pcVar2 = (char *)*piVar1;

      local_4._1_3_ = (undefined3)((uint)local_4 >> 8);

      local_4 = (int *)CONCAT31(local_4._1_3_,0x22);

      iVar4 = *(int *)(pcVar2 + -4);

      if ((*(int *)(pcVar2 + -0x10) == 1) && (iVar4 + 1U <= *(uint *)(pcVar2 + -0xc))) {

        *(uint *)(pcVar2 + -4) = iVar4 + 1U;

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

      }

      else {

        FUN_00401280(iVar4);

        pcVar11 = (char *)*piVar1;

        pcVar10 = pcVar2;

        do {

          cVar5 = *pcVar10;

          pcVar10 = pcVar10 + 1;

          *pcVar11 = cVar5;

          pcVar11 = pcVar11 + 1;

        } while (cVar5 != '\0');

        LVar9 = InterlockedDecrement((LONG *)(pcVar2 + -0x10));

        if ((LVar9 == 0) && (pcVar2 + -0x14 != (char *)0x0)) {

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

        }

      }

      strncpy((char *)(*piVar1 + -1 + iVar4),(char *)&local_4,1);

      *(undefined1 *)(*(int *)(*piVar1 + -4) + -1 + *piVar1) = 0;

      return 1;

    }

    putc(0x22,*(FILE **)(iVar4 + 8));

  }

  return 1;

}





// --- FUN_006bb320 at 0x006BB320 (size: 52) ---


void FUN_006bb320(int param_1)



{

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

    param_1 = CONCAT31(param_1._1_3_,10);

    FUN_00404ef0(&param_1,1);

    return;

  }

  putc(10,*(FILE **)(param_1 + 8));

  return;

}





// --- FUN_006bb360 at 0x006BB360 (size: 104) ---


void __thiscall FUN_006bb360(int param_1,int param_2)



{

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

    if (*(char *)(param_2 + 4) != '\0') {

      param_2 = CONCAT31(param_2._1_3_,0x20);

      FUN_00404ef0(&param_2,1);

      return;

    }

    putc(0x20,*(FILE **)(param_2 + 8));

    return;

  }

  if (*(char *)(param_2 + 4) != '\0') {

    param_2 = CONCAT31(param_2._1_3_,10);

    FUN_00404ef0(&param_2,1);

    return;

  }

  putc(10,*(FILE **)(param_2 + 8));

  return;

}





// --- FUN_006bb3d0 at 0x006BB3D0 (size: 80) ---


void __thiscall FUN_006bb3d0(int param_1,undefined4 param_2,undefined4 param_3,char param_4)



{

  char cVar1;

  int iVar2;

  

  cVar1 = FUN_006bab90(param_3);

  if (cVar1 != '\0') {

    FUN_006bad10(param_2,param_3);

    return;

  }

  iVar2 = 0;

  if (param_4 != '\0') {

    iVar2 = param_1 + 4;

  }

  FUN_006bca90(param_2,param_3,iVar2,*(undefined4 *)(param_1 + 8),*(undefined4 *)(param_1 + 0x10),

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

  return;

}





// --- FUN_006bb420 at 0x006BB420 (size: 415) ---


void __thiscall FUN_006bb420(uint param_1,uint param_2,int param_3)



{

  int iVar1;

  char cVar2;

  uint uVar3;

  undefined4 *unaff_EBX;

  char unaff_retaddr;

  uint local_14;

  

  iVar1 = param_3;

  if ((param_2 != 0) && (*(int *)(*(int *)(param_2 + 0x10) + -4) != 1)) {

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

      FUN_006bb320(param_3);

    }

    FUN_006bade0(iVar1);

    if (*(char *)(iVar1 + 4) == '\0') {

      putc(0x23,*(FILE **)(iVar1 + 8));

    }

    else {

      param_2 = CONCAT31(param_2._1_3_,0x23);

      FUN_00404ef0(&param_2,1);

    }

    param_2 = param_2 & 0xffffff00;

    cVar2 = (*(code *)PTR_FUN_00795494)(0);

    local_14 = param_1;

    if (cVar2 != '\0') {

      do {

        if (unaff_retaddr != '\0') {

          FUN_006bade0(iVar1);

          if (*(char *)(iVar1 + 4) == '\0') {

            putc(0x23,*(FILE **)(iVar1 + 8));

          }

          else {

            FUN_00404ef0(&stack0x00000000,1);

          }

          unaff_retaddr = '\0';

        }

        cVar2 = (**(code **)(local_14 + 8))(&PTR_FUN_0079548c);

        if (*(char *)(iVar1 + 4) == '\0') {

          putc((int)cVar2,*(FILE **)(iVar1 + 8));

        }

        else {

          FUN_00404ef0(&stack0x00000000,1);

          unaff_retaddr = cVar2;

        }

        local_14 = local_14 + 1;

        uVar3 = (*(code *)*unaff_EBX)();

        if (uVar3 < local_14) {

          local_14 = (*(code *)*unaff_EBX)();

        }

        cVar2 = (*(code *)unaff_EBX[2])(local_14);

      } while (cVar2 != '\0');

      if (unaff_retaddr != '\0') {

        return;

      }

    }

    if (*(char *)(iVar1 + 4) != '\0') {

      FUN_00404ef0(&stack0x00000000,1);

      return;

    }

    putc(10,*(FILE **)(iVar1 + 8));

  }

  return;

}





// --- FUN_006bb5c0 at 0x006BB5C0 (size: 381) ---


undefined4 __thiscall FUN_006bb5c0(undefined *param_1,int param_2,int param_3)



{

  int iVar1;

  int iVar2;

  uint uVar3;

  int iVar4;

  LONG LVar5;

  char cVar6;

  undefined4 *puVar7;

  undefined *local_4;

  

  iVar1 = param_2;

  if (param_2 != 0) {

    local_4 = param_1;

    if ((param_1[0x1c] == '\0') || (uVar3 = FUN_006babf0(param_2,0x50,3), uVar3 < 0x51)) {

      cVar6 = '\0';

    }

    else {

      cVar6 = '\x01';

    }

    iVar2 = param_3;

    if (((param_1[0x1e] != '\0') || ((param_1[0x1d] == '\0' && (cVar6 != '\0')))) &&

       (param_1[0x1e] = 0, *(int *)(*(int *)(iVar1 + 0x10) + -4) == 1)) {

      FUN_006bb320(param_3);

    }

    FUN_006bb420(iVar1,iVar2);

    FUN_006bade0(iVar2);

    local_4 = PTR_DAT_00818344;

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

    FUN_00426020(&local_4);

    FUN_006bae50(&local_4,iVar2);

    iVar4 = FUN_0065ca40();

    if (iVar4 != 0) {

      param_3 = CONCAT31(param_3._1_3_,param_1[0x1c]);

      param_1[0x1c] = cVar6;

      FUN_006bb360(iVar2);

      FUN_006bade0(iVar2);

      if (*(char *)(iVar2 + 4) == '\0') {

        putc(0x5b,*(FILE **)(iVar2 + 8));

      }

      else {

        param_2 = CONCAT31(param_2._1_3_,0x5b);

        FUN_00404ef0(&param_2,1);

      }

      FUN_006bb360(iVar2);

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

      FUN_006bab00(iVar1,iVar2);

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

      FUN_006bade0(iVar2);

      if (*(char *)(iVar2 + 4) == '\0') {

        putc(0x5d,*(FILE **)(iVar2 + 8));

      }

      else {

        param_2 = CONCAT31(param_2._1_3_,0x5d);

        FUN_00404ef0(&param_2,1);

      }

      param_1[0x1e] = param_1[0x1c];

      param_1[0x1c] = (undefined1)param_3;

    }

    FUN_006bb360(iVar2);

    puVar7 = (undefined4 *)(local_4 + -0x14);

    LVar5 = InterlockedDecrement((LONG *)(local_4 + -0x10));

    if ((LVar5 == 0) && (puVar7 != (undefined4 *)0x0)) {

      (**(code **)*puVar7)(1);

    }

    return 1;

  }

  return 1;

}





// --- FUN_006bb740 at 0x006BB740 (size: 378) ---


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



undefined1 __thiscall FUN_006bb740(int param_1,int param_2,undefined4 *param_3)



{

  char cVar1;

  undefined1 uVar2;

  FILE *_File;

  LONG LVar3;

  undefined4 *puVar4;

  undefined *local_28;

  uint local_24;

  double local_20;

  undefined **local_18;

  undefined1 local_14;

  FILE *local_10;

  undefined4 local_c;

  

  if (param_2 != 0) {

    local_28 = PTR_DAT_00818344;

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

    thunk_FUN_0040c780(&local_28,param_3);

    thunk_FUN_0040df20(&local_28);

    local_24 = 0;

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

      do {

        _File = _fsopen((char *)*param_3,"w",0x10);

        if (_File != (FILE *)0x0) {

          local_c = 0;

          local_14 = 0;

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

          local_18 = &PTR_LAB_00807b3c;

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

          local_10 = _File;

          FUN_006bb420(param_2,&local_18);

          uVar2 = FUN_006bab00(param_2,&local_18);

          fclose(_File);

          puVar4 = (undefined4 *)(local_28 + -0x14);

          local_18 = &PTR_LAB_00807b3c;

          LVar3 = InterlockedDecrement((LONG *)(local_28 + -0x10));

          if ((LVar3 == 0) && (puVar4 != (undefined4 *)0x0)) {

            (**(code **)*puVar4)(1);

          }

          return uVar2;

        }

        cVar1 = FUN_0040b320(param_3,0);

        if (cVar1 == '\0') break;

        FUN_0040fbd0();

        local_20 = _DAT_008379a8 + *(double *)(param_1 + 0x10);

        if (_DAT_008379a8 < local_20) {

          do {

            FUN_0040fbd0();

          } while (_DAT_008379a8 < local_20);

        }

        local_24 = local_24 + 1;

      } while (local_24 < *(uint *)(param_1 + 8));

    }

    puVar4 = (undefined4 *)(local_28 + -0x14);

    LVar3 = InterlockedDecrement((LONG *)(local_28 + -0x10));

    if ((LVar3 == 0) && (puVar4 != (undefined4 *)0x0)) {

      (**(code **)*puVar4)(1);

    }

  }

  return 0;

}





// --- FUN_006bb8c0 at 0x006BB8C0 (size: 116) ---


undefined4 * __thiscall FUN_006bb8c0(undefined4 *param_1,undefined4 param_2)



{

  LONG *pLVar1;

  

  *param_1 = &PTR_FUN_00795074;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 0;

  FUN_006bbc60();

  pLVar1 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0xe] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  pLVar1 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0xf] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  param_1[0x10] = param_2;

  pLVar1 = (LONG *)(PTR_DAT_00818344 + -0x10);

  param_1[0x11] = PTR_DAT_00818344;

  InterlockedIncrement(pLVar1);

  FUN_006bbce0(&PTR_DAT_008183b4,&PTR_DAT_008183b4);

  return param_1;

}





// --- FUN_006bb940 at 0x006BB940 (size: 124) ---


void __fastcall FUN_006bb940(undefined4 *param_1)



{

  LONG LVar1;

  undefined4 *puVar2;

  

  FUN_006bbda0();

  puVar2 = (undefined4 *)(param_1[0x11] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0x11] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  puVar2 = (undefined4 *)(param_1[0xf] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0xf] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  puVar2 = (undefined4 *)(param_1[0xe] + -0x14);

  LVar1 = InterlockedDecrement((LONG *)(param_1[0xe] + -0x10));

  if ((LVar1 == 0) && (puVar2 != (undefined4 *)0x0)) {

    (**(code **)*puVar2)(1);

  }

  FUN_006bbc90();

  *param_1 = &PTR_FUN_00795074;

  FUN_00405210();

  return;

}





// --- FUN_006bb9c0 at 0x006BB9C0 (size: 70) ---


undefined4 * __fastcall FUN_006bb9c0(undefined4 *param_1)



{

  int iVar1;

  undefined4 uVar2;

  

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 1;

  param_1[4] = 0;

  param_1[5] = 0;

  param_1[6] = 0;

  *(undefined1 *)(param_1 + 7) = 1;

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

  iVar1 = FUN_005df0f5(0x48);

  if (iVar1 != 0) {

    uVar2 = FUN_006bb8c0(param_1);

    *param_1 = uVar2;

    return param_1;

  }

  *param_1 = 0;

  return param_1;

}





// --- FUN_006bba10 at 0x006BBA10 (size: 52) ---


void __fastcall FUN_006bba10(undefined4 *param_1)



{

  void *pvVar1;

  

  if ((FILE *)param_1[1] != (FILE *)0x0) {

    fclose((FILE *)param_1[1]);

  }

  pvVar1 = (void *)*param_1;

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

    FUN_006bb940();

    operator_delete(pvVar1);

  }

  *param_1 = 0;

  return;

}





// --- FUN_006bba50 at 0x006BBA50 (size: 143) ---


char __fastcall FUN_006bba50(char *param_1)



{

  char cVar1;

  char cVar2;

  uint uVar3;

  undefined4 uVar4;

  int iVar5;

  

  cVar1 = param_1[0x20];

  if (cVar1 == '\n') {

    *(short *)(param_1 + 0x18) = *(short *)(param_1 + 0x18) + 1;

    param_1[0x1a] = '\x01';

    param_1[0x1b] = '\0';

  }

  else {

    *(short *)(param_1 + 0x1a) = *(short *)(param_1 + 0x1a) + 1;

  }

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

  if (*param_1 == '\0') {

    iVar5 = getc(*(FILE **)(param_1 + 0x14));

    cVar2 = (char)iVar5;

    param_1[0x20] = cVar2;

    if ((cVar2 != -1) && (cVar2 != 0xffff)) {

      return cVar1;

    }

  }

  else {

    cVar2 = (**(code **)(*(int *)(param_1 + 4) + 8))(*(undefined4 *)(param_1 + 8));

    param_1[0x20] = cVar2;

    if (cVar2 != '\0') {

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

      uVar3 = (*(code *)**(undefined4 **)(param_1 + 4))();

      if (iVar5 + 1U <= uVar3) {

        *(uint *)(param_1 + 8) = iVar5 + 1U;

        return cVar1;

      }

      uVar4 = (*(code *)**(undefined4 **)(param_1 + 4))();

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

      return cVar1;

    }

  }

  param_1[0x21] = '\x01';

  return cVar1;

}





// --- FUN_006bbae0 at 0x006BBAE0 (size: 299) ---


undefined4 __thiscall

FUN_006bbae0(undefined1 *param_1,int *param_2,undefined4 *param_3,uint param_4,double param_5)



{

  FILE *pFVar1;

  int iVar2;

  float10 fVar3;

  float10 fVar4;

  uint local_14;

  

  if (*(FILE **)(param_1 + 0x14) != (FILE *)0x0) {

    if (param_1[1] == '\0') {

      fclose(*(FILE **)(param_1 + 0x14));

    }

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

  }

  param_1[1] = 0;

  *(undefined2 *)(param_1 + 0x18) = 1;

  *(undefined2 *)(param_1 + 0x1a) = 1;

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

  param_1[0x21] = 1;

  if (*(int *)(*param_2 + -4) != 1) {

    local_14 = 0;

    if (param_4 != 0) {

      do {

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

          pFVar1 = _fsopen((char *)*param_2,"r",0x20);

          *(FILE **)(param_1 + 0x14) = pFVar1;

          _errno();

          param_1[1] = 0;

        }

        else {

          pFVar1 = _fsopen((char *)*param_2,"r+",0x10);

          *(FILE **)(param_1 + 0x14) = pFVar1;

          _errno();

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

          param_1[1] = 1;

        }

        if (*(int *)(param_1 + 0x14) != 0) break;

        if (local_14 < param_4 - 1) {

          fVar3 = (float10)FUN_0040faa0();

          do {

            fVar4 = (float10)FUN_0040faa0();

          } while (fVar4 < (float10)(double)(fVar3 + (float10)param_5));

        }

        local_14 = local_14 + 1;

      } while (local_14 < param_4);

    }

    *param_1 = 0;

    if (*(FILE **)(param_1 + 0x14) != (FILE *)0x0) {

      iVar2 = getc(*(FILE **)(param_1 + 0x14));

      param_1[0x20] = (char)iVar2;

      param_1[0x21] = 0;

      return 1;

    }

    param_1[0x21] = 1;

  }

  return 0;

}





// --- FUN_006bbc10 at 0x006BBC10 (size: 80) ---


undefined4 __thiscall FUN_006bbc10(int param_1,undefined4 *param_2)



{

  int iVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)FUN_005df0f5(0xc);

  if (puVar2 == (undefined4 *)0x0) {

    return 0;

  }

  *puVar2 = *param_2;

  puVar2[1] = 0;

  puVar2[2] = 0;

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

    *(undefined4 **)(param_1 + 4) = puVar2;

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

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

    return 1;

  }

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

  *(undefined4 **)(iVar1 + 4) = puVar2;

  puVar2[2] = iVar1;

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

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

  return 1;

}





// --- FUN_006bbc60 at 0x006BBC60 (size: 45) ---


void __fastcall FUN_006bbc60(undefined1 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  *(undefined ***)(param_1 + 4) = &PTR_FUN_0079548c;

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

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

  *(undefined2 *)(param_1 + 0x18) = 1;

  *(undefined2 *)(param_1 + 0x1a) = 1;

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

  param_1[0x20] = 0;

  param_1[0x21] = 1;

  return;

}





// --- FUN_006bbc90 at 0x006BBC90 (size: 70) ---


void __fastcall FUN_006bbc90(int param_1)



{

  if (*(FILE **)(param_1 + 0x14) != (FILE *)0x0) {

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

      fclose(*(FILE **)(param_1 + 0x14));

    }

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

  }

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

  *(undefined2 *)(param_1 + 0x18) = 1;

  *(undefined2 *)(param_1 + 0x1a) = 1;

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

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

  *(undefined ***)(param_1 + 4) = &PTR_LAB_00795478;

  return;

}





// --- FUN_006bbce0 at 0x006BBCE0 (size: 181) ---


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



{

  int iVar1;

  undefined *puVar2;

  LONG LVar3;

  LONG *lpAddend;

  

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

  if (iVar1 != *param_2) {

    LVar3 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar3 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

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

    }

    iVar1 = *param_2;

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

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

  }

  puVar2 = *(undefined **)(param_1 + 0x38);

  if (puVar2 != PTR_DAT_00818344) {

    LVar3 = InterlockedDecrement((LONG *)(puVar2 + -0x10));

    if ((LVar3 == 0) && ((undefined4 *)(puVar2 + -0x14) != (undefined4 *)0x0)) {

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

    }

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

    *(undefined **)(param_1 + 0x38) = PTR_DAT_00818344;

    InterlockedIncrement(lpAddend);

  }

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

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

  if (iVar1 != *param_3) {

    LVar3 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar3 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

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

    }

    iVar1 = *param_3;

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

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

  }

  return;

}





// --- FUN_006bbda0 at 0x006BBDA0 (size: 232) ---


void __fastcall FUN_006bbda0(int param_1)



{

  undefined *puVar1;

  LONG LVar2;

  LONG *pLVar3;

  

  if (*(FILE **)(param_1 + 0x28) != (FILE *)0x0) {

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

      fclose(*(FILE **)(param_1 + 0x28));

    }

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

  }

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

  *(undefined2 *)(param_1 + 0x2c) = 1;

  *(undefined2 *)(param_1 + 0x2e) = 1;

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

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

  puVar1 = *(undefined **)(param_1 + 0x3c);

  if (puVar1 != PTR_DAT_00818344) {

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

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

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

    }

    pLVar3 = (LONG *)(PTR_DAT_00818344 + -0x10);

    *(undefined **)(param_1 + 0x3c) = PTR_DAT_00818344;

    InterlockedIncrement(pLVar3);

  }

  puVar1 = *(undefined **)(param_1 + 0x38);

  if (puVar1 != PTR_DAT_00818344) {

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

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

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

    }

    pLVar3 = (LONG *)(PTR_DAT_00818344 + -0x10);

    *(undefined **)(param_1 + 0x38) = PTR_DAT_00818344;

    InterlockedIncrement(pLVar3);

  }

  puVar1 = *(undefined **)(param_1 + 0x44);

  if (puVar1 != PTR_DAT_00818344) {

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

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

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

    }

    pLVar3 = (LONG *)(PTR_DAT_00818344 + -0x10);

    *(undefined **)(param_1 + 0x44) = PTR_DAT_00818344;

    InterlockedIncrement(pLVar3);

  }

  return;

}





// --- FUN_006bbe90 at 0x006BBE90 (size: 71) ---


void __thiscall FUN_006bbe90(int param_1,int *param_2)



{

  int iVar1;

  LONG LVar2;

  

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

  if (iVar1 != *param_2) {

    LVar2 = InterlockedDecrement((LONG *)(iVar1 + -0x10));

    if ((LVar2 == 0) && ((undefined4 *)(iVar1 + -0x14) != (undefined4 *)0x0)) {

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

    }

    iVar1 = *param_2;

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

                    /* WARNING: Could not recover jumptable at 0x006bbecc. Too many branches */

                    /* WARNING: Treating indirect jump as call */

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

    return;

  }

  return;

}





// --- FUN_006bbee0 at 0x006BBEE0 (size: 558) ---


undefined4 __thiscall FUN_006bbee0(int param_1,char param_2)



{

  int *piVar1;

  char cVar2;

  undefined *puVar3;

  int iVar4;

  int iVar5;

  char *pcVar6;

  LONG LVar7;

  LONG *lpAddend;

  char *pcVar8;

  char *pcVar9;

  char acStack_8 [4];

  int local_4;

  

  puVar3 = *(undefined **)(param_1 + 0x38);

  piVar1 = (int *)(param_1 + 0x38);

  local_4 = param_1;

  if (puVar3 != PTR_DAT_00818344) {

    LVar7 = InterlockedDecrement((LONG *)(puVar3 + -0x10));

    if ((LVar7 == 0) && ((undefined4 *)(puVar3 + -0x14) != (undefined4 *)0x0)) {

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

    }

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

    *piVar1 = (int)PTR_DAT_00818344;

    InterlockedIncrement(lpAddend);

  }

  while ((((cVar2 = *(char *)(param_1 + 0x34), cVar2 == ',' || (cVar2 == ' ')) || (cVar2 == '\t'))

         || ((cVar2 == '\r' || (cVar2 == '\n'))))) {

    FUN_006bba50();

  }

  if (*(char *)(param_1 + 0x34) != '#') {

    return 0;

  }

  while( true ) {

    FUN_006bba50();

    if (*(char *)(local_4 + 0x35) != '\0') {

      return 1;

    }

    acStack_8[0] = FUN_006bba50();

    while (((acStack_8[0] != '\n' && (acStack_8[0] != -1)) &&

           ((acStack_8[0] != 0xffff && (acStack_8[0] != '\0'))))) {

      iVar4 = *piVar1;

      iVar5 = *(int *)(iVar4 + -4);

      if ((*(int *)(iVar4 + -0x10) == 1) && (iVar5 + 1U <= *(uint *)(iVar4 + -0xc))) {

        *(uint *)(iVar4 + -4) = iVar5 + 1U;

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

      }

      else {

        FUN_00401280(iVar5);

        FUN_00401070(*piVar1,iVar4);

        LVar7 = InterlockedDecrement((LONG *)(iVar4 + -0x10));

        if ((LVar7 == 0) && ((undefined4 *)(iVar4 + -0x14) != (undefined4 *)0x0)) {

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

        }

      }

      strncpy((char *)(*piVar1 + -1 + iVar5),acStack_8,1);

      *(undefined1 *)(*(int *)(*piVar1 + -4) + -1 + *piVar1) = 0;

      acStack_8[0] = FUN_006bba50();

    }

    if (*(char *)(local_4 + 0x35) != '\0') break;

    pcVar6 = (char *)*piVar1;

    acStack_8[0] = '\n';

    iVar4 = *(int *)(pcVar6 + -4);

    if ((*(int *)(pcVar6 + -0x10) == 1) && (iVar4 + 1U <= *(uint *)(pcVar6 + -0xc))) {

      *(uint *)(pcVar6 + -4) = iVar4 + 1U;

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

    }

    else {

      FUN_00401280(iVar4);

      pcVar9 = (char *)*piVar1;

      pcVar8 = pcVar6;

      do {

        cVar2 = *pcVar8;

        pcVar8 = pcVar8 + 1;

        *pcVar9 = cVar2;

        pcVar9 = pcVar9 + 1;

      } while (cVar2 != '\0');

      LVar7 = InterlockedDecrement((LONG *)(pcVar6 + -0x10));

      if ((LVar7 == 0) && (pcVar6 + -0x14 != (char *)0x0)) {

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

      }

    }

    strncpy((char *)(*piVar1 + -1 + iVar4),acStack_8,1);

    *(undefined1 *)(*(int *)(*piVar1 + -4) + -1 + *piVar1) = 0;

    while (((((cVar2 = *(char *)(param_1 + 0x34), cVar2 == ',' || (cVar2 == ' ')) || (cVar2 == '\t')

             ) || (cVar2 == '\r')) || ((cVar2 == '\n' && (param_2 != '\0'))))) {

      FUN_006bba50();

    }

    if (*(char *)(local_4 + 0x34) != '#') {

      return 1;

    }

  }

  return 1;

}





// --- FUN_006bc110 at 0x006BC110 (size: 638) ---


undefined4 __thiscall FUN_006bc110(int param_1,char param_2)



{

  undefined *puVar1;

  char cVar2;

  int iVar3;

  LONG LVar4;

  bool bVar5;

  undefined *puVar6;

  int local_8;

  int local_4;

  

  while ((((cVar2 = *(char *)(param_1 + 0x34), cVar2 == ',' || (cVar2 == ' ')) || (cVar2 == '\t'))

         || ((cVar2 == '\r' || (cVar2 == '\n'))))) {

    FUN_006bba50();

  }

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

    return 0;

  }

  FUN_006bbe90(param_1 + 0x3c);

  FUN_0065c7f0(*(undefined2 *)(param_1 + 0x2c));

  FUN_0065c800(*(undefined2 *)(param_1 + 0x2e));

  puVar1 = PTR_DAT_00818344;

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

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

    do {

      while( true ) {

        iVar3 = (int)*(char *)(param_1 + 0x34);

        if (0x2c < iVar3) break;

        if (iVar3 == 0x2c) goto switchD_006bc2b2_caseD_ffffffff;

        switch(iVar3) {

        default:

switchD_006bc2b2_caseD_1:

          param_2 = *(char *)(param_1 + 0x34);

          FUN_00404ef0(&param_2,1);

          FUN_006bba50();

          break;

        case -1:

        case 0:

        case 9:

        case 10:

        case 0xd:

        case 0x20:

        case 0x22:

        case 0x23:

        case 0x28:

        case 0x29:

          goto switchD_006bc2b2_caseD_ffffffff;

        }

      }

      if (0x7b < iVar3) {

        if (iVar3 != 0x7d) {

          bVar5 = iVar3 == 0xffff;

LAB_006bc314:

          if (!bVar5) goto switchD_006bc2b2_caseD_1;

        }

        goto switchD_006bc2b2_caseD_ffffffff;

      }

      if ((iVar3 == 0x7b) || (iVar3 == 0x5b)) goto switchD_006bc2b2_caseD_ffffffff;

      if (iVar3 != 0x5c) {

        bVar5 = iVar3 == 0x5d;

        goto LAB_006bc314;

      }

      FUN_006bba50();

      cVar2 = FUN_006bba50();

      if (((cVar2 == '\0') || (cVar2 == -1)) || (cVar2 == 0xffff)) goto LAB_006bc336;

      param_2 = cVar2;

      FUN_00404ef0(&param_2,1);

    } while( true );

  }

  do {

    FUN_006bba50();

    while( true ) {

      iVar3 = (int)*(char *)(param_1 + 0x34);

      if (iVar3 < 0x23) break;

      if (iVar3 != 0x5c) {

        bVar5 = iVar3 == 0xffff;

        goto LAB_006bc1d5;

      }

      FUN_006bba50();

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

        FUN_00401340("unexpected EOF after \'\\\'");

        LVar4 = InterlockedDecrement((LONG *)(local_4 + -0x10));

        if ((LVar4 == 0) && ((undefined4 *)(local_4 + -0x14) != (undefined4 *)0x0)) {

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

        }

        goto switchD_006bc2b2_caseD_ffffffff;

      }

      param_2 = FUN_006bba50();

      FUN_00404ef0(&param_2,1);

    }

    if (iVar3 == 0x22) {

      FUN_006bba50();

      goto switchD_006bc2b2_caseD_ffffffff;

    }

    if (-2 < iVar3) {

      if (iVar3 < 1) goto LAB_006bc224;

      bVar5 = iVar3 == 10;

LAB_006bc1d5:

      if (bVar5) goto LAB_006bc224;

    }

    param_2 = *(char *)(param_1 + 0x34);

    FUN_00404ef0(&param_2,1);

  } while( true );

LAB_006bc336:

  FUN_00401340("unexpected EOF after \'\\\'");

  FUN_004011b0();

  goto switchD_006bc2b2_caseD_ffffffff;

LAB_006bc224:

  FUN_00401340("unterminated string");

  LVar4 = InterlockedDecrement((LONG *)(local_8 + -0x10));

  if ((LVar4 == 0) && ((undefined4 *)(local_8 + -0x14) != (undefined4 *)0x0)) {

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

  }

switchD_006bc2b2_caseD_ffffffff:

  puVar6 = puVar1;

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

  FUN_00427050(puVar6);

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

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

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

  }

  return 1;

}





// --- FUN_006bc3d0 at 0x006BC3D0 (size: 471) ---


undefined4 __thiscall FUN_006bc3d0(int param_1,undefined4 param_2)



{

  int iVar1;

  char cVar2;

  char extraout_AL;

  char extraout_AL_00;

  int iVar3;

  char cVar4;

  

  while ((((cVar4 = *(char *)(param_1 + 0x34), cVar4 == ',' || (cVar4 == ' ')) || (cVar4 == '\t'))

         || ((cVar4 == '\r' || (cVar4 == '\n'))))) {

    FUN_006bba50();

  }

  cVar4 = *(char *)(param_1 + 0x34);

  if (((cVar4 != '\0') && (cVar4 != -1)) &&

     ((cVar4 != 0xffff && (((cVar4 != ']' && (cVar4 != '}')) && (cVar4 != ')')))))) {

    iVar1 = param_1 + 0x38;

    FUN_0065d5c0(iVar1);

    FUN_006bc110(param_2);

    if (extraout_AL != '\0') {

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

switchD_006bc4ac_caseD_1:

        return 1;

      }

      FUN_006bbee0(1);

      while (((cVar4 = *(char *)(param_1 + 0x34), cVar4 == ',' || (cVar4 == ' ')) ||

             ((cVar4 == '\t' || ((cVar4 == '\r' || (cVar4 == '\n'))))))) {

        FUN_006bba50();

      }

      iVar3 = (int)*(char *)(param_1 + 0x34);

      if (iVar3 < 0x5e) {

        if (iVar3 == 0x5d) {

switchD_006bc4ac_caseD_ffffffff:

          FUN_0065d5c0(iVar1);

          FUN_00404cd0();

          return 1;

        }

        switch(iVar3) {

        default:

          goto switchD_006bc4ac_caseD_1;

        case 0x28:

          cVar4 = ')';

          break;

        case 0x5b:

          cVar4 = ']';

          break;

        case -1:

        case 0:

        case 0x29:

          goto switchD_006bc4ac_caseD_ffffffff;

        }

      }

      else {

        if (iVar3 != 0x7b) {

          if ((iVar3 != 0x7d) && (iVar3 != 0xffff)) {

            return 1;

          }

          goto switchD_006bc4ac_caseD_ffffffff;

        }

        cVar4 = '}';

      }

      FUN_0065d5c0(iVar1);

      FUN_00404cd0();

      FUN_006bba50();

      FUN_006bc650(param_2);

      if (extraout_AL_00 != '\0') {

        while ((((cVar2 = *(char *)(param_1 + 0x34), cVar2 == ',' || (cVar2 == ' ')) ||

                (cVar2 == '\t')) || ((cVar2 == '\r' || (cVar2 == '\n'))))) {

          FUN_006bba50();

        }

        if (*(char *)(param_1 + 0x34) == cVar4) {

          FUN_006bba50();

          FUN_006bbee0(1);

          cVar4 = *(char *)(param_1 + 0x34);

          if (((cVar4 != '\0') && (cVar4 != -1)) &&

             ((cVar4 != 0xffff && (((cVar4 != ')' && (cVar4 != ']')) && (cVar4 != '}')))))) {

            return 1;

          }

          FUN_0065d5c0(iVar1);

          FUN_00404cd0();

          return 1;

        }

        FUN_00401340("mismatched paren");

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

        FUN_004011b0();

      }

    }

  }

  return 0;

}





// --- FUN_006bc620 at 0x006BC620 (size: 36) ---


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



{

  *param_1 = &PTR_FUN_00807b40;

  FUN_0049f850();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006bc650 at 0x006BC650 (size: 389) ---


bool __fastcall FUN_006bc650(int param_1)



{

  undefined4 *puVar1;

  char *pcVar2;

  char cVar3;

  char *pcVar4;

  char *pcVar5;

  LONG LVar6;

  undefined4 *puVar7;

  bool bVar8;

  char *local_14;

  undefined **local_10;

  undefined4 *local_c;

  undefined4 local_8;

  int local_4;

  

  FUN_006bbee0(1);

  while( true ) {

    if (DAT_008f8638 == (undefined4 *)0x0) {

      FUN_00661110();

    }

    DAT_008f8638 = (undefined4 *)*DAT_008f8638;

    pcVar4 = (char *)FUN_0065d1a0();

    cVar3 = FUN_006bc3d0(pcVar4);

    if (cVar3 == '\0') break;

    local_14 = PTR_DAT_00818344;

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

    FUN_00426020(&local_14);

    pcVar2 = local_14;

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

      pcVar5 = local_14 + *(int *)(local_14 + -4) + -1;

      if (*(int *)(local_14 + -4) != 0) {

        pcVar5 = local_14;

      }

      if (*pcVar5 != '!') goto LAB_006bc757;

      local_10 = &PTR_FUN_00807b40;

      local_c = (undefined4 *)0x0;

      local_8 = 0;

      local_4 = 0;

      FUN_006bcaf0(pcVar4,&local_10);

      for (puVar7 = local_c; puVar7 != (undefined4 *)0x0; puVar7 = (undefined4 *)puVar7[1]) {

        FUN_0065d7b0(*puVar7);

      }

      local_10 = &PTR_FUN_00807b40;

      while (puVar7 = local_c, local_c != (undefined4 *)0x0) {

        puVar1 = (undefined4 *)local_c[1];

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

          local_8 = 0;

        }

        else {

          puVar1[2] = 0;

        }

        bVar8 = local_c != (undefined4 *)0x0;

        local_c = puVar1;

        if (bVar8) {

          operator_delete(puVar7);

        }

        local_4 = local_4 + -1;

      }

    }

    else {

LAB_006bc757:

      FUN_0065d7b0(pcVar4);

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

        pcVar4 = pcVar2 + -0x14;

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

        if ((LVar6 == 0) && (pcVar4 != (char *)0x0)) {

LAB_006bc7b9:

          (*(code *)**(undefined4 **)pcVar4)(1);

        }

LAB_006bc7c1:

        return *(char *)(param_1 + 0x10) == '\0';

      }

    }

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

    if ((LVar6 == 0) && (pcVar2 + -0x14 != (char *)0x0)) {

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

    }

  }

  if ((pcVar4 == (char *)0x0) || (LVar6 = InterlockedDecrement((LONG *)(pcVar4 + 4)), LVar6 != 0))

  goto LAB_006bc7c1;

  goto LAB_006bc7b9;

}





// --- FUN_006bc7e0 at 0x006BC7E0 (size: 427) ---


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



{

  int iVar1;

  int *piVar2;

  LONG LVar3;

  int iVar4;

  int *piVar5;

  undefined4 *puVar6;

  code *pcVar7;

  undefined *local_8;

  int *local_4;

  

  iVar4 = param_3;

  local_4 = param_1;

  FUN_00405210();

  local_8 = PTR_DAT_00818344;

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

  piVar2 = param_2;

  while (param_1 = (int *)param_1[1], param_1 != (int *)0x0) {

    if (local_8 != (undefined *)*param_1) {

      puVar6 = (undefined4 *)(local_8 + -0x14);

      LVar3 = InterlockedDecrement((LONG *)(local_8 + -0x10));

      if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

        (**(code **)*puVar6)(1);

      }

      local_8 = (undefined *)*param_1;

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

      iVar4 = param_3;

    }

    thunk_FUN_0040deb0(&local_8,0);

    iVar1 = *(int *)(*piVar2 + -4);

    if (iVar1 != 1) {

      FUN_00404ef0(*piVar2,iVar1 + -1);

    }

    FUN_0040d4a0(&local_8,iVar4,0,0);

  }

  pcVar7 = InterlockedDecrement_exref;

  if (*(int *)(iVar4 + 0xc) == 0) {

    param_2 = (int *)PTR_DAT_00818344;

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

    thunk_FUN_0040c780(&param_2,local_4 + 0xf);

    thunk_FUN_0040deb0(&param_2,0);

    iVar1 = *(int *)(*piVar2 + -4);

    if (iVar1 != 1) {

      FUN_00404ef0(*piVar2,iVar1 + -1);

    }

    FUN_0040d4a0(&param_2,iVar4,0,0);

    pcVar7 = InterlockedDecrement_exref;

    piVar5 = param_2 + -5;

    LVar3 = InterlockedDecrement(param_2 + -4);

    iVar4 = param_3;

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

      (**(code **)*piVar5)(1);

      iVar4 = param_3;

    }

  }

  if (*(int *)(iVar4 + 0xc) == 0) {

    FUN_00679290(&param_3,piVar2);

    if (*(int *)(param_3 + -4) != 1) {

      FUN_0040b720(&param_3);

    }

    puVar6 = (undefined4 *)(param_3 + -0x14);

    iVar4 = (*pcVar7)(param_3 + -0x10);

    if ((iVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

  }

  puVar6 = (undefined4 *)(local_8 + -0x14);

  iVar4 = (*pcVar7)(local_8 + -0x10);

  if ((iVar4 == 0) && (puVar6 != (undefined4 *)0x0)) {

    (**(code **)*puVar6)(1);

  }

  return;

}





// --- FUN_006bc990 at 0x006BC990 (size: 249) ---


undefined4 __thiscall FUN_006bc990(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  LONG LVar3;

  int iVar4;

  

  piVar1 = (int *)(param_1 + 0x3c);

  FUN_0065d3f0(piVar1);

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

  if (iVar2 != *piVar1) {

    LVar3 = InterlockedDecrement((LONG *)(iVar2 + -0x10));

    if ((LVar3 == 0) && ((undefined4 *)(iVar2 + -0x14) != (undefined4 *)0x0)) {

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

    }

    iVar2 = *piVar1;

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

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

  }

  iVar2 = *piVar1;

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

  iVar4 = iVar2;

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

  FUN_00427050(iVar4);

  LVar3 = InterlockedDecrement((LONG *)(iVar2 + -0x10));

  if ((LVar3 == 0) && ((undefined4 *)(iVar2 + -0x14) != (undefined4 *)0x0)) {

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

  }

  FUN_006bbee0(0);

  FUN_0065d5c0(param_1 + 0x38);

  FUN_006bc650(param_2);

  FUN_0065d5c0(param_1 + 0x38);

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

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

      return 1;

    }

    FUN_00401340("unexpected close brace");

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

    LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

    if ((LVar3 == 0) && ((undefined4 *)(param_2 + -0x14) != (undefined4 *)0x0)) {

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

    }

  }

  return 0;

}





// --- FUN_006bca90 at 0x006BCA90 (size: 87) ---


undefined1

FUN_006bca90(undefined4 param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

            undefined4 param_5,undefined4 param_6)



{

  char cVar1;

  undefined1 uVar2;

  

  FUN_006bbce0(param_2,&PTR_DAT_008183b4);

  cVar1 = FUN_006bbae0(param_2,param_3,param_4,param_5,param_6);

  if (cVar1 == '\0') {

    return 0;

  }

  uVar2 = FUN_006bc990(param_1);

  FUN_006bbda0();

  return uVar2;

}





// --- FUN_006bcaf0 at 0x006BCAF0 (size: 1405) ---


void __thiscall FUN_006bcaf0(int param_1,int *param_2)



{

  char cVar1;

  int iVar2;

  LONG LVar3;

  uint uVar4;

  code *pcVar5;

  undefined4 *puVar6;

  undefined4 *puVar7;

  undefined *puVar8;

  int *piVar9;

  undefined *local_78;

  undefined *local_74;

  int local_70;

  undefined *local_6c;

  undefined *local_68 [4];

  undefined **local_58;

  undefined4 local_54;

  undefined4 local_50;

  uint local_4c;

  

  piVar9 = param_2;

  local_70 = param_1;

  cVar1 = FUN_0065cc50(&DAT_00906668);

  if ((cVar1 == '\0') || (*(char *)(*(int *)(param_1 + 0x40) + 0x1f) == '\0')) {

    cVar1 = FUN_0065cc50(&DAT_0090666c);

    if (cVar1 == '\0') {

      cVar1 = FUN_0065cc50(&DAT_00906670);

      if (cVar1 == '\0') {

        FUN_006bbc10(&param_2);

      }

      else {

        local_68[0] = PTR_DAT_00818344;

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

        iVar2 = FUN_0065ca40();

        puVar8 = PTR_DAT_00818344;

        if (iVar2 != 0) {

          local_6c = PTR_DAT_00818344;

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

          iVar2 = (**(code **)(*piVar9 + 0xc))(0);

          if (iVar2 != 0) {

            FUN_00426020(&local_6c);

            puVar8 = local_6c;

          }

          FUN_00402070(&local_6c);

          LVar3 = InterlockedDecrement((LONG *)(puVar8 + -0x10));

          if ((LVar3 == 0) && ((undefined4 *)(puVar8 + -0x14) != (undefined4 *)0x0)) {

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

          }

        }

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

          FUN_00405f70();

        }

        puVar6 = (undefined4 *)(local_68[0] + -0x14);

        LVar3 = InterlockedDecrement((LONG *)(local_68[0] + -0x10));

        if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

          (**(code **)*puVar6)(1);

          return;

        }

      }

    }

    else {

      local_6c = PTR_DAT_00818344;

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

      iVar2 = FUN_0065ca40();

      puVar8 = PTR_DAT_00818344;

      if (iVar2 != 0) {

        local_68[0] = PTR_DAT_00818344;

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

        iVar2 = (**(code **)(*piVar9 + 0xc))(0);

        if (iVar2 != 0) {

          FUN_00426020(local_68);

          puVar8 = local_68[0];

        }

        if (*(int *)(puVar8 + -4) != 1) {

          FUN_00404ef0(puVar8,*(int *)(puVar8 + -4) + -1);

        }

        LVar3 = InterlockedDecrement((LONG *)(puVar8 + -0x10));

        if ((LVar3 == 0) && ((undefined4 *)(puVar8 + -0x14) != (undefined4 *)0x0)) {

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

        }

      }

      *(undefined1 *)(local_70 + 0x10) = 1;

      if ((piVar9 != (int *)0x0) && (LVar3 = InterlockedDecrement(piVar9 + 1), LVar3 == 0)) {

        (**(code **)*piVar9)(1);

      }

      puVar6 = (undefined4 *)(local_6c + -0x14);

      LVar3 = InterlockedDecrement((LONG *)(local_6c + -0x10));

      if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

        (**(code **)*puVar6)(1);

        return;

      }

    }

    return;

  }

  local_58 = &PTR_FUN_00795074;

  local_54 = 0;

  local_50 = 0;

  local_4c = 0;

  FUN_0065cf90(piVar9);

  iVar2 = FUN_0065c810();

  do {

    if (iVar2 == 0) {

      if ((piVar9 != (int *)0x0) && (LVar3 = InterlockedDecrement(piVar9 + 1), LVar3 == 0)) {

        (**(code **)*piVar9)(1);

      }

      FUN_0065cae0();

      local_58 = &PTR_FUN_00795074;

      FUN_00405210();

      return;

    }

    local_74 = PTR_DAT_00818344;

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

    FUN_00426020(&local_74);

    FUN_006bc7e0(&local_74,&local_58);

    pcVar5 = InterlockedDecrement_exref;

    if (1 < local_4c) {

      local_6c = PTR_DAT_00818344;

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

      FUN_00402710(&local_6c,"Multiple files named \'%s\' found",local_74);

      pcVar5 = InterlockedDecrement_exref;

      puVar6 = (undefined4 *)(local_6c + -0x14);

      LVar3 = InterlockedDecrement((LONG *)(local_6c + -0x10));

      if ((LVar3 == 0) && (puVar6 != (undefined4 *)0x0)) {

        (**(code **)*puVar6)(1);

      }

    }

    local_78 = PTR_DAT_00818344;

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

    cVar1 = FUN_00405120(&local_78);

    if (cVar1 == '\0') {

      local_6c = PTR_DAT_00818344;

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

      FUN_00402710(&local_6c,"Couldn\'t find !include file \'%s\'",local_74);

      puVar6 = (undefined4 *)(local_6c + -0x14);

      *(undefined1 *)(local_70 + 0x10) = 1;

      iVar2 = (*pcVar5)(local_6c + -0x10);

      if ((iVar2 == 0) && (puVar6 != (undefined4 *)0x0)) {

        (**(code **)*puVar6)(1);

      }

    }

    else {

      FUN_006bb8c0(*(undefined4 *)(local_70 + 0x40));

      if (DAT_008f8638 == (undefined4 *)0x0) {

        FUN_00661110();

      }

      DAT_008f8638 = (undefined4 *)*DAT_008f8638;

      puVar6 = (undefined4 *)FUN_0065d1a0();

      FUN_006bbce0(&local_78,&PTR_DAT_008183b4);

      cVar1 = FUN_006bbae0(&local_78,0,1,0,0);

      if (cVar1 == '\0') {

LAB_006bcd89:

        local_6c = PTR_DAT_00818344;

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

        FUN_00402710(&local_6c,"Failed to parse include: %s",local_78);

        puVar7 = (undefined4 *)(local_6c + -0x14);

        *(undefined1 *)(local_70 + 0x10) = 1;

        iVar2 = (*pcVar5)(local_6c + -0x10);

        if ((iVar2 == 0) && (puVar7 != (undefined4 *)0x0)) {

          (**(code **)*puVar7)(1);

        }

      }

      else {

        cVar1 = FUN_006bc990(puVar6);

        FUN_006bbda0();

        pcVar5 = InterlockedDecrement_exref;

        if (cVar1 == '\0') goto LAB_006bcd89;

        uVar4 = FUN_0065ca40();

        pcVar5 = InterlockedDecrement_exref;

        if (uVar4 != 0) {

          local_6c = (undefined *)FUN_0065cab0(0);

          local_68[0] = *(undefined **)(local_6c + 0x10);

          InterlockedIncrement((LONG *)(local_68[0] + -0x10));

          FUN_0065ce40(0);

          FUN_0065d5c0(param_2 + 4);

          FUN_0065d5c0(puVar6 + 4);

          FUN_0065d5c0(local_68);

          FUN_006bbc10(&local_6c);

          if (1 < uVar4) {

            iVar2 = uVar4 - 1;

            do {

              local_6c = (undefined *)FUN_0065cab0(0);

              FUN_006bbc10(&local_6c);

              iVar2 = iVar2 + -1;

            } while (iVar2 != 0);

          }

          puVar7 = (undefined4 *)(local_68[0] + -0x14);

          LVar3 = InterlockedDecrement((LONG *)(local_68[0] + -0x10));

          pcVar5 = InterlockedDecrement_exref;

          if ((LVar3 == 0) && (puVar7 != (undefined4 *)0x0)) {

            (**(code **)*puVar7)(1);

            pcVar5 = InterlockedDecrement_exref;

          }

        }

      }

      if ((puVar6 != (undefined4 *)0x0) && (iVar2 = (*pcVar5)(puVar6 + 1), iVar2 == 0)) {

        (**(code **)*puVar6)(1);

      }

      FUN_006bb940();

      piVar9 = param_2;

    }

    puVar6 = (undefined4 *)(local_78 + -0x14);

    iVar2 = (*pcVar5)(local_78 + -0x10);

    if ((iVar2 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    puVar6 = (undefined4 *)(local_78 + -0x14);

    iVar2 = (*pcVar5)(local_78 + -0x10);

    if ((iVar2 == 0) && (puVar6 != (undefined4 *)0x0)) {

      (**(code **)*puVar6)(1);

    }

    iVar2 = FUN_0065cb10();

  } while( true );

}





// --- FUN_006bd070 at 0x006BD070 (size: 35) ---


undefined4 * __fastcall FUN_006bd070(undefined4 *param_1)



{

  FUN_00670e60();

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

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

  param_1[7] = 0;

  param_1[8] = 0;

  param_1[9] = 0;

  *param_1 = &PTR_FUN_00807c30;

  return param_1;

}





// --- FUN_006bd0a0 at 0x006BD0A0 (size: 82) ---


void __fastcall FUN_006bd0a0(undefined4 *param_1)



{

  BOOL BVar1;

  

  *param_1 = &PTR_FUN_00807c30;

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

    CloseHandle((HANDLE)param_1[8]);

    if ((LPCVOID)param_1[7] != (LPCVOID)0x0) {

      BVar1 = UnmapViewOfFile((LPCVOID)param_1[7]);

      if (BVar1 == 0) {

        GetLastError();

      }

      BVar1 = CloseHandle((HANDLE)param_1[9]);

      if (BVar1 == 0) {

        GetLastError();

      }

    }

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

  }

  FUN_00670eb0();

  return;

}





// --- FUN_006bd100 at 0x006BD100 (size: 4) ---


undefined4 __fastcall FUN_006bd100(int param_1)



{

  return *(undefined4 *)(param_1 + 0x1c);

}





// --- FUN_006bd120 at 0x006BD120 (size: 30) ---


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



{

  FUN_006bd0a0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006bd140 at 0x006BD140 (size: 454) ---


undefined4 __thiscall

FUN_006bd140(int param_1,LPCSTR param_2,undefined4 param_3,DWORD param_4,char param_5,int param_6,

            DWORD param_7,DWORD param_8)



{

  LPCSTR lpFileName;

  char cVar1;

  undefined1 uVar2;

  LONG LVar3;

  HANDLE pvVar4;

  LPVOID pvVar5;

  LPCSTR pCVar6;

  DWORD DVar7;

  

  lpFileName = param_2;

  FUN_00401340(param_2);

  uVar2 = FUN_0040b320(&param_2,0);

  pCVar6 = param_2 + -0x14;

  *(undefined1 *)(param_1 + 0x19) = uVar2;

  LVar3 = InterlockedDecrement((LONG *)(param_2 + -0x10));

  if ((LVar3 == 0) && (pCVar6 != (LPCSTR)0x0)) {

    (*(code *)**(undefined4 **)pCVar6)(1);

  }

  if (((char)param_4 != '\0') && (*(char *)(param_1 + 0x19) == '\0')) {

    return 0;

  }

  cVar1 = (char)param_3;

  if ((*(char *)(param_1 + 0x19) == '\0') || (param_5 != '\0')) {

    DVar7 = 2;

  }

  else {

    DVar7 = 3;

  }

  pvVar4 = CreateFileA(lpFileName,(-(uint)((char)param_3 != '\0') & 0xc0000000) + 0xc0000000,1,

                       (LPSECURITY_ATTRIBUTES)0x0,DVar7,0x8000000,(HANDLE)0x0);

  *(HANDLE *)(param_1 + 0x20) = pvVar4;

  if (pvVar4 != (HANDLE)0xffffffff) {

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

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

      SetFilePointer(pvVar4,param_6,(PLONG)0x0,0);

      param_3 = 0;

      WriteFile(*(HANDLE *)(param_1 + 0x20),&param_3,4,&param_4,(LPOVERLAPPED)0x0);

      if (param_4 != 4) {

        return 0;

      }

    }

    pvVar4 = CreateFileMappingA(*(HANDLE *)(param_1 + 0x20),(LPSECURITY_ATTRIBUTES)0x0,

                                (uint)(cVar1 == '\0') * 2 + 2,0,0,(LPCSTR)0x0);

    *(HANDLE *)(param_1 + 0x24) = pvVar4;

    if (pvVar4 != (HANDLE)0x0) {

      pvVar5 = MapViewOfFileEx(pvVar4,(-(uint)(cVar1 != '\0') & 0xfff0ffe5) + 0xf001f,param_7,

                               param_8,0,(LPVOID)0x0);

      *(LPVOID *)(param_1 + 0x1c) = pvVar5;

      if (pvVar5 != (LPVOID)0x0) {

        DVar7 = GetFileSize(*(HANDLE *)(param_1 + 0x20),(LPDWORD)0x0);

        FUN_00670e80(*(undefined4 *)(param_1 + 0x1c),DVar7);

        return *(undefined4 *)(param_1 + 0x1c);

      }

      GetLastError();

      CloseHandle(*(HANDLE *)(param_1 + 0x20));

      CloseHandle(*(HANDLE *)(param_1 + 0x24));

      return 0;

    }

    GetLastError();

    CloseHandle(*(HANDLE *)(param_1 + 0x20));

    return 0;

  }

  GetLastError();

  return 0;

}





// --- FUN_006bd310 at 0x006BD310 (size: 52) ---


undefined2 *

FUN_006bd310(undefined2 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

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

    return (undefined2 *)0x0;

  }

  *param_1 = 0;

  (*(code *)PTR_FUN_00837394)(param_4,0,param_2,0xffffffff,param_1,param_3);

  return param_1;

}





// --- FUN_006bd350 at 0x006BD350 (size: 20) ---


void __thiscall FUN_006bd350(undefined4 *param_1,undefined4 param_2)



{

  (*(code *)**(undefined4 **)*param_1)((undefined4 *)*param_1,&DAT_00807cac,param_2);

  return;

}





// --- FUN_006bd370 at 0x006BD370 (size: 20) ---


void __thiscall FUN_006bd370(undefined4 *param_1,undefined4 param_2)



{

  (*(code *)**(undefined4 **)*param_1)((undefined4 *)*param_1,&DAT_00807cbc,param_2);

  return;

}





// --- FUN_006bd390 at 0x006BD390 (size: 20) ---


void __thiscall FUN_006bd390(undefined4 *param_1,undefined4 param_2)



{

  (*(code *)**(undefined4 **)*param_1)((undefined4 *)*param_1,&DAT_00807ccc,param_2);

  return;

}





// --- FUN_006bd3b0 at 0x006BD3B0 (size: 199) ---


void __fastcall FUN_006bd3b0(undefined4 *param_1)



{

  int *piVar1;

  

  piVar1 = (int *)param_1[6];

  *param_1 = &PTR_FUN_00807cdc;

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

    (**(code **)(*piVar1 + 0x24))(piVar1);

  }

  piVar1 = (int *)param_1[6];

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

    param_1[6] = 0;

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  piVar1 = (int *)param_1[8];

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

    param_1[8] = 0;

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  piVar1 = (int *)param_1[7];

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

    param_1[7] = 0;

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  piVar1 = (int *)param_1[5];

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

    param_1[5] = 0;

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  piVar1 = (int *)param_1[9];

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

    param_1[9] = 0;

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  piVar1 = (int *)param_1[9];

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

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  piVar1 = (int *)param_1[8];

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

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  piVar1 = (int *)param_1[7];

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

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  piVar1 = (int *)param_1[6];

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

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  piVar1 = (int *)param_1[5];

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

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  *param_1 = &PTR_LAB_00796c4c;

  return;

}





// --- FUN_006bd480 at 0x006BD480 (size: 137) ---


undefined1 __fastcall FUN_006bd480(int param_1)



{

  int *piVar1;

  int iVar2;

  undefined1 uVar3;

  undefined1 *puVar4;

  undefined1 *puVar5;

  undefined4 uVar6;

  undefined1 local_c [4];

  undefined1 local_8 [4];

  undefined1 local_4 [4];

  

  piVar1 = *(int **)(param_1 + 0x20);

  uVar3 = 0;

  if ((piVar1 != (int *)0x0) && (*(char *)(param_1 + 0x10) == '\0')) {

    uVar6 = 0;

    puVar5 = local_8;

    puVar4 = local_4;

    iVar2 = (**(code **)(*piVar1 + 0x20))(piVar1,local_c,puVar4,puVar5,0);

    if (-1 < iVar2) {

      uVar3 = 0;

      if (puVar4 == (undefined1 *)0x1) {

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

          piVar1 = *(int **)(param_1 + 0x18);

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

            (**(code **)(*piVar1 + 0x24))(piVar1);

          }

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

          uVar3 = 1;

        }

        else {

          (**(code **)(**(int **)(param_1 + 0x1c) + 0x20))(*(int **)(param_1 + 0x1c),0,0);

        }

      }

      (**(code **)(**(int **)(param_1 + 0x20) + 0x30))

                (*(int **)(param_1 + 0x20),puVar4,uVar6,puVar5);

    }

    return uVar3;

  }

  return 1;

}





// --- FUN_006bd510 at 0x006BD510 (size: 30) ---


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



{

  FUN_006bd3b0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006bd530 at 0x006BD530 (size: 582) ---


/* WARNING: Function: __chkstk replaced with injection: alloca_probe */

/* WARNING: Removing unreachable block (ram,0x006bd75f) */

/* WARNING: Removing unreachable block (ram,0x006bd585) */

/* WARNING: Removing unreachable block (ram,0x006bd734) */



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



{

  LPVOID *ppv;

  int *piVar1;

  int *piVar2;

  HRESULT HVar3;

  int iVar4;

  wchar_t *_Source;

  undefined1 auStack_310 [516];

  CHAR local_10c [260];

  int local_8;

  

  ppv = (LPVOID *)(param_1 + 0x14);

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

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

  param_4 = (int *)0x0;

  HVar3 = CoCreateInstance((IID *)&DAT_00808430,(LPUNKNOWN)0x0,3,(IID *)&DAT_00807c9c,ppv);

  if (HVar3 < 0) {

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

      (**(code **)(*param_4 + 8))(param_4);

    }

  }

  else {

    local_8 = 0;

    iVar4 = FUN_005df0f5(0x178);

    if (iVar4 == 0) {

      iVar4 = 0;

    }

    else {

      iVar4 = FUN_006bdb80(0,&local_8,*(undefined4 *)(param_1 + 8));

    }

    if ((local_8 < 0) || (iVar4 == 0)) {

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

        (**(code **)(*param_4 + 8))(param_4);

      }

    }

    else {

      piVar1 = (int *)(iVar4 + 0xc);

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

        (**(code **)(*piVar1 + 4))(piVar1);

      }

      piVar2 = *(int **)(param_1 + 0x24);

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

        (**(code **)(*piVar2 + 8))(piVar2);

      }

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

      local_8 = (**(code **)(*(int *)*ppv + 0xc))(*ppv,piVar1,L"TEXTURERENDERER");

      if (-1 < local_8) {

        lstrcpyA(local_10c,(LPCSTR)*param_2);

        (*(code *)PTR_FUN_00820a9c)();

        iVar4 = lstrlenA(local_10c);

        _Source = (wchar_t *)FUN_006bd310(auStack_310,local_10c,iVar4 + 1);

        wcsncpy((wchar_t *)&stack0xfffffcec,_Source,0x104);

        local_8 = (**(code **)(*(int *)*ppv + 0x38))(*ppv,&stack0xfffffcec,L"SOURCE");

        if ((((local_8 != -0x7ffbfdea) && (-1 < local_8)) &&

            (local_8 = (**(code **)(iRam00000000 + 0x2c))(0,L"Output",&param_4), -1 < local_8)) &&

           (local_8 = (**(code **)(*(int *)*ppv + 0x30))(*ppv,param_4), -1 < local_8)) {

          FUN_006bd350((undefined4 *)(param_1 + 0x18));

          FUN_006bd370(param_1 + 0x1c);

          FUN_006bd390(param_1 + 0x20);

          piVar1 = *(int **)(param_1 + 0x18);

          local_8 = (**(code **)(*piVar1 + 0x1c))(piVar1);

          if (-1 < local_8) {

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

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

              (**(code **)(*param_4 + 8))(param_4);

            }

            return 1;

          }

        }

      }

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

        (**(code **)(*param_4 + 8))(param_4);

      }

    }

  }

  return 0;

}





// --- FUN_006bd780 at 0x006BD780 (size: 133) ---


void FUN_006bd780(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

                 int *param_5)



{

  int *piVar1;

  char cVar2;

  undefined4 *puVar3;

  

  puVar3 = (undefined4 *)FUN_005df0f5(0x28);

  if (puVar3 == (undefined4 *)0x0) {

    puVar3 = (undefined4 *)0x0;

  }

  else {

    puVar3[1] = 1;

    *puVar3 = &PTR_FUN_00807cdc;

    puVar3[2] = 0;

    puVar3[3] = 0;

    puVar3[5] = 0;

    puVar3[6] = 0;

    puVar3[7] = 0;

    puVar3[8] = 0;

    puVar3[9] = 0;

  }

  *param_5 = (int)puVar3;

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

    cVar2 = FUN_006bd530(param_2,param_4,param_3);

    if (cVar2 != '\0') {

      *param_1 = 0;

      return;

    }

    puVar3 = (undefined4 *)*param_5;

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

      piVar1 = puVar3 + 1;

      *piVar1 = *piVar1 + -1;

      if (*piVar1 == 0) {

        (**(code **)*puVar3)(1);

      }

      *param_5 = 0;

    }

  }

  *param_1 = 0x80004005;

  return;

}





// --- FUN_006bd825 at 0x006BD825 (size: 78) ---


undefined4 __fastcall FUN_006bd825(undefined4 param_1,int *param_2)



{

  undefined4 in_EAX;

  int iVar1;

  int *piVar2;

  int *piVar3;

  bool bVar4;

  

  iVar1 = 4;

  bVar4 = true;

  piVar2 = param_2 + 0xb;

  piVar3 = &DAT_00808410;

  do {

    if (iVar1 == 0) break;

    iVar1 = iVar1 + -1;

    bVar4 = *piVar2 == *piVar3;

    piVar2 = piVar2 + 1;

    piVar3 = piVar3 + 1;

  } while (bVar4);

  if (!bVar4) {

    return 0x80070057;

  }

  iVar1 = 4;

  bVar4 = true;

  piVar2 = param_2;

  piVar3 = &DAT_00808460;

  do {

    if (iVar1 == 0) break;

    iVar1 = iVar1 + -1;

    bVar4 = *piVar2 == *piVar3;

    piVar2 = piVar2 + 1;

    piVar3 = piVar3 + 1;

  } while (bVar4);

  if (bVar4) {

    iVar1 = 4;

    bVar4 = true;

    piVar2 = param_2 + 4;

    piVar3 = &DAT_00808450;

    do {

      if (iVar1 == 0) break;

      iVar1 = iVar1 + -1;

      bVar4 = *piVar2 == *piVar3;

      piVar2 = piVar2 + 1;

      piVar3 = piVar3 + 1;

    } while (bVar4);

    if (bVar4) {

      in_EAX = 0;

    }

  }

  return in_EAX;

}





// --- FUN_006bdb80 at 0x006BDB80 (size: 185) ---


undefined4 * __thiscall

FUN_006bdb80(undefined4 *param_1,undefined4 param_2,undefined4 *param_3,int param_4)



{

  int *piVar1;

  int iVar2;

  

  FUN_006bffa0(&DAT_00807e74,"Texture Renderer",param_2,param_3);

  *param_1 = &PTR_LAB_00807db0;

  param_1[3] = &PTR_FUN_00807d70;

  param_1[4] = &PTR_LAB_00807d5c;

  param_1[0x38] = &PTR_LAB_00807d38;

  param_1[0x39] = &PTR_LAB_00807d24;

  param_1[0x5b] = 0;

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

    *param_3 = 0;

  }

  if ((*(uint *)(param_4 + 0x554) >> 0x11 & 1) == 0) {

    return param_1;

  }

  if ((*(uint *)(param_4 + 0xa4) >> 1 & 1) == 0) {

    return param_1;

  }

  piVar1 = *(int **)(param_4 + 0xb0);

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

    if (*(int *)(param_4 + 0xac) == 0) {

      return param_1;

    }

    piVar1 = (int *)FUN_004592b0();

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

      return param_1;

    }

  }

  iVar2 = (**(code **)(*piVar1 + 0x1c))();

  if (iVar2 != 0) {

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

    param_1[0x5b] = iVar2;

    if (iVar2 != 0) {

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

    }

  }

  return param_1;

}





// --- FUN_006bdc40 at 0x006BDC40 (size: 15) ---


void FUN_006bdc40(int param_1)



{

                    /* WARNING: Could not recover jumptable at 0x006bdc4d. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (**(code **)**(undefined4 **)(param_1 + -8))();

  return;

}





// --- FUN_006bdc50 at 0x006BDC50 (size: 16) ---


void FUN_006bdc50(int param_1)



{

                    /* WARNING: Could not recover jumptable at 0x006bdc5d. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (**(code **)(**(int **)(param_1 + -8) + 4))();

  return;

}





// --- FUN_006bdc60 at 0x006BDC60 (size: 16) ---


void FUN_006bdc60(int param_1)



{

                    /* WARNING: Could not recover jumptable at 0x006bdc6d. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  (**(code **)(**(int **)(param_1 + -8) + 8))();

  return;

}





// --- FUN_006bdcd0 at 0x006BDCD0 (size: 82) ---


void __fastcall FUN_006bdcd0(undefined4 *param_1)



{

  int *piVar1;

  undefined4 *puVar2;

  

  puVar2 = (undefined4 *)param_1[0x5b];

  *param_1 = &PTR_LAB_00807db0;

  param_1[3] = &PTR_FUN_00807d70;

  param_1[4] = &PTR_LAB_00807d5c;

  param_1[0x38] = &PTR_LAB_00807d38;

  param_1[0x39] = &PTR_LAB_00807d24;

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

    piVar1 = puVar2 + 1;

    *piVar1 = *piVar1 + -1;

    if (*piVar1 == 0) {

      (**(code **)*puVar2)(1);

    }

    param_1[0x5b] = 0;

  }

  FUN_006bff50();

  return;

}





// --- FUN_006bdd30 at 0x006BDD30 (size: 30) ---


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



{

  FUN_006bdcd0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006bdd50 at 0x006BDD50 (size: 22) ---


undefined4 * __thiscall FUN_006bdd50(undefined4 *param_1,LPCRITICAL_SECTION param_2)



{

  *param_1 = param_2;

  EnterCriticalSection(param_2);

  return param_1;

}





// --- FUN_006bdd70 at 0x006BDD70 (size: 195) ---


undefined4 * __thiscall

FUN_006bdd70(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_006c1dd0(param_3,param_4,(LPCRITICAL_SECTION)(param_1 + 0x1f),param_2);

  *param_1 = &PTR_FUN_00807ed8;

  param_1[3] = &PTR_FUN_00807e98;

  param_1[4] = &PTR_LAB_00807d5c;

  param_1[0x14] = 0;

  FUN_006c1f90(0);

  FUN_006c1f90(1);

  FUN_006c1f90(1);

  param_1[0x18] = 0;

  param_1[0x19] = 0;

  param_1[0x1a] = 0;

  param_1[0x1b] = 0;

  param_1[0x1c] = 0;

  param_1[0x1d] = 0;

  param_1[0x1e] = 0;

  InitializeCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x1f));

  InitializeCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

  param_1[0x2b] = 0;

  param_1[0x2c] = 1;

  param_1[0x2d] = 0;

  param_1[0x2e] = 0;

  param_1[0x2f] = 0;

  param_1[0x30] = 0;

  InitializeCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x31));

  SetEvent((HANDLE)param_1[0x17]);

  return param_1;

}





// --- FUN_006bdf30 at 0x006BDF30 (size: 73) ---


void FUN_006bdf30(int *param_1,int *param_2,undefined4 param_3)



{

  int iVar1;

  int *piVar2;

  int *piVar3;

  bool bVar4;

  

  iVar1 = 4;

  bVar4 = true;

  piVar2 = param_2;

  piVar3 = &DAT_00807cbc;

  do {

    if (iVar1 == 0) break;

    iVar1 = iVar1 + -1;

    bVar4 = *piVar2 == *piVar3;

    piVar2 = piVar2 + 1;

    piVar3 = piVar3 + 1;

  } while (bVar4);

  if (!bVar4) {

    iVar1 = 4;

    bVar4 = true;

    piVar2 = param_2;

    piVar3 = &DAT_00808340;

    do {

      if (iVar1 == 0) break;

      iVar1 = iVar1 + -1;

      bVar4 = *piVar2 == *piVar3;

      piVar2 = piVar2 + 1;

      piVar3 = piVar3 + 1;

    } while (bVar4);

    if (!bVar4) {

      FUN_006c0060();

      return;

    }

  }

  (**(code **)(*param_1 + 0x24))(param_2,param_3);

  return;

}





// --- FUN_006bdfb0 at 0x006BDFB0 (size: 102) ---


void __fastcall FUN_006bdfb0(int param_1)



{

  int iVar1;

  DWORD DVar2;

  UINT Msg;

  WPARAM wParam;

  LPARAM lParam;

  tagMSG local_1c;

  

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

  while (iVar1 != 0) {

    PeekMessageA(&local_1c,(HWND)0x0,0,0,0);

    Sleep(1);

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

  }

  DVar2 = GetQueueStatus(8);

  if ((DVar2 >> 0x10 & 8) != 0) {

    lParam = 0;

    wParam = 0;

    Msg = 0;

    DVar2 = GetCurrentThreadId();

    PostThreadMessageA(DVar2,Msg,wParam,lParam);

  }

  return;

}





// --- FUN_006be020 at 0x006BE020 (size: 77) ---


undefined4 FUN_006be020(int param_1,undefined4 param_2,undefined4 *param_3)



{

  int iVar1;

  

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

    return 0x80004003;

  }

  iVar1 = FUN_006c23a0(*(undefined4 *)(param_1 + 0x50),param_2,0,0,0);

  if (iVar1 == 0x102) {

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

    return 0x40237;

  }

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

  return 0;

}





// --- FUN_006be070 at 0x006BE070 (size: 93) ---


undefined4 __thiscall FUN_006be070(int *param_1,int param_2)



{

  int iVar1;

  

  if (*(int *)(param_1[0x1e] + 0x18) != 0) {

    if (param_1[0x1c] == 1) {

      SetEvent((HANDLE)param_1[0x17]);

      return 0;

    }

    iVar1 = (**(code **)(*param_1 + 0xa0))();

    if ((iVar1 != 1) || (param_2 == 0)) {

      ResetEvent((HANDLE)param_1[0x17]);

      return 1;

    }

  }

  SetEvent((HANDLE)param_1[0x17]);

  return 0;

}





// --- FUN_006be0d0 at 0x006BE0D0 (size: 103) ---


undefined4 FUN_006be0d0(int param_1,undefined4 param_2,undefined4 *param_3)



{

  int iVar1;

  int *piVar2;

  

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

    return 0x80004003;

  }

  iVar1 = FUN_006c2030(param_2,&DAT_00807fa4);

  if (iVar1 == 0) {

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

    if (iVar1 != 0) {

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

      *param_3 = piVar2;

      (**(code **)(*piVar2 + 4))(piVar2);

      return 0;

    }

    *param_3 = 0;

    (**(code **)(iRam00000000 + 4))(0);

    return 0;

  }

  *param_3 = 0;

  return 0x80040216;

}





// --- FUN_006be140 at 0x006BE140 (size: 52) ---


undefined4 __fastcall FUN_006be140(int *param_1)



{

  if ((param_1[5] != 0) && (param_1[0x1c] = 1, param_1[0x1b] == 0)) {

    SetEvent((HANDLE)param_1[0x17]);

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

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

    }

  }

  return 0;

}





// --- FUN_006be180 at 0x006BE180 (size: 53) ---


undefined4 __fastcall FUN_006be180(int *param_1)



{

  if (param_1[5] == 1) {

    ResetEvent((HANDLE)param_1[0x17]);

  }

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

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

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

  FUN_006bdfb0();

  return 0;

}





// --- FUN_006be1c0 at 0x006BE1C0 (size: 28) ---


undefined4 __fastcall FUN_006be1c0(int *param_1)



{

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

    FUN_006c31d0();

  }

  (**(code **)(*param_1 + 0x28))(1);

  return 0;

}





// --- FUN_006be1e0 at 0x006BE1E0 (size: 26) ---


undefined4 __fastcall FUN_006be1e0(int *param_1)



{

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

    FUN_006c31d0();

  }

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

  return 0;

}





// --- FUN_006be270 at 0x006BE270 (size: 48) ---


bool __fastcall FUN_006be270(int param_1)



{

  int iVar1;

  

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

  if (iVar1 != 0) {

    (**(code **)(**(int **)(param_1 + 0x18) + 0x18))(*(int **)(param_1 + 0x18),iVar1);

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

  }

  ResetEvent(*(HANDLE *)(param_1 + 0x54));

  return iVar1 == 0;

}





// --- FUN_006be2a0 at 0x006BE2A0 (size: 124) ---


bool __thiscall FUN_006be2a0(int *param_1,int param_2)



{

  int iVar1;

  undefined1 *puVar2;

  undefined1 *puVar3;

  undefined1 local_10 [8];

  undefined1 local_8 [8];

  

  if (param_2 != 0) {

    puVar3 = local_8;

    puVar2 = local_10;

    iVar1 = (**(code **)(*param_1 + 0x58))(param_2,puVar2,puVar3);

    if (-1 < iVar1) {

      if (iVar1 == 0) {

        SetEvent((HANDLE)param_1[0x15]);

        return true;

      }

      iVar1 = (**(code **)(*(int *)param_1[6] + 0x10))

                        ((int *)param_1[6],param_1[8],param_1[9],puVar2,puVar3,param_1[0x15],

                         param_1 + 0x1a);

      return -1 < iVar1;

    }

  }

  return false;

}





// --- FUN_006be360 at 0x006BE360 (size: 41) ---


bool __fastcall FUN_006be360(int param_1)



{

  int iVar1;

  

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x94));

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

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x94));

  return iVar1 != 0;

}





// --- FUN_006be390 at 0x006BE390 (size: 45) ---


undefined4 __fastcall FUN_006be390(int param_1)



{

  int *piVar1;

  undefined4 uVar2;

  

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x94));

  piVar1 = *(int **)(param_1 + 0x6c);

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

    (**(code **)(*piVar1 + 4))(piVar1);

  }

  uVar2 = *(undefined4 *)(param_1 + 0x6c);

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x94));

  return uVar2;

}





// --- FUN_006be3c0 at 0x006BE3C0 (size: 284) ---


uint __thiscall FUN_006be3c0(int *param_1,undefined4 param_2)



{

  uint uVar1;

  int iVar2;

  LPCRITICAL_SECTION unaff_EBX;

  undefined4 unaff_retaddr;

  

  uVar1 = (**(code **)(*param_1 + 0x98))(param_2);

  if ((int)uVar1 < 0) {

    return uVar1 & (uVar1 == 0x8004022b) - 1;

  }

  if (param_1[5] == 1) {

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

    param_1[0x2d] = 0;

    EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x1f));

    if (param_1[5] == 0) {

      LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x1f));

      return 0;

    }

    param_1[0x2d] = 1;

    EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

    (**(code **)(*param_1 + 0x34))(unaff_retaddr);

    LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

    LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x1f));

    SetEvent((HANDLE)param_1[0x17]);

  }

  iVar2 = (**(code **)(*param_1 + 0x2c))();

  if (iVar2 < 0) {

    param_1[0x2d] = 0;

    return 0;

  }

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

  param_1[0x2d] = 0;

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x1f));

  if (param_1[5] == 0) {

    LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x1f));

    return 0;

  }

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

  (**(code **)(*param_1 + 0xa8))(param_1[0x1b]);

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

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

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

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

  LeaveCriticalSection(unaff_EBX);

  return 0;

}





// --- FUN_006be4e0 at 0x006BE4E0 (size: 49) ---


undefined4 __fastcall FUN_006be4e0(int param_1)



{

  int *piVar1;

  

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x94));

  piVar1 = *(int **)(param_1 + 0x6c);

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x94));

  return 0;

}





// --- FUN_006be520 at 0x006BE520 (size: 94) ---


undefined4 __fastcall FUN_006be520(int param_1)



{

  LPCRITICAL_SECTION lpCriticalSection;

  undefined4 uVar1;

  

  lpCriticalSection = (LPCRITICAL_SECTION)(param_1 + 0x94);

  EnterCriticalSection(lpCriticalSection);

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

    LeaveCriticalSection(lpCriticalSection);

    return 0;

  }

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

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

    FUN_006c3200();

  }

  *(undefined4 *)(param_1 + 0x74) = 1;

  uVar1 = FUN_006c0530(1,0,param_1 + 0xc);

  LeaveCriticalSection(lpCriticalSection);

  return uVar1;

}





// --- FUN_006be580 at 0x006BE580 (size: 104) ---


undefined4 __fastcall FUN_006be580(int *param_1)



{

  LPCRITICAL_SECTION lpCriticalSection;

  undefined4 uVar1;

  int iVar2;

  

  lpCriticalSection = (LPCRITICAL_SECTION)(param_1 + 0x25);

  EnterCriticalSection(lpCriticalSection);

  if (param_1[0x19] != 1) {

    param_1[0x19] = 1;

    timeBeginPeriod(1);

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

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

      uVar1 = (**(code **)(*param_1 + 0x60))();

      LeaveCriticalSection(lpCriticalSection);

      return uVar1;

    }

    iVar2 = (**(code **)(*param_1 + 0x54))(param_1[0x1b]);

    if (iVar2 == 0) {

      SetEvent((HANDLE)param_1[0x15]);

    }

  }

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006be5f0 at 0x006BE5F0 (size: 60) ---


undefined4 __fastcall FUN_006be5f0(int *param_1)



{

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

  param_1[0x1d] = 0;

  if (param_1[0x19] == 1) {

    param_1[0x19] = 0;

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

    timeEndPeriod(1);

  }

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

  return 0;

}





// --- FUN_006be630 at 0x006BE630 (size: 39) ---


void __thiscall FUN_006be630(int param_1,undefined4 param_2)



{

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x94));

  *(undefined4 *)(param_1 + 0xb0) = param_2;

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x94));

  return;

}





// --- FUN_006be660 at 0x006BE660 (size: 78) ---


undefined4 * __thiscall

FUN_006be660(undefined4 *param_1,int param_2,undefined4 param_3,undefined4 param_4)



{

  FUN_006c1d20("Renderer pin",param_2,param_2 + 0x7c,param_3,param_4);

  param_1[0x36] = param_2;

  *param_1 = &PTR_LAB_00808030;

  param_1[3] = &PTR_FUN_00807fe8;

  param_1[4] = &PTR_LAB_00807fd0;

  param_1[0x26] = &PTR_LAB_00807fac;

  return param_1;

}





// --- FUN_006be6b0 at 0x006BE6B0 (size: 102) ---


int FUN_006be6b0(int param_1)



{

  int iVar1;

  LPCRITICAL_SECTION lpCriticalSection;

  LPCRITICAL_SECTION lpCriticalSection_00;

  

  lpCriticalSection = (LPCRITICAL_SECTION)(*(int *)(param_1 + 0xcc) + 0x7c);

  EnterCriticalSection(lpCriticalSection);

  lpCriticalSection_00 = (LPCRITICAL_SECTION)(*(int *)(param_1 + 0xcc) + 0x94);

  EnterCriticalSection(lpCriticalSection_00);

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

  if (iVar1 == 0) {

    iVar1 = (**(code **)(**(int **)(param_1 + 0xcc) + 0x68))();

    if (-1 < iVar1) {

      iVar1 = FUN_004f1b30(param_1);

    }

  }

  LeaveCriticalSection(lpCriticalSection_00);

  LeaveCriticalSection(lpCriticalSection);

  return iVar1;

}





// --- FUN_006be780 at 0x006BE780 (size: 90) ---


int FUN_006be780(int param_1)



{

  int iVar1;

  LPCRITICAL_SECTION lpCriticalSection;

  LPCRITICAL_SECTION lpCriticalSection_00;

  

  lpCriticalSection = (LPCRITICAL_SECTION)(*(int *)(param_1 + 0xcc) + 0x7c);

  EnterCriticalSection(lpCriticalSection);

  lpCriticalSection_00 = (LPCRITICAL_SECTION)(*(int *)(param_1 + 0xcc) + 0x94);

  EnterCriticalSection(lpCriticalSection_00);

  iVar1 = (**(code **)(**(int **)(param_1 + 0xcc) + 0x88))();

  if (-1 < iVar1) {

    iVar1 = FUN_006c13f0(param_1);

  }

  LeaveCriticalSection(lpCriticalSection_00);

  LeaveCriticalSection(lpCriticalSection);

  return iVar1;

}





// --- FUN_006be880 at 0x006BE880 (size: 31) ---


void __fastcall FUN_006be880(int param_1)



{

  int iVar1;

  

  iVar1 = (**(code **)(**(int **)(param_1 + 0xd8) + 0x8c))();

  if (-1 < iVar1) {

    FUN_006c1100();

    return;

  }

  return;

}





// --- FUN_006be8d0 at 0x006BE8D0 (size: 58) ---


undefined4 FUN_006be8d0(undefined4 param_1,undefined4 *param_2)



{

  LPVOID pvVar1;

  

  if (param_2 == (undefined4 *)0x0) {

    return 0x80004003;

  }

  pvVar1 = CoTaskMemAlloc(8);

  *param_2 = pvVar1;

  if (pvVar1 == (LPVOID)0x0) {

    return 0x8007000e;

  }

  FUN_006c1fc0(pvVar1,&DAT_00807fa4);

  return 0;

}





// --- FUN_006be970 at 0x006BE970 (size: 191) ---


void __fastcall FUN_006be970(int param_1)



{

  DWORD DVar1;

  

  *(undefined4 *)(param_1 + 0x138) = 0xfffffc18;

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

  DVar1 = timeGetTime();

  *(DWORD *)(param_1 + 0x158) = DVar1;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  *(undefined4 *)(param_1 + 0x104) = 0xfffb6c20;

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

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

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

  return;

}





// --- FUN_006bea40 at 0x006BEA40 (size: 25) ---


undefined4 __fastcall FUN_006bea40(int param_1)



{

  DWORD DVar1;

  

  DVar1 = timeGetTime();

  *(DWORD *)(param_1 + 0x158) = DVar1 - *(int *)(param_1 + 0x158);

  return 0;

}





// --- FUN_006beb70 at 0x006BEB70 (size: 100) ---


void __fastcall FUN_006beb70(int *param_1)



{

  param_1[0x3d] = 0;

  param_1[0x3e] = 5000000;

  (**(code **)(*param_1 + 0xb4))(param_1[0x54],param_1[0x55]);

  if (0 < param_1[0x3c]) {

                    /* WARNING: Could not recover jumptable at 0x006bebbf. Too many branches */

                    /* WARNING: Treating indirect jump as call */

    Sleep(param_1[0x3c] / 10000);

    return;

  }

                    /* WARNING: Could not recover jumptable at 0x006bebce. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  Sleep(0);

  return;

}





// --- FUN_006bebe0 at 0x006BEBE0 (size: 43) ---


void __fastcall FUN_006bebe0(int *param_1)



{

  DWORD DVar1;

  

  (**(code **)(*param_1 + 0xb4))(param_1[0x54],param_1[0x55]);

  DVar1 = timeGetTime();

  param_1[0x3f] = DVar1;

  return;

}





// --- FUN_006bec10 at 0x006BEC10 (size: 127) ---


void __fastcall FUN_006bec10(int param_1)



{

  int iVar1;

  DWORD DVar2;

  int iVar3;

  

  DVar2 = timeGetTime();

  iVar3 = (DVar2 - *(int *)(param_1 + 0xfc)) * 10000;

  if ((iVar3 < *(int *)(param_1 + 0xf4) * 2) || (iVar3 < *(int *)(param_1 + 0xf8) * 2)) {

    iVar1 = iVar3 + *(int *)(param_1 + 0xf4) * 3;

    *(int *)(param_1 + 0xf4) = (int)(iVar1 + (iVar1 >> 0x1f & 3U)) >> 2;

  }

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

  if (0 < *(int *)(param_1 + 0xf0)) {

                    /* WARNING: Could not recover jumptable at 0x006bec7a. Too many branches */

                    /* WARNING: Treating indirect jump as call */

    Sleep(*(int *)(param_1 + 0xf0) / 10000);

    return;

  }

                    /* WARNING: Could not recover jumptable at 0x006bec89. Too many branches */

                    /* WARNING: Treating indirect jump as call */

  Sleep(0);

  return;

}





// --- FUN_006bf2e0 at 0x006BF2E0 (size: 54) ---


undefined4 FUN_006bf2e0(int param_1,undefined4 *param_2)



{

  if (param_2 == (undefined4 *)0x0) {

    return 0x80004003;

  }

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + -100));

  *param_2 = *(undefined4 *)(param_1 + 0x40);

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + -100));

  return 0;

}





// --- FUN_006bf320 at 0x006BF320 (size: 54) ---


undefined4 FUN_006bf320(int param_1,undefined4 *param_2)



{

  if (param_2 == (undefined4 *)0x0) {

    return 0x80004003;

  }

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + -100));

  *param_2 = *(undefined4 *)(param_1 + 0x44);

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + -100));

  return 0;

}





// --- FUN_006bf360 at 0x006BF360 (size: 113) ---


undefined4 FUN_006bf360(int param_1,int *param_2)



{

  LPCRITICAL_SECTION lpCriticalSection;

  DWORD DVar1;

  int iVar2;

  

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

    return 0x80004003;

  }

  lpCriticalSection = (LPCRITICAL_SECTION)(param_1 + -100);

  EnterCriticalSection(lpCriticalSection);

  if (*(int *)(param_1 + -0x7c) == 0) {

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

  }

  else {

    DVar1 = timeGetTime();

    iVar2 = DVar1 - *(int *)(param_1 + 0x78);

  }

  if (iVar2 < 1) {

    *param_2 = 0;

    LeaveCriticalSection(lpCriticalSection);

    return 0;

  }

  iVar2 = MulDiv(100000,*(int *)(param_1 + 0x44),iVar2);

  *param_2 = iVar2;

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006bf3e0 at 0x006BF3E0 (size: 107) ---


undefined4 FUN_006bf3e0(int param_1,undefined4 *param_2)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int iVar1;

  undefined4 uVar2;

  

  if (param_2 == (undefined4 *)0x0) {

    return 0x80004003;

  }

  lpCriticalSection = (LPCRITICAL_SECTION)(param_1 + -100);

  EnterCriticalSection(lpCriticalSection);

  if ((*(int *)(param_1 + -200) != 0) && (1 < *(int *)(param_1 + 0x44))) {

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

    uVar2 = __alldiv(*(undefined4 *)(param_1 + 0x48),*(undefined4 *)(param_1 + 0x4c),iVar1,

                     iVar1 >> 0x1f);

    *param_2 = uVar2;

    LeaveCriticalSection(lpCriticalSection);

    return 0;

  }

  *param_2 = 0;

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006bf450 at 0x006BF450 (size: 97) ---


int FUN_006bf450(int param_1)



{

  int iVar1;

  

  iVar1 = 1;

  if (0x40000000 < param_1) {

    return 0x8000;

  }

  if (1 < param_1) {

    do {

      iVar1 = iVar1 * 2;

    } while (iVar1 * iVar1 < param_1);

  }

  if (param_1 != 0) {

    iVar1 = (iVar1 * iVar1 + param_1) / (iVar1 * 2);

    if ((-1 < iVar1) && (iVar1 = (iVar1 * iVar1 + param_1) / (iVar1 * 2), -1 < iVar1)) {

      iVar1 = (iVar1 * iVar1 + param_1) / (iVar1 * 2);

    }

    return iVar1;

  }

  return 0;

}





// --- FUN_006bf4c0 at 0x006BF4C0 (size: 149) ---


undefined4 __thiscall

FUN_006bf4c0(int param_1,int param_2,undefined4 *param_3,uint param_4,int param_5,undefined4 param_6

            ,undefined4 param_7)



{

  LPCRITICAL_SECTION lpCriticalSection;

  undefined4 uVar1;

  undefined8 uVar2;

  

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

    return 0x80004003;

  }

  lpCriticalSection = (LPCRITICAL_SECTION)(param_1 + 0x7c);

  EnterCriticalSection(lpCriticalSection);

  if ((*(int *)(param_1 + 0x18) != 0) && (1 < param_2)) {

    uVar2 = FUN_006c2090(param_6,param_7,param_6,param_7,param_2,param_2 >> 0x1f,0,0);

    uVar1 = __alldiv(param_4 - (uint)uVar2,

                     (param_5 - (int)((ulonglong)uVar2 >> 0x20)) - (uint)(param_4 < (uint)uVar2),

                     param_2 + -1,param_2 + -1 >> 0x1f);

    uVar1 = FUN_006bf450(uVar1);

    *param_3 = uVar1;

    LeaveCriticalSection(lpCriticalSection);

    return 0;

  }

  *param_3 = 0;

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006bf650 at 0x006BF650 (size: 80) ---


void FUN_006bf650(undefined4 *param_1,int param_2,undefined4 param_3)



{

  int iVar1;

  int *unaff_ESI;

  

  iVar1 = param_2;

  if ((param_2 == 0) && (param_1[0xd] != 0)) {

    (**(code **)*param_1)(param_1,&DAT_00808390,&param_2);

    FUN_006c0530(0x15,unaff_ESI,0);

    (**(code **)(*unaff_ESI + 8))(unaff_ESI);

  }

  FUN_006c0480(param_1,iVar1,param_3);

  return;

}





// --- FUN_006bf700 at 0x006BF700 (size: 202) ---


void __fastcall FUN_006bf700(int *param_1)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int *piVar1;

  

  lpCriticalSection = (LPCRITICAL_SECTION)(param_1 + 0x25);

  *param_1 = (int)&PTR_FUN_00807ed8;

  param_1[3] = (int)&PTR_FUN_00807e98;

  param_1[4] = (int)&PTR_LAB_00807d5c;

  EnterCriticalSection(lpCriticalSection);

  param_1[0x1d] = 0;

  if (param_1[0x19] == 1) {

    param_1[0x19] = 0;

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

    timeEndPeriod(1);

  }

  LeaveCriticalSection(lpCriticalSection);

  EnterCriticalSection(lpCriticalSection);

  piVar1 = (int *)param_1[0x1b];

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

    (**(code **)(*piVar1 + 8))(piVar1);

    param_1[0x1b] = 0;

  }

  LeaveCriticalSection(lpCriticalSection);

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

    (**(code **)(*(int *)(param_1[0x14] + 8) + 0xc))(1);

    param_1[0x14] = 0;

  }

  if ((int *)param_1[0x1e] != (int *)0x0) {

    (**(code **)(*(int *)param_1[0x1e] + 0xc))(1);

    param_1[0x1e] = 0;

  }

  DeleteCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x31));

  DeleteCriticalSection(lpCriticalSection);

  DeleteCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x1f));

  FUN_006c1fb0();

  FUN_006c1fb0();

  FUN_006c1fb0();

  FUN_006c0110();

  return;

}





// --- FUN_006bfb00 at 0x006BFB00 (size: 141) ---


undefined4 __thiscall FUN_006bfb00(int param_1,int param_2)



{

  LPCRITICAL_SECTION lpCriticalSection;

  undefined4 uVar1;

  int iVar2;

  int *piVar3;

  

  lpCriticalSection = (LPCRITICAL_SECTION)(param_1 + 0xc4);

  EnterCriticalSection(lpCriticalSection);

  if (param_2 == 0) {

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

LAB_006bfb7c:

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

      LeaveCriticalSection(lpCriticalSection);

      return uVar1;

    }

    param_2 = 0;

    iVar2 = FUN_005df0f5(0xe0);

    if (iVar2 == 0) {

      piVar3 = (int *)0x0;

    }

    else {

      piVar3 = (int *)FUN_006be660(param_1,&param_2,&DAT_00807fa4);

    }

    *(int **)(param_1 + 0x78) = piVar3;

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

      if (-1 < param_2) goto LAB_006bfb7c;

      (**(code **)(*piVar3 + 0xc))(1);

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

    }

  }

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006bfb90 at 0x006BFB90 (size: 100) ---


int __fastcall FUN_006bfb90(int *param_1)



{

  int iVar1;

  

  param_1[0x18] = 0;

  if (param_1[5] == 2) {

    iVar1 = (**(code **)(*param_1 + 0x7c))();

    if (-1 < iVar1) {

      EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

      param_1[0x2c] = 0;

      LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

      return 0;

    }

  }

  else {

    EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

    param_1[0x2c] = 1;

    LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

    iVar1 = 0;

  }

  return iVar1;

}





// --- FUN_006bfc00 at 0x006BFC00 (size: 140) ---


undefined4 __fastcall FUN_006bfc00(int *param_1)



{

  int *piVar1;

  

  piVar1 = (int *)param_1[0x2b];

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

    (**(code **)(*piVar1 + 8))(piVar1);

    param_1[0x2b] = 0;

  }

  if (*(int *)(param_1[0x1e] + 0x18) == 0) {

    return 1;

  }

  if ((param_1[5] != 0) && (*(char *)(param_1[0x1e] + 0x25) == '\0')) {

    return 0x80040224;

  }

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

  param_1[0x2c] = 0;

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x25));

  (**(code **)(*param_1 + 100))();

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

  param_1[0x18] = 0;

  if (param_1[5] == 2) {

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

  }

  return 0;

}





// --- FUN_006bfe00 at 0x006BFE00 (size: 58) ---


void FUN_006bfe00(undefined4 param_1,undefined4 param_2,int *param_3)



{

  EnterCriticalSection((LPCRITICAL_SECTION)(param_3 + 0x25));

  if (param_3[0x30] != 0) {

    param_3[0x30] = 0;

    (**(code **)(*param_3 + 0x60))();

  }

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_3 + 0x25));

  return;

}





// --- FUN_006bfee0 at 0x006BFEE0 (size: 74) ---


undefined4 __fastcall FUN_006bfee0(int param_1)



{

  if (*(UINT *)(param_1 + 0xc0) != 0) {

    timeKillEvent(*(UINT *)(param_1 + 0xc0));

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

  }

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x94));

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

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

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

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

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x94));

  return 0;

}





// --- FUN_006bff30 at 0x006BFF30 (size: 30) ---


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



{

  FUN_006c0fa0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006bff50 at 0x006BFF50 (size: 45) ---


void __fastcall FUN_006bff50(undefined4 *param_1)



{

  *param_1 = &PTR_LAB_00808080;

  param_1[3] = &PTR_FUN_00807d70;

  param_1[4] = &PTR_LAB_00807d5c;

  param_1[0x38] = &PTR_LAB_00807d38;

  param_1[0x39] = &PTR_LAB_00807d24;

  FUN_006bf700();

  return;

}





// --- FUN_006bff80 at 0x006BFF80 (size: 30) ---


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



{

  FUN_006bf700();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006bffa0 at 0x006BFFA0 (size: 103) ---


undefined4 * __thiscall

FUN_006bffa0(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

            undefined4 param_5)



{

  FUN_006bdd70(param_2,param_3,param_4,param_5);

  *param_1 = &PTR_LAB_00808080;

  param_1[3] = &PTR_FUN_00807d70;

  param_1[4] = &PTR_LAB_00807d5c;

  param_1[0x38] = &PTR_LAB_00807d38;

  param_1[0x39] = &PTR_LAB_00807d24;

  param_1[0x3b] = 0;

  param_1[0x48] = 0;

  param_1[0x49] = 0;

  FUN_006be970();

  return param_1;

}





