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

// --- FUN_006c0010 at 0x006C0010 (size: 70) ---


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



{

  *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();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006c0060 at 0x006C0060 (size: 161) ---


void FUN_006c0060(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_00808390;

  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_008083a0;

    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_00808304;

      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 = &DAT_00808350;

        do {

          if (iVar1 == 0) break;

          iVar1 = iVar1 + -1;

          bVar4 = *param_2 == *piVar2;

          param_2 = param_2 + 1;

          piVar2 = piVar2 + 1;

        } while (bVar4);

        if (!bVar4) {

          FUN_006c1ee0();

          return;

        }

        if (param_1 != 0) {

          FUN_006c1e80(param_1 + 0x10,param_3);

          return;

        }

        goto LAB_006c0093;

      }

    }

  }

  if (param_1 != 0) {

    FUN_006c1e80(param_1 + 0xc,param_3);

    return;

  }

LAB_006c0093:

  FUN_006c1e80(0,param_3);

  return;

}





// --- FUN_006c0110 at 0x006C0110 (size: 44) ---


void __fastcall FUN_006c0110(int param_1)



{

  int *piVar1;

  

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

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

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

  FUN_006c1e30();

  return;

}





// --- FUN_006c01c0 at 0x006C01C0 (size: 67) ---


undefined4 FUN_006c01c0(int param_1,undefined4 *param_2)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int *piVar1;

  

  if (param_2 == (undefined4 *)0x0) {

    return 0x80004003;

  }

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + 0x2c);

  EnterCriticalSection(lpCriticalSection);

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

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

    (**(code **)(*piVar1 + 4))(piVar1);

  }

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

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006c0210 at 0x006C0210 (size: 122) ---


int FUN_006c0210(int param_1)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int iVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  int iVar5;

  

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + 0x2c);

  EnterCriticalSection(lpCriticalSection);

  iVar4 = 0;

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

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

    iVar5 = 0;

    if (0 < iVar1) {

      do {

        piVar2 = (int *)(**(code **)(*(int *)(param_1 + -0xc) + 0x1c))(iVar5);

        if (((piVar2[6] != 0) && (iVar3 = (**(code **)(*piVar2 + 0x18))(), iVar3 < 0)) &&

           (-1 < iVar4)) {

          iVar4 = iVar3;

        }

        iVar5 = iVar5 + 1;

      } while (iVar5 < iVar1);

    }

  }

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

  LeaveCriticalSection(lpCriticalSection);

  return iVar4;

}





// --- FUN_006c0290 at 0x006C0290 (size: 135) ---


int FUN_006c0290(int param_1)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int iVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + 0x2c);

  EnterCriticalSection(lpCriticalSection);

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

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

    iVar4 = 0;

    if (0 < iVar1) {

      do {

        piVar2 = (int *)(**(code **)(*(int *)(param_1 + -0xc) + 0x1c))(iVar4);

        if ((piVar2[6] != 0) && (iVar3 = (**(code **)(*piVar2 + 0x14))(), iVar3 < 0)) {

          LeaveCriticalSection(lpCriticalSection);

          return iVar3;

        }

        iVar4 = iVar4 + 1;

      } while (iVar4 < iVar1);

    }

  }

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

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006c0320 at 0x006C0320 (size: 197) ---


int FUN_006c0320(int *param_1,int param_2,int param_3)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int iVar1;

  int *piVar2;

  int iVar3;

  int iVar4;

  

  lpCriticalSection = (LPCRITICAL_SECTION)param_1[0xb];

  EnterCriticalSection(lpCriticalSection);

  param_1[5] = param_2;

  param_1[6] = param_3;

  if ((param_1[2] == 0) && (iVar1 = (**(code **)(*param_1 + 0x14))(param_1), iVar1 < 0)) {

    LeaveCriticalSection(lpCriticalSection);

    return iVar1;

  }

  if (param_1[2] != 2) {

    iVar1 = (**(code **)(param_1[-3] + 0x18))();

    iVar4 = 0;

    if (0 < iVar1) {

      do {

        piVar2 = (int *)(**(code **)(param_1[-3] + 0x1c))(iVar4);

        if ((piVar2[6] != 0) && (iVar3 = (**(code **)(*piVar2 + 0x1c))(param_2,param_3), iVar3 < 0))

        {

          LeaveCriticalSection(lpCriticalSection);

          return iVar3;

        }

        iVar4 = iVar4 + 1;

      } while (iVar4 < iVar1);

    }

  }

  param_1[2] = 2;

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006c0430 at 0x006C0430 (size: 78) ---


undefined4 FUN_006c0430(int param_1,undefined2 *param_2)



{

  int *piVar1;

  

  if (param_2 == (undefined2 *)0x0) {

    return 0x80004003;

  }

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

    *param_2 = 0;

  }

  else {

    FUN_006c1ff0(param_2,*(int *)(param_1 + 0x30),0x80);

  }

  *(undefined4 *)(param_2 + 0x80) = *(undefined4 *)(param_1 + 0x34);

  piVar1 = *(int **)(param_1 + 0x34);

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

    (**(code **)(*piVar1 + 4))(piVar1);

  }

  return 0;

}





// --- FUN_006c0480 at 0x006C0480 (size: 161) ---


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



{

  LPCRITICAL_SECTION lpCriticalSection;

  int *piVar1;

  int iVar2;

  undefined4 *puVar3;

  uint uVar4;

  uint uVar5;

  

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + 0x2c);

  EnterCriticalSection(lpCriticalSection);

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

  if (param_2 == (undefined4 *)0x0) {

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

  }

  else {

    iVar2 = (**(code **)*param_2)(param_2,&DAT_00808320,(undefined4 *)(param_1 + 0x38));

    if (-1 < iVar2) {

      piVar1 = *(int **)(param_1 + 0x38);

      (**(code **)(*piVar1 + 8))(piVar1);

    }

  }

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

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

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

  }

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

    iVar2 = FUN_006c2070(param_3);

    uVar5 = (iVar2 + 1) * 2;

    puVar3 = (undefined4 *)thunk_FUN_005df0f5(uVar5);

    *(undefined4 **)(param_1 + 0x30) = puVar3;

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

      for (uVar4 = uVar5 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

        *puVar3 = *param_3;

        param_3 = param_3 + 1;

        puVar3 = puVar3 + 1;

      }

      for (uVar5 = uVar5 & 3; uVar5 != 0; uVar5 = uVar5 - 1) {

        *(undefined1 *)puVar3 = *(undefined1 *)param_3;

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

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

      }

    }

  }

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006c0530 at 0x006C0530 (size: 67) ---


undefined4 __thiscall FUN_006c0530(int param_1,int param_2,undefined4 param_3,undefined4 param_4)



{

  int *piVar1;

  undefined4 uVar2;

  

  piVar1 = *(int **)(param_1 + 0x44);

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

    return 0x80004001;

  }

  if (param_2 == 1) {

    uVar2 = (**(code **)(*piVar1 + 0xc))(piVar1,1,param_3,param_1 + 0xc);

    return uVar2;

  }

  uVar2 = (**(code **)(*piVar1 + 0xc))(piVar1,param_2,param_3,param_4);

  return uVar2;

}





// --- FUN_006c0600 at 0x006C0600 (size: 42) ---


LONG FUN_006c0600(int *param_1)



{

  LONG LVar1;

  

  LVar1 = InterlockedDecrement(param_1 + 5);

  if ((LVar1 == 0) && (param_1 != (int *)0x0)) {

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

  }

  return LVar1;

}





// --- FUN_006c0630 at 0x006C0630 (size: 63) ---


undefined4 FUN_006c0630(int param_1,uint param_2)



{

  int iVar1;

  

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

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

    return 0x80040203;

  }

  if ((uint)(*(int *)(param_1 + 8) - *(int *)(param_1 + 4)) < param_2) {

    return 1;

  }

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

  return 0;

}





// --- FUN_006c0670 at 0x006C0670 (size: 48) ---


undefined4 FUN_006c0670(int param_1)



{

  undefined4 uVar1;

  

  uVar1 = (**(code **)(**(int **)(param_1 + 0xc) + 0x14))();

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

  uVar1 = (**(code **)(**(int **)(param_1 + 0xc) + 0x18))();

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

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

  FUN_006c3540();

  return 0;

}





// --- FUN_006c0720 at 0x006C0720 (size: 42) ---


LONG FUN_006c0720(int *param_1)



{

  LONG LVar1;

  

  LVar1 = InterlockedDecrement(param_1 + 4);

  if ((LVar1 == 0) && (param_1 != (int *)0x0)) {

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

  }

  return LVar1;

}





// --- FUN_006c08e0 at 0x006C08E0 (size: 29) ---


undefined4 FUN_006c08e0(int param_1)



{

  undefined4 uVar1;

  

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

  uVar1 = (**(code **)(**(int **)(param_1 + 8) + 0x10))();

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

  return 0;

}





// --- FUN_006c0900 at 0x006C0900 (size: 125) ---


void FUN_006c0900(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_008083d0;

  do {

    if (iVar1 == 0) break;

    iVar1 = iVar1 + -1;

    bVar4 = *piVar2 == *piVar3;

    piVar2 = piVar2 + 1;

    piVar3 = piVar3 + 1;

  } while (bVar4);

  if (bVar4) {

    if (param_1 != 0) {

      FUN_006c1e80(param_1 + 0xc,param_3);

      return;

    }

  }

  else {

    iVar1 = 4;

    bVar4 = true;

    piVar2 = &DAT_008082f4;

    do {

      if (iVar1 == 0) break;

      iVar1 = iVar1 + -1;

      bVar4 = *param_2 == *piVar2;

      param_2 = param_2 + 1;

      piVar2 = piVar2 + 1;

    } while (bVar4);

    if (!bVar4) {

      FUN_006c1ee0();

      return;

    }

    if (param_1 != 0) {

      FUN_006c1e80(param_1 + 0x10,param_3);

      return;

    }

  }

  FUN_006c1e80(0,param_3);

  return;

}





// --- FUN_006c09c0 at 0x006C09C0 (size: 174) ---


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



{

  int *piVar1;

  int iVar2;

  

  iVar2 = (**(code **)(*param_1 + 0x28))(param_2);

  if (iVar2 < 0) {

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

    return iVar2;

  }

  iVar2 = (**(code **)(*param_1 + 0x20))(param_2);

  if (iVar2 == 0) {

    param_1[6] = (int)param_2;

    (**(code **)(*param_2 + 4))(param_2);

    iVar2 = (**(code **)(*param_1 + 0x24))(param_2);

    if ((-1 < iVar2) &&

       (iVar2 = (**(code **)(*param_2 + 0x10))(param_2,param_1 + 3,param_2), -1 < iVar2)) {

      iVar2 = (**(code **)(*param_1 + 0x30))(param_2);

      if (-1 < iVar2) {

        return iVar2;

      }

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

    }

  }

  else if (((-1 < iVar2) || (iVar2 == -0x7fffbffb)) || (iVar2 == -0x7ff8ffa9)) {

    iVar2 = -0x7ffbfdd6;

  }

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

  piVar1 = (int *)param_1[6];

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

    (**(code **)(*piVar1 + 8))(piVar1);

    param_1[6] = 0;

  }

  return iVar2;

}





// --- FUN_006c0a70 at 0x006C0A70 (size: 219) ---


/* WARNING: Removing unreachable block (ram,0x006c0abc) */

/* WARNING: Removing unreachable block (ram,0x006c0aca) */



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



{

  int *piVar1;

  int iVar2;

  int iVar3;

  undefined1 *puStack_1c;

  undefined4 auStack_8 [2];

  

  piVar1 = param_3;

  iVar2 = (**(code **)(*param_3 + 0x14))();

  if (iVar2 < 0) {

    return iVar2;

  }

  puStack_1c = &stack0xfffffff4;

  param_2 = 0;

  iVar2 = 0;

  iVar3 = (**(code **)(*piVar1 + 0xc))(piVar1,1,&param_2);

  if (iVar3 == 0) {

    do {

      iVar3 = FUN_006c09c0(piVar1,auStack_8[0]);

      if ((((iVar3 < 0) && (-1 < iVar2)) && (iVar3 != -0x7fffbffb)) &&

         ((iVar3 != -0x7ff8ffa9 && (iVar3 != -0x7ffbfdd6)))) {

        iVar2 = iVar3;

      }

      FUN_006c3910(auStack_8[0]);

      if (iVar3 == 0) {

        return 0;

      }

      iVar3 = (**(code **)(*piVar1 + 0xc))(piVar1,1,auStack_8,&puStack_1c);

    } while (iVar3 == 0);

    if (iVar2 != 0) {

      return iVar2;

    }

  }

  return -0x7ffbfdf9;

}





// --- FUN_006c0b50 at 0x006C0B50 (size: 215) ---


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



{

  int iVar1;

  int iVar2;

  int *local_8;

  int local_4;

  

  iVar2 = param_3;

  local_8 = (int *)0x0;

  if (param_3 != 0) {

    iVar1 = FUN_006c36f0();

    if (iVar1 == 0) {

      iVar2 = FUN_006c09c0(param_2,param_3);

      return iVar2;

    }

  }

  local_4 = -0x7ffbfdf9;

  param_3 = 0;

  do {

    if (param_3 == *(byte *)(param_1 + 0x26)) {

      iVar1 = (**(code **)(*param_2 + 0x30))(param_2,&local_8);

    }

    else {

      iVar1 = (**(code **)(*(int *)(param_1 + 0xc) + 0x30))(param_1 + 0xc,&local_8);

    }

    if (-1 < iVar1) {

      iVar1 = FUN_006c0a70(param_2,iVar2,local_8);

      (**(code **)(*local_8 + 8))(local_8);

      if (-1 < iVar1) {

        return 0;

      }

      if (((iVar1 != -0x7fffbffb) && (iVar1 != -0x7ff8ffa9)) && (iVar1 != -0x7ffbfdd6)) {

        local_4 = iVar1;

      }

    }

    param_3 = param_3 + 1;

  } while ((int)param_3 < 2);

  return local_4;

}





// --- FUN_006c0c30 at 0x006C0C30 (size: 26) ---


uint FUN_006c0c30(undefined4 param_1)



{

  uint uVar1;

  

  uVar1 = thunk_FUN_006c38b0(param_1);

  return uVar1 & (-1 < (int)uVar1) - 1;

}





// --- FUN_006c0c80 at 0x006C0C80 (size: 26) ---


int FUN_006c0c80(LPCRITICAL_SECTION param_1,int *param_2,int param_3)



{

  HANDLE *ppvVar1;

  LPCRITICAL_SECTION lpCriticalSection;

  int iVar2;

  LPCRITICAL_SECTION unaff_EBX;

  LPCRITICAL_SECTION unaff_retaddr;

  

  if ((param_2 == (int *)0x0) || (param_3 == 0)) {

    return -0x7fffbffd;

  }

  lpCriticalSection = (LPCRITICAL_SECTION)param_1->SpinCount;

  EnterCriticalSection(lpCriticalSection);

  if (param_1->OwningThread != (HANDLE)0x0) {

    LeaveCriticalSection(lpCriticalSection);

    return -0x7ffbfdfc;

  }

  if ((*(int *)(param_1[1].LockCount + 0x14) != 0) &&

     (*(char *)((int)&param_1[1].DebugInfo + 1) == '\0')) {

    LeaveCriticalSection(lpCriticalSection);

    return -0x7ffbfddc;

  }

  ppvVar1 = &param_1[-1].OwningThread;

  iVar2 = (**(code **)((int)param_1[-1].OwningThread + 0x28))(param_2);

  if (iVar2 < 0) {

    (**(code **)((int)*ppvVar1 + 0x2c))();

    LeaveCriticalSection(param_1);

    return iVar2;

  }

  iVar2 = (**(code **)((int)*ppvVar1 + 0x20))(lpCriticalSection);

  if (iVar2 == 0) {

    param_1->OwningThread = param_2;

    (**(code **)(*param_2 + 4))(param_2);

    iVar2 = (**(code **)((int)*ppvVar1 + 0x24))(unaff_retaddr);

    if (-1 < iVar2) {

      iVar2 = (**(code **)((int)*ppvVar1 + 0x30))(param_2);

      if (-1 < iVar2) {

        LeaveCriticalSection(unaff_EBX);

        return 0;

      }

    }

    (**(code **)(*(int *)param_1->OwningThread + 8))(param_1->OwningThread);

    param_1->OwningThread = (HANDLE)0x0;

    (**(code **)((int)*ppvVar1 + 0x2c))();

  }

  else {

    (**(code **)((int)*ppvVar1 + 0x2c))();

    if (((-1 < iVar2) || (iVar2 == -0x7fffbffb)) || (iVar2 == -0x7ff8ffa9)) {

      LeaveCriticalSection(unaff_retaddr);

      return -0x7ffbfdd6;

    }

  }

  LeaveCriticalSection(unaff_retaddr);

  return iVar2;

}





// --- FUN_006c0c9a at 0x006C0C9A (size: 301) ---


int FUN_006c0c9a(LPCRITICAL_SECTION param_1,LPCRITICAL_SECTION param_2)



{

  HANDLE *ppvVar1;

  LPCRITICAL_SECTION lpCriticalSection;

  int iVar2;

  LPCRITICAL_SECTION unaff_EBX;

  int *unaff_EBP;

  LPCRITICAL_SECTION p_Stack0000000c;

  

  lpCriticalSection = (LPCRITICAL_SECTION)param_2->SpinCount;

  p_Stack0000000c = lpCriticalSection;

  EnterCriticalSection(lpCriticalSection);

  if (param_2->OwningThread != (HANDLE)0x0) {

    LeaveCriticalSection(lpCriticalSection);

    return -0x7ffbfdfc;

  }

  if ((*(int *)(param_2[1].LockCount + 0x14) != 0) &&

     (*(char *)((int)&param_2[1].DebugInfo + 1) == '\0')) {

    LeaveCriticalSection(lpCriticalSection);

    return -0x7ffbfddc;

  }

  ppvVar1 = &param_2[-1].OwningThread;

  iVar2 = (**(code **)((int)param_2[-1].OwningThread + 0x28))();

  if (iVar2 < 0) {

    (**(code **)((int)*ppvVar1 + 0x2c))();

    LeaveCriticalSection(param_2);

    return iVar2;

  }

  iVar2 = (**(code **)((int)*ppvVar1 + 0x20))(p_Stack0000000c);

  if (iVar2 == 0) {

    param_2->OwningThread = unaff_EBP;

    (**(code **)(*unaff_EBP + 4))();

    iVar2 = (**(code **)((int)*ppvVar1 + 0x24))(param_1);

    if (-1 < iVar2) {

      iVar2 = (**(code **)((int)*ppvVar1 + 0x30))();

      if (-1 < iVar2) {

        LeaveCriticalSection(unaff_EBX);

        return 0;

      }

    }

    (**(code **)(*(int *)param_2->OwningThread + 8))(param_2->OwningThread);

    param_2->OwningThread = (HANDLE)0x0;

    (**(code **)((int)*ppvVar1 + 0x2c))();

  }

  else {

    (**(code **)((int)*ppvVar1 + 0x2c))();

    if (((-1 < iVar2) || (iVar2 == -0x7fffbffb)) || (iVar2 == -0x7ff8ffa9)) {

      LeaveCriticalSection(param_1);

      return -0x7ffbfdd6;

    }

  }

  LeaveCriticalSection(param_1);

  return iVar2;

}





// --- FUN_006c0e00 at 0x006C0E00 (size: 91) ---


undefined4 FUN_006c0e00(int param_1,int param_2)



{

  LPCRITICAL_SECTION lpCriticalSection;

  

  if (param_2 == 0) {

    return 0x80004003;

  }

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + 0x14);

  EnterCriticalSection(lpCriticalSection);

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

    FUN_006c37e0(param_2,param_1 + 0x28);

    LeaveCriticalSection(lpCriticalSection);

    return 0;

  }

  FUN_006c36d0();

  LeaveCriticalSection(lpCriticalSection);

  return 0x80040209;

}





// --- FUN_006c0e60 at 0x006C0E60 (size: 110) ---


undefined4 FUN_006c0e60(int param_1,int *param_2)



{

  int iVar1;

  

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

    return 0x80004003;

  }

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

    iVar1 = 0;

  }

  else {

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

  }

  *param_2 = iVar1;

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

  if (iVar1 != 0) {

    (**(code **)(*(int *)(iVar1 + 0xc) + 4))(iVar1 + 0xc);

  }

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

    FUN_006c1ff0(param_2 + 2,*(int *)(param_1 + 8),0x80);

    param_2[1] = *(int *)(param_1 + 0x10);

    return 0;

  }

  *(undefined2 *)(param_2 + 2) = 0;

  param_2[1] = *(int *)(param_1 + 0x10);

  return 0;

}





// --- FUN_006c0fa0 at 0x006C0FA0 (size: 58) ---


void __fastcall FUN_006c0fa0(int param_1)



{

  int *piVar1;

  

  piVar1 = *(int **)(param_1 + 0x9c);

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

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

  FUN_006c3850();

  FUN_006c1e30();

  return;

}





// --- FUN_006c1030 at 0x006C1030 (size: 117) ---


HRESULT FUN_006c1030(int param_1,undefined4 *param_2)



{

  LPCRITICAL_SECTION lpCriticalSection;

  HRESULT HVar1;

  LPVOID *ppv;

  

  if (param_2 == (undefined4 *)0x0) {

    return -0x7fffbffd;

  }

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + -0x78);

  EnterCriticalSection(lpCriticalSection);

  ppv = (LPVOID *)(param_1 + 4);

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

    HVar1 = CoCreateInstance((IID *)&DAT_00808420,(LPUNKNOWN)0x0,1,(IID *)&DAT_00808370,ppv);

    if (HVar1 < 0) {

      LeaveCriticalSection(lpCriticalSection);

      return HVar1;

    }

  }

  *param_2 = *ppv;

  (**(code **)(*(int *)*ppv + 4))(*ppv);

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006c10b0 at 0x006C10B0 (size: 80) ---


undefined4 FUN_006c10b0(int param_1,int *param_2)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int *piVar1;

  

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

    return 0x80004003;

  }

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + -0x78);

  EnterCriticalSection(lpCriticalSection);

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

  (**(code **)(*param_2 + 4))(param_2);

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

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

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  *(undefined1 *)(param_1 + 8) = param_2._0_1_;

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006c1100 at 0x006C1100 (size: 49) ---


int __fastcall FUN_006c1100(int param_1)



{

  int *piVar1;

  int iVar2;

  

  piVar1 = *(int **)(param_1 + 0x9c);

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

    iVar2 = (**(code **)(*piVar1 + 0x18))(piVar1);

    if (iVar2 < 0) {

      return iVar2;

    }

    (**(code **)(**(int **)(param_1 + 0x9c) + 8))(*(int **)(param_1 + 0x9c));

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

  }

  return 0;

}





// --- FUN_006c1140 at 0x006C1140 (size: 339) ---


/* WARNING: Restarted to delay deadcode elimination for space: stack */



int FUN_006c1140(int param_1,int *param_2)



{

  int *piVar1;

  int iVar2;

  undefined4 uVar3;

  int *unaff_EDI;

  

  piVar1 = param_2;

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

    return -0x7fffbffd;

  }

  iVar2 = (**(code **)(*(int *)(param_1 + -0x98) + 0x38))();

  if (iVar2 != 0) {

    return iVar2;

  }

  iVar2 = (**(code **)*piVar1)(piVar1,&DAT_00808380);

  if (iVar2 < 0) {

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

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

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

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

    iVar2 = (**(code **)(*piVar1 + 0x3c))(piVar1);

    if (iVar2 == 0) {

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

    }

    iVar2 = (**(code **)(*piVar1 + 0x24))(piVar1);

    if (iVar2 == 0) {

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

    }

    iVar2 = (**(code **)(*piVar1 + 0x1c))(piVar1);

    if (iVar2 == 0) {

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

    }

    iVar2 = (**(code **)(*piVar1 + 0x14))(piVar1,param_1 + 0x20,param_1 + 0x28);

    if (-1 < iVar2) {

      *(uint *)(param_1 + 0x18) = *(uint *)(param_1 + 0x18) | 0x110;

    }

    iVar2 = (**(code **)(*piVar1 + 0x34))(piVar1,param_1 + 0x34);

    if (iVar2 == 0) {

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

    }

    (**(code **)(*piVar1 + 0xc))(piVar1,param_1 + 0x38);

    uVar3 = (**(code **)(*piVar1 + 0x2c))(piVar1);

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

    uVar3 = (**(code **)(*piVar1 + 0x10))(piVar1);

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

  }

  else {

    iVar2 = (**(code **)(*unaff_EDI + 0x4c))(unaff_EDI,0x30,param_1 + 0x10);

    (*(code *)param_2[2])(&param_2);

    if (iVar2 < 0) {

      return iVar2;

    }

  }

  if (((*(byte *)(param_1 + 0x18) & 8) != 0) &&

     (iVar2 = (**(code **)(*(int *)(param_1 + -0x98) + 0x20))(*(undefined4 *)(param_1 + 0x34)),

     iVar2 != 0)) {

    *(undefined1 *)(param_1 + -0x74) = 1;

    (**(code **)(*(int *)(param_1 + -0x8c) + 0x38))(param_1 + -0x8c);

    piVar1 = *(int **)(*(int *)(param_1 + -0x70) + 0x44);

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

      (**(code **)(*piVar1 + 0xc))(piVar1,3,0x8004022a,0);

    }

    return -0x7ffbfe00;

  }

  return 0;

}





// --- FUN_006c12a0 at 0x006C12A0 (size: 82) ---


int FUN_006c12a0(int *param_1,int param_2,int param_3,int *param_4)



{

  int iVar1;

  

  if (param_2 == 0) {

    return -0x7fffbffd;

  }

  *param_4 = 0;

  while( true ) {

    if (param_3 < 1) {

      return 0;

    }

    param_3 = param_3 + -1;

    iVar1 = (**(code **)(*param_1 + 0x18))(param_1,*(undefined4 *)(param_2 + *param_4 * 4));

    if (iVar1 != 0) break;

    *param_4 = *param_4 + 1;

  }

  return iVar1;

}





// --- FUN_006c13c0 at 0x006C13C0 (size: 37) ---


undefined4 FUN_006c13c0(int param_1)



{

  LPCRITICAL_SECTION lpCriticalSection;

  

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + 0x14);

  EnterCriticalSection(lpCriticalSection);

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

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006c13f0 at 0x006C13F0 (size: 41) ---


undefined4 FUN_006c13f0(int param_1)



{

  LPCRITICAL_SECTION lpCriticalSection;

  

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + 0x14);

  EnterCriticalSection(lpCriticalSection);

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

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

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006c1470 at 0x006C1470 (size: 461) ---


uint FUN_006c1470(int *param_1,int *param_2)



{

  undefined4 *puVar1;

  undefined4 *puVar2;

  undefined4 *puVar3;

  uint uVar4;

  int iVar5;

  int unaff_EBX;

  int *piVar6;

  int *piVar7;

  int iVar8;

  uint uVar9;

  int *piVar10;

  uint uVar11;

  

  iVar8 = 0;

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

    return 1;

  }

  puVar1 = (undefined4 *)*param_1;

  piVar7 = param_2;

  uVar4 = (**(code **)(*param_2 + 0x1c))(param_2,*puVar1,puVar1[1],puVar1[2],puVar1[3]);

  if (unaff_EBX != 0) {

    puVar1 = (undefined4 *)*param_1;

    uVar4 = (**(code **)(*param_2 + 0xc))

                      (param_2,*puVar1,puVar1[1],puVar1[2],puVar1[3],param_1[1],param_1[2]);

    if ((-1 < (int)uVar4) && (uVar11 = 0, param_1[3] != 0)) {

      while( true ) {

        puVar1 = (undefined4 *)(param_1[4] + iVar8);

        puVar2 = (undefined4 *)puVar1[5];

        puVar3 = (undefined4 *)*param_1;

        piVar10 = piVar7;

        uVar4 = (**(code **)(*param_2 + 0x14))

                          (piVar7,*puVar3,puVar3[1],puVar3[2],puVar3[3],*puVar1,puVar1[1],puVar1[2],

                           puVar1[3],puVar1[4],*puVar2,puVar2[1],puVar2[2],puVar2[3],puVar1[6]);

        if ((int)uVar4 < 0) break;

        iVar5 = param_1[4];

        uVar9 = 0;

        piVar6 = piVar7;

        if (*(int *)(iVar8 + 0x1c + iVar5) != 0) {

          do {

            piVar7 = piVar10;

            piVar10 = (int *)(*(int *)(iVar8 + 0x20 + iVar5) + uVar9 * 8);

            puVar1 = (undefined4 *)piVar10[1];

            puVar2 = (undefined4 *)*piVar10;

            puVar3 = (undefined4 *)*param_1;

            piVar10 = piVar7;

            uVar4 = (**(code **)(*piVar6 + 0x18))

                              (piVar7,*puVar3,puVar3[1],puVar3[2],puVar3[3],

                               *(undefined4 *)(iVar8 + iVar5),*puVar2,puVar2[1],puVar2[2],puVar2[3],

                               *puVar1,puVar1[1],puVar1[2],puVar1[3]);

            if ((int)uVar4 < 0) goto LAB_006c1628;

            iVar5 = param_1[4];

            uVar9 = uVar9 + 1;

            piVar6 = piVar7;

          } while (uVar9 < *(uint *)(iVar8 + 0x1c + iVar5));

        }

        uVar11 = uVar11 + 1;

        iVar8 = iVar8 + 0x24;

        param_2 = piVar7;

        piVar7 = piVar10;

        if ((uint)param_1[3] <= uVar11) break;

      }

    }

  }

LAB_006c1628:

  return uVar4 & (uVar4 == 0x80070002) - 1;

}





// --- FUN_006c1730 at 0x006C1730 (size: 139) ---


undefined4 * __thiscall FUN_006c1730(undefined4 *param_1,int param_2)



{

  undefined4 uVar1;

  

  *param_1 = &PTR_LAB_00808144;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = param_2;

  param_1[5] = 1;

  FUN_006c3520("Pin Cache");

  (**(code **)(*(int *)(param_1[3] + 0xc) + 4))(param_1[3] + 0xc);

  if (param_2 == 0) {

    uVar1 = (**(code **)(*(int *)param_1[3] + 0x14))();

    param_1[4] = uVar1;

    uVar1 = (**(code **)(*(int *)param_1[3] + 0x18))();

    param_1[2] = uVar1;

    return param_1;

  }

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

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

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

  FUN_006c3620(param_2 + 0x18);

  return param_1;

}





// --- FUN_006c17c0 at 0x006C17C0 (size: 51) ---


undefined4 * __fastcall FUN_006c17c0(undefined4 *param_1)



{

  byte unaff_retaddr;

  

  *param_1 = &PTR_LAB_00808144;

  (**(code **)(*(int *)(param_1[3] + 0xc) + 8))((int *)(param_1[3] + 0xc));

  FUN_006c36a0();

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006c1800 at 0x006C1800 (size: 103) ---


undefined4 FUN_006c1800(int param_1,int *param_2)



{

  int iVar1;

  undefined4 uVar2;

  

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

    return 0x80004003;

  }

  uVar2 = 0;

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

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

    *param_2 = 0;

    return 0x80040203;

  }

  iVar1 = FUN_005df0f5(0x30);

  if (iVar1 == 0) {

    iVar1 = 0;

  }

  else {

    iVar1 = FUN_006c1730(*(undefined4 *)(param_1 + 0xc),param_1);

  }

  *param_2 = iVar1;

  if (iVar1 == 0) {

    uVar2 = 0x8007000e;

  }

  return uVar2;

}





// --- FUN_006c19b0 at 0x006C19B0 (size: 82) ---


undefined4 * __thiscall FUN_006c19b0(undefined4 *param_1,int param_2)



{

  undefined4 uVar1;

  

  param_1[2] = param_2;

  *param_1 = &PTR_LAB_00808164;

  param_1[1] = 0;

  param_1[4] = 1;

  (**(code **)(*(int *)(param_2 + 0xc) + 4))((int *)(param_2 + 0xc));

  if (param_2 == 0) {

    uVar1 = (**(code **)(*(int *)param_1[2] + 0x10))();

    param_1[3] = uVar1;

    return param_1;

  }

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

  param_1[3] = *(undefined4 *)(param_2 + 0xc);

  return param_1;

}





// --- FUN_006c1a10 at 0x006C1A10 (size: 43) ---


undefined4 * __fastcall FUN_006c1a10(undefined4 *param_1)



{

  byte unaff_retaddr;

  

  *param_1 = &PTR_LAB_00808164;

  (**(code **)(*(int *)(param_1[2] + 0xc) + 8))((int *)(param_1[2] + 0xc));

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

    operator_delete(param_1);

  }

  return param_1;

}





// --- FUN_006c1a40 at 0x006C1A40 (size: 103) ---


undefined4 FUN_006c1a40(int param_1,int *param_2)



{

  int iVar1;

  undefined4 uVar2;

  

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

    return 0x80004003;

  }

  uVar2 = 0;

  iVar1 = (**(code **)(**(int **)(param_1 + 8) + 0x10))();

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

    *param_2 = 0;

    return 0x80040203;

  }

  iVar1 = FUN_005df0f5(0x14);

  if (iVar1 == 0) {

    iVar1 = 0;

  }

  else {

    iVar1 = FUN_006c19b0(*(undefined4 *)(param_1 + 8),param_1);

  }

  *param_2 = iVar1;

  if (iVar1 == 0) {

    uVar2 = 0x8007000e;

  }

  return uVar2;

}





// --- FUN_006c1ab0 at 0x006C1AB0 (size: 182) ---


int __thiscall

FUN_006c1ab0(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5

            ,undefined4 *param_6,undefined4 param_7)



{

  int iVar1;

  undefined4 *puVar2;

  uint uVar3;

  uint uVar4;

  

  FUN_006c1eb0(param_2,0);

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

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

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

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

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

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

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

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

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

  *(undefined4 *)(param_1 + 0x30) = 1;

  FUN_006c3890();

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

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

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

  *(undefined4 *)(param_1 + 0x8c) = 0x7fffffff;

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

  *(undefined4 *)(param_1 + 0x94) = 0x3ff00000;

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

    iVar1 = FUN_006c2070(param_6);

    uVar4 = (iVar1 + 1) * 2;

    puVar2 = (undefined4 *)thunk_FUN_005df0f5(uVar4);

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

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

      for (uVar3 = uVar4 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) {

        *puVar2 = *param_6;

        param_6 = param_6 + 1;

        puVar2 = puVar2 + 1;

      }

      for (uVar4 = uVar4 & 3; uVar4 != 0; uVar4 = uVar4 - 1) {

        *(undefined1 *)puVar2 = *(undefined1 *)param_6;

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

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

      }

    }

  }

  return param_1;

}





// --- FUN_006c1b70 at 0x006C1B70 (size: 153) ---


int FUN_006c1b70(int param_1,int param_2,undefined4 param_3)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int iVar1;

  

  if (param_2 == 0) {

    return -0x7fffbffd;

  }

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + 0x14);

  EnterCriticalSection(lpCriticalSection);

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

    LeaveCriticalSection(lpCriticalSection);

    return -0x7ffbfdfc;

  }

  if ((*(int *)(*(int *)(param_1 + 0x1c) + 0x14) != 0) && (*(char *)(param_1 + 0x19) == '\0')) {

    LeaveCriticalSection(lpCriticalSection);

    return -0x7ffbfddc;

  }

  iVar1 = FUN_006c0b50(param_2,param_3);

  if (iVar1 < 0) {

    (**(code **)(*(int *)(param_1 + -0xc) + 0x2c))();

    LeaveCriticalSection(lpCriticalSection);

    return iVar1;

  }

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006c1c10 at 0x006C1C10 (size: 131) ---


int FUN_006c1c10(int param_1)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int iVar1;

  

  lpCriticalSection = *(LPCRITICAL_SECTION *)(param_1 + 0x14);

  EnterCriticalSection(lpCriticalSection);

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

    LeaveCriticalSection(lpCriticalSection);

    return -0x7ffbfddc;

  }

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

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

    if (iVar1 < 0) {

      LeaveCriticalSection(lpCriticalSection);

      return iVar1;

    }

    (**(code **)(**(int **)(param_1 + 0xc) + 8))(*(int **)(param_1 + 0xc));

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

    LeaveCriticalSection(lpCriticalSection);

    return 0;

  }

  LeaveCriticalSection(lpCriticalSection);

  return 1;

}





// --- FUN_006c1ca0 at 0x006C1CA0 (size: 127) ---


uint FUN_006c1ca0(int *param_1,undefined4 *param_2)



{

  undefined4 *puVar1;

  undefined4 uVar2;

  

  if (param_2 == (undefined4 *)0x0) {

    return 0x80004003;

  }

  puVar1 = (undefined4 *)FUN_005df0f5(0x14);

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

    puVar1[2] = param_1 + -3;

    *puVar1 = &PTR_LAB_00808164;

    puVar1[1] = 0;

    puVar1[4] = 1;

    (**(code **)(*param_1 + 4))(param_1);

    uVar2 = (**(code **)(*(int *)puVar1[2] + 0x10))();

    puVar1[3] = uVar2;

    *param_2 = puVar1;

    return (puVar1 != (undefined4 *)0x0) - 1 & 0x8007000e;

  }

  *param_2 = 0;

  return 0x8007000e;

}





// --- FUN_006c1d20 at 0x006C1D20 (size: 84) ---


int __thiscall

FUN_006c1d20(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,undefined4 param_5

            ,undefined4 param_6)



{

  int iVar1;

  undefined4 *puVar2;

  

  FUN_006c1ab0(param_2,param_3,param_4,param_5,param_6,0);

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

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

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

  puVar2 = (undefined4 *)(param_1 + 0xa8);

  for (iVar1 = 0xc; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

  return param_1;

}





// --- FUN_006c1d80 at 0x006C1D80 (size: 75) ---


uint FUN_006c1d80(int param_1,int *param_2)



{

  int iVar1;

  

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

    return 0x80004003;

  }

  iVar1 = FUN_005df0f5(0x30);

  if (iVar1 == 0) {

    iVar1 = 0;

  }

  else {

    iVar1 = FUN_006c1730(param_1 + -0xc,0);

  }

  *param_2 = iVar1;

  return (iVar1 != 0) - 1 & 0x8007000e;

}





// --- FUN_006c1dd0 at 0x006C1DD0 (size: 94) ---


int __thiscall

FUN_006c1dd0(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,

            undefined4 *param_5)



{

  FUN_006c1eb0(param_2,param_3);

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

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

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

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

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

  *(undefined4 *)(param_1 + 0x2c) = param_5[1];

  *(undefined4 *)(param_1 + 0x30) = param_5[2];

  *(undefined4 *)(param_1 + 0x34) = param_5[3];

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

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

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

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

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

  return param_1;

}





// --- FUN_006c1e30 at 0x006C1E30 (size: 42) ---


void FUN_006c1e30(void)



{

  LONG LVar1;

  

  LVar1 = InterlockedDecrement((LONG *)&DAT_00906744);

  if ((LVar1 == 0) && (DAT_00906740 != (HMODULE)0x0)) {

    FreeLibrary(DAT_00906740);

    DAT_00906740 = (HMODULE)0x0;

  }

  return;

}





// --- FUN_006c1e60 at 0x006C1E60 (size: 26) ---


void FUN_006c1e60(void)



{

  if (DAT_00906740 == (HMODULE)0x0) {

    DAT_00906740 = LoadLibraryA("OleAut32.dll");

  }

  return;

}





// --- FUN_006c1e80 at 0x006C1E80 (size: 33) ---


undefined4 FUN_006c1e80(int *param_1,undefined4 *param_2)



{

  if (param_2 == (undefined4 *)0x0) {

    return 0x80004003;

  }

  *param_2 = param_1;

  (**(code **)(*param_1 + 4))(param_1);

  return 0;

}





// --- FUN_006c1eb0 at 0x006C1EB0 (size: 40) ---


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



{

  InterlockedIncrement((LONG *)&DAT_00906744);

  if (param_3 == 0) {

    param_3 = param_1;

  }

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

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

  return param_1;

}





// --- FUN_006c1ee0 at 0x006C1EE0 (size: 71) ---


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



{

  int iVar1;

  int *piVar2;

  bool bVar3;

  

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

    return 0x80004003;

  }

  iVar1 = 4;

  bVar3 = true;

  piVar2 = &DAT_007cc670;

  do {

    if (iVar1 == 0) break;

    iVar1 = iVar1 + -1;

    bVar3 = *param_2 == *piVar2;

    param_2 = param_2 + 1;

    piVar2 = piVar2 + 1;

  } while (bVar3);

  if (bVar3) {

    *param_3 = param_1;

    (**(code **)(*param_1 + 4))(param_1);

    return 0;

  }

  *param_3 = 0;

  return 0x80004002;

}





// --- FUN_006c1f30 at 0x006C1F30 (size: 31) ---


uint FUN_006c1f30(int param_1)



{

  uint uVar1;

  

  InterlockedIncrement((LONG *)(param_1 + 8));

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

  if (uVar1 < 2) {

    uVar1 = 1;

  }

  return uVar1;

}





// --- FUN_006c1f90 at 0x006C1F90 (size: 28) ---


undefined4 * __thiscall FUN_006c1f90(undefined4 *param_1,BOOL param_2)



{

  HANDLE pvVar1;

  

  pvVar1 = CreateEventA((LPSECURITY_ATTRIBUTES)0x0,param_2,0,(LPCSTR)0x0);

  *param_1 = pvVar1;

  return param_1;

}





// --- FUN_006c1fb0 at 0x006C1FB0 (size: 14) ---


void __fastcall FUN_006c1fb0(undefined4 *param_1)



{

  if ((HANDLE)*param_1 != (HANDLE)0x0) {

    CloseHandle((HANDLE)*param_1);

  }

  return;

}





// --- FUN_006c1fc0 at 0x006C1FC0 (size: 34) ---


short * FUN_006c1fc0(short *param_1,short *param_2)



{

  short sVar1;

  short *psVar2;

  

  psVar2 = param_1;

  do {

    sVar1 = *param_2;

    *param_1 = sVar1;

    param_1 = param_1 + 1;

    param_2 = param_2 + 1;

  } while (sVar1 != 0);

  return psVar2;

}





// --- FUN_006c1ff0 at 0x006C1FF0 (size: 55) ---


short * FUN_006c1ff0(short *param_1,short *param_2,int param_3)



{

  short sVar1;

  short *psVar2;

  

  psVar2 = param_1;

  if (param_3 != 0) {

    while (param_3 = param_3 + -1, param_3 != 0) {

      sVar1 = *param_2;

      *param_1 = sVar1;

      param_1 = param_1 + 1;

      param_2 = param_2 + 1;

      if (sVar1 == 0) {

        return psVar2;

      }

    }

    *param_1 = 0;

  }

  return psVar2;

}





// --- FUN_006c2030 at 0x006C2030 (size: 61) ---


int FUN_006c2030(ushort *param_1,ushort *param_2)



{

  ushort uVar1;

  ushort uVar2;

  

  do {

    uVar1 = *param_1;

    uVar2 = *param_2;

    if (uVar1 != uVar2) {

      return (uint)uVar1 - (uint)uVar2;

    }

    param_1 = param_1 + 1;

  } while ((uVar1 != 0) && (param_2 = param_2 + 1, uVar2 != 0));

  return 0;

}





// --- FUN_006c2070 at 0x006C2070 (size: 18) ---


void FUN_006c2070(int param_1)



{

  int iVar1;

  

  iVar1 = -1;

  do {

    iVar1 = iVar1 + 1;

  } while (*(short *)(param_1 + iVar1 * 2) != 0);

  return;

}





// --- FUN_006c2090 at 0x006C2090 (size: 781) ---


/* WARNING: Removing unreachable block (ram,0x006c2290) */



undefined8

FUN_006c2090(int param_1,int param_2,int param_3,int param_4,uint param_5,uint param_6,uint param_7,

            uint param_8)



{

  byte bVar1;

  byte bVar2;

  uint uVar3;

  int iVar4;

  uint uVar5;

  uint uVar6;

  uint uVar7;

  undefined4 extraout_ECX;

  uint uVar8;

  int iVar9;

  uint uVar10;

  uint uVar11;

  uint uVar12;

  bool bVar13;

  bool bVar14;

  bool bVar15;

  ulonglong uVar16;

  longlong lVar17;

  longlong lVar18;

  undefined8 uVar19;

  int local_28;

  int local_24;

  uint local_20;

  int local_1c;

  

  if (param_2 < 0) {

    bVar15 = param_1 != 0;

    param_1 = -param_1;

    local_1c = -(param_2 + (uint)bVar15);

  }

  else {

    local_1c = param_2;

  }

  if (param_4 < 0) {

    local_28 = -param_3;

    local_24 = -(param_4 + (uint)(param_3 != 0));

  }

  else {

    local_28 = param_3;

    local_24 = param_4;

  }

  uVar3 = param_6;

  uVar6 = param_5;

  if ((int)param_6 < 0) {

    uVar3 = -(param_6 + (param_5 != 0));

    uVar6 = -param_5;

  }

  if ((param_2 < 1) && (param_2 < 0)) {

    bVar1 = 1;

  }

  else {

    bVar1 = 0;

  }

  if ((param_4 < 1) && (param_4 < 0)) {

    bVar2 = 1;

  }

  else {

    bVar2 = 0;

  }

  bVar15 = (bool)(bVar2 ^ bVar1);

  uVar16 = __allmul(param_1,0,local_28,0);

  uVar10 = (uint)uVar16;

  lVar17 = __allmul(local_24,0,param_1,0);

  lVar18 = __allmul(local_1c,0,local_28,0);

  uVar16 = lVar17 + lVar18 + (uVar16 >> 0x20);

  uVar11 = (uint)uVar16;

  lVar17 = __allmul(local_24,0,local_1c,0);

  uVar16 = lVar17 + (uVar16 >> 0x20);

  if (param_7 == 0 && param_8 == 0) goto LAB_006c2265;

  if (bVar15) {

    local_20 = -param_7;

    uVar7 = -(param_8 + (param_7 != 0));

    if (((int)param_8 < 0) || (((int)param_8 < 1 && (param_7 == 0)))) {

LAB_006c21f3:

      uVar12 = 0;

      param_8 = uVar7;

    }

    else {

      uVar12 = 0xffffffff;

      param_8 = uVar7;

    }

  }

  else {

    local_20 = param_7;

    uVar7 = param_8;

    if ((0 < (int)param_8) || (-1 < (int)param_8)) goto LAB_006c21f3;

    uVar12 = 0xffffffff;

  }

  bVar13 = CARRY4(uVar10,local_20);

  uVar10 = uVar10 + local_20;

  bVar14 = CARRY4(param_8,uVar11);

  param_8 = param_8 + uVar11;

  uVar11 = bVar13 + param_8;

  uVar7 = (uint)bVar14 + (uint)CARRY4((uint)bVar13,param_8);

  lVar17 = CONCAT44(uVar12 + CARRY4(uVar7,uVar12),uVar7 + uVar12);

  lVar18 = uVar16 + lVar17;

  uVar16 = uVar16 + lVar17;

  if (lVar18 < 0) {

    bVar15 = !bVar15;

    uVar7 = ~uVar10;

    uVar10 = uVar7 + 1;

    uVar11 = ~uVar11 + (uint)(0xfffffffe < uVar7);

    uVar7 = (uint)(uVar10 == 0 && uVar11 == 0);

    uVar16 = CONCAT44(~(uint)((ulonglong)lVar18 >> 0x20) + (uint)CARRY4(~(uint)lVar18,uVar7),

                      ~(uint)lVar18 + uVar7);

  }

LAB_006c2265:

  if (((int)param_6 < 1) && ((int)param_6 < 0)) {

    bVar15 = !bVar15;

  }

  if (CONCAT44(uVar3,uVar6) <= uVar16) {

    if (!bVar15) {

      return 0x7fffffffffffffff;

    }

    return 0x8000000000000000;

  }

  if (uVar16 == 0) {

    uVar19 = __aulldiv(uVar10,uVar11,uVar6,uVar3);

    if (bVar15) {

      return CONCAT44(-((int)((ulonglong)uVar19 >> 0x20) + (uint)((int)uVar19 != 0)),-(int)uVar19);

    }

  }

  else {

    if (uVar3 == 0) {

      iVar4 = __aulldvrm(uVar11,(int)uVar16,uVar6,0);

      uVar19 = __aulldiv(uVar10,extraout_ECX,uVar6,0);

      iVar9 = (int)uVar19;

      iVar4 = iVar4 + (int)((ulonglong)uVar19 >> 0x20);

      if (bVar15) {

        bVar15 = iVar9 != 0;

        iVar9 = -iVar9;

        iVar4 = -(iVar4 + (uint)bVar15);

      }

      return CONCAT44(iVar4,iVar9);

    }

    uVar12 = 0;

    uVar7 = 0;

    param_5 = 0x40;

    do {

      uVar7 = uVar7 << 1 | uVar12 >> 0x1f;

      uVar8 = (int)(uVar16 >> 0x20) << 1 | (uint)uVar16 >> 0x1f;

      uVar12 = uVar12 * 2;

      uVar5 = (uint)uVar16 * 2;

      if ((int)uVar11 < 0) {

        uVar5 = uVar5 + 1;

      }

      uVar11 = uVar11 << 1 | uVar10 >> 0x1f;

      uVar10 = uVar10 << 1;

      if ((uVar3 <= uVar8) && ((uVar3 < uVar8 || (uVar6 <= uVar5)))) {

        bVar13 = uVar5 < uVar6;

        uVar5 = uVar5 - uVar6;

        uVar8 = (uVar8 - uVar3) - (uint)bVar13;

        bVar13 = 0xfffffffe < uVar12;

        uVar12 = uVar12 + 1;

        uVar7 = uVar7 + bVar13;

      }

      uVar19 = CONCAT44(uVar7,uVar12);

      uVar16 = CONCAT44(uVar8,uVar5);

      param_5 = param_5 + -1;

    } while (param_5 != 0);

    if (bVar15) {

      uVar19 = CONCAT44(-(uVar7 + (uVar12 != 0)),-uVar12);

    }

  }

  return uVar19;

}





// --- FUN_006c23a0 at 0x006C23A0 (size: 520) ---


DWORD FUN_006c23a0(HANDLE param_1,uint param_2,HWND param_3,UINT param_4,int param_5)



{

  bool bVar1;

  DWORD DVar2;

  int iVar3;

  HANDLE pvVar4;

  DWORD DVar5;

  UINT UVar6;

  uint nCount;

  uint dwMilliseconds;

  WPARAM wParam;

  LPARAM lParam;

  DWORD local_30;

  uint local_28;

  HANDLE local_24;

  int local_20;

  tagMSG local_1c;

  

  bVar1 = false;

  local_30 = 0;

  local_28 = 0;

  local_24 = param_1;

  local_20 = param_5;

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

    local_30 = GetTickCount();

  }

  nCount = (param_5 != 0) + 1;

  DVar2 = WaitForMultipleObjects(nCount,&local_24,0,0);

  if (nCount <= DVar2) {

    do {

      dwMilliseconds = param_2;

      if (10 < param_2) {

        dwMilliseconds = 10;

      }

      DVar2 = MsgWaitForMultipleObjects

                        (nCount,&local_24,0,dwMilliseconds,(uint)(param_3 != (HWND)0x0) * 8 + 0x40);

      if ((DVar2 != nCount) && ((DVar2 != 0x102 || (dwMilliseconds == param_2)))) break;

      if (param_3 != (HWND)0x0) {

        iVar3 = PeekMessageA(&local_1c,param_3,param_4,param_4,1);

        while (iVar3 != 0) {

          DispatchMessageA(&local_1c);

          iVar3 = PeekMessageA(&local_1c,param_3,param_4,param_4,1);

        }

      }

      PeekMessageA(&local_1c,(HWND)0x0,0,0,0);

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

        DVar2 = GetTickCount();

        if (param_2 < DVar2 - local_30) {

          param_2 = 0;

          local_30 = DVar2;

        }

        else {

          param_2 = param_2 - (DVar2 - local_30);

          local_30 = DVar2;

        }

      }

      if (!bVar1) {

        pvVar4 = GetCurrentThread();

        local_28 = GetThreadPriority(pvVar4);

        if (local_28 < 2) {

          iVar3 = 2;

          pvVar4 = GetCurrentThread();

          SetThreadPriority(pvVar4,iVar3);

        }

        bVar1 = true;

      }

      DVar2 = WaitForMultipleObjects(nCount,&local_24,0,0);

    } while (nCount <= DVar2);

    if (bVar1) {

      pvVar4 = GetCurrentThread();

      SetThreadPriority(pvVar4,local_28);

      DVar5 = GetQueueStatus(8);

      if ((DVar5 >> 0x10 & 8) != 0) {

        if (DAT_00906748 != 0) goto LAB_006c2571;

        DAT_00906748 = RegisterWindowMessageA("AMUnblock");

        UVar6 = DAT_00906748;

        while (UVar6 != 0) {

LAB_006c2571:

          UVar6 = PeekMessageA(&local_1c,(HWND)0xffffffff,DAT_00906748,DAT_00906748,1);

        }

        lParam = 0;

        wParam = 0;

        UVar6 = DAT_00906748;

        DVar5 = GetCurrentThreadId();

        PostThreadMessageA(DVar5,UVar6,wParam,lParam);

      }

    }

  }

  return DVar2;

}





// --- FUN_006c25b0 at 0x006C25B0 (size: 150) ---


void FUN_006c25b0(UINT param_1,UINT param_2,LPTIMECALLBACK param_3,DWORD_PTR param_4,uint param_5)



{

  BOOL BVar1;

  _OSVERSIONINFOA local_94;

  

  if (DAT_0090674d == '\0') {

    local_94.dwOSVersionInfoSize = 0x94;

    BVar1 = GetVersionExA(&local_94);

    if ((BVar1 == 0) ||

       ((local_94.dwMajorVersion < 6 &&

        ((local_94.dwMajorVersion != 5 || (local_94.dwMinorVersion == 0)))))) {

      DAT_0090674c = '\0';

    }

    else {

      DAT_0090674c = '\x01';

    }

    DAT_0090674d = '\x01';

  }

  if (DAT_0090674c != '\0') {

    param_5 = param_5 | 0x100;

  }

  timeSetEvent(param_1,param_2,param_3,param_4,param_5);

  return;

}





// --- FUN_006c2650 at 0x006C2650 (size: 221) ---


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



{

  undefined *puVar1;

  int *piVar2;

  int iVar3;

  DWORD DVar4;

  code *pcVar5;

  int iVar6;

  uint uVar7;

  int *unaff_ESI;

  int *unaff_retaddr;

  

  piVar2 = param_5;

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

    return 0x80004003;

  }

  *param_5 = 0;

  if (param_3 != 0) {

    return 0x8002802b;

  }

  if (*param_1 == 0) {

    iVar3 = FUN_006c1e60();

    puVar1 = PTR_FUN_00837388;

    if ((iVar3 == 0) ||

       (pcVar5 = (code *)(*(code *)PTR_FUN_00837388)(iVar3,"LoadRegTypeLib"), pcVar5 == (code *)0x0)

       ) {

LAB_006c2695:

      DVar4 = GetLastError();

      return DVar4 | 0x80070000;

    }

    iVar6 = (*pcVar5)(&DAT_008083e0,1,0,param_4,&param_5);

    if (iVar6 < 0) {

      pcVar5 = (code *)(*(code *)puVar1)(iVar3,"LoadTypeLib");

      if (pcVar5 == (code *)0x0) goto LAB_006c2695;

      uVar7 = (*pcVar5)(L"control.tlb",&param_5);

      if ((int)uVar7 < 0) {

        return uVar7;

      }

    }

    uVar7 = (**(code **)(*unaff_retaddr + 0x18))(unaff_retaddr,unaff_ESI,param_1);

    (**(code **)(*unaff_ESI + 8))(unaff_ESI);

    if ((int)uVar7 < 0) {

      return uVar7;

    }

  }

  *piVar2 = *param_1;

  (**(code **)(*(int *)*param_1 + 4))((int *)*param_1);

  return 0;

}





// --- FUN_006c2900 at 0x006C2900 (size: 59) ---


void __fastcall FUN_006c2900(int param_1)



{

  int *piVar1;

  

  if (param_1 == 8) {

    param_1 = 0;

  }

  else {

    param_1 = param_1 + -4;

  }

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

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

    (**(code **)(*piVar1 + 8))(piVar1);

  }

  if ((param_1 != 0) && (param_1 != -4)) {

    FUN_006c1e30();

    return;

  }

  FUN_006c1e30();

  return;

}





// --- FUN_006c29c0 at 0x006C29C0 (size: 90) ---


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



{

  int *piVar1;

  undefined4 *puVar2;

  int iVar3;

  undefined4 *puVar4;

  undefined4 *puStack_c;

  

  puVar2 = param_2;

  *param_2 = 0;

  piVar1 = (int *)param_1[6];

  puStack_c = &param_2;

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

  if (-1 < iVar3) {

    puVar4 = &DAT_00807cbc;

    iVar3 = (**(code **)*param_1)(param_1,&DAT_00807cbc,&puStack_c);

    (**(code **)(*piVar1 + 8))(piVar1);

    if (-1 < iVar3) {

      *puVar2 = puVar4;

      return 0;

    }

  }

  return 0x80004001;

}





// --- FUN_006c2a20 at 0x006C2A20 (size: 90) ---


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



{

  int *piVar1;

  undefined4 *puVar2;

  int iVar3;

  undefined4 *puVar4;

  undefined4 *puStack_c;

  

  puVar2 = param_2;

  *param_2 = 0;

  piVar1 = (int *)param_1[6];

  puStack_c = &param_2;

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

  if (-1 < iVar3) {

    puVar4 = &DAT_00808340;

    iVar3 = (**(code **)*param_1)(param_1,&DAT_00808340,&puStack_c);

    (**(code **)(*piVar1 + 8))(piVar1);

    if (-1 < iVar3) {

      *puVar2 = puVar4;

      return 0;

    }

  }

  return 0x80004001;

}





// --- FUN_006c30d0 at 0x006C30D0 (size: 114) ---


int __thiscall FUN_006c30d0(int param_1,int *param_2)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int iVar1;

  undefined4 unaff_EBX;

  undefined4 unaff_ESI;

  undefined4 unaff_EDI;

  undefined4 local_10 [2];

  undefined1 local_8 [8];

  

  lpCriticalSection = (LPCRITICAL_SECTION)(param_1 + 0x1c);

  EnterCriticalSection(lpCriticalSection);

  iVar1 = (**(code **)(*param_2 + 0x14))(param_2,local_10,local_8);

  if (iVar1 < 0) {

    LeaveCriticalSection(lpCriticalSection);

    return iVar1;

  }

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

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

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

  *(undefined4 *)(param_1 + 0x44) = local_10[0];

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

  LeaveCriticalSection(lpCriticalSection);

  return 0;

}





// --- FUN_006c3150 at 0x006C3150 (size: 117) ---


int __thiscall FUN_006c3150(int *param_1,undefined4 param_2)



{

  LPCRITICAL_SECTION lpCriticalSection;

  int iVar1;

  

  lpCriticalSection = (LPCRITICAL_SECTION)(param_1 + 7);

  EnterCriticalSection(lpCriticalSection);

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

    iVar1 = (**(code **)(*param_1 + 0x34))(param_1,param_2,0,param_1[0xe],param_1[0xf]);

    if (-1 < iVar1) {

      iVar1 = (**(code **)(*param_1 + 0x34))

                        (param_1,&DAT_008083f0,0,param_1[0x10],param_1[0x11],&DAT_008083f0);

    }

    LeaveCriticalSection(lpCriticalSection);

    return iVar1;

  }

  LeaveCriticalSection(lpCriticalSection);

  return -0x7fffbffb;

}





// --- FUN_006c31d0 at 0x006C31D0 (size: 47) ---


undefined4 __fastcall FUN_006c31d0(int param_1)



{

  EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x1c));

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

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

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

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

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

  LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x1c));

  return 0;

}





// --- FUN_006c3200 at 0x006C3200 (size: 87) ---


int __fastcall FUN_006c3200(int *param_1)



{

  int iVar1;

  int unaff_EBX;

  int unaff_ESI;

  undefined1 local_8 [8];

  

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

    return -0x7fffbffb;

  }

  iVar1 = (**(code **)(*param_1 + 0x2c))(param_1,local_8);

  if (-1 < iVar1) {

    EnterCriticalSection((LPCRITICAL_SECTION)(param_1 + 7));

    param_1[0x10] = unaff_EBX;

    param_1[0x11] = unaff_ESI;

    param_1[0xe] = unaff_EBX;

    param_1[0xf] = unaff_ESI;

    LeaveCriticalSection((LPCRITICAL_SECTION)(param_1 + 7));

  }

  return iVar1;

}





// --- FUN_006c3260 at 0x006C3260 (size: 9) ---


void FUN_006c3260(int *param_1)



{

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

                    /* WARNING: Treating indirect jump as call */

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

  return;

}





// --- FUN_006c3270 at 0x006C3270 (size: 9) ---


void FUN_006c3270(int *param_1)



{

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

                    /* WARNING: Treating indirect jump as call */

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

  return;

}





// --- FUN_006c3280 at 0x006C3280 (size: 9) ---


void FUN_006c3280(int *param_1)



{

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

                    /* WARNING: Treating indirect jump as call */

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

  return;

}





// --- FUN_006c3290 at 0x006C3290 (size: 9) ---


void FUN_006c3290(int *param_1)



{

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

                    /* WARNING: Treating indirect jump as call */

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

  return;

}





// --- FUN_006c32a0 at 0x006C32A0 (size: 75) ---


int FUN_006c32a0(int *param_1,undefined4 param_2)



{

  int iVar1;

  int *unaff_ESI;

  

  iVar1 = (**(code **)(*param_1 + 0x50))(param_2,0);

  if (-1 < iVar1) {

    return 0;

  }

  iVar1 = FUN_006c2a20(&stack0xfffffffc);

  if (-1 < iVar1) {

    iVar1 = FUN_006c3290(unaff_ESI,param_2);

    (**(code **)(*unaff_ESI + 8))(unaff_ESI);

  }

  return iVar1;

}





// --- FUN_006c3470 at 0x006C3470 (size: 124) ---


undefined4 * __thiscall

FUN_006c3470(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 *param_4,

            int param_5)



{

  FUN_006c1eb0(param_2,param_3);

  param_1[5] = 0;

  *param_1 = &PTR_LAB_00808238;

  param_1[1] = &PTR_LAB_008081f0;

  param_1[2] = &PTR_LAB_008081e0;

  param_1[6] = param_5;

  if (param_5 == 0) {

    *param_4 = 0x80004003;

  }

  *param_1 = &PTR_LAB_008082a0;

  param_1[1] = &PTR_LAB_008081f0;

  param_1[2] = &PTR_LAB_0080828c;

  InitializeCriticalSection((LPCRITICAL_SECTION)(param_1 + 7));

  param_1[0xe] = 0;

  param_1[0xf] = 0;

  param_1[0x10] = 0;

  param_1[0x11] = 0;

  param_1[0x12] = 1;

  return param_1;

}





// --- FUN_006c34f0 at 0x006C34F0 (size: 46) ---


int __thiscall FUN_006c34f0(int param_1,byte param_2)



{

  DeleteCriticalSection((LPCRITICAL_SECTION)(param_1 + 0x14));

  FUN_006c2900();

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

    operator_delete((void *)(param_1 + -8));

  }

  return param_1 + -8;

}





// --- FUN_006c3520 at 0x006C3520 (size: 28) ---


void __fastcall FUN_006c3520(undefined4 *param_1)



{

  *param_1 = 0;

  param_1[1] = 0;

  param_1[2] = 0;

  param_1[3] = 10;

  param_1[4] = 0;

  param_1[5] = 0;

  return;

}





// --- FUN_006c3540 at 0x006C3540 (size: 57) ---


void __fastcall FUN_006c3540(undefined4 *param_1)



{

  void *pvVar1;

  void *pvVar2;

  

  pvVar2 = (void *)*param_1;

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

    pvVar1 = *(void **)((int)pvVar2 + 4);

    operator_delete(pvVar2);

    pvVar2 = pvVar1;

  }

  param_1[2] = 0;

  param_1[1] = 0;

  *param_1 = 0;

  return;

}





// --- FUN_006c3580 at 0x006C3580 (size: 41) ---


int __thiscall FUN_006c3580(int *param_1,int param_2)



{

  int iVar1;

  int iVar2;

  

  iVar2 = *param_1;

  while( true ) {

    iVar1 = iVar2;

    if (iVar1 == 0) {

      return 0;

    }

    if (*(int *)(iVar1 + 8) == param_2) break;

    iVar2 = *param_1;

    if (iVar1 != 0) {

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

    }

  }

  return iVar1;

}





// --- FUN_006c35b0 at 0x006C35B0 (size: 104) ---


void __thiscall FUN_006c35b0(undefined4 *param_1,undefined4 param_2)



{

  undefined4 *puVar1;

  

  puVar1 = (undefined4 *)param_1[5];

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

    param_1[5] = puVar1[1];

    param_1[4] = param_1[4] + -1;

    if (puVar1 != (undefined4 *)0x0) goto LAB_006c35dd;

  }

  puVar1 = (undefined4 *)FUN_005df0f5(0xc);

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

    return;

  }

LAB_006c35dd:

  puVar1[2] = param_2;

  puVar1[1] = 0;

  *puVar1 = param_1[1];

  if (param_1[1] == 0) {

    *param_1 = puVar1;

    param_1[1] = puVar1;

    param_1[2] = param_1[2] + 1;

    return;

  }

  *(undefined4 **)(param_1[1] + 4) = puVar1;

  param_1[1] = puVar1;

  param_1[2] = param_1[2] + 1;

  return;

}





// --- FUN_006c3620 at 0x006C3620 (size: 124) ---


undefined4 __thiscall FUN_006c3620(undefined4 *param_1,int *param_2)



{

  int iVar1;

  undefined4 uVar2;

  undefined4 *puVar3;

  

  iVar1 = *param_2;

  do {

    if (iVar1 == 0) {

      return 1;

    }

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

    puVar3 = (undefined4 *)param_1[5];

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

    if (puVar3 == (undefined4 *)0x0) {

LAB_006c3650:

      puVar3 = (undefined4 *)FUN_005df0f5(0xc);

      if (puVar3 == (undefined4 *)0x0) {

        return 0;

      }

    }

    else {

      param_1[5] = puVar3[1];

      param_1[4] = param_1[4] + -1;

      if (puVar3 == (undefined4 *)0x0) goto LAB_006c3650;

    }

    puVar3[2] = uVar2;

    puVar3[1] = 0;

    *puVar3 = param_1[1];

    if (param_1[1] == 0) {

      *param_1 = puVar3;

    }

    else {

      *(undefined4 **)(param_1[1] + 4) = puVar3;

    }

    param_1[1] = puVar3;

    param_1[2] = param_1[2] + 1;

  } while( true );

}





// --- FUN_006c36a0 at 0x006C36A0 (size: 36) ---


void __fastcall FUN_006c36a0(int param_1)



{

  void *pvVar1;

  void *pvVar2;

  

  FUN_006c3540();

  pvVar2 = *(void **)(param_1 + 0x14);

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

    pvVar1 = *(void **)((int)pvVar2 + 4);

    operator_delete(pvVar2);

    pvVar2 = pvVar1;

  }

  return;

}





// --- FUN_006c36d0 at 0x006C36D0 (size: 27) ---


void __fastcall FUN_006c36d0(undefined4 *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  puVar2 = param_1;

  for (iVar1 = 0x12; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

  param_1[10] = 1;

  param_1[8] = 1;

  return;

}





// --- FUN_006c36f0 at 0x006C36F0 (size: 52) ---


undefined4 __fastcall FUN_006c36f0(int *param_1)



{

  int iVar1;

  int *piVar2;

  int *piVar3;

  bool bVar4;

  

  iVar1 = 4;

  bVar4 = true;

  piVar2 = param_1;

  piVar3 = &DAT_008079f4;

  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_1 + 0xb;

    piVar3 = &DAT_008079f4;

    do {

      if (iVar1 == 0) break;

      iVar1 = iVar1 + -1;

      bVar4 = *piVar2 == *piVar3;

      piVar2 = piVar2 + 1;

      piVar3 = piVar3 + 1;

    } while (bVar4);

    if (!bVar4) {

      return 0;

    }

  }

  return 1;

}





// --- FUN_006c3730 at 0x006C3730 (size: 170) ---


undefined4 __thiscall FUN_006c3730(int *param_1,int *param_2)



{

  int iVar1;

  int *piVar2;

  char *pcVar3;

  int *piVar4;

  char *pcVar5;

  bool bVar6;

  

  iVar1 = 4;

  bVar6 = true;

  piVar2 = param_2;

  piVar4 = &DAT_008079f4;

  do {

    if (iVar1 == 0) break;

    iVar1 = iVar1 + -1;

    bVar6 = *piVar2 == *piVar4;

    piVar2 = piVar2 + 1;

    piVar4 = piVar4 + 1;

  } while (bVar6);

  if (!bVar6) {

    iVar1 = 4;

    bVar6 = true;

    piVar2 = param_1;

    piVar4 = param_2;

    do {

      if (iVar1 == 0) break;

      iVar1 = iVar1 + -1;

      bVar6 = *piVar2 == *piVar4;

      piVar2 = piVar2 + 1;

      piVar4 = piVar4 + 1;

    } while (bVar6);

    if (!bVar6) {

      return 0;

    }

  }

  iVar1 = 4;

  bVar6 = true;

  piVar2 = param_2 + 4;

  piVar4 = &DAT_008079f4;

  do {

    if (iVar1 == 0) break;

    iVar1 = iVar1 + -1;

    bVar6 = *piVar2 == *piVar4;

    piVar2 = piVar2 + 1;

    piVar4 = piVar4 + 1;

  } while (bVar6);

  if (!bVar6) {

    iVar1 = 4;

    bVar6 = true;

    piVar2 = param_1 + 4;

    piVar4 = param_2 + 4;

    do {

      if (iVar1 == 0) break;

      iVar1 = iVar1 + -1;

      bVar6 = *piVar2 == *piVar4;

      piVar2 = piVar2 + 1;

      piVar4 = piVar4 + 1;

    } while (bVar6);

    if (!bVar6) {

      return 0;

    }

  }

  iVar1 = 4;

  bVar6 = true;

  piVar2 = param_2 + 0xb;

  piVar4 = &DAT_008079f4;

  do {

    if (iVar1 == 0) break;

    iVar1 = iVar1 + -1;

    bVar6 = *piVar2 == *piVar4;

    piVar2 = piVar2 + 1;

    piVar4 = piVar4 + 1;

  } while (bVar6);

  if (!bVar6) {

    iVar1 = 4;

    bVar6 = true;

    piVar2 = param_1 + 0xb;

    piVar4 = param_2 + 0xb;

    do {

      if (iVar1 == 0) break;

      iVar1 = iVar1 + -1;

      bVar6 = *piVar2 == *piVar4;

      piVar2 = piVar2 + 1;

      piVar4 = piVar4 + 1;

    } while (bVar6);

    if ((!bVar6) || (iVar1 = param_1[0x10], iVar1 != param_2[0x10])) {

      return 0;

    }

    if (iVar1 != 0) {

      bVar6 = true;

      pcVar3 = (char *)param_1[0x11];

      pcVar5 = (char *)param_2[0x11];

      do {

        if (iVar1 == 0) break;

        iVar1 = iVar1 + -1;

        bVar6 = *pcVar3 == *pcVar5;

        pcVar3 = pcVar3 + 1;

        pcVar5 = pcVar5 + 1;

      } while (bVar6);

      if (!bVar6) {

        return 0;

      }

    }

  }

  return 1;

}





// --- FUN_006c37e0 at 0x006C37E0 (size: 103) ---


undefined4 FUN_006c37e0(undefined4 *param_1,undefined4 *param_2)



{

  int *piVar1;

  undefined4 *puVar2;

  int iVar3;

  uint uVar4;

  uint uVar5;

  undefined4 *puVar6;

  

  puVar2 = param_2;

  puVar6 = param_1;

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

    *puVar6 = *puVar2;

    puVar2 = puVar2 + 1;

    puVar6 = puVar6 + 1;

  }

  if (param_2[0x10] != 0) {

    puVar2 = CoTaskMemAlloc(param_2[0x10]);

    param_1[0x11] = puVar2;

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

      param_1[0x10] = 0;

      return 0x8007000e;

    }

    uVar5 = param_1[0x10];

    puVar6 = (undefined4 *)param_2[0x11];

    for (uVar4 = uVar5 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {

      *puVar2 = *puVar6;

      puVar6 = puVar6 + 1;

      puVar2 = puVar2 + 1;

    }

    for (uVar5 = uVar5 & 3; uVar5 != 0; uVar5 = uVar5 - 1) {

      *(undefined1 *)puVar2 = *(undefined1 *)puVar6;

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

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

    }

  }

  piVar1 = (int *)param_1[0xf];

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

    (**(code **)(*piVar1 + 4))(piVar1);

  }

  return 0;

}





// --- FUN_006c3850 at 0x006C3850 (size: 56) ---


void __fastcall FUN_006c3850(int param_1)



{

  int *piVar1;

  

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

    CoTaskMemFree(*(LPVOID *)(param_1 + 0x44));

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

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

  }

  piVar1 = *(int **)(param_1 + 0x3c);

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

    (**(code **)(*piVar1 + 8))(piVar1);

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

  }

  return;

}





// --- FUN_006c3890 at 0x006C3890 (size: 29) ---


undefined4 * __fastcall FUN_006c3890(undefined4 *param_1)



{

  int iVar1;

  undefined4 *puVar2;

  

  puVar2 = param_1;

  for (iVar1 = 0x12; iVar1 != 0; iVar1 = iVar1 + -1) {

    *puVar2 = 0;

    puVar2 = puVar2 + 1;

  }

  param_1[10] = 1;

  param_1[8] = 1;

  return param_1;

}





// --- FUN_006c38b0 at 0x006C38B0 (size: 91) ---


undefined4 __thiscall FUN_006c38b0(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  

  if (param_2 != param_1) {

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

      CoTaskMemFree(*(LPVOID *)(param_1 + 0x44));

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

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

    }

    piVar1 = *(int **)(param_1 + 0x3c);

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

      (**(code **)(*piVar1 + 8))(piVar1);

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

    }

    iVar2 = FUN_006c37e0(param_1,param_2);

    if (iVar2 < 0) {

      return 0x8007000e;

    }

  }

  return 0;

}





// --- FUN_006c3910 at 0x006C3910 (size: 71) ---


void FUN_006c3910(LPVOID param_1)



{

  int *piVar1;

  

  if (param_1 != (LPVOID)0x0) {

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

      CoTaskMemFree(*(LPVOID *)((int)param_1 + 0x44));

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

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

    }

    piVar1 = *(int **)((int)param_1 + 0x3c);

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

      (**(code **)(*piVar1 + 8))(piVar1);

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

    }

    CoTaskMemFree(param_1);

  }

  return;

}





// --- thunk_FUN_006c38b0 at 0x006C3960 (size: 5) ---


undefined4 __thiscall thunk_FUN_006c38b0(int param_1,int param_2)



{

  int *piVar1;

  int iVar2;

  

  if (param_2 != param_1) {

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

      CoTaskMemFree(*(LPVOID *)(param_1 + 0x44));

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

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

    }

    piVar1 = *(int **)(param_1 + 0x3c);

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

      (**(code **)(*piVar1 + 8))(piVar1);

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

    }

    iVar2 = FUN_006c37e0(param_1,param_2);

    if (iVar2 < 0) {

      return 0x8007000e;

    }

  }

  return 0;

}





// --- Unwind@006c39c0 at 0x006C39C0 (size: 8) ---


void Unwind_006c39c0(void)



{

  FUN_00557e60();

  return;

}





// --- Unwind@006c39e0 at 0x006C39E0 (size: 11) ---


void Unwind_006c39e0(void)



{

  FUN_0042e590();

  return;

}





// --- Unwind@006c39eb at 0x006C39EB (size: 11) ---


void Unwind_006c39eb(void)



{

  FUN_004011b0();

  return;

}





// --- Unwind@006c3a00 at 0x006C3A00 (size: 8) ---


void Unwind_006c3a00(void)



{

  FUN_004011b0();

  return;

}





