/* @0040aee0 file=? name=FUN_0040aee0 */

void __cdecl FUN_0040aee0(undefined4 *param_1,undefined4 *param_2)

{
  *param_1 = *param_2;
  param_1[4] = param_2[1];
  param_1[8] = param_2[2];
  param_1[1] = param_2[4];
  param_1[5] = param_2[5];
  param_1[9] = param_2[6];
  param_1[2] = param_2[8];
  param_1[6] = param_2[9];
  param_1[10] = param_2[10];
  param_1[3] = param_2[0xc];
  param_1[7] = param_2[0xd];
  param_1[0xb] = param_2[0xe];
  return;
}



/* @0040af34 file=? name=FUN_0040af34 */

void __cdecl FUN_0040af34(undefined4 *param_1,undefined4 *param_2)

{
  *param_1 = *param_2;
  param_1[4] = param_2[1];
  param_1[8] = param_2[2];
  param_1[1] = param_2[4];
  param_1[5] = param_2[5];
  param_1[9] = param_2[6];
  param_1[2] = param_2[8];
  param_1[6] = param_2[9];
  param_1[10] = param_2[10];
  param_1[3] = param_2[0xc];
  param_1[7] = param_2[0xd];
  param_1[0xb] = param_2[0xe];
  return;
}



/* @0040af88 file=? name=FUN_0040af88 */

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

undefined4 __cdecl FUN_0040af88(float *param_1,float *param_2)

{
  uint uVar1;
  float10 fVar2;
  
  uVar1 = 0;
  do {
    fVar2 = FUN_004dcd00((double)(*param_1 - *param_2));
    if ((float10)_DAT_0040afec < fVar2) {
      return 0;
    }
    uVar1 = uVar1 + 1;
    param_1 = param_1 + 1;
    param_2 = param_2 + 1;
  } while (uVar1 < 0xc);
  return 1;
}



/* @0040aff0 file=? name=FUN_0040aff0 */

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

undefined4 __cdecl FUN_0040aff0(float *param_1,float *param_2)

{
  uint uVar1;
  float10 fVar2;
  
  uVar1 = 0;
  do {
    fVar2 = FUN_004dcd00((double)(*param_1 - *param_2));
    if ((float10)_DAT_0040b054 < fVar2) {
      return 1;
    }
    uVar1 = uVar1 + 1;
    param_1 = param_1 + 1;
    param_2 = param_2 + 1;
  } while (uVar1 < 0xc);
  return 0;
}



/* @0040b058 file=? name=FUN_0040b058 */

void __cdecl FUN_0040b058(int param_1,int param_2,undefined4 *param_3)

{
  *param_3 = *(undefined4 *)(param_1 + param_2 * 4);
  param_3[1] = *(undefined4 *)(param_1 + 0x10 + param_2 * 4);
  param_3[2] = *(undefined4 *)(param_1 + 0x20 + param_2 * 4);
  return;
}



/* @0040b07c file=? name=FUN_0040b07c */

void __cdecl FUN_0040b07c(int param_1,int param_2,undefined4 *param_3)

{
  *param_3 = *(undefined4 *)(param_1 + param_2 * 0x10);
  param_3[1] = *(undefined4 *)(param_1 + 4 + param_2 * 0x10);
  param_3[2] = *(undefined4 *)(param_1 + 8 + param_2 * 0x10);
  return;
}



/* @0040b0ac file=? name=FUN_0040b0ac */

void __cdecl FUN_0040b0ac(int param_1,int param_2,undefined4 *param_3)

{
  *(undefined4 *)(param_1 + param_2 * 4) = *param_3;
  *(undefined4 *)(param_1 + 0x10 + param_2 * 4) = param_3[1];
  *(undefined4 *)(param_1 + 0x20 + param_2 * 4) = param_3[2];
  return;
}



/* @0040b0d0 file=? name=FUN_0040b0d0 */

void __cdecl FUN_0040b0d0(int param_1,int param_2,undefined4 *param_3)

{
  *(undefined4 *)(param_1 + param_2 * 0x10) = *param_3;
  *(undefined4 *)(param_1 + 4 + param_2 * 0x10) = param_3[1];
  *(undefined4 *)(param_1 + 8 + param_2 * 0x10) = param_3[2];
  return;
}



/* @0040b104 file=? name=FUN_0040b104 */

float * __cdecl FUN_0040b104(float *param_1,float *param_2,float *param_3)

{
  *param_1 = param_2[8] * param_3[2] + param_2[4] * param_3[1] + *param_2 * *param_3;
  param_1[1] = param_2[9] * param_3[2] + param_2[5] * param_3[1] + param_2[1] * *param_3;
  param_1[2] = param_2[10] * param_3[2] + param_2[6] * param_3[1] + param_2[2] * *param_3;
  param_1[3] = param_2[0xb] * param_3[2] + param_2[7] * param_3[1] + param_2[3] * *param_3 +
               param_3[3];
  param_1[4] = param_2[8] * param_3[6] + param_2[4] * param_3[5] + *param_2 * param_3[4];
  param_1[5] = param_2[9] * param_3[6] + param_2[5] * param_3[5] + param_2[1] * param_3[4];
  param_1[6] = param_2[10] * param_3[6] + param_2[6] * param_3[5] + param_2[2] * param_3[4];
  param_1[7] = param_2[0xb] * param_3[6] + param_2[7] * param_3[5] + param_2[3] * param_3[4] +
               param_3[7];
  param_1[8] = param_2[8] * param_3[10] + param_2[4] * param_3[9] + *param_2 * param_3[8];
  param_1[9] = param_2[9] * param_3[10] + param_2[5] * param_3[9] + param_2[1] * param_3[8];
  param_1[10] = param_2[10] * param_3[10] + param_2[6] * param_3[9] + param_2[2] * param_3[8];
  param_1[0xb] = param_2[0xb] * param_3[10] + param_2[7] * param_3[9] + param_2[3] * param_3[8] +
                 param_3[0xb];
  return param_1;
}



/* @0040b244 file=? name=FUN_0040b244 */

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

float * __cdecl FUN_0040b244(float *param_1,float *param_2)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float *pfVar4;
  int iVar5;
  
  *param_1 = param_2[5] * param_2[10] - param_2[9] * param_2[6];
  param_1[1] = param_2[9] * param_2[2] - param_2[1] * param_2[10];
  param_1[2] = param_2[1] * param_2[6] - param_2[5] * param_2[2];
  fVar1 = *param_2;
  fVar2 = param_2[4];
  fVar3 = param_2[8];
  param_1[3] = (-param_2[3] * *param_1 - param_2[7] * param_1[1]) - param_2[0xb] * param_1[2];
  param_1[4] = param_2[8] * param_2[6] - param_2[4] * param_2[10];
  param_1[5] = *param_2 * param_2[10] - param_2[8] * param_2[2];
  param_1[6] = param_2[4] * param_2[2] - *param_2 * param_2[6];
  param_1[7] = (-param_2[3] * param_1[4] - param_2[7] * param_1[5]) - param_2[0xb] * param_1[6];
  param_1[8] = param_2[4] * param_2[9] - param_2[8] * param_2[5];
  param_1[9] = param_2[1] * param_2[8] - *param_2 * param_2[9];
  param_1[10] = *param_2 * param_2[5] - param_2[4] * param_2[1];
  param_1[0xb] = (-param_2[3] * param_1[8] - param_2[7] * param_1[9]) - param_2[0xb] * param_1[10];
  fVar1 = _DAT_0040b370 / (param_1[2] * fVar3 + param_1[1] * fVar2 + *param_1 * fVar1);
  iVar5 = 0;
  pfVar4 = param_1;
  do {
    *pfVar4 = fVar1 * *pfVar4;
    iVar5 = iVar5 + 1;
    pfVar4 = pfVar4 + 1;
  } while (iVar5 < 0xc);
  return param_1;
}



/* @0040b374 file=? name=FUN_0040b374 */

void __cdecl FUN_0040b374(float *param_1,float *param_2,float *param_3)

{
  *param_1 = *param_2 * *param_3;
  param_1[1] = param_2[1] * *param_3;
  param_1[2] = param_2[2] * *param_3;
  param_1[3] = param_2[3] * *param_3;
  param_1[4] = param_2[4] * param_3[1];
  param_1[5] = param_2[5] * param_3[1];
  param_1[6] = param_2[6] * param_3[1];
  param_1[7] = param_2[7] * param_3[1];
  param_1[8] = param_2[8] * param_3[2];
  param_1[9] = param_2[9] * param_3[2];
  param_1[10] = param_2[10] * param_3[2];
  param_1[0xb] = param_2[0xb] * param_3[2];
  return;
}



/* @0040b3e8 file=? name=FUN_0040b3e8 */

void __cdecl FUN_0040b3e8(float *param_1,float *param_2,float *param_3)

{
  int iVar1;
  float *pfVar2;
  float *pfVar3;
  float local_34 [12];
  
  pfVar2 = (float *)&DAT_004e107c;
  pfVar3 = local_34;
  for (iVar1 = 0xc; iVar1 != 0; iVar1 = iVar1 + -1) {
    *pfVar3 = *pfVar2;
    pfVar2 = pfVar2 + 1;
    pfVar3 = pfVar3 + 1;
  }
  FUN_0040adec(local_34,param_3);
  FUN_0040b104(param_1,param_2,local_34);
  return;
}



/* @0040b42c file=? name=FUN_0040b42c */

void __cdecl FUN_0040b42c(int param_1,int param_2,float *param_3)

{
  *(float *)(param_1 + 0xc) = *(float *)(param_2 + 0xc) + *param_3;
  *(float *)(param_1 + 0x1c) = *(float *)(param_2 + 0x1c) + param_3[1];
  *(float *)(param_1 + 0x2c) = *(float *)(param_2 + 0x2c) + param_3[2];
  return;
}



/* @0040b454 file=? name=FUN_0040b454 */

float10 __cdecl FUN_0040b454(float *param_1)

{
  return ((float10)param_1[1] * (float10)param_1[6] - (float10)param_1[5] * (float10)param_1[2]) *
         (float10)param_1[8] +
         ((float10)param_1[9] * (float10)param_1[2] - (float10)param_1[1] * (float10)param_1[10]) *
         (float10)param_1[4] +
         ((float10)param_1[5] * (float10)param_1[10] - (float10)param_1[9] * (float10)param_1[6]) *
         (float10)*param_1;
}



/* @0040b494 file=? name=FUN_0040b494 */

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

float * __cdecl FUN_0040b494(float *param_1)

{
  float fVar1;
  int iVar2;
  
  if (*param_1 == _DAT_0040b68c) {
    iVar2 = 0;
    do {
      if (param_1[iVar2 * 4] != _DAT_0040b68c) break;
      iVar2 = iVar2 + 1;
    } while (iVar2 < 3);
    fVar1 = *param_1;
    *param_1 = param_1[iVar2 * 4];
    param_1[iVar2 * 4] = fVar1;
    fVar1 = param_1[1];
    param_1[1] = param_1[iVar2 * 4 + 1];
    param_1[iVar2 * 4 + 1] = fVar1;
    fVar1 = param_1[2];
    param_1[2] = param_1[iVar2 * 4 + 2];
    param_1[iVar2 * 4 + 2] = fVar1;
    fVar1 = param_1[3];
    param_1[3] = param_1[iVar2 * 4 + 3];
    param_1[iVar2 * 4 + 3] = fVar1;
  }
  fVar1 = *param_1;
  *param_1 = 1.0;
  param_1[1] = param_1[1] / fVar1;
  param_1[2] = param_1[2] / fVar1;
  param_1[3] = param_1[3] / fVar1;
  fVar1 = param_1[4];
  param_1[4] = 0.0;
  param_1[5] = param_1[5] - fVar1 * param_1[1];
  param_1[6] = param_1[6] - fVar1 * param_1[2];
  param_1[7] = param_1[7] - fVar1 * param_1[3];
  fVar1 = param_1[8];
  param_1[8] = 0.0;
  param_1[9] = param_1[9] - fVar1 * param_1[1];
  param_1[10] = param_1[10] - fVar1 * param_1[2];
  param_1[0xb] = param_1[0xb] - fVar1 * param_1[3];
  if (param_1[5] == _DAT_0040b68c) {
    fVar1 = param_1[5];
    param_1[5] = param_1[9];
    param_1[9] = fVar1;
    fVar1 = param_1[6];
    param_1[6] = param_1[10];
    param_1[10] = fVar1;
    fVar1 = param_1[7];
    param_1[7] = param_1[0xb];
    param_1[0xb] = fVar1;
  }
  fVar1 = param_1[5];
  param_1[5] = 1.0;
  param_1[6] = param_1[6] / fVar1;
  param_1[7] = param_1[7] / fVar1;
  fVar1 = param_1[1];
  param_1[1] = 0.0;
  param_1[2] = param_1[2] - fVar1 * param_1[6];
  param_1[3] = param_1[3] - fVar1 * param_1[7];
  fVar1 = param_1[9];
  param_1[9] = 0.0;
  param_1[10] = param_1[10] - fVar1 * param_1[6];
  param_1[0xb] = param_1[0xb] - fVar1 * param_1[7];
  fVar1 = param_1[10];
  param_1[10] = 1.0;
  param_1[0xb] = param_1[0xb] / fVar1;
  fVar1 = param_1[2];
  param_1[2] = 0.0;
  param_1[3] = param_1[3] - fVar1 * param_1[0xb];
  fVar1 = param_1[6];
  param_1[6] = 0.0;
  param_1[7] = param_1[7] - fVar1 * param_1[0xb];
  return param_1;
}



/* @0040bbe8 file=? name=FUN_0040bbe8 */

undefined4 FUN_0040bbe8(void)

{
  return 1;
}



/* @0040bc00 file=? name=FUN_0040bc00 */

undefined4 * __cdecl FUN_0040bc00(undefined4 *param_1,undefined4 *param_2)

{
  FUN_0040ab28(param_1,param_2);
  return param_1;
}



/* @0040bc1c file=? name=FUN_0040bc1c */

undefined4 * __cdecl FUN_0040bc1c(undefined4 *param_1,undefined4 *param_2)

{
  FUN_0040aee0(param_1,param_2);
  return param_1;
}



/* @0040bc38 file=? name=FUN_0040bc38 */

undefined4 * __cdecl FUN_0040bc38(undefined4 *param_1,undefined4 *param_2)

{
  FUN_0040af34(param_1,param_2);
  return param_1;
}



/* @0040bc54 file=? name=FUN_0040bc54 */

float * __cdecl FUN_0040bc54(float *param_1,float *param_2)

{
  *param_1 = *param_2;
  param_1[4] = param_2[1];
  param_1[8] = param_2[2];
  param_1[1] = param_2[4];
  param_1[5] = param_2[5];
  param_1[9] = param_2[6];
  param_1[2] = param_2[8];
  param_1[6] = param_2[9];
  param_1[10] = param_2[10];
  param_1[3] = (-param_2[3] * *param_2 - param_2[7] * param_2[4]) - param_2[0xb] * param_2[8];
  param_1[7] = (-param_2[3] * param_2[1] - param_2[7] * param_2[5]) - param_2[0xb] * param_2[9];
  param_1[0xb] = (-param_2[3] * param_2[2] - param_2[7] * param_2[6]) - param_2[0xb] * param_2[10];
  return param_1;
}



/* @0040bce8 file=? name=FUN_0040bce8 */

void __cdecl FUN_0040bce8(float *param_1)

{
  param_1[8] = param_1[1] * param_1[6] - param_1[5] * param_1[2];
  param_1[9] = param_1[2] * param_1[4] - param_1[6] * *param_1;
  param_1[10] = *param_1 * param_1[5] - param_1[4] * param_1[1];
  return;
}



/* @0040bd24 file=? name=FUN_0040bd24 */

undefined4 __cdecl FUN_0040bd24(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  float local_28 [3];
  float local_1c [3];
  float local_10 [3];
  
  FUN_0040b058(param_1,0,local_10);
  iVar1 = FUN_00408cbc(local_10);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    FUN_0040b058(param_1,1,local_1c);
    iVar1 = FUN_00408cbc(local_1c);
    if (iVar1 == 0) {
      uVar2 = 0;
    }
    else {
      FUN_0040866c(local_28,local_10,local_1c);
      FUN_0040b058(param_1,2,local_10);
      uVar2 = FUN_004084fc(local_10,local_28,0.0001);
    }
  }
  return uVar2;
}



/* @0040bdbc file=? name=FUN_0040bdbc */

undefined4 * __cdecl FUN_0040bdbc(undefined4 *param_1,undefined4 *param_2)

{
  FUN_004d4918(param_1,param_2,0x40);
  return param_1;
}



/* @0040bdd8 file=? name=FUN_0040bdd8 */

void __cdecl FUN_0040bdd8(undefined4 *param_1,undefined4 *param_2)

{
  *param_1 = *param_2;
  param_1[1] = param_2[4];
  param_1[2] = param_2[8];
  param_1[3] = param_2[0xc];
  param_1[4] = param_2[1];
  param_1[5] = param_2[5];
  param_1[6] = param_2[9];
  param_1[7] = param_2[0xd];
  param_1[8] = param_2[2];
  param_1[9] = param_2[6];
  param_1[10] = param_2[10];
  param_1[0xb] = param_2[0xe];
  param_1[0xc] = param_2[3];
  param_1[0xd] = param_2[7];
  param_1[0xe] = param_2[0xb];
  param_1[0xf] = param_2[0xf];
  return;
}



/* @0040be44 file=? name=FUN_0040be44 */

undefined4 FUN_0040be44(void)

{
  return 1;
}



/* @0040be50 file=? name=FUN_0040be50 */

void __cdecl FUN_0040be50(undefined4 *param_1)

{
  *param_1 = 0x3f800000;
  param_1[4] = 0;
  param_1[8] = 0;
  param_1[0xc] = 0;
  param_1[1] = 0;
  param_1[5] = 0x3f800000;
  param_1[9] = 0;
  param_1[0xd] = 0;
  param_1[2] = 0;
  param_1[6] = 0;
  param_1[10] = 0x3f800000;
  param_1[0xe] = 0;
  param_1[3] = 0;
  param_1[7] = 0;
  param_1[0xb] = 0;
  param_1[0xf] = 0x3f800000;
  return;
}



/* @0040beb0 file=? name=FUN_0040beb0 */

void __cdecl FUN_0040beb0(undefined4 *param_1,undefined4 *param_2)

{
  *param_1 = *param_2;
  param_1[1] = param_2[4];
  param_1[2] = param_2[8];
  param_1[3] = 0;
  param_1[4] = param_2[1];
  param_1[5] = param_2[5];
  param_1[6] = param_2[9];
  param_1[7] = 0;
  param_1[8] = param_2[2];
  param_1[9] = param_2[6];
  param_1[10] = param_2[10];
  param_1[0xb] = 0;
  param_1[0xc] = param_2[3];
  param_1[0xd] = param_2[7];
  param_1[0xe] = param_2[0xb];
  param_1[0xf] = 0x3f800000;
  return;
}



/* @0040bf18 file=? name=FUN_0040bf18 */

float * __cdecl FUN_0040bf18(float *param_1,undefined4 *param_2)

{
  FUN_0040c03c(param_1,(float *)(param_2 + 3));
  FUN_0040c170((int)param_1,param_2);
  param_1[3] = 0.0;
  param_1[7] = 0.0;
  param_1[0xb] = 0.0;
  param_1[0xf] = 1.0;
  return param_1;
}



/* @0040bf58 file=? name=FUN_0040bf58 */

float * __cdecl FUN_0040bf58(float *param_1,float *param_2)

{
  float local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  FUN_00408328(&local_c,param_2);
  FUN_00408328(&local_14,param_2 + 1);
  FUN_00408328(&local_1c,param_2 + 2);
  *param_1 = local_10 * local_18;
  param_1[1] = local_10 * local_1c;
  param_1[2] = -local_14;
  param_1[3] = 0.0;
  param_1[4] = local_c * local_14 * local_18 - local_8 * local_1c;
  param_1[5] = local_8 * local_18 + local_c * local_14 * local_1c;
  param_1[6] = local_c * local_10;
  param_1[7] = 0.0;
  param_1[8] = local_c * local_1c + local_8 * local_14 * local_18;
  param_1[9] = local_8 * local_14 * local_1c - local_c * local_18;
  param_1[10] = local_8 * local_10;
  param_1[0xb] = 0.0;
  param_1[0xc] = 0.0;
  param_1[0xd] = 0.0;
  param_1[0xe] = 0.0;
  param_1[0xf] = 1.0;
  return param_1;
}



/* @0040c03c file=? name=FUN_0040c03c */

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

float * __cdecl FUN_0040c03c(float *param_1,float *param_2)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  float fVar7;
  float fVar8;
  float fVar9;
  float fVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  float fVar15;
  float fVar16;
  
  fVar1 = *param_2;
  fVar2 = param_2[1];
  fVar3 = param_2[1];
  fVar4 = param_2[2];
  fVar5 = param_2[2];
  fVar6 = *param_2;
  fVar7 = param_2[3];
  fVar8 = *param_2;
  fVar9 = param_2[3];
  fVar10 = param_2[1];
  fVar11 = param_2[3];
  fVar12 = param_2[2];
  fVar13 = param_2[3] * param_2[3];
  fVar14 = *param_2 * *param_2;
  fVar15 = param_2[1] * param_2[1];
  fVar16 = param_2[2] * param_2[2];
  *param_1 = ((fVar13 + fVar14) - fVar15) - fVar16;
  param_1[4] = (fVar1 * fVar2 - fVar11 * fVar12) * _DAT_0040c12c;
  param_1[8] = (fVar5 * fVar6 + fVar9 * fVar10) * _DAT_0040c12c;
  param_1[1] = (fVar11 * fVar12 + fVar1 * fVar2) * _DAT_0040c12c;
  param_1[5] = ((fVar13 - fVar14) + fVar15) - fVar16;
  param_1[9] = (fVar3 * fVar4 - fVar7 * fVar8) * _DAT_0040c12c;
  param_1[2] = (fVar5 * fVar6 - fVar9 * fVar10) * _DAT_0040c12c;
  param_1[6] = (fVar3 * fVar4 + fVar7 * fVar8) * _DAT_0040c12c;
  param_1[10] = ((fVar13 - fVar14) - fVar15) + fVar16;
  return param_1;
}



/* @0040c170 file=? name=FUN_0040c170 */

void __cdecl FUN_0040c170(int param_1,undefined4 *param_2)

{
  *(undefined4 *)(param_1 + 0x30) = *param_2;
  *(undefined4 *)(param_1 + 0x34) = param_2[1];
  *(undefined4 *)(param_1 + 0x38) = param_2[2];
  return;
}



/* @0040c18c file=? name=FUN_0040c18c */

undefined4 * __cdecl FUN_0040c18c(undefined4 *param_1,undefined4 *param_2)

{
  FUN_0040c170((int)param_1,param_2);
  *param_1 = 0x3f800000;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[5] = 0x3f800000;
  param_1[6] = 0;
  param_1[7] = 0;
  param_1[8] = 0;
  param_1[9] = 0;
  param_1[10] = 0x3f800000;
  param_1[0xb] = 0;
  param_1[0xf] = 0x3f800000;
  return param_1;
}



/* @0040c1f0 file=? name=FUN_0040c1f0 */

float * __cdecl FUN_0040c1f0(float *param_1,float *param_2,float *param_3)

{
  *param_1 = param_2[3] * param_3[0xc] +
             param_2[2] * param_3[8] + param_2[1] * param_3[4] + *param_2 * *param_3;
  param_1[4] = param_2[7] * param_3[0xc] +
               param_2[6] * param_3[8] + param_2[5] * param_3[4] + param_2[4] * *param_3;
  param_1[8] = param_2[0xb] * param_3[0xc] +
               param_2[10] * param_3[8] + param_2[9] * param_3[4] + param_2[8] * *param_3;
  param_1[0xc] = param_2[0xf] * param_3[0xc] +
                 param_2[0xe] * param_3[8] + param_2[0xd] * param_3[4] + param_2[0xc] * *param_3;
  param_1[1] = param_2[3] * param_3[0xd] +
               param_2[2] * param_3[9] + param_2[1] * param_3[5] + *param_2 * param_3[1];
  param_1[5] = param_2[7] * param_3[0xd] +
               param_2[6] * param_3[9] + param_2[5] * param_3[5] + param_2[4] * param_3[1];
  param_1[9] = param_2[0xb] * param_3[0xd] +
               param_2[10] * param_3[9] + param_2[9] * param_3[5] + param_2[8] * param_3[1];
  param_1[0xd] = param_2[0xf] * param_3[0xd] +
                 param_2[0xe] * param_3[9] + param_2[0xd] * param_3[5] + param_2[0xc] * param_3[1];
  param_1[2] = param_2[3] * param_3[0xe] +
               param_2[2] * param_3[10] + param_2[1] * param_3[6] + *param_2 * param_3[2];
  param_1[6] = param_2[7] * param_3[0xe] +
               param_2[6] * param_3[10] + param_2[5] * param_3[6] + param_2[4] * param_3[2];
  param_1[10] = param_2[0xb] * param_3[0xe] +
                param_2[10] * param_3[10] + param_2[9] * param_3[6] + param_2[8] * param_3[2];
  param_1[0xe] = param_2[0xf] * param_3[0xe] +
                 param_2[0xe] * param_3[10] + param_2[0xd] * param_3[6] + param_2[0xc] * param_3[2];
  param_1[3] = param_2[3] * param_3[0xf] +
               param_2[2] * param_3[0xb] + param_2[1] * param_3[7] + *param_2 * param_3[3];
  param_1[7] = param_2[7] * param_3[0xf] +
               param_2[6] * param_3[0xb] + param_2[5] * param_3[7] + param_2[4] * param_3[3];
  param_1[0xb] = param_2[0xb] * param_3[0xf] +
                 param_2[10] * param_3[0xb] + param_2[9] * param_3[7] + param_2[8] * param_3[3];
  param_1[0xf] = param_2[0xf] * param_3[0xf] +
                 param_2[0xe] * param_3[0xb] + param_2[0xd] * param_3[7] + param_2[0xc] * param_3[3]
  ;
  return param_1;
}



/* @0040c408 file=? name=FUN_0040c408 */

float * __cdecl FUN_0040c408(float *param_1,float *param_2,float *param_3)

{
  *param_1 = param_2[3] * param_3[3] +
             param_2[2] * param_3[2] + param_2[1] * param_3[1] + *param_2 * *param_3;
  param_1[4] = param_2[7] * param_3[3] +
               param_2[6] * param_3[2] + param_2[5] * param_3[1] + param_2[4] * *param_3;
  param_1[8] = param_2[0xb] * param_3[3] +
               param_2[10] * param_3[2] + param_2[9] * param_3[1] + param_2[8] * *param_3;
  param_1[0xc] = param_2[0xf] * param_3[3] +
                 param_2[0xe] * param_3[2] + param_2[0xd] * param_3[1] + param_2[0xc] * *param_3;
  param_1[1] = param_2[3] * param_3[7] +
               param_2[2] * param_3[6] + param_2[1] * param_3[5] + *param_2 * param_3[4];
  param_1[5] = param_2[7] * param_3[7] +
               param_2[6] * param_3[6] + param_2[5] * param_3[5] + param_2[4] * param_3[4];
  param_1[9] = param_2[0xb] * param_3[7] +
               param_2[10] * param_3[6] + param_2[9] * param_3[5] + param_2[8] * param_3[4];
  param_1[0xd] = param_2[0xf] * param_3[7] +
                 param_2[0xe] * param_3[6] + param_2[0xd] * param_3[5] + param_2[0xc] * param_3[4];
  param_1[2] = param_2[3] * param_3[0xb] +
               param_2[2] * param_3[10] + param_2[1] * param_3[9] + *param_2 * param_3[8];
  param_1[6] = param_2[7] * param_3[0xb] +
               param_2[6] * param_3[10] + param_2[5] * param_3[9] + param_2[4] * param_3[8];
  param_1[10] = param_2[0xb] * param_3[0xb] +
                param_2[10] * param_3[10] + param_2[9] * param_3[9] + param_2[8] * param_3[8];
  param_1[0xe] = param_2[0xf] * param_3[0xb] +
                 param_2[0xe] * param_3[10] + param_2[0xd] * param_3[9] + param_2[0xc] * param_3[8];
  param_1[3] = param_2[3];
  param_1[7] = param_2[7];
  param_1[0xb] = param_2[0xb];
  param_1[0xf] = param_2[0xf];
  return param_1;
}



/* @0040c5b4 file=? name=FUN_0040c5b4 */

float * __cdecl FUN_0040c5b4(float *param_1,float *param_2,float *param_3)

{
  *param_1 = param_2[8] * param_3[8] + param_2[4] * param_3[4] + *param_2 * *param_3;
  param_1[4] = param_2[9] * param_3[8] + param_2[5] * param_3[4] + param_2[1] * *param_3;
  param_1[8] = param_2[10] * param_3[8] + param_2[6] * param_3[4] + param_2[2] * *param_3;
  param_1[0xc] = param_2[0xb] * param_3[8] + param_2[7] * param_3[4] + param_2[3] * *param_3 +
                 param_3[0xc];
  param_1[1] = param_2[8] * param_3[9] + param_2[4] * param_3[5] + *param_2 * param_3[1];
  param_1[5] = param_2[9] * param_3[9] + param_2[5] * param_3[5] + param_2[1] * param_3[1];
  param_1[9] = param_2[10] * param_3[9] + param_2[6] * param_3[5] + param_2[2] * param_3[1];
  param_1[0xd] = param_2[0xb] * param_3[9] + param_2[7] * param_3[5] + param_2[3] * param_3[1] +
                 param_3[0xd];
  param_1[2] = param_2[8] * param_3[10] + param_2[4] * param_3[6] + *param_2 * param_3[2];
  param_1[6] = param_2[9] * param_3[10] + param_2[5] * param_3[6] + param_2[1] * param_3[2];
  param_1[10] = param_2[10] * param_3[10] + param_2[6] * param_3[6] + param_2[2] * param_3[2];
  param_1[0xe] = param_2[0xb] * param_3[10] + param_2[7] * param_3[6] + param_2[3] * param_3[2] +
                 param_3[0xe];
  param_1[3] = param_2[8] * param_3[0xb] + param_2[4] * param_3[7] + *param_2 * param_3[3];
  param_1[7] = param_2[9] * param_3[0xb] + param_2[5] * param_3[7] + param_2[1] * param_3[3];
  param_1[0xb] = param_2[10] * param_3[0xb] + param_2[6] * param_3[7] + param_2[2] * param_3[3];
  param_1[0xf] = param_2[0xb] * param_3[0xb] + param_2[7] * param_3[7] + param_2[3] * param_3[3] +
                 param_3[0xf];
  return param_1;
}



/* @0040c758 file=? name=FUN_0040c758 */

float * __cdecl FUN_0040c758(float *param_1,float *param_2,float *param_3)

{
  FUN_0040b104(param_1,param_2,param_3);
  param_1[3] = 0.0;
  param_1[7] = 0.0;
  param_1[0xb] = 0.0;
  param_1[0xf] = 1.0;
  return param_1;
}



/* @0040c78c file=? name=FUN_0040c78c */

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

void __cdecl
FUN_0040c78c(undefined4 *param_1,float param_2,float param_3,float param_4,float param_5,
            float param_6)

{
  *param_1 = 0x3f800000;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 0;
  param_1[5] = 0x3f800000;
  param_1[6] = 0;
  param_1[7] = 0;
  param_1[0xc] = param_4 * param_6 * param_2;
  param_1[8] = -(param_4 * param_6);
  param_1[0xd] = param_5 * param_6 * param_2;
  param_1[9] = -(param_5 * param_6);
  param_1[10] = param_2 * -param_3 * param_6;
  param_1[0xb] = (_DAT_0040c82c - (float)param_1[10]) * param_2;
  param_1[0xe] = -param_3 * param_6;
  param_1[0xf] = _DAT_0040c82c - (float)param_1[10];
  return;
}



/* @0040cdb4 file=? name=FUN_0040cdb4 */

undefined4 * __cdecl FUN_0040cdb4(undefined4 *param_1,undefined4 *param_2)

{
  FUN_004d4918(param_1,param_2,0x30);
  param_1[0xc] = 0;
  param_1[0xd] = 0;
  param_1[0xe] = 0;
  param_1[0xf] = 0x3f800000;
  return param_1;
}



/* @0040cdf4 file=? name=FUN_0040cdf4 */

void __cdecl FUN_0040cdf4(float *param_1,float param_2,float *param_3)

{
  float local_10 [3];
  
  FUN_004086ac(local_10,param_1 + 3,param_2);
  FUN_004085ec(param_3,param_1,local_10);
  return;
}



/* @0040ce2c file=? name=FUN_0040ce2c */

float10 __cdecl FUN_0040ce2c(float *param_1,float *param_2)

{
  float local_10;
  float local_c;
  float local_8;
  
  FUN_00408644(&local_10,param_2,param_1);
  return (float10)local_8 * (float10)param_1[5] +
         (float10)local_c * (float10)param_1[4] + (float10)local_10 * (float10)param_1[3];
}



/* @0040ce64 file=? name=FUN_0040ce64 */

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

float10 __cdecl FUN_0040ce64(float *param_1,float *param_2,float *param_3)

{
  float10 fVar1;
  float local_8;
  
  *param_3 = param_2[2] * param_1[5] + param_2[1] * param_1[4] + *param_2 * param_1[3];
  local_8 = (param_2[2] * param_1[2] + param_2[1] * param_1[1] + *param_2 * *param_1) - param_2[3];
  fVar1 = FUN_004dcd00((double)*param_3);
  if ((float10)_DAT_0040cee4 < fVar1) {
    local_8 = local_8 / -*param_3;
  }
  return (float10)local_8;
}



/* @0040cfb8 file=? name=FUN_0040cfb8 */

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

float10 __cdecl
FUN_0040cfb8(float *param_1,float *param_2,float *param_3,float *param_4,float *param_5,
            float *param_6,float *param_7,undefined4 *param_8)

{
  float10 fVar1;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  float local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  FUN_00408644(&local_18,param_1,param_4);
  FUN_00408644(&local_24,param_2,param_5);
  local_c = local_1c * local_1c + local_20 * local_20 + local_24 * local_24;
  local_8 = local_c;
  fVar1 = FUN_004dcd00((double)local_c);
  if ((float10)_DAT_0040d0fc < fVar1) {
    *param_8 = 0;
    *param_7 = (local_10 * local_1c + local_14 * local_20 + local_18 * local_24) / -local_8;
    FUN_00408614(&local_30,&local_18,&local_24,*param_7);
    FUN_00408614(param_3,param_1,param_2,*param_7);
    FUN_00408614(param_6,param_4,param_5,*param_7);
    fVar1 = FUN_004dd138((double)(local_28 * local_28 + local_2c * local_2c + local_30 * local_30));
  }
  else {
    *param_8 = 1;
    fVar1 = FUN_004dd138((double)(local_10 * local_10 + local_14 * local_14 + local_18 * local_18));
  }
  return (float10)(float)fVar1;
}



/* @0040d100 file=? name=FUN_0040d100 */

int __cdecl FUN_0040d100(int param_1,float *param_2)

{
  float10 fVar1;
  
  fVar1 = FUN_004dd138((double)(param_2[2] * param_2[2] +
                               param_2[1] * param_2[1] + *param_2 * *param_2));
  *(float *)(param_1 + 0x18) = (float)fVar1;
  *(float *)(param_1 + 0xc) = *param_2 / *(float *)(param_1 + 0x18);
  *(float *)(param_1 + 0x10) = param_2[1] / *(float *)(param_1 + 0x18);
  *(float *)(param_1 + 0x14) = param_2[2] / *(float *)(param_1 + 0x18);
  return param_1;
}



/* @0040d150 file=? name=FUN_0040d150 */

void __cdecl FUN_0040d150(undefined4 *param_1,undefined4 *param_2)

{
  *param_1 = *param_2;
  param_1[1] = param_2[1];
  param_1[2] = param_2[2];
  return;
}



/* @0040d16c file=? name=FUN_0040d16c */

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

float10 __cdecl FUN_0040d16c(float *param_1,float *param_2,float *param_3)

{
  float fVar1;
  float10 fVar2;
  
  *param_3 = param_1[5] * param_2[2] + param_1[4] * param_2[1] + param_1[3] * *param_2;
  fVar2 = FUN_004dcd00((double)*param_3);
  fVar1 = _DAT_0040d1fc;
  if ((float10)_DAT_0040d1f8 < fVar2) {
    fVar1 = -((param_2[2] * param_1[2] + param_2[1] * param_1[1] + *param_2 * *param_1) - param_2[3]
             ) / *param_3;
  }
  return (float10)fVar1;
}



/* @0040d210 file=? name=FUN_0040d210 */

float * __cdecl FUN_0040d210(float *param_1,float *param_2,float *param_3)

{
  if (*param_3 < *param_2) {
    *param_1 = *param_3;
    param_1[1] = *param_2;
  }
  else {
    *param_1 = *param_2;
    param_1[1] = *param_3;
  }
  if (param_3[1] < param_2[1]) {
    param_1[2] = param_3[1];
    param_1[3] = param_2[1];
  }
  else {
    param_1[2] = param_2[1];
    param_1[3] = param_3[1];
  }
  if (param_3[2] < param_2[2]) {
    param_1[4] = param_3[2];
    param_1[5] = param_2[2];
  }
  else {
    param_1[4] = param_2[2];
    param_1[5] = param_3[2];
  }
  return param_1;
}



/* @0040d28c file=? name=FUN_0040d28c */

void __cdecl FUN_0040d28c(undefined4 *param_1,undefined4 *param_2)

{
  *param_1 = *param_2;
  param_1[1] = param_2[1];
  param_1[2] = param_2[2];
  param_1[3] = param_2[3];
  param_1[4] = param_2[4];
  param_1[5] = param_2[5];
  return;
}



/* @0040d2bc file=? name=FUN_0040d2bc */

float * __cdecl FUN_0040d2bc(float *param_1,float *param_2,float *param_3)

{
  float fVar1;
  
  if (*param_2 <= *param_3) {
    fVar1 = *param_3;
  }
  else {
    fVar1 = *param_2;
  }
  *param_1 = fVar1;
  if (param_3[1] <= param_2[1]) {
    fVar1 = param_3[1];
  }
  else {
    fVar1 = param_2[1];
  }
  param_1[1] = fVar1;
  if (param_2[2] <= param_3[2]) {
    fVar1 = param_3[2];
  }
  else {
    fVar1 = param_2[2];
  }
  param_1[2] = fVar1;
  if (param_3[3] <= param_2[3]) {
    fVar1 = param_3[3];
  }
  else {
    fVar1 = param_2[3];
  }
  param_1[3] = fVar1;
  if (param_2[4] <= param_3[4]) {
    fVar1 = param_3[4];
  }
  else {
    fVar1 = param_2[4];
  }
  param_1[4] = fVar1;
  if (param_3[5] <= param_2[5]) {
    fVar1 = param_3[5];
  }
  else {
    fVar1 = param_2[5];
  }
  param_1[5] = fVar1;
  return param_1;
}



/* @0040d350 file=? name=FUN_0040d350 */

float * __cdecl FUN_0040d350(float *param_1,float *param_2)

{
  float fVar1;
  
  if (*param_1 <= *param_2) {
    if (*param_2 <= param_1[1]) {
      fVar1 = *param_2;
    }
    else {
      fVar1 = param_1[1];
    }
  }
  else {
    fVar1 = *param_1;
  }
  *param_2 = fVar1;
  if (param_1[2] <= param_2[1]) {
    if (param_2[1] <= param_1[3]) {
      fVar1 = param_2[1];
    }
    else {
      fVar1 = param_1[3];
    }
  }
  else {
    fVar1 = param_1[2];
  }
  param_2[1] = fVar1;
  if (param_1[4] <= param_2[2]) {
    if (param_2[2] <= param_1[5]) {
      fVar1 = param_2[2];
    }
    else {
      fVar1 = param_1[5];
    }
  }
  else {
    fVar1 = param_1[4];
  }
  param_2[2] = fVar1;
  return param_2;
}



/* @0040d3cc file=? name=FUN_0040d3cc */

undefined4 __cdecl FUN_0040d3cc(float *param_1,float *param_2)

{
  undefined4 uVar1;
  
  if ((((*param_2 < *param_1) || (param_1[1] < *param_2)) || (param_2[1] < param_1[2])) ||
     (((param_1[3] < param_2[1] || (param_2[2] < param_1[4])) || (param_1[5] < param_2[2])))) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
  }
  return uVar1;
}



/* @0040d420 file=? name=FUN_0040d420 */

undefined4 __cdecl FUN_0040d420(float *param_1,float *param_2)

{
  undefined4 uVar1;
  
  if ((((*param_2 < *param_1) || (param_1[1] < param_2[1])) || (param_2[2] < param_1[2])) ||
     (((param_1[3] < param_2[3] || (param_2[4] < param_1[4])) || (param_1[5] < param_2[5])))) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
  }
  return uVar1;
}



/* @0040d474 file=? name=FUN_0040d474 */

undefined4 __cdecl FUN_0040d474(float *param_1,float *param_2)

{
  undefined4 uVar1;
  
  if ((((param_2[1] < *param_1) || (param_1[1] < *param_2)) || (param_2[3] < param_1[2])) ||
     (((param_1[3] < param_2[2] || (param_2[5] < param_1[4])) || (param_1[5] < param_2[4])))) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
  }
  return uVar1;
}



/* @0040d4c8 file=? name=FUN_0040d4c8 */

undefined4 __cdecl FUN_0040d4c8(float *param_1)

{
  undefined4 uVar1;
  
  if (((param_1[1] < *param_1) || (param_1[3] < param_1[2])) || (param_1[5] < param_1[4])) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
  }
  return uVar1;
}



/* @0040d4fc file=? name=FUN_0040d4fc */

void __cdecl FUN_0040d4fc(int *param_1,float *param_2)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  int *piVar7;
  byte bVar8;
  
  bVar8 = 0x5d;
  fVar1 = param_2[5];
  fVar2 = param_2[4];
  fVar3 = param_2[3];
  fVar4 = param_2[2];
  fVar5 = param_2[1];
  fVar6 = *param_2;
  piVar7 = FUN_004db92c(param_1,0x5b);
  piVar7 = FUN_004db634(piVar7,(float10)fVar6);
  FUN_004dbb24(piVar7,&DAT_004e1130,(char *)0x0);
  piVar7 = FUN_004db634(piVar7,(float10)fVar5);
  FUN_004dbb24(piVar7,&DAT_004e1133,(char *)0x0);
  piVar7 = FUN_004db634(piVar7,(float10)fVar4);
  FUN_004dbb24(piVar7,&DAT_004e1137,(char *)0x0);
  piVar7 = FUN_004db634(piVar7,(float10)fVar3);
  FUN_004dbb24(piVar7,&DAT_004e113a,(char *)0x0);
  piVar7 = FUN_004db634(piVar7,(float10)fVar2);
  FUN_004dbb24(piVar7,&DAT_004e113e,(char *)0x0);
  piVar7 = FUN_004db634(piVar7,(float10)fVar1);
  FUN_004db92c(piVar7,bVar8);
  return;
}



/* @0040d62c file=? name=FUN_0040d62c */

void __cdecl FUN_0040d62c(char *param_1,float *param_2)

{
  uint *puVar1;
  float10 fVar2;
  uint local_80 [2];
  char *local_78;
  uint local_70 [2];
  char *local_68;
  uint local_60 [2];
  char *local_58;
  uint local_50 [2];
  char *local_48;
  uint local_40 [2];
  char *local_38;
  uint local_30 [2];
  char *local_28;
  uint *local_20;
  uint *local_1c;
  uint *local_18;
  uint *local_14;
  uint *local_10;
  uint *local_c;
  uint *local_8;
  
  puVar1 = (uint *)FUN_00402298(0x10);
  if (puVar1 == (uint *)0x0) {
    local_8 = (uint *)0x0;
  }
  else {
    local_8 = FUN_00402460(puVar1,param_1);
  }
  local_8[3] = local_8[3] + 1;
  FUN_00402838(local_30,local_8,0,(char *)0x0);
  puVar1 = (uint *)FUN_00402298(0x10);
  if (puVar1 == (uint *)0x0) {
    local_c = (uint *)0x0;
  }
  else {
    local_c = FUN_00402460(puVar1,local_28);
  }
  local_c[3] = local_c[3] + 1;
  FUN_004024d8((int *)local_30,2);
  fVar2 = (float10)FUN_004dd1cc(local_c[2]);
  *param_2 = (float)fVar2;
  puVar1 = local_c + 3;
  *puVar1 = *puVar1 - 1;
  if (*puVar1 == 0) {
    FUN_004024d8((int *)local_c,3);
  }
  FUN_00402838(local_40,local_8,1,(char *)0x0);
  puVar1 = (uint *)FUN_00402298(0x10);
  if (puVar1 == (uint *)0x0) {
    local_10 = (uint *)0x0;
  }
  else {
    local_10 = FUN_00402460(puVar1,local_38);
  }
  local_10[3] = local_10[3] + 1;
  FUN_004024d8((int *)local_40,2);
  fVar2 = (float10)FUN_004dd1cc(local_10[2]);
  param_2[2] = (float)fVar2;
  puVar1 = local_10 + 3;
  *puVar1 = *puVar1 - 1;
  if (*puVar1 == 0) {
    FUN_004024d8((int *)local_10,3);
  }
  FUN_00402838(local_50,local_8,2,(char *)0x0);
  puVar1 = (uint *)FUN_00402298(0x10);
  if (puVar1 == (uint *)0x0) {
    local_14 = (uint *)0x0;
  }
  else {
    local_14 = FUN_00402460(puVar1,local_48);
  }
  local_14[3] = local_14[3] + 1;
  FUN_004024d8((int *)local_50,2);
  fVar2 = (float10)FUN_004dd1cc(local_14[2]);
  param_2[4] = (float)fVar2;
  puVar1 = local_14 + 3;
  *puVar1 = *puVar1 - 1;
  if (*puVar1 == 0) {
    FUN_004024d8((int *)local_14,3);
  }
  FUN_00402838(local_60,local_8,3,(char *)0x0);
  puVar1 = (uint *)FUN_00402298(0x10);
  if (puVar1 == (uint *)0x0) {
    local_18 = (uint *)0x0;
  }
  else {
    local_18 = FUN_00402460(puVar1,local_58);
  }
  local_18[3] = local_18[3] + 1;
  FUN_004024d8((int *)local_60,2);
  fVar2 = (float10)FUN_004dd1cc(local_18[2]);
  param_2[1] = (float)fVar2;
  puVar1 = local_18 + 3;
  *puVar1 = *puVar1 - 1;
  if (*puVar1 == 0) {
    FUN_004024d8((int *)local_18,3);
  }
  FUN_00402838(local_70,local_8,4,(char *)0x0);
  puVar1 = (uint *)FUN_00402298(0x10);
  if (puVar1 == (uint *)0x0) {
    local_1c = (uint *)0x0;
  }
  else {
    local_1c = FUN_00402460(puVar1,local_68);
  }
  local_1c[3] = local_1c[3] + 1;
  FUN_004024d8((int *)local_70,2);
  fVar2 = (float10)FUN_004dd1cc(local_1c[2]);
  param_2[3] = (float)fVar2;
  puVar1 = local_1c + 3;
  *puVar1 = *puVar1 - 1;
  if (*puVar1 == 0) {
    FUN_004024d8((int *)local_1c,3);
  }
  FUN_00402838(local_80,local_8,5,(char *)0x0);
  puVar1 = (uint *)FUN_00402298(0x10);
  if (puVar1 == (uint *)0x0) {
    local_20 = (uint *)0x0;
  }
  else {
    local_20 = FUN_00402460(puVar1,local_78);
  }
  local_20[3] = local_20[3] + 1;
  FUN_004024d8((int *)local_80,2);
  fVar2 = (float10)FUN_004dd1cc(local_20[2]);
  param_2[5] = (float)fVar2;
  puVar1 = local_20 + 3;
  *puVar1 = *puVar1 - 1;
  if (*puVar1 == 0) {
    FUN_004024d8((int *)local_20,3);
  }
  puVar1 = local_8 + 3;
  *puVar1 = *puVar1 - 1;
  if (*puVar1 == 0) {
    FUN_004024d8((int *)local_8,3);
  }
  return;
}



/* @0040d908 file=? name=FUN_0040d908 */

int FUN_0040d908(int param_1,int *param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  int extraout_EAX;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  char acStack_38 [52];
  
  bVar1 = FUN_004040d8(param_1,s_COLLISION_004e1141,s_extentcount_004e114b,param_2);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    FUN_004dbb24((int *)&DAT_00524e68,s_No__COLLISION__entry______004e1157,(char *)0x0);
    FUN_004d9c38((int *)&DAT_00524e68);
    FUN_004036a0(1);
  }
  FUN_004de998((int *)0x0,0x18,*param_2,1,FUN_0040daba);
  for (iVar8 = 0; iVar8 < *param_2; iVar8 = iVar8 + 1) {
    FUN_004d7f10(acStack_38,s_extent__d_004e1171);
    iVar2 = FUN_00404118(param_1,acStack_38,s_extminX_004e117b,
                         (float *)(iVar8 * 0x18 + extraout_EAX));
    iVar3 = FUN_00404118(param_1,acStack_38,s_extmaxX_004e1183,
                         (float *)(iVar8 * 0x18 + extraout_EAX + 4));
    iVar4 = FUN_00404118(param_1,acStack_38,s_extminY_004e118b,
                         (float *)(iVar8 * 0x18 + extraout_EAX + 8));
    iVar5 = FUN_00404118(param_1,acStack_38,s_extmaxY_004e1193,
                         (float *)(iVar8 * 0x18 + extraout_EAX + 0xc));
    iVar6 = FUN_00404118(param_1,acStack_38,s_extminZ_004e119b,
                         (float *)(iVar8 * 0x18 + extraout_EAX + 0x10));
    iVar7 = FUN_00404118(param_1,acStack_38,s_extmaxZ_004e11a3,
                         (float *)(iVar8 * 0x18 + extraout_EAX + 0x14));
    if (((((iVar2 == 0 || iVar3 == 0) || iVar4 == 0) || iVar5 == 0) || iVar6 == 0) || iVar7 == 0) {
      FUN_004036a0(1);
    }
  }
  return extraout_EAX;
}



/* @0040d90e file=? name=FUN_0040d90e */

int FUN_0040d90e(void)

{
  bool bVar1;
  undefined3 extraout_var;
  int extraout_EAX;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  int unaff_EBP;
  
  bVar1 = FUN_004040d8(*(int *)(unaff_EBP + 8),s_COLLISION_004e1141,s_extentcount_004e114b,
                       *(int **)(unaff_EBP + 0xc));
  if (CONCAT31(extraout_var,bVar1) == 0) {
    FUN_004dbb24((int *)&DAT_00524e68,s_No__COLLISION__entry______004e1157,(char *)0x0);
    FUN_004d9c38((int *)&DAT_00524e68);
    FUN_004036a0(1);
  }
  FUN_004de998((int *)0x0,0x18,**(int **)(unaff_EBP + 0xc),1,FUN_0040daba);
  for (iVar8 = 0; iVar8 < **(int **)(unaff_EBP + 0xc); iVar8 = iVar8 + 1) {
    FUN_004d7f10((undefined1 *)(unaff_EBP + -0x34),s_extent__d_004e1171);
    iVar2 = FUN_00404118(*(int *)(unaff_EBP + 8),(char *)(unaff_EBP + -0x34),s_extminX_004e117b,
                         (float *)(iVar8 * 0x18 + extraout_EAX));
    iVar3 = FUN_00404118(*(int *)(unaff_EBP + 8),(char *)(unaff_EBP + -0x34),s_extmaxX_004e1183,
                         (float *)(iVar8 * 0x18 + extraout_EAX + 4));
    iVar4 = FUN_00404118(*(int *)(unaff_EBP + 8),(char *)(unaff_EBP + -0x34),s_extminY_004e118b,
                         (float *)(iVar8 * 0x18 + extraout_EAX + 8));
    iVar5 = FUN_00404118(*(int *)(unaff_EBP + 8),(char *)(unaff_EBP + -0x34),s_extmaxY_004e1193,
                         (float *)(iVar8 * 0x18 + extraout_EAX + 0xc));
    iVar6 = FUN_00404118(*(int *)(unaff_EBP + 8),(char *)(unaff_EBP + -0x34),s_extminZ_004e119b,
                         (float *)(iVar8 * 0x18 + extraout_EAX + 0x10));
    iVar7 = FUN_00404118(*(int *)(unaff_EBP + 8),(char *)(unaff_EBP + -0x34),s_extmaxZ_004e11a3,
                         (float *)(iVar8 * 0x18 + extraout_EAX + 0x14));
    if (((((iVar2 == 0 || iVar3 == 0) || iVar4 == 0) || iVar5 == 0) || iVar6 == 0) || iVar7 == 0) {
      FUN_004036a0(1);
    }
  }
  return extraout_EAX;
}



/* @0040daba file=? name=FUN_0040daba */

undefined4 __cdecl FUN_0040daba(undefined4 param_1)

{
  return param_1;
}



/* @0040dac4 file=? name=FUN_0040dac4 */

undefined4 * __cdecl FUN_0040dac4(undefined4 *param_1,undefined4 *param_2)

{
  FUN_0040d28c(param_1,param_2);
  param_1[6] = &PTR_FUN_004e11c4;
  return param_1;
}



/* @0040dae4 file=? name=FUN_0040dae4 */

void __cdecl FUN_0040dae4(int param_1)

{
  *(undefined ***)(param_1 + 0x18) = &PTR_FUN_004e11c4;
  return;
}



/* @0040daf4 file=? name=FUN_0040daf4 */

void __cdecl FUN_0040daf4(float *param_1,float *param_2)

{
  *param_1 = *param_2 + *param_1;
  param_1[1] = *param_2 + param_1[1];
  param_1[2] = param_2[1] + param_1[2];
  param_1[3] = param_2[1] + param_1[3];
  param_1[4] = param_2[2] + param_1[4];
  param_1[5] = param_2[2] + param_1[5];
  return;
}



/* @0040db34 file=? name=FUN_0040db34 */

void __cdecl FUN_0040db34(int *param_1,byte param_2)

{
  if ((param_1 != (int *)0x0) && (param_1[6] = (int)&PTR_FUN_004e11c4, (param_2 & 1) != 0)) {
    FUN_004022d0(param_1);
  }
  return;
}



/* @0040db54 file=? name=FUN_0040db54 */

undefined4 __cdecl FUN_0040db54(float *param_1,float *param_2)

{
  int iVar1;
  undefined4 uVar2;
  float local_1c [6];
  
  iVar1 = FUN_0040d474(param_1,param_2);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    FUN_0040d2bc(local_1c,param_1,param_2);
    uVar2 = (**(code **)((int)param_1[6] + 4))(param_1,local_1c);
  }
  return uVar2;
}



/* @0040db98 file=? name=FUN_0040db98 */

undefined4 __cdecl FUN_0040db98(float *param_1,float *param_2,float *param_3)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_0040d474(param_1,param_2);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    FUN_0040d2bc(param_3,param_1,param_2);
    uVar2 = (**(code **)((int)param_1[6] + 4))(param_1,param_3);
  }
  return uVar2;
}



/* @0040dbd4 file=? name=FUN_0040dbd4 */

undefined4 __cdecl FUN_0040dbd4(float *param_1,float *param_2)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_0040d3cc(param_1,param_2);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    uVar2 = (**(code **)((int)param_1[6] + 8))(param_1,param_2);
  }
  return uVar2;
}



/* @0040dc00 file=? name=FUN_0040dc00 */

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

float10 __cdecl FUN_0040dc00(float *param_1,float *param_2)

{
  float10 fVar1;
  
  if ((((*param_1 <= *param_2) && (*param_2 <= param_1[1])) && (param_1[2] <= param_2[1])) &&
     ((param_1[4] <= param_2[2] && (param_2[2] <= param_1[5])))) {
    fVar1 = (float10)(**(code **)((int)param_1[6] + 0xc))(param_1,param_2);
    return fVar1;
  }
  return (float10)_DAT_0040dc54;
}



/* @0040dc58 file=? name=FUN_0040dc58 */

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

undefined4 __cdecl FUN_0040dc58(int param_1,int param_2)

{
  float fVar1;
  bool bVar2;
  bool bVar3;
  undefined4 uVar4;
  int iVar5;
  uint uVar6;
  float10 fVar7;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  bVar2 = false;
  bVar3 = false;
  uVar6 = 0;
  do {
    iVar5 = (int)uVar6 >> 1;
    if ((uVar6 & 1) == 0) {
      local_10 = *(float *)(param_1 + uVar6 * 4) - *(float *)(param_2 + iVar5 * 4);
      local_14 = -*(float *)(param_2 + 0xc + iVar5 * 4);
    }
    else {
      local_10 = *(float *)(param_2 + iVar5 * 4) - *(float *)(param_1 + uVar6 * 4);
      local_14 = *(float *)(param_2 + 0xc + iVar5 * 4);
    }
    fVar7 = FUN_004dcd00((double)local_14);
    if ((float10)_DAT_0040dda4 < fVar7) {
      fVar1 = -local_10 / local_14;
      if (_DAT_0040dda8 <= local_14) {
        if (bVar3) {
          if (fVar1 < local_c) {
            local_c = fVar1;
          }
        }
        else {
          bVar3 = true;
          local_c = fVar1;
        }
        if (local_c < _DAT_0040dda8) {
          return 0;
        }
      }
      else {
        if (bVar2) {
          if (local_8 <= fVar1) {
            local_8 = fVar1;
          }
        }
        else {
          bVar2 = true;
          local_8 = fVar1;
        }
        if (*(float *)(param_2 + 0x18) < local_8) {
          return 0;
        }
      }
    }
    else if (_DAT_0040dda8 < local_10) {
      return 0;
    }
    uVar6 = uVar6 + 1;
    if (5 < (int)uVar6) {
      if (local_c < local_8) {
        uVar4 = 0;
      }
      else {
        uVar4 = (**(code **)(*(int *)(param_1 + 0x18) + 0x10))(param_1,param_2,local_8,local_c);
      }
      return uVar4;
    }
  } while( true );
}



/* @0040ddb8 file=? name=FUN_0040ddb8 */

undefined4 FUN_0040ddb8(void)

{
  return 1;
}



/* @0040ddc4 file=? name=FUN_0040ddc4 */

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

float10 __cdecl FUN_0040ddc4(int param_1,int param_2)

{
  float fVar1;
  float fVar2;
  
  fVar1 = *(float *)(param_2 + 4) - *(float *)(param_1 + 0xc);
  fVar2 = _DAT_0040ddf4;
  if (_DAT_0040ddf4 < fVar1) {
    fVar2 = fVar1;
  }
  return (float10)fVar2;
}



/* @0040de34 file=? name=FUN_0040de34 */

undefined4 FUN_0040de34(void)

{
  return 1;
}



/* @0040de40 file=? name=FUN_0040de40 */

undefined4 * __cdecl FUN_0040de40(undefined4 *param_1,int param_2)

{
  undefined4 extraout_EAX;
  
  FUN_004de998((int *)0x0,0x1c,param_2,1,FUN_0040df25);
  *param_1 = extraout_EAX;
  param_1[2] = param_2;
  param_1[1] = *param_1;
  param_1[3] = param_1[2];
  return param_1;
}



/* @0040de78 file=? name=FUN_0040de78 */

void __cdecl FUN_0040de78(int param_1,undefined4 param_2,undefined4 *param_3)

{
  int iVar1;
  undefined4 *puVar2;
  
  puVar2 = *(undefined4 **)(param_1 + 4);
  *puVar2 = param_2;
  for (iVar1 = 6; puVar2 = puVar2 + 1, iVar1 != 0; iVar1 = iVar1 + -1) {
    *puVar2 = *param_3;
    param_3 = param_3 + 1;
  }
  *(int *)(param_1 + 4) = *(int *)(param_1 + 4) + 0x1c;
  *(int *)(param_1 + 0xc) = *(int *)(param_1 + 0xc) + -1;
  return;
}



/* @0040dea4 file=? name=FUN_0040dea4 */

undefined4 FUN_0040dea4(void)

{
  return 1;
}



/* @0040deb0 file=? name=FUN_0040deb0 */

int __cdecl FUN_0040deb0(int param_1,undefined4 param_2)

{
  FUN_0040dae4(param_1);
  *(undefined ***)(param_1 + 0x18) = &PTR_FUN_004e11ac;
  *(undefined4 *)(param_1 + 0x1c) = param_2;
  return param_1;
}



/* @0040ded0 file=? name=FUN_0040ded0 */

undefined4 * __cdecl FUN_0040ded0(undefined4 *param_1,undefined4 *param_2,undefined4 param_3)

{
  FUN_0040dac4(param_1,param_2);
  param_1[6] = &PTR_FUN_004e11ac;
  param_1[7] = param_3;
  return param_1;
}



/* @0040def8 file=? name=FUN_0040def8 */

void __cdecl FUN_0040def8(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e11ac;
    FUN_0040db34(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0040df25 file=? name=FUN_0040df25 */

undefined4 __cdecl FUN_0040df25(undefined4 param_1)

{
  return param_1;
}



/* @0040df68 file=? name=FUN_0040df68 */

undefined4 * __cdecl FUN_0040df68(undefined4 *param_1,undefined4 param_2,undefined4 *param_3)

{
  undefined4 *puVar1;
  int iVar2;
  
  puVar1 = param_1;
  for (iVar2 = 6; iVar2 != 0; iVar2 = iVar2 + -1) {
    *puVar1 = *param_3;
    param_3 = param_3 + 1;
    puVar1 = puVar1 + 1;
  }
  param_1[6] = param_2;
  param_1[0xd] = 0;
  iVar2 = 0;
  puVar1 = param_1 + 7;
  do {
    *puVar1 = 0;
    iVar2 = iVar2 + 1;
    puVar1 = puVar1 + 1;
  } while (iVar2 < 6);
  return param_1;
}



/* @0040dfa4 file=? name=FUN_0040dfa4 */

void __cdecl FUN_0040dfa4(undefined4 *param_1,byte param_2)

{
  undefined4 *puVar1;
  int iVar2;
  
  if (param_1 != (undefined4 *)0x0) {
    iVar2 = 0;
    puVar1 = param_1 + 7;
    do {
      if ((undefined4 *)*puVar1 != (undefined4 *)0x0) {
        FUN_0040dfa4((undefined4 *)*puVar1,3);
      }
      iVar2 = iVar2 + 1;
      puVar1 = puVar1 + 1;
    } while (iVar2 < 6);
    if ((undefined4 *)param_1[0xd] != (undefined4 *)0x0) {
      FUN_0040dfa4((undefined4 *)param_1[0xd],3);
    }
    if ((param_2 & 1) != 0) {
      FUN_00402f98(0x4e11dc,param_1);
    }
  }
  return;
}



/* @0040e000 file=? name=FUN_0040e000 */

void __cdecl FUN_0040e000(int param_1,int param_2,undefined4 *param_3)

{
  uint uVar1;
  int iVar2;
  undefined4 *puVar3;
  uint uVar4;
  float local_30 [6];
  uint *local_18;
  undefined4 *local_14;
  float local_10;
  uint local_c;
  int local_8;
  
  FUN_0040d28c(local_30,param_3);
  local_8 = 0;
  local_18 = &DAT_004e1204;
  do {
    uVar1 = *local_18;
    uVar4 = uVar1 ^ 1;
    if ((uVar1 & 1) == 0) {
      if (local_30[uVar1] < *(float *)(param_1 + uVar1 * 4)) {
        local_c = (uint)(*(float *)(param_1 + uVar1 * 4) < local_30[uVar4]);
        goto LAB_0040e07f;
      }
    }
    else if (*(float *)(param_1 + uVar1 * 4) < local_30[uVar1]) {
      local_c = (uint)(local_30[uVar4] < *(float *)(param_1 + uVar1 * 4));
LAB_0040e07f:
      if (local_c != 0) {
        local_10 = local_30[uVar4];
        local_30[uVar4] = *(float *)(param_1 + uVar1 * 4);
      }
      iVar2 = (**(code **)(*(int *)(param_2 + 0x18) + 4))(param_2,local_30);
      if (iVar2 != 0) {
        if (*(int *)(param_1 + 0x1c + uVar1 * 4) == 0) {
          local_14 = FUN_00402f74(0x4e11dc);
          if (local_14 == (undefined4 *)0x0) {
            puVar3 = (undefined4 *)0x0;
          }
          else {
            puVar3 = FUN_0040df68(local_14,param_2,local_30);
          }
          *(undefined4 **)(param_1 + 0x1c + uVar1 * 4) = puVar3;
        }
        else {
          FUN_0040e000(*(int *)(param_1 + 0x1c + uVar1 * 4),param_2,local_30);
        }
      }
      if (local_c == 0) {
        return;
      }
      local_30[uVar4] = local_10;
      local_30[uVar1] = *(float *)(param_1 + uVar1 * 4);
    }
    local_8 = local_8 + 1;
    local_18 = local_18 + 1;
    if (5 < local_8) {
      iVar2 = (**(code **)(*(int *)(param_2 + 0x18) + 4))(param_2,local_30);
      if (iVar2 != 0) {
        if (*(int *)(param_1 + 0x34) == 0) {
          puVar3 = FUN_00402f74(0x4e11dc);
          if (puVar3 == (undefined4 *)0x0) {
            puVar3 = (undefined4 *)0x0;
          }
          else {
            puVar3 = FUN_0040df68(puVar3,param_2,local_30);
          }
          *(undefined4 **)(param_1 + 0x34) = puVar3;
        }
        else {
          FUN_0040e000(*(int *)(param_1 + 0x34),param_2,local_30);
        }
      }
      return;
    }
  } while( true );
}



/* @0040e184 file=? name=FUN_0040e184 */

void __cdecl FUN_0040e184(int param_1,int param_2,undefined4 *param_3)

{
  uint uVar1;
  int iVar2;
  uint uVar3;
  float local_2c [6];
  uint *local_14;
  float local_10;
  uint local_c;
  int local_8;
  
  if (*(int *)(param_1 + 0x18) == param_2) {
    *(undefined4 *)(param_1 + 0x18) = 0;
  }
  else {
    FUN_0040d28c(local_2c,param_3);
    local_8 = 0;
    local_14 = &DAT_004e1204;
    do {
      uVar1 = *local_14;
      uVar3 = uVar1 ^ 1;
      if ((uVar1 & 1) == 0) {
        if (local_2c[uVar1] < *(float *)(param_1 + uVar1 * 4)) {
          local_c = (uint)(*(float *)(param_1 + uVar1 * 4) < local_2c[uVar3]);
          goto LAB_0040e213;
        }
      }
      else if (*(float *)(param_1 + uVar1 * 4) < local_2c[uVar1]) {
        local_c = (uint)(local_2c[uVar3] < *(float *)(param_1 + uVar1 * 4));
LAB_0040e213:
        if (local_c != 0) {
          local_10 = local_2c[uVar3];
          local_2c[uVar3] = *(float *)(param_1 + uVar1 * 4);
        }
        iVar2 = (**(code **)(*(int *)(param_2 + 0x18) + 4))(param_2,local_2c);
        if (iVar2 != 0) {
          FUN_0040e184(*(int *)(param_1 + 0x1c + uVar1 * 4),param_2,local_2c);
        }
        if (local_c == 0) {
          return;
        }
        local_2c[uVar3] = local_10;
        local_2c[uVar1] = *(float *)(param_1 + uVar1 * 4);
      }
      local_8 = local_8 + 1;
      local_14 = local_14 + 1;
    } while (local_8 < 6);
    iVar2 = (**(code **)(*(int *)(param_2 + 0x18) + 4))(param_2,local_2c);
    if (iVar2 != 0) {
      FUN_0040e184(*(int *)(param_1 + 0x34),param_2,local_2c);
    }
  }
  return;
}



/* @0040e2ac file=? name=FUN_0040e2ac */

int __cdecl FUN_0040e2ac(int param_1,int param_2,int param_3)

{
  uint uVar1;
  int iVar2;
  uint *puVar3;
  int local_8;
  
LAB_0040e2c0:
  do {
    iVar2 = param_1;
    puVar3 = &DAT_004e1204;
    local_8 = 0;
    do {
      uVar1 = *puVar3;
      if ((uVar1 & 1) == 0) {
        if (*(float *)(param_2 + uVar1 * 4) < *(float *)(iVar2 + uVar1 * 4)) {
          if (*(float *)(iVar2 + uVar1 * 4) <= *(float *)(param_2 + (uVar1 ^ 1) * 4)) {
            if (param_3 == 0) {
              return iVar2;
            }
            return param_3;
          }
          goto LAB_0040e323;
        }
      }
      else if (*(float *)(iVar2 + uVar1 * 4) < *(float *)(param_2 + uVar1 * 4)) {
        if (*(float *)(param_2 + (uVar1 ^ 1) * 4) <= *(float *)(iVar2 + uVar1 * 4)) {
          if (param_3 == 0) {
            return iVar2;
          }
          return param_3;
        }
LAB_0040e323:
        if (*(int *)(iVar2 + 0x1c + uVar1 * 4) == 0) {
          if (param_3 == 0) {
            return iVar2;
          }
          return param_3;
        }
        param_1 = *(int *)(iVar2 + 0x1c + uVar1 * 4);
        goto LAB_0040e2c0;
      }
      local_8 = local_8 + 1;
      puVar3 = puVar3 + 1;
    } while (local_8 < 6);
    param_1 = *(int *)(iVar2 + 0x34);
    param_3 = iVar2;
    if (*(int *)(iVar2 + 0x34) == 0) {
      return iVar2;
    }
  } while( true );
}



/* @0040e36c file=? name=FUN_0040e36c */

int __cdecl FUN_0040e36c(int param_1,int param_2)

{
  uint uVar1;
  int iVar2;
  uint *puVar3;
  int local_8;
  
LAB_0040e37b:
  iVar2 = param_1;
  puVar3 = &DAT_004e1204;
  local_8 = 0;
  do {
    uVar1 = *puVar3;
    if ((uVar1 & 1) == 0) {
      if (*(float *)(param_2 + uVar1 * 4) < *(float *)(iVar2 + uVar1 * 4)) {
        if (*(float *)(iVar2 + uVar1 * 4) <= *(float *)(param_2 + (uVar1 ^ 1) * 4)) {
          return iVar2;
        }
        goto LAB_0040e3c5;
      }
    }
    else if (*(float *)(iVar2 + uVar1 * 4) < *(float *)(param_2 + uVar1 * 4)) break;
    local_8 = local_8 + 1;
    puVar3 = puVar3 + 1;
    if (3 < local_8) {
      return iVar2;
    }
  } while( true );
  if (*(float *)(param_2 + (uVar1 ^ 1) * 4) <= *(float *)(iVar2 + uVar1 * 4)) {
    return iVar2;
  }
LAB_0040e3c5:
  param_1 = *(int *)(iVar2 + 0x1c + uVar1 * 4);
  if (param_1 == 0) {
    return iVar2;
  }
  goto LAB_0040e37b;
}



/* @0040e3ec file=? name=FUN_0040e3ec */

undefined4 __cdecl FUN_0040e3ec(int param_1,int param_2,undefined4 param_3)

{
  uint uVar1;
  int iVar2;
  uint *puVar3;
  int local_8;
  
LAB_0040e3f7:
  do {
    puVar3 = &DAT_004e1204;
    local_8 = 0;
    do {
      uVar1 = *puVar3;
      if ((uVar1 & 1) == 0) {
        if (*(float *)(param_2 + ((int)uVar1 >> 1) * 4) < *(float *)(param_1 + uVar1 * 4))
        goto LAB_0040e42a;
      }
      else if (*(float *)(param_1 + uVar1 * 4) < *(float *)(param_2 + ((int)uVar1 >> 1) * 4)) {
LAB_0040e42a:
        param_1 = *(int *)(param_1 + 0x1c + uVar1 * 4);
        if (param_1 == 0) {
          return param_3;
        }
        goto LAB_0040e3f7;
      }
      local_8 = local_8 + 1;
      puVar3 = puVar3 + 1;
    } while (local_8 < 6);
    if (*(int *)(param_1 + 0x34) == 0) {
      iVar2 = *(int *)(param_1 + 0x18);
      if (iVar2 == 0) {
        param_3 = 0;
      }
      else {
        iVar2 = (**(code **)(*(int *)(iVar2 + 0x18) + 8))(iVar2,param_2);
        if (iVar2 != 0) {
          param_3 = *(undefined4 *)(param_1 + 0x18);
        }
      }
      return param_3;
    }
    iVar2 = *(int *)(param_1 + 0x18);
    if (iVar2 == 0) {
      param_3 = 0;
    }
    else {
      iVar2 = (**(code **)(*(int *)(iVar2 + 0x18) + 8))(iVar2,param_2);
      if (iVar2 != 0) {
        param_3 = *(undefined4 *)(param_1 + 0x18);
      }
    }
    param_1 = *(int *)(param_1 + 0x34);
  } while( true );
}



/* @0040e4ac file=? name=FUN_0040e4ac */

void __cdecl FUN_0040e4ac(int param_1,undefined4 param_2,undefined4 *param_3,int param_4)

{
  uint uVar1;
  int iVar2;
  int iVar3;
  uint uVar4;
  float local_2c [6];
  uint *local_14;
  float local_10;
  uint local_c;
  int local_8;
  
  FUN_0040d28c(local_2c,param_3);
  local_8 = 0;
  local_14 = &DAT_004e1204;
  do {
    uVar1 = *local_14;
    uVar4 = uVar1 ^ 1;
    if ((uVar1 & 1) == 0) {
      if (local_2c[uVar1] < *(float *)(param_1 + uVar1 * 4)) {
        local_c = (uint)(*(float *)(param_1 + uVar1 * 4) <= local_2c[uVar4]);
        goto LAB_0040e527;
      }
    }
    else if (*(float *)(param_1 + uVar1 * 4) < local_2c[uVar1]) {
      local_c = (uint)(local_2c[uVar4] <= *(float *)(param_1 + uVar1 * 4));
LAB_0040e527:
      if (local_c != 0) {
        local_10 = local_2c[uVar4];
        local_2c[uVar4] = *(float *)(param_1 + uVar1 * 4);
      }
      iVar2 = *(int *)(param_1 + 0x1c + uVar1 * 4);
      if (iVar2 != 0) {
        FUN_0040e4ac(iVar2,param_2,local_2c,param_4);
      }
      if (local_c == 0) {
        return;
      }
      if (*(int *)(param_4 + 0xc) == 0) {
        return;
      }
      local_2c[uVar4] = local_10;
      local_2c[uVar1] = *(float *)(param_1 + uVar1 * 4);
    }
    local_8 = local_8 + 1;
    local_14 = local_14 + 1;
    if (5 < local_8) {
      iVar3 = 0;
      iVar2 = *(int *)(param_1 + 0x18);
      if ((iVar2 != 0) &&
         (iVar2 = (**(code **)(*(int *)(iVar2 + 0x18) + 4))(iVar2,local_2c), iVar2 != 0)) {
        iVar3 = *(int *)(param_1 + 0x18);
      }
      if (*(int *)(param_1 + 0x34) != 0) {
        FUN_0040e4ac(*(int *)(param_1 + 0x34),param_2,local_2c,param_4);
      }
      if ((iVar3 != 0) && (*(int *)(param_4 + 0xc) != 0)) {
        FUN_0040de78(param_4,iVar3,local_2c);
      }
      return;
    }
  } while( true );
}



/* @0040e5f0 file=? name=FUN_0040e5f0 */

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

int __cdecl FUN_0040e5f0(int param_1,int param_2,float *param_3)

{
  uint uVar1;
  int iVar2;
  int iVar3;
  float10 fVar4;
  uint *local_10;
  float local_c;
  int local_8;
  
LAB_0040e601:
  local_8 = 0;
  local_10 = &DAT_004e1204;
  do {
    uVar1 = *local_10;
    if ((uVar1 & 1) == 0) {
      if (*(float *)(param_2 + ((int)uVar1 >> 1) * 4) < *(float *)(param_1 + uVar1 * 4)) break;
    }
    else if (*(float *)(param_1 + uVar1 * 4) < *(float *)(param_2 + ((int)uVar1 >> 1) * 4)) break;
    local_8 = local_8 + 1;
    local_10 = local_10 + 1;
    if (3 < local_8) {
      if (((*(float *)(param_1 + 0xc) < *(float *)(param_2 + 4)) && (*(int *)(param_1 + 0x28) != 0))
         && (iVar2 = FUN_0040e5f0(*(int *)(param_1 + 0x28),param_2,param_3), iVar2 != 0)) {
        return iVar2;
      }
      if (*(float *)(param_2 + 4) < *(float *)(param_1 + 8)) goto LAB_0040e725;
      if (*(int *)(param_1 + 0x18) == 0) {
LAB_0040e6dc:
        iVar2 = 0;
        *param_3 = -1.0;
      }
      else {
        iVar2 = *(int *)(param_1 + 0x18);
        fVar4 = (float10)(**(code **)(*(int *)(*(int *)(param_1 + 0x18) + 0x18) + 0xc))
                                   (*(int *)(param_1 + 0x18),param_2);
        *param_3 = (float)fVar4;
        if ((*param_3 == _DAT_0040e750) ||
           (*(float *)(param_2 + 4) - *param_3 < *(float *)(param_1 + 8))) goto LAB_0040e6dc;
      }
      if (((*(int *)(param_1 + 0x34) != 0) &&
          (iVar3 = FUN_0040e5f0(*(int *)(param_1 + 0x34),param_2,&local_c), iVar3 != 0)) &&
         ((local_c < *param_3 || (iVar2 == 0)))) {
        *param_3 = local_c;
        iVar2 = iVar3;
      }
      if (iVar2 != 0) {
        return iVar2;
      }
LAB_0040e725:
      if (*(int *)(param_1 + 0x24) != 0) {
        iVar2 = FUN_0040e5f0(*(int *)(param_1 + 0x24),param_2,param_3);
        return iVar2;
      }
      *param_3 = -1.0;
      return 0;
    }
  } while( true );
  param_1 = *(int *)(param_1 + 0x1c + uVar1 * 4);
  if (param_1 == 0) {
    *param_3 = -1.0;
    return 0;
  }
  goto LAB_0040e601;
}



/* @0040e754 file=? name=FUN_0040e754 */

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

int __cdecl FUN_0040e754(int param_1,int param_2)

{
  uint uVar1;
  int iVar2;
  int iVar3;
  float10 fVar4;
  uint local_60 [6];
  uint local_48;
  uint *local_44;
  uint *local_40;
  uint *local_3c;
  uint *local_38;
  uint *local_34;
  float local_30;
  int local_2c;
  int local_28;
  int local_24;
  int local_20;
  int local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  local_8 = 0.0;
  local_c = 0.0;
  local_1c = 0;
  local_20 = 6;
  local_24 = 0;
  local_28 = 0;
  local_2c = 0;
  local_3c = &local_48;
  local_38 = local_60;
  local_34 = &DAT_004e1204;
  do {
    uVar1 = *local_34;
    iVar2 = (int)uVar1 >> 1;
    if ((uVar1 & 1) == 0) {
      local_10 = *(float *)(param_1 + uVar1 * 4) - *(float *)(param_2 + iVar2 * 4);
      local_14 = -*(float *)(param_2 + 0xc + iVar2 * 4);
    }
    else {
      local_10 = *(float *)(param_2 + iVar2 * 4) - *(float *)(param_1 + uVar1 * 4);
      local_14 = *(float *)(param_2 + 0xc + iVar2 * 4);
    }
    local_30 = local_14;
    fVar4 = FUN_004dcd00((double)local_14);
    if ((float10)_DAT_0040ea58 < fVar4) {
      local_18 = -local_10 / local_14;
      if (_DAT_0040ea5c <= local_14) {
        if (local_28 == 0) {
          local_28 = 1;
          local_c = local_18;
        }
        else if (local_18 < local_c) {
          local_c = local_18;
        }
        if (_DAT_0040ea5c <= local_10) {
          if (*(int *)(param_1 + 0x1c + uVar1 * 4) != 0) {
            *local_3c = uVar1;
            local_20 = local_20 + -1;
          }
          goto LAB_0040e93e;
        }
        if ((local_18 <= *(float *)(param_2 + 0x18)) && (*(int *)(param_1 + 0x1c + uVar1 * 4) != 0))
        {
          *local_3c = uVar1;
          local_20 = local_20 + -1;
          local_3c = local_3c + -1;
        }
        if ((local_24 != 0) && (local_c < local_8)) goto LAB_0040e93e;
      }
      else {
        if (local_24 == 0) {
          local_24 = 1;
          local_8 = local_18;
        }
        else if (local_8 < local_18) {
          local_8 = local_18;
        }
        if (_DAT_0040ea5c <= local_10) {
          if (*(int *)(param_1 + 0x1c + uVar1 * 4) != 0) {
            *local_38 = uVar1;
            local_1c = local_1c + 1;
            local_38 = local_38 + 1;
          }
          if ((*(float *)(param_2 + 0x18) < local_18) || ((local_28 != 0 && (local_c < local_8))))
          goto LAB_0040e93e;
        }
      }
    }
    else if (_DAT_0040ea5c < local_10) {
      if (*(int *)(param_1 + 0x1c + uVar1 * 4) != 0) {
        *local_38 = uVar1;
        local_1c = local_1c + 1;
      }
      goto LAB_0040e93e;
    }
    local_2c = local_2c + 1;
    local_34 = local_34 + 1;
    if (5 < local_2c) {
LAB_0040e93e:
      if (local_2c == 6) {
        local_60[local_20] = 6;
        local_20 = local_20 + -1;
      }
      local_2c = 0;
      local_40 = local_60;
      if (0 < local_1c) {
        do {
          iVar2 = FUN_0040e754(*(int *)(param_1 + 0x1c + *local_40 * 4),param_2);
          if (iVar2 != 0) {
            return iVar2;
          }
          local_2c = local_2c + 1;
          local_40 = local_40 + 1;
        } while (local_2c < local_1c);
      }
      if ((local_20 < 6) && (local_60[local_20 + 1] == 6)) {
        iVar2 = 0;
        if (*(int *)(param_1 + 0x18) == 0) {
          if (*(int *)(param_1 + 0x34) != 0) {
            iVar2 = FUN_0040e754(*(int *)(param_1 + 0x34),param_2);
          }
        }
        else {
          iVar3 = (**(code **)(*(int *)(*(int *)(param_1 + 0x18) + 0x18) + 0x10))
                            (*(int *)(param_1 + 0x18),param_2,local_8);
          if (iVar3 != 0) {
            iVar2 = *(int *)(param_1 + 0x18);
          }
          if ((*(int *)(param_1 + 0x34) != 0) &&
             (iVar3 = FUN_0040e754(*(int *)(param_1 + 0x34),param_2), iVar3 != 0)) {
            iVar2 = iVar3;
          }
        }
        if (iVar2 != 0) {
          return iVar2;
        }
        local_20 = local_20 + 1;
      }
      local_2c = local_20 + 1;
      local_44 = local_60 + local_2c;
      while( true ) {
        if (6 < local_2c) {
          return 0;
        }
        iVar2 = FUN_0040e754(*(int *)(param_1 + 0x1c + *local_44 * 4),param_2);
        if (iVar2 != 0) break;
        local_2c = local_2c + 1;
        local_44 = local_44 + 1;
      }
      return iVar2;
    }
  } while( true );
}



/* @0040ea6c file=? name=FUN_0040ea6c */

void __cdecl FUN_0040ea6c(int *param_1,int param_2,undefined4 *param_3)

{
  undefined4 *puVar1;
  
  if (*param_1 == 0) {
    puVar1 = FUN_00402f74(0x4e11dc);
    if (puVar1 == (undefined4 *)0x0) {
      puVar1 = (undefined4 *)0x0;
    }
    else {
      puVar1 = FUN_0040df68(puVar1,param_2,param_3);
    }
    *param_1 = (int)puVar1;
  }
  else {
    FUN_0040e000(*param_1,param_2,param_3);
  }
  return;
}



/* @0040eabc file=? name=FUN_0040eabc */

void __cdecl FUN_0040eabc(undefined4 *param_1)

{
  if ((undefined4 *)*param_1 != (undefined4 *)0x0) {
    FUN_0040dfa4((undefined4 *)*param_1,3);
  }
  *param_1 = 0;
  return;
}



/* @0040eadc file=? name=FUN_0040eadc */

void __cdecl FUN_0040eadc(int *param_1,float *param_2)

{
  int iVar1;
  float local_28 [6];
  float local_10 [3];
  
  FUN_0040cdf4(param_2,param_2[6],local_10);
  FUN_0040d210(local_28,param_2,local_10);
  iVar1 = FUN_0040e2ac(*param_1,(int)local_28,0);
  FUN_0040e754(iVar1,(int)param_2);
  return;
}



/* @0040eb2c file=? name=FUN_0040eb2c */

undefined4 FUN_0040eb2c(void)

{
  return 1;
}



/* @0040eb64 file=? name=FUN_0040eb64 */

undefined4 FUN_0040eb64(void)

{
  return 1;
}



/* @0040eb70 file=? name=FUN_0040eb70 */

void __cdecl FUN_0040eb70(undefined4 *param_1)

{
  *param_1 = 0;
  param_1[1] = 0;
  param_1[2] = 0;
  param_1[3] = 0;
  param_1[4] = 1;
  return;
}



/* @0040eb94 file=? name=FUN_0040eb94 */

void __cdecl FUN_0040eb94(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    if ((int *)param_1[2] != (int *)0x0) {
      FUN_004022d0((int *)param_1[2]);
    }
    if ((int *)param_1[3] != (int *)0x0) {
      FUN_004022d0((int *)param_1[3]);
    }
    FUN_0040ec7c(param_1);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0040ebd4 file=? name=FUN_0040ebd4 */

void __cdecl FUN_0040ebd4(undefined4 *param_1,undefined4 param_2,undefined4 *param_3)

{
  undefined4 *puVar1;
  
  param_1[1] = param_1[1] + 1;
  puVar1 = FUN_00402f74(0x4e1234);
  if (puVar1 != (undefined4 *)0x0) {
    *puVar1 = param_2;
    puVar1[1] = 0;
    FUN_0040d28c(puVar1 + 2,param_3);
  }
  puVar1[1] = *param_1;
  *param_1 = puVar1;
  return;
}



/* @0040ec28 file=? name=FUN_0040ec28 */

void __cdecl FUN_0040ec28(int *param_1,int param_2)

{
  int *piVar1;
  int *piVar2;
  
  piVar1 = (int *)0x0;
  for (piVar2 = (int *)*param_1; (piVar2 != (int *)0x0 && (param_2 != *piVar2));
      piVar2 = (int *)piVar2[1]) {
    piVar1 = piVar2;
  }
  if (piVar2 != (int *)0x0) {
    if (piVar1 == (int *)0x0) {
      *param_1 = piVar2[1];
    }
    else {
      piVar1[1] = piVar2[1];
    }
    param_1[1] = param_1[1] + -1;
    if (piVar2 != (int *)0x0) {
      FUN_00402f98(0x4e1234,piVar2);
    }
  }
  return;
}



/* @0040ec7c file=? name=FUN_0040ec7c */

void __cdecl FUN_0040ec7c(undefined4 *param_1)

{
  undefined4 *puVar1;
  undefined4 *puVar2;
  
  puVar1 = (undefined4 *)*param_1;
  while (puVar2 = puVar1, puVar2 != (undefined4 *)0x0) {
    puVar1 = (undefined4 *)puVar2[1];
    if (puVar2 != (undefined4 *)0x0) {
      FUN_00402f98(0x4e1234,puVar2);
    }
  }
  *param_1 = 0;
  param_1[1] = 0;
  return;
}



/* @0040ecbc file=? name=FUN_0040ecbc */

float * __cdecl FUN_0040ecbc(undefined4 *param_1,float *param_2)

{
  undefined4 *puVar1;
  float *pfVar2;
  int iVar3;
  
  puVar1 = (undefined4 *)*param_1;
  while( true ) {
    if (puVar1 == (undefined4 *)0x0) {
      return (float *)0x0;
    }
    pfVar2 = (float *)*puVar1;
    iVar3 = FUN_0040dbd4(pfVar2,param_2);
    if (iVar3 != 0) break;
    puVar1 = (undefined4 *)puVar1[1];
  }
  return pfVar2;
}



/* @0040ecf0 file=? name=FUN_0040ecf0 */

void __cdecl FUN_0040ecf0(undefined4 *param_1,float *param_2,int param_3)

{
  undefined4 *puVar1;
  float *pfVar2;
  int iVar3;
  float local_1c [6];
  
  puVar1 = (undefined4 *)*param_1;
  do {
    if (puVar1 == (undefined4 *)0x0) {
      return;
    }
    pfVar2 = (float *)*puVar1;
    iVar3 = FUN_0040d474(pfVar2,param_2);
    if (iVar3 != 0) {
      FUN_0040d2bc(local_1c,param_2,pfVar2);
      iVar3 = (**(code **)((int)pfVar2[6] + 4))(pfVar2,local_1c);
      if ((iVar3 != 0) && (FUN_0040de78(param_3,pfVar2,local_1c), *(int *)(param_3 + 0xc) == 0)) {
        return;
      }
    }
    puVar1 = (undefined4 *)puVar1[1];
  } while( true );
}



/* @0040ed60 file=? name=FUN_0040ed60 */

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

float * __cdecl FUN_0040ed60(undefined4 *param_1,float *param_2,float *param_3)

{
  float fVar1;
  undefined4 *puVar2;
  float *pfVar3;
  float *pfVar4;
  float10 fVar5;
  
  pfVar4 = (float *)0x0;
  *param_3 = -1.0;
  for (puVar2 = (undefined4 *)*param_1; puVar2 != (undefined4 *)0x0;
      puVar2 = (undefined4 *)puVar2[1]) {
    pfVar3 = (float *)*puVar2;
    fVar5 = FUN_0040dc00(pfVar3,param_2);
    fVar1 = (float)fVar5;
    if ((fVar1 != _DAT_0040edc8) && ((pfVar4 == (float *)0x0 || (fVar1 < *param_3)))) {
      *param_3 = fVar1;
      pfVar4 = pfVar3;
    }
  }
  return pfVar4;
}



/* @0040ee00 file=? name=FUN_0040ee00 */

undefined4 FUN_0040ee00(void)

{
  return 1;
}



/* @0040ee38 file=? name=FUN_0040ee38 */

undefined4 * __cdecl
FUN_0040ee38(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5,undefined4 param_6)

{
  FUN_0040ded0(param_1,param_2,param_5);
  param_1[6] = &PTR_FUN_004e15b0;
  param_1[8] = param_3;
  param_1[9] = param_4;
  param_1[10] = param_6;
  return param_1;
}



/* @0040ee70 file=? name=FUN_0040ee70 */

undefined4 * __cdecl
FUN_0040ee70(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ded0(param_1,param_2,param_4);
  param_1[6] = &PTR_FUN_004e15b0;
  param_1[8] = 0;
  param_1[9] = param_3;
  param_1[10] = param_5;
  return param_1;
}



/* @0040eea8 file=? name=FUN_0040eea8 */

void __cdecl FUN_0040eea8(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e15b0;
    FUN_0040def8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0040eed8 file=? name=FUN_0040eed8 */

void __cdecl FUN_0040eed8(int param_1,undefined4 param_2,undefined4 param_3)

{
  undefined4 *puVar1;
  
  switch(*(undefined4 *)(param_1 + 0x34)) {
  case 0:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_0040ee70(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 1:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00410500(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 2:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_004108b4(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 3:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_0040ff5c(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 4:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00411024(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 5:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_0041140c(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 6:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00411218(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 7:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00411600(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 8:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_004117f0(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 9:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00411bf8(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 10:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_004119f4(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 0xb:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00411df4(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 0xc:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00411ff8(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 0xd:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00412614(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 0xe:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00412200(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 0xf:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_0041240c(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 0x10:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00412820(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 0x11:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_00412c78(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
    break;
  case 0x12:
    puVar1 = (undefined4 *)FUN_00402298(0x2c);
    if (puVar1 != (undefined4 *)0x0) {
      FUN_004146dc(puVar1,(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0x38),param_2,
                   param_3);
    }
  }
  return;
}



/* @0040f2f8 file=? name=FUN_0040f2f8 */

undefined4 FUN_0040f2f8(void)

{
  return 1;
}



/* @0040f304 file=munga/boxsolid.cpp name=FUN_0040f304 */

undefined4 FUN_0040f304(void)

{
  FUN_0040385c(s_Unsupported_mover_collision_type_004e13c4,s_d__tesla_bt_munga_BOXSOLID_CPP_004e13e7
               ,0x162);
  return 0;
}



/* @0040f324 file=? name=FUN_0040f324 */

bool __cdecl FUN_0040f324(int param_1)

{
  return *(int *)(param_1 + 0x20) == 0;
}



/* @0040f33c file=? name=FUN_0040f33c */

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

void __cdecl FUN_0040f33c(undefined4 *param_1,undefined4 *param_2,float *param_3)

{
  int iVar1;
  undefined4 *puVar2;
  undefined4 *puVar3;
  float10 fVar4;
  float local_68 [2];
  float local_60;
  float local_5c [12];
  float local_2c;
  undefined4 local_28;
  float local_24;
  float local_20;
  float local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  param_1[0xe] = param_2[0xe];
  local_8 = param_3[6];
  fVar4 = FUN_004dcd00((double)(local_8 - _DAT_0040f6a8));
  if ((float10)_DAT_0040f6ac < fVar4) {
    fVar4 = FUN_004dcd00((double)param_3[4]);
    local_c = (float)fVar4;
    fVar4 = FUN_004dcd00((double)(local_c - _DAT_0040f6a8));
    if ((float10)_DAT_0040f6ac < fVar4) {
      local_10 = param_3[4];
      local_14 = param_3[6];
      fVar4 = FUN_004dcd00((double)(local_14 - local_10));
      if ((float10)_DAT_0040f6ac < fVar4) {
        local_18 = -param_3[4];
        local_1c = param_3[6];
        fVar4 = FUN_004dcd00((double)(local_1c - local_18));
        if ((float10)_DAT_0040f6ac < fVar4) {
          iVar1 = param_2[0xd];
          if (((iVar1 == 0x11) || (iVar1 == 2)) || (iVar1 == 1)) {
            param_1[0xd] = iVar1;
            local_2c = ((float)param_2[1] + (float)param_2[2]) * _DAT_0040f6b0;
            local_28 = param_2[3];
            local_24 = ((float)param_2[5] + (float)param_2[6]) * _DAT_0040f6b0;
            local_20 = local_2c - (float)param_2[1];
            FUN_0040aadc(local_5c);
            FUN_0040adec(local_5c,param_3 + 3);
            FUN_00408744(local_68,&local_2c,local_5c);
            param_1[1] = local_68[0] - local_20;
            param_1[2] = local_68[0] + local_20;
            param_1[3] = param_2[3];
            param_1[4] = param_2[4];
            param_1[5] = local_60 - local_20;
            param_1[6] = local_60 + local_20;
            puVar3 = param_1 + 7;
            puVar2 = param_1;
            for (iVar1 = 6; puVar2 = puVar2 + 1, iVar1 != 0; iVar1 = iVar1 + -1) {
              *puVar3 = *puVar2;
              puVar3 = puVar3 + 1;
            }
          }
        }
        else {
          param_1[0xd] = *(undefined4 *)(&DAT_004e131c + param_2[0xd] * 4);
          param_1[1] = -(float)param_2[6];
          param_1[2] = -(float)param_2[5];
          param_1[3] = param_2[3];
          param_1[4] = param_2[4];
          param_1[5] = param_2[1];
          param_1[6] = param_2[2];
          param_1[7] = -(float)param_2[0xc];
          param_1[8] = -(float)param_2[0xb];
          param_1[9] = param_2[9];
          param_1[10] = param_2[10];
          param_1[0xb] = param_2[7];
          param_1[0xc] = param_2[8];
        }
      }
      else {
        param_1[0xd] = *(undefined4 *)(&DAT_004e1274 + param_2[0xd] * 4);
        param_1[1] = param_2[5];
        param_1[2] = param_2[6];
        param_1[3] = param_2[3];
        param_1[4] = param_2[4];
        param_1[5] = -(float)param_2[2];
        param_1[6] = -(float)param_2[1];
        param_1[7] = param_2[0xb];
        param_1[8] = param_2[0xc];
        param_1[9] = param_2[9];
        param_1[10] = param_2[10];
        param_1[0xb] = -(float)param_2[8];
        param_1[0xc] = -(float)param_2[7];
      }
    }
    else {
      param_1[0xd] = *(undefined4 *)(&DAT_004e12c8 + param_2[0xd] * 4);
      param_1[1] = -(float)param_2[2];
      param_1[2] = -(float)param_2[1];
      param_1[3] = param_2[3];
      param_1[4] = param_2[4];
      param_1[5] = -(float)param_2[6];
      param_1[6] = -(float)param_2[5];
      param_1[7] = -(float)param_2[8];
      param_1[8] = -(float)param_2[7];
      param_1[9] = param_2[9];
      param_1[10] = param_2[10];
      param_1[0xb] = -(float)param_2[0xc];
      param_1[0xc] = -(float)param_2[0xb];
    }
  }
  else {
    param_1[0xd] = param_2[0xd];
    iVar1 = 6;
    puVar2 = param_2;
    puVar3 = param_1;
    while( true ) {
      puVar3 = puVar3 + 1;
      puVar2 = puVar2 + 1;
      if (iVar1 == 0) break;
      iVar1 = iVar1 + -1;
      *puVar3 = *puVar2;
    }
    puVar2 = param_2 + 7;
    puVar3 = param_1 + 7;
    for (iVar1 = 6; iVar1 != 0; iVar1 = iVar1 + -1) {
      *puVar3 = *puVar2;
      puVar2 = puVar2 + 1;
      puVar3 = puVar3 + 1;
    }
  }
  param_1[1] = *param_3 + (float)param_1[1];
  param_1[2] = *param_3 + (float)param_1[2];
  param_1[3] = param_3[1] + (float)param_1[3];
  param_1[4] = param_3[1] + (float)param_1[4];
  param_1[5] = param_3[2] + (float)param_1[5];
  param_1[6] = param_3[2] + (float)param_1[6];
  param_1[7] = *param_3 + (float)param_1[7];
  param_1[8] = *param_3 + (float)param_1[8];
  param_1[9] = param_3[1] + (float)param_1[9];
  param_1[10] = param_3[1] + (float)param_1[10];
  param_1[0xb] = param_3[2] + (float)param_1[0xb];
  param_1[0xc] = param_3[2] + (float)param_1[0xc];
  return;
}



/* @0040f7d8 file=? name=FUN_0040f7d8 */

undefined4 __cdecl FUN_0040f7d8(char *param_1,int param_2,int param_3,int param_4)

{
  int *piVar1;
  int *piVar2;
  int iVar3;
  int *extraout_EAX;
  int *piVar4;
  undefined4 *puVar5;
  int iVar6;
  int *piVar7;
  undefined4 unaff_EDI;
  int *piVar8;
  
  piVar1 = (int *)FUN_004064fc(*(char **)(param_3 + 8),param_1);
  piVar2 = (int *)FUN_00402298(0x20);
  if (piVar2 == (int *)0x0) {
    piVar2 = (int *)0x0;
  }
  else {
    piVar2 = FUN_00403e84(piVar2,(char *)piVar1,1);
  }
  FUN_004022d0(piVar1);
  if ((*(byte *)(piVar2 + 7) & 2) == 0) {
    iVar3 = piVar2[3];
  }
  else {
    iVar3 = piVar2[4];
  }
  if (iVar3 == 0) {
    FUN_004dbb24(&DAT_00524e20,s____Collision_file___004e1406,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,param_1,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___empty_or_not_found_____004e141a,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
  }
  else {
    piVar1 = (int *)FUN_00402298(0x14);
    if (piVar1 != (int *)0x0) {
      FUN_0040eb70(piVar1);
    }
    iVar3 = FUN_004101a0(piVar1,(int)piVar2);
    FUN_004de998((int *)0x0,0x3c,iVar3,1,FUN_004104f7);
    piVar4 = extraout_EAX + 0xe;
    for (puVar5 = (undefined4 *)*piVar1; puVar5 != (undefined4 *)0x0;
        puVar5 = (undefined4 *)puVar5[1]) {
      piVar7 = (int *)*puVar5;
      *piVar4 = piVar7[9];
      if ((piVar7[8] == 0) && (param_4 != 0)) {
        piVar4[-1] = 3;
      }
      else {
        piVar4[-1] = piVar7[8];
      }
      piVar8 = piVar4 + -0xd;
      for (iVar6 = 6; iVar6 != 0; iVar6 = iVar6 + -1) {
        *piVar8 = *piVar7;
        piVar7 = piVar7 + 1;
        piVar8 = piVar8 + 1;
      }
      piVar7 = puVar5 + 2;
      piVar8 = piVar4 + -7;
      for (iVar6 = 6; iVar6 != 0; iVar6 = iVar6 + -1) {
        *piVar8 = *piVar7;
        piVar7 = piVar7 + 1;
        piVar8 = piVar8 + 1;
      }
      piVar4[-0xe] = 0x3c;
      piVar4 = piVar4 + 0xf;
    }
    for (piVar4 = (int *)*piVar1; piVar4 != (int *)0x0; piVar4 = (int *)piVar4[1]) {
      iVar6 = *piVar4;
      if (iVar6 != 0) {
        (*(code *)**(undefined4 **)(iVar6 + 0x18))(iVar6,3);
      }
    }
    puVar5 = (undefined4 *)FUN_00406ff8(param_2,param_1,9,-1);
    if (puVar5 == (undefined4 *)0x0) {
      puVar5 = (undefined4 *)FUN_00406db4(param_2,param_1,9,1,0,extraout_EAX,iVar3 * 0x3c,-1);
      unaff_EDI = *puVar5;
    }
    else {
      unaff_EDI = *puVar5;
    }
    FUN_004022d0(extraout_EAX);
    if (piVar1 != (int *)0x0) {
      FUN_0040eb94(piVar1,0);
      FUN_004022d0(piVar1);
    }
  }
  FUN_00403ecc(piVar2,3);
  return unaff_EDI;
}



/* @0040f9d8 file=? name=FUN_0040f9d8 */

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

undefined4 __cdecl FUN_0040f9d8(float *param_1,float *param_2,float *param_3)

{
  float fVar1;
  int iVar2;
  float *pfVar3;
  uint uVar4;
  float *pfVar5;
  int iVar6;
  float10 fVar7;
  float *local_10;
  
  iVar6 = 0;
  local_10 = param_3;
  do {
    fVar7 = FUN_004dcd00((double)*local_10);
    if ((float10)_DAT_0040fba8 < fVar7) {
      iVar2 = *(int *)((int)*param_1 + 0x20);
      if (((1 << ((byte)iVar6 & 0x1f) & *(uint *)(&DAT_004e1370 + iVar2 * 4)) == 0) ||
         (iVar2 == *(int *)((int)*param_2 + 0x20))) {
        uVar4 = (uint)(*local_10 < _DAT_0040fbac) + iVar6 * 2;
        if ((uVar4 & 1) == 0) {
          if (iVar2 == 0) {
            if (param_1[uVar4 + 1] < param_2[uVar4 + 1]) goto LAB_0040fade;
          }
          else if (param_1[(uVar4 ^ 1) + 1] <= param_2[uVar4 + 1]) goto LAB_0040fade;
        }
        else if (iVar2 == 0) {
          if (param_2[uVar4 + 1] < param_1[uVar4 + 1]) {
LAB_0040fade:
            uVar4 = 0;
            pfVar3 = param_1;
            pfVar5 = param_2;
            do {
              pfVar5 = pfVar5 + 1;
              pfVar3 = pfVar3 + 1;
              if (iVar6 != (int)uVar4 >> 1) {
                if ((uVar4 & 1) == 0) {
                  if (*pfVar5 < *pfVar3) break;
                }
                else if (*pfVar3 < *pfVar5) break;
              }
              uVar4 = uVar4 + 1;
            } while ((int)uVar4 < 6);
            if (uVar4 == 6) {
              iVar2 = iVar6 * 2;
              if (*local_10 <= _DAT_0040fbac) {
                if (param_2[iVar6 * 2 + 1] <= param_1[iVar6 * 2 + 1]) {
                  fVar1 = param_2[iVar6 * 2 + 1];
                }
                else {
                  fVar1 = param_1[iVar6 * 2 + 1];
                }
                param_1[iVar6 * 2 + 1] = fVar1;
              }
              else {
                if (param_1[iVar2 + 2] <= param_2[iVar2 + 2]) {
                  fVar1 = param_2[iVar2 + 2];
                }
                else {
                  fVar1 = param_1[iVar2 + 2];
                }
                param_1[iVar2 + 2] = fVar1;
              }
              return 1;
            }
          }
        }
        else if (param_2[uVar4 + 1] <= param_1[(uVar4 ^ 1) + 1]) goto LAB_0040fade;
      }
    }
    iVar6 = iVar6 + 1;
    local_10 = local_10 + 1;
    if (2 < iVar6) {
      return 0;
    }
  } while( true );
}



/* @0040fbb0 file=? name=FUN_0040fbb0 */

void __cdecl FUN_0040fbb0(int *param_1,float *param_2)

{
  bool bVar1;
  float *pfVar2;
  int *piVar3;
  int *piVar4;
  int *piVar5;
  int iVar6;
  int *piVar7;
  float *pfVar8;
  float *pfVar9;
  float *pfVar10;
  int *piVar11;
  int iVar12;
  undefined4 *puVar13;
  int iVar14;
  undefined4 *puVar15;
  int local_28;
  float local_20;
  int local_14;
  int local_c;
  int local_8;
  
  bVar1 = true;
  local_14 = param_1[2] - param_1[3];
  param_1[4] = 0;
  while ((bVar1 && (1 < local_14))) {
    bVar1 = false;
    local_8 = 0;
    if (0 < local_14) {
      do {
        local_c = local_8 + 1;
        if (local_c < local_14) {
          do {
            pfVar9 = (float *)(*param_1 + local_8 * 0x1c);
            pfVar2 = (float *)(*param_1 + local_c * 0x1c);
            if (*(int *)((int)*pfVar9 + 0x20) == *(int *)((int)*pfVar2 + 0x20)) {
              iVar14 = 0;
              iVar6 = -1;
              iVar12 = 0;
              pfVar10 = pfVar9 + 1;
              pfVar8 = pfVar2 + 1;
              do {
                if ((*pfVar10 == *pfVar8) && (pfVar10[1] == pfVar8[1])) {
                  iVar14 = iVar14 + 1;
                }
                else if (iVar6 < 0) {
                  iVar6 = iVar12;
                }
                iVar12 = iVar12 + 2;
                pfVar8 = pfVar8 + 2;
                pfVar10 = pfVar10 + 2;
              } while (iVar12 < 6);
              if ((iVar14 == 2) &&
                 ((pfVar9[iVar6 + 1] == pfVar2[iVar6 + 2] ||
                  (pfVar9[iVar6 + 2] == pfVar2[iVar6 + 1])))) {
                if (pfVar9[iVar6 + 2] == pfVar2[iVar6 + 1]) {
                  iVar6 = iVar6 + 1;
                }
                local_20 = 0.0;
                if ((*pfVar9 != *pfVar2) &&
                   (iVar12 = FUN_0040f9d8(pfVar2,pfVar9,param_2), iVar12 != 0)) {
                  local_20 = *pfVar9;
                  *pfVar9 = *pfVar2;
                }
                pfVar9[iVar6 + 1] = pfVar2[iVar6 + 1];
                iVar6 = local_c;
                while (iVar6 = iVar6 + 1, iVar6 < local_14) {
                  puVar13 = (undefined4 *)(*param_1 + iVar6 * 0x1c);
                  puVar15 = (undefined4 *)(*param_1 + -0x1c + iVar6 * 0x1c);
                  for (iVar12 = 7; iVar12 != 0; iVar12 = iVar12 + -1) {
                    *puVar15 = *puVar13;
                    puVar13 = puVar13 + 1;
                    puVar15 = puVar15 + 1;
                  }
                }
                param_1[4] = param_1[4] + 1;
                local_14 = local_14 + -1;
                *(float *)(*param_1 + local_14 * 0x1c) = local_20;
                local_c = local_c + -1;
                bVar1 = true;
              }
            }
            local_c = local_c + 1;
          } while (local_c < local_14);
        }
        local_8 = local_8 + 1;
      } while (local_8 < local_14);
    }
  }
  if (1 < local_14) {
    piVar3 = (int *)FUN_004022b0(local_14 << 2);
    piVar4 = (int *)FUN_004022b0(local_14 << 2);
    local_8 = 0;
    piVar5 = piVar3;
    if (0 < local_14) {
      do {
        *piVar5 = 0;
        local_8 = local_8 + 1;
        piVar5 = piVar5 + 1;
      } while (local_8 < local_14);
    }
    local_8 = 0;
    if (0 < local_14) {
      do {
        local_c = 0;
        piVar5 = piVar3;
        if (0 < local_14) {
          do {
            if (((local_8 != local_c) && (*piVar5 == 0)) &&
               (iVar6 = FUN_0040f9d8((float *)(*param_1 + local_8 * 0x1c),
                                     (float *)(*param_1 + local_c * 0x1c),param_2), iVar6 != 0)) {
              *piVar5 = 1;
            }
            local_c = local_c + 1;
            piVar5 = piVar5 + 1;
          } while (local_c < local_14);
        }
        local_8 = local_8 + 1;
      } while (local_8 < local_14);
    }
    local_c = 0;
    local_28 = 0;
    local_8 = 0;
    piVar7 = piVar3;
    piVar11 = piVar4;
    piVar5 = piVar4;
    if (0 < local_14) {
      do {
        if (*piVar7 == 0) {
          if (local_c < local_8) {
            puVar13 = (undefined4 *)(*param_1 + local_8 * 0x1c);
            puVar15 = (undefined4 *)(*param_1 + local_c * 0x1c);
            for (iVar6 = 7; iVar6 != 0; iVar6 = iVar6 + -1) {
              *puVar15 = *puVar13;
              puVar13 = puVar13 + 1;
              puVar15 = puVar15 + 1;
            }
          }
          local_c = local_c + 1;
        }
        else {
          local_28 = local_28 + 1;
          piVar11 = piVar11 + 1;
          *piVar11 = *(int *)(*param_1 + local_8 * 0x1c);
        }
        local_8 = local_8 + 1;
        piVar7 = piVar7 + 1;
      } while (local_8 < local_14);
    }
    for (; local_c < local_14; local_c = local_c + 1) {
      *(int *)(*param_1 + local_c * 0x1c) = *piVar5;
      piVar5 = piVar5 + 1;
    }
    param_1[4] = param_1[4] + local_28;
    FUN_004022e8(piVar4);
    FUN_004022e8(piVar3);
  }
  return;
}



/* @0040ff5c file=? name=FUN_0040ff5c */

undefined4 * __cdecl
FUN_0040ff5c(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,3,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1590;
  return param_1;
}



/* @0040ff8c file=? name=FUN_0040ff8c */

void __cdecl FUN_0040ff8c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1590;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0040ffbc file=? name=FUN_0040ffbc */

bool __cdecl FUN_0040ffbc(int param_1)

{
  return *(int *)(param_1 + 0x20) == 3;
}



/* @0040ffd4 file=? name=FUN_0040ffd4 */

void __cdecl FUN_0040ffd4(float *param_1,float *param_2)

{
  FUN_0040d474(param_1,param_2);
  return;
}



/* @0040ffec file=? name=FUN_0040ffec */

void __cdecl FUN_0040ffec(float *param_1,float *param_2)

{
  FUN_0040d3cc(param_1,param_2);
  return;
}



/* @00410004 file=? name=FUN_00410004 */

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

float10 __cdecl FUN_00410004(float *param_1,float *param_2)

{
  float fVar1;
  
  fVar1 = _DAT_00410078;
  if ((((*param_1 <= *param_2) && (*param_2 <= param_1[1])) && (param_1[2] <= param_2[1])) &&
     (((param_1[4] <= param_2[2] && (param_2[2] <= param_1[5])) &&
      (fVar1 = param_2[1] - param_1[3], fVar1 <= _DAT_00410074)))) {
    return (float10)_DAT_00410074;
  }
  return (float10)fVar1;
}



/* @004101a0 file=? name=FUN_004101a0 */

int __cdecl FUN_004101a0(undefined4 *param_1,int param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  int *piVar2;
  undefined3 extraout_var_01;
  int iVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  int iVar8;
  undefined4 uVar9;
  uint uVar10;
  undefined1 local_7c [4];
  float local_78;
  float local_74;
  float local_70;
  float local_6c;
  float local_68;
  float local_64;
  float local_60;
  float local_5c;
  float local_58;
  float local_54;
  float local_50;
  float local_4c;
  int local_48;
  int local_44;
  char local_40 [52];
  int local_c;
  int local_8;
  
  local_8 = 0;
  bVar1 = FUN_004040d8(param_2,s_COLLISION_004e1433,s_count_004e143d,&local_8);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    FUN_004dbb24(&DAT_00524e20,s_No__COLLISION__entry______004e1443,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    FUN_004036a0(1);
  }
  uVar10 = 0;
  if (0 < local_8) {
    do {
      FUN_004d7f10(local_40,s_volume__d_004e145d);
      bVar1 = FUN_004040d8(param_2,local_40,s_TypeNumber_004e1467,&local_c);
      if (CONCAT31(extraout_var_00,bVar1) == 0) {
        FUN_004dbb24(&DAT_00524e20,s_No_solid_at_collision_number___004e1472,(char *)0x0);
        piVar2 = FUN_004db78c(&DAT_00524e20,uVar10);
        FUN_004d9c38(piVar2);
        FUN_004036a0(1);
      }
      local_48 = local_c;
      bVar1 = FUN_004040d8(param_2,local_40,s_MaterialNumber_004e1492,&local_c);
      if (CONCAT31(extraout_var_01,bVar1) == 0) {
        FUN_004dbb24(&DAT_00524e20,s_No_material_at_collision_number___004e14a1,(char *)0x0);
        piVar2 = FUN_004db78c(&DAT_00524e20,uVar10);
        FUN_004d9c38(piVar2);
        FUN_004036a0(1);
      }
      local_44 = local_c;
      iVar3 = FUN_00404118(param_2,local_40,s_extminX_004e14c4,&local_78);
      iVar4 = FUN_00404118(param_2,local_40,s_extmaxX_004e14cc,&local_74);
      iVar5 = FUN_00404118(param_2,local_40,s_extminY_004e14d4,&local_70);
      iVar6 = FUN_00404118(param_2,local_40,s_extmaxY_004e14dc,&local_6c);
      iVar7 = FUN_00404118(param_2,local_40,s_extminZ_004e14e4,&local_68);
      iVar8 = FUN_00404118(param_2,local_40,s_extmaxZ_004e14ec,&local_64);
      if (((((iVar3 == 0 || iVar4 == 0) || iVar5 == 0) || iVar6 == 0) || iVar7 == 0) || iVar8 == 0)
      {
        FUN_004dbb24(&DAT_00524e20,s_Collision_number___004e14f4,(char *)0x0);
        piVar2 = FUN_004db78c(&DAT_00524e20,uVar10);
        FUN_004dbb24(piVar2,s_does_not_have_valid_extents_004e1508,(char *)0x0);
        FUN_004036a0(1);
      }
      iVar3 = FUN_00404118(param_2,local_40,s_slcminX_004e1526,&local_60);
      iVar4 = FUN_00404118(param_2,local_40,s_slcmaxX_004e152e,&local_5c);
      iVar5 = FUN_00404118(param_2,local_40,s_slcminY_004e1536,&local_58);
      iVar6 = FUN_00404118(param_2,local_40,s_slcmaxY_004e153e,&local_54);
      iVar7 = FUN_00404118(param_2,local_40,s_slcminZ_004e1546,&local_50);
      iVar8 = FUN_00404118(param_2,local_40,s_slcmaxZ_004e154e,&local_4c);
      if (((((iVar3 == 0 || iVar4 == 0) || iVar5 == 0) || iVar6 == 0) || iVar7 == 0) || iVar8 == 0)
      {
        FUN_004dbb24(&DAT_00524e20,s_Collision_number___004e1556,(char *)0x0);
        piVar2 = FUN_004db78c(&DAT_00524e20,uVar10);
        FUN_004dbb24(piVar2,s_does_not_have_valid_slice_extent_004e156a,(char *)0x0);
        FUN_004036a0(1);
      }
      uVar9 = FUN_0040eed8((int)local_7c,0,0);
      FUN_0040ebd4(param_1,uVar9,&local_60);
      uVar10 = uVar10 + 1;
    } while ((int)uVar10 < local_8);
  }
  return local_8;
}



/* @004104f7 file=? name=FUN_004104f7 */

undefined4 __cdecl FUN_004104f7(undefined4 param_1)

{
  return param_1;
}



/* @00410500 file=? name=FUN_00410500 */

undefined4 * __cdecl
FUN_00410500(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,1,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e15d0;
  return param_1;
}



/* @00410530 file=? name=FUN_00410530 */

void __cdecl FUN_00410530(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e15d0;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00410560 file=? name=FUN_00410560 */

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

bool __cdecl FUN_00410560(float *param_1,float *param_2)

{
  float local_20;
  float local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  local_20 = (*param_1 + param_1[1]) * _DAT_00410600;
  local_1c = (param_1[2] + param_1[3]) * _DAT_00410600;
  local_18 = (param_1[4] + param_1[5]) * _DAT_00410600;
  local_8 = param_1[1] - local_20;
  local_14 = local_20;
  local_10 = local_1c;
  local_c = local_18;
  FUN_0040d350(param_2,&local_20);
  FUN_00408644(&local_20,&local_20,&local_14);
  return local_18 * local_18 + local_1c * local_1c + local_20 * local_20 <= local_8 * local_8;
}



/* @004108b4 file=? name=FUN_004108b4 */

undefined4 * __cdecl
FUN_004108b4(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,2,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e15f0;
  return param_1;
}



/* @004108e4 file=? name=FUN_004108e4 */

void __cdecl FUN_004108e4(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e15f0;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00410914 file=? name=FUN_00410914 */

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

bool __cdecl FUN_00410914(float *param_1,float *param_2)

{
  bool bVar1;
  float10 fVar2;
  float local_28;
  float local_24;
  float local_20;
  float local_1c;
  float local_18;
  float local_14;
  float local_c;
  float local_8;
  
  local_28 = (*param_1 + param_1[1]) * _DAT_004109e4;
  local_24 = param_1[2];
  local_20 = (param_1[4] + param_1[5]) * _DAT_004109e4;
  local_8 = param_1[1] - local_28;
  local_1c = local_28;
  local_18 = local_24;
  local_14 = local_20;
  FUN_0040d350(param_2,&local_28);
  local_18 = param_1[3];
  FUN_00408644(&local_28,&local_1c,&local_28);
  local_c = local_20 * local_20 + local_28 * local_28;
  if (local_c <= local_8 * local_8) {
    fVar2 = FUN_004dd138((double)local_c);
    bVar1 = (float)fVar2 * (param_1[3] - param_1[2]) <= local_24 * local_8;
  }
  else {
    bVar1 = false;
  }
  return bVar1;
}



/* @00410b5c file=? name=FUN_00410b5c */

float10 __cdecl FUN_00410b5c(float *param_1,float *param_2,float param_3)

{
  return (float10)param_1[2] * (float10)param_2[2] +
         ((float10)*param_1 * (float10)*param_2 -
         (float10)param_3 * (float10)param_1[1] * (float10)param_2[1]);
}



/* @00410b80 file=? name=FUN_00410b80 */

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

undefined4 __cdecl FUN_00410b80(float *param_1,float *param_2,float param_3,float param_4)

{
  float *pfVar1;
  float fVar2;
  float10 fVar3;
  float local_58;
  float local_54;
  float local_4c;
  float local_48;
  float local_44;
  float local_38;
  float local_34;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  float local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  local_4c = (*param_1 + param_1[1]) * _DAT_00410e9c;
  local_48 = param_1[3];
  local_44 = (param_1[4] + param_1[5]) * _DAT_00410e9c;
  local_8 = param_1[1] - local_4c;
  local_c = param_1[3] - param_1[2];
  local_10 = (local_8 * local_8) / (local_c * local_c);
  FUN_00408644(&local_58,param_2,&local_4c);
  pfVar1 = param_2 + 3;
  fVar3 = FUN_00410b5c(pfVar1,pfVar1,local_10);
  local_18 = (float)fVar3;
  local_14 = local_18;
  fVar3 = FUN_004dcd00((double)local_18);
  if ((float10)_DAT_00410ea0 < fVar3) {
    fVar3 = FUN_00410b5c(&local_58,pfVar1,local_10);
    local_1c = (float)(fVar3 * (float10)_DAT_00410ea4);
    fVar3 = FUN_00410b5c(&local_58,&local_58,local_10);
    local_20 = (float)fVar3;
    local_24 = -local_1c / (_DAT_00410ea4 * local_14);
    local_2c = local_1c * local_1c - _DAT_00410ea8 * local_14 * local_20;
    if (local_2c < _DAT_00410eac) {
      return 0;
    }
    local_28 = local_2c;
    fVar3 = FUN_004dcd00((double)local_2c);
    if (fVar3 <= (float10)_DAT_00410ea0) {
      if (_DAT_00410eac < param_2[4] * local_24 + local_54) {
        return 0;
      }
      if (param_2[4] <= _DAT_00410eac) {
        if (param_3 <= local_24) {
          param_3 = local_24;
        }
      }
      else if (local_24 < param_4) {
        param_4 = local_24;
      }
      if (((param_3 <= param_4) && (param_3 <= param_2[6])) && (_DAT_00410eac <= param_4)) {
        fVar2 = _DAT_00410eac;
        if (_DAT_00410eac < param_3) {
          fVar2 = param_3;
        }
        param_2[6] = fVar2;
        return 1;
      }
      return 0;
    }
    fVar3 = FUN_004dd138((double)local_28);
    local_38 = (float)(fVar3 / ((float10)_DAT_00410ea4 * (float10)local_14));
    if (local_38 <= _DAT_00410eac) {
      local_34 = local_24 + local_38;
      local_38 = local_24 - local_38;
    }
    else {
      local_34 = local_24 - local_38;
      local_38 = local_24 + local_38;
    }
    fVar2 = param_2[4] * local_38 + local_54;
    if (param_2[4] * local_34 + local_54 <= _DAT_00410eac) {
      if (fVar2 <= _DAT_00410eac) {
        if (param_3 < local_34) {
          param_3 = local_34;
        }
        if (local_38 < param_4) {
          param_4 = local_38;
        }
      }
      else if (local_34 < param_4) {
        param_4 = local_34;
      }
    }
    else {
      if (_DAT_00410eac < fVar2) {
        return 0;
      }
      if (param_3 < local_38) {
        param_3 = local_38;
      }
    }
    if (((param_4 < param_3) || (param_2[6] < param_3)) || (param_4 < _DAT_00410eac)) {
      return 0;
    }
    fVar2 = _DAT_00410eac;
    if (_DAT_00410eac < param_3) {
      fVar2 = param_3;
    }
    param_2[6] = fVar2;
  }
  return 1;
}



/* @00410ec8 file=? name=FUN_00410ec8 */

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

undefined4 __cdecl FUN_00410ec8(float *param_1,float *param_2,float param_3,float param_4)

{
  float fVar1;
  float fVar2;
  undefined4 uVar3;
  
  fVar1 = (param_2[2] * param_1[2] + param_2[1] * param_1[1] + *param_2 * *param_1) - param_2[3];
  fVar2 = param_1[5] * param_2[2] + param_1[4] * param_2[1] + param_1[3] * *param_2;
  if ((fVar2 <= _DAT_00411020) || (fVar1 <= _DAT_00411020)) {
    if (fVar2 == _DAT_00411020) {
      if (_DAT_00411020 < fVar1) {
        uVar3 = 0;
      }
      else {
        fVar1 = _DAT_00411020;
        if (_DAT_00411020 < param_3) {
          fVar1 = param_3;
        }
        param_1[6] = fVar1;
        uVar3 = 1;
      }
    }
    else if (_DAT_00411020 <= fVar2) {
      if (fVar1 / -fVar2 < param_3) {
        uVar3 = 0;
      }
      else {
        fVar1 = _DAT_00411020;
        if (_DAT_00411020 < param_3) {
          fVar1 = param_3;
        }
        param_1[6] = fVar1;
        uVar3 = 1;
      }
    }
    else {
      fVar1 = fVar1 / -fVar2;
      if ((fVar1 <= param_3) || ((fVar1 <= param_4 && (param_3 = fVar1, fVar1 <= param_1[6])))) {
        fVar1 = _DAT_00411020;
        if (_DAT_00411020 < param_3) {
          fVar1 = param_3;
        }
        param_1[6] = fVar1;
        uVar3 = 1;
      }
      else {
        uVar3 = 0;
      }
    }
  }
  else {
    uVar3 = 0;
  }
  return uVar3;
}



/* @00411024 file=? name=FUN_00411024 */

undefined4 * __cdecl
FUN_00411024(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,4,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1670;
  return param_1;
}



/* @00411054 file=? name=FUN_00411054 */

void __cdecl FUN_00411054(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1670;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00411084 file=? name=FUN_00411084 */

bool __cdecl FUN_00411084(int param_1,int param_2)

{
  return (*(float *)(param_2 + 0x10) - *(float *)(param_1 + 0x14)) *
         (*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8)) <=
         (*(float *)(param_2 + 8) - *(float *)(param_1 + 8)) *
         (*(float *)(param_1 + 0x10) - *(float *)(param_1 + 0x14));
}



/* @004110d0 file=? name=FUN_004110d0 */

bool __cdecl FUN_004110d0(int param_1,int param_2)

{
  return (*(float *)(param_2 + 8) - *(float *)(param_1 + 0x14)) *
         (*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8)) <=
         (*(float *)(param_2 + 4) - *(float *)(param_1 + 8)) *
         (*(float *)(param_1 + 0x10) - *(float *)(param_1 + 0x14));
}



/* @0041111c file=? name=FUN_0041111c */

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

float10 __cdecl FUN_0041111c(int param_1,int param_2)

{
  float fVar1;
  float fVar2;
  
  fVar1 = (*(float *)(param_2 + 4) - *(float *)(param_1 + 8)) -
          ((*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8)) /
          (*(float *)(param_1 + 0x10) - *(float *)(param_1 + 0x14))) *
          (*(float *)(param_2 + 8) - *(float *)(param_1 + 0x14));
  fVar2 = _DAT_00411178;
  if (_DAT_00411178 < fVar1) {
    fVar2 = fVar1;
  }
  return (float10)fVar2;
}



/* @00411200 file=? name=FUN_00411200 */

bool __cdecl FUN_00411200(int param_1)

{
  return *(int *)(param_1 + 0x20) == 4;
}



/* @00411218 file=? name=FUN_00411218 */

undefined4 * __cdecl
FUN_00411218(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,6,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1650;
  return param_1;
}



/* @00411248 file=? name=FUN_00411248 */

void __cdecl FUN_00411248(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1650;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00411278 file=? name=FUN_00411278 */

bool __cdecl FUN_00411278(int param_1,int param_2)

{
  return (*(float *)(param_2 + 8) - *(float *)(param_1 + 8)) *
         (*(float *)(param_1 + 0x14) - *(float *)(param_1 + 0x10)) <=
         (*(float *)(param_2 + 0x14) - *(float *)(param_1 + 0x10)) *
         (*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8));
}



/* @004112c4 file=? name=FUN_004112c4 */

bool __cdecl FUN_004112c4(int param_1,int param_2)

{
  return (*(float *)(param_2 + 4) - *(float *)(param_1 + 8)) *
         (*(float *)(param_1 + 0x14) - *(float *)(param_1 + 0x10)) <=
         (*(float *)(param_2 + 8) - *(float *)(param_1 + 0x10)) *
         (*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8));
}



/* @00411310 file=? name=FUN_00411310 */

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

float10 __cdecl FUN_00411310(int param_1,int param_2)

{
  float fVar1;
  float fVar2;
  
  fVar1 = (*(float *)(param_2 + 4) - *(float *)(param_1 + 8)) -
          ((*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8)) /
          (*(float *)(param_1 + 0x14) - *(float *)(param_1 + 0x10))) *
          (*(float *)(param_2 + 8) - *(float *)(param_1 + 0x10));
  fVar2 = _DAT_0041136c;
  if (_DAT_0041136c < fVar1) {
    fVar2 = fVar1;
  }
  return (float10)fVar2;
}



/* @004113f4 file=? name=FUN_004113f4 */

bool __cdecl FUN_004113f4(int param_1)

{
  return *(int *)(param_1 + 0x20) == 6;
}



/* @0041140c file=? name=FUN_0041140c */

undefined4 * __cdecl
FUN_0041140c(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,5,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1630;
  return param_1;
}



/* @0041143c file=? name=FUN_0041143c */

void __cdecl FUN_0041143c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1630;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041146c file=? name=FUN_0041146c */

bool __cdecl FUN_0041146c(float *param_1,float *param_2)

{
  return (*param_2 - param_1[1]) * (param_1[3] - param_1[2]) <=
         (param_2[2] - param_1[2]) * (*param_1 - param_1[1]);
}



/* @004114b8 file=? name=FUN_004114b8 */

bool __cdecl FUN_004114b8(float *param_1,float *param_2)

{
  return (*param_2 - param_1[1]) * (param_1[3] - param_1[2]) <=
         (param_2[1] - param_1[2]) * (*param_1 - param_1[1]);
}



/* @00411504 file=? name=FUN_00411504 */

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

float10 __cdecl FUN_00411504(float *param_1,float *param_2)

{
  float fVar1;
  float fVar2;
  
  fVar1 = (param_2[1] - param_1[2]) -
          ((param_1[3] - param_1[2]) / (*param_1 - param_1[1])) * (*param_2 - param_1[1]);
  fVar2 = _DAT_00411560;
  if (_DAT_00411560 < fVar1) {
    fVar2 = fVar1;
  }
  return (float10)fVar2;
}



/* @004115e8 file=? name=FUN_004115e8 */

bool __cdecl FUN_004115e8(int param_1)

{
  return *(int *)(param_1 + 0x20) == 5;
}



/* @00411600 file=? name=FUN_00411600 */

undefined4 * __cdecl
FUN_00411600(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,7,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1610;
  return param_1;
}



/* @00411630 file=? name=FUN_00411630 */

void __cdecl FUN_00411630(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1610;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00411660 file=? name=FUN_00411660 */

bool __cdecl FUN_00411660(float *param_1,int param_2)

{
  return (*(float *)(param_2 + 8) - param_1[2]) * (param_1[1] - *param_1) <=
         (*(float *)(param_2 + 4) - *param_1) * (param_1[3] - param_1[2]);
}



/* @004116ac file=? name=FUN_004116ac */

bool __cdecl FUN_004116ac(float *param_1,float *param_2)

{
  return (param_2[1] - param_1[2]) * (param_1[1] - *param_1) <=
         (*param_2 - *param_1) * (param_1[3] - param_1[2]);
}



/* @004116f4 file=? name=FUN_004116f4 */

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

float10 __cdecl FUN_004116f4(float *param_1,float *param_2)

{
  float fVar1;
  float fVar2;
  
  fVar1 = (param_2[1] - param_1[2]) -
          ((param_1[3] - param_1[2]) / (param_1[1] - *param_1)) * (*param_2 - *param_1);
  fVar2 = _DAT_00411750;
  if (_DAT_00411750 < fVar1) {
    fVar2 = fVar1;
  }
  return (float10)fVar2;
}



/* @004117d8 file=? name=FUN_004117d8 */

bool __cdecl FUN_004117d8(int param_1)

{
  return *(int *)(param_1 + 0x20) == 7;
}



/* @004117f0 file=? name=FUN_004117f0 */

undefined4 * __cdecl
FUN_004117f0(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,8,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e16f0;
  return param_1;
}



/* @00411820 file=? name=FUN_00411820 */

void __cdecl FUN_00411820(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e16f0;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00411850 file=? name=FUN_00411850 */

bool __cdecl FUN_00411850(int param_1,int param_2)

{
  return (*(float *)(param_2 + 0x10) - *(float *)(param_1 + 0x10)) *
         (*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8)) <=
         (*(float *)(param_2 + 0xc) - *(float *)(param_1 + 8)) *
         (*(float *)(param_1 + 0x14) - *(float *)(param_1 + 0x10));
}



/* @0041189c file=? name=FUN_0041189c */

bool __cdecl FUN_0041189c(int param_1,int param_2)

{
  return (*(float *)(param_2 + 8) - *(float *)(param_1 + 0x10)) *
         (*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8)) <=
         (*(float *)(param_2 + 4) - *(float *)(param_1 + 8)) *
         (*(float *)(param_1 + 0x14) - *(float *)(param_1 + 0x10));
}



/* @004118e8 file=? name=FUN_004118e8 */

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

float10 __cdecl FUN_004118e8(int param_1,int param_2)

{
  float10 fVar1;
  
  if (*(float *)(param_2 + 4) <= *(float *)(param_1 + 0xc)) {
    if ((*(float *)(param_2 + 4) - *(float *)(param_1 + 8)) *
        (*(float *)(param_1 + 0x14) - *(float *)(param_1 + 0x10)) <
        (*(float *)(param_2 + 8) - *(float *)(param_1 + 0x10)) *
        (*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8))) {
      fVar1 = (float10)_DAT_00411954;
    }
    else {
      fVar1 = (float10)_DAT_00411950;
    }
  }
  else {
    fVar1 = (float10)*(float *)(param_2 + 4) - (float10)*(float *)(param_1 + 0xc);
  }
  return fVar1;
}



/* @004119dc file=? name=FUN_004119dc */

bool __cdecl FUN_004119dc(int param_1)

{
  return *(int *)(param_1 + 0x20) == 8;
}



/* @004119f4 file=? name=FUN_004119f4 */

undefined4 * __cdecl
FUN_004119f4(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,10,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e16d0;
  return param_1;
}



/* @00411a24 file=? name=FUN_00411a24 */

void __cdecl FUN_00411a24(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e16d0;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00411a54 file=? name=FUN_00411a54 */

bool __cdecl FUN_00411a54(int param_1,int param_2)

{
  return (*(float *)(param_2 + 0xc) - *(float *)(param_1 + 8)) *
         (*(float *)(param_1 + 0x10) - *(float *)(param_1 + 0x14)) <=
         (*(float *)(param_2 + 0x14) - *(float *)(param_1 + 0x14)) *
         (*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8));
}



/* @00411aa0 file=? name=FUN_00411aa0 */

bool __cdecl FUN_00411aa0(int param_1,int param_2)

{
  return (*(float *)(param_2 + 4) - *(float *)(param_1 + 8)) *
         (*(float *)(param_1 + 0x10) - *(float *)(param_1 + 0x14)) <=
         (*(float *)(param_2 + 8) - *(float *)(param_1 + 0x14)) *
         (*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8));
}



/* @00411aec file=? name=FUN_00411aec */

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

float10 __cdecl FUN_00411aec(int param_1,int param_2)

{
  float10 fVar1;
  
  if (*(float *)(param_2 + 4) <= *(float *)(param_1 + 0xc)) {
    if ((*(float *)(param_2 + 8) - *(float *)(param_1 + 0x14)) *
        (*(float *)(param_1 + 0xc) - *(float *)(param_1 + 8)) <
        (*(float *)(param_2 + 4) - *(float *)(param_1 + 8)) *
        (*(float *)(param_1 + 0x10) - *(float *)(param_1 + 0x14))) {
      fVar1 = (float10)_DAT_00411b58;
    }
    else {
      fVar1 = (float10)_DAT_00411b54;
    }
  }
  else {
    fVar1 = (float10)*(float *)(param_2 + 4) - (float10)*(float *)(param_1 + 0xc);
  }
  return fVar1;
}



/* @00411be0 file=? name=FUN_00411be0 */

bool __cdecl FUN_00411be0(int param_1)

{
  return *(int *)(param_1 + 0x20) == 10;
}



/* @00411bf8 file=? name=FUN_00411bf8 */

undefined4 * __cdecl
FUN_00411bf8(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,9,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e16b0;
  return param_1;
}



/* @00411c28 file=? name=FUN_00411c28 */

void __cdecl FUN_00411c28(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e16b0;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00411c58 file=? name=FUN_00411c58 */

bool __cdecl FUN_00411c58(float *param_1,float *param_2)

{
  return (*param_2 - *param_1) * (param_1[3] - param_1[2]) <=
         (param_2[3] - param_1[2]) * (param_1[1] - *param_1);
}



/* @00411ca0 file=? name=FUN_00411ca0 */

bool __cdecl FUN_00411ca0(float *param_1,float *param_2)

{
  return (*param_2 - *param_1) * (param_1[3] - param_1[2]) <=
         (param_2[1] - param_1[2]) * (param_1[1] - *param_1);
}



/* @00411ce8 file=? name=FUN_00411ce8 */

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

float10 __cdecl FUN_00411ce8(float *param_1,float *param_2)

{
  float10 fVar1;
  
  if (param_2[1] <= param_1[3]) {
    if ((param_2[1] - param_1[2]) * (param_1[1] - *param_1) <
        (*param_2 - *param_1) * (param_1[3] - param_1[2])) {
      fVar1 = (float10)_DAT_00411d54;
    }
    else {
      fVar1 = (float10)_DAT_00411d50;
    }
  }
  else {
    fVar1 = (float10)param_2[1] - (float10)param_1[3];
  }
  return fVar1;
}



/* @00411ddc file=? name=FUN_00411ddc */

bool __cdecl FUN_00411ddc(int param_1)

{
  return *(int *)(param_1 + 0x20) == 9;
}



/* @00411df4 file=? name=FUN_00411df4 */

undefined4 * __cdecl
FUN_00411df4(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,0xb,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1690;
  return param_1;
}



/* @00411e24 file=? name=FUN_00411e24 */

void __cdecl FUN_00411e24(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1690;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00411e54 file=? name=FUN_00411e54 */

bool __cdecl FUN_00411e54(float *param_1,int param_2)

{
  return (*(float *)(param_2 + 0xc) - param_1[2]) * (*param_1 - param_1[1]) <=
         (*(float *)(param_2 + 4) - param_1[1]) * (param_1[3] - param_1[2]);
}



/* @00411ea0 file=? name=FUN_00411ea0 */

bool __cdecl FUN_00411ea0(float *param_1,float *param_2)

{
  return (param_2[1] - param_1[2]) * (*param_1 - param_1[1]) <=
         (*param_2 - param_1[1]) * (param_1[3] - param_1[2]);
}



/* @00411eec file=? name=FUN_00411eec */

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

float10 __cdecl FUN_00411eec(float *param_1,float *param_2)

{
  float10 fVar1;
  
  if (param_2[1] <= param_1[3]) {
    if ((*param_2 - param_1[1]) * (param_1[3] - param_1[2]) <
        (param_2[1] - param_1[2]) * (*param_1 - param_1[1])) {
      fVar1 = (float10)_DAT_00411f58;
    }
    else {
      fVar1 = (float10)_DAT_00411f54;
    }
  }
  else {
    fVar1 = (float10)param_2[1] - (float10)param_1[3];
  }
  return fVar1;
}



/* @00411fe0 file=? name=FUN_00411fe0 */

bool __cdecl FUN_00411fe0(int param_1)

{
  return *(int *)(param_1 + 0x20) == 0xb;
}



/* @00411ff8 file=? name=FUN_00411ff8 */

undefined4 * __cdecl
FUN_00411ff8(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,0xc,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1770;
  return param_1;
}



/* @00412028 file=? name=FUN_00412028 */

void __cdecl FUN_00412028(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1770;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00412058 file=? name=FUN_00412058 */

bool __cdecl FUN_00412058(float *param_1,int param_2)

{
  return (*(float *)(param_2 + 0x10) - param_1[4]) * (param_1[1] - *param_1) <=
         (*(float *)(param_2 + 4) - *param_1) * (param_1[5] - param_1[4]);
}



/* @004120a4 file=? name=FUN_004120a4 */

bool __cdecl FUN_004120a4(float *param_1,float *param_2)

{
  return (param_2[2] - param_1[4]) * (param_1[1] - *param_1) <=
         (*param_2 - *param_1) * (param_1[5] - param_1[4]);
}



/* @004120ec file=? name=FUN_004120ec */

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

float10 __cdecl FUN_004120ec(float *param_1,float *param_2)

{
  float10 fVar1;
  
  if ((*param_2 - *param_1) * (param_1[5] - param_1[4]) <
      (param_2[2] - param_1[4]) * (param_1[1] - *param_1)) {
    fVar1 = (float10)_DAT_00412160;
  }
  else if (param_2[1] - param_1[3] <= _DAT_0041215c) {
    fVar1 = (float10)_DAT_0041215c;
  }
  else {
    fVar1 = (float10)(param_2[1] - param_1[3]);
  }
  return fVar1;
}



/* @004121e8 file=? name=FUN_004121e8 */

bool __cdecl FUN_004121e8(int param_1)

{
  return *(int *)(param_1 + 0x20) == 0xc;
}



/* @00412200 file=? name=FUN_00412200 */

undefined4 * __cdecl
FUN_00412200(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,0xe,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1750;
  return param_1;
}



/* @00412230 file=? name=FUN_00412230 */

void __cdecl FUN_00412230(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1750;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00412260 file=? name=FUN_00412260 */

bool __cdecl FUN_00412260(float *param_1,float *param_2)

{
  return (param_2[5] - param_1[5]) * (*param_1 - param_1[1]) <=
         (*param_2 - param_1[1]) * (param_1[4] - param_1[5]);
}



/* @004122ac file=? name=FUN_004122ac */

bool __cdecl FUN_004122ac(float *param_1,float *param_2)

{
  return (param_2[2] - param_1[5]) * (*param_1 - param_1[1]) <=
         (*param_2 - param_1[1]) * (param_1[4] - param_1[5]);
}



/* @004122f8 file=? name=FUN_004122f8 */

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

float10 __cdecl FUN_004122f8(float *param_1,float *param_2)

{
  float10 fVar1;
  
  if ((*param_2 - param_1[1]) * (param_1[4] - param_1[5]) <
      (param_2[2] - param_1[5]) * (*param_1 - param_1[1])) {
    fVar1 = (float10)_DAT_0041236c;
  }
  else if (param_2[1] - param_1[3] <= _DAT_00412368) {
    fVar1 = (float10)_DAT_00412368;
  }
  else {
    fVar1 = (float10)(param_2[1] - param_1[3]);
  }
  return fVar1;
}



/* @004123f4 file=? name=FUN_004123f4 */

bool __cdecl FUN_004123f4(int param_1)

{
  return *(int *)(param_1 + 0x20) == 0xe;
}



/* @0041240c file=? name=FUN_0041240c */

undefined4 * __cdecl
FUN_0041240c(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,0xf,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1730;
  return param_1;
}



/* @0041243c file=? name=FUN_0041243c */

void __cdecl FUN_0041243c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1730;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041246c file=? name=FUN_0041246c */

bool __cdecl FUN_0041246c(float *param_1,int param_2)

{
  return (*(float *)(param_2 + 4) - *param_1) * (param_1[4] - param_1[5]) <=
         (*(float *)(param_2 + 0x14) - param_1[5]) * (param_1[1] - *param_1);
}



/* @004124b8 file=? name=FUN_004124b8 */

bool __cdecl FUN_004124b8(float *param_1,float *param_2)

{
  return (*param_2 - *param_1) * (param_1[4] - param_1[5]) <=
         (param_2[2] - param_1[5]) * (param_1[1] - *param_1);
}



/* @00412500 file=? name=FUN_00412500 */

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

float10 __cdecl FUN_00412500(float *param_1,float *param_2)

{
  float10 fVar1;
  
  if ((param_2[2] - param_1[5]) * (param_1[1] - *param_1) <
      (*param_2 - *param_1) * (param_1[4] - param_1[5])) {
    fVar1 = (float10)_DAT_00412574;
  }
  else if (param_2[1] - param_1[3] <= _DAT_00412570) {
    fVar1 = (float10)_DAT_00412570;
  }
  else {
    fVar1 = (float10)(param_2[1] - param_1[3]);
  }
  return fVar1;
}



/* @004125fc file=? name=FUN_004125fc */

bool __cdecl FUN_004125fc(int param_1)

{
  return *(int *)(param_1 + 0x20) == 0xf;
}



/* @00412614 file=? name=FUN_00412614 */

undefined4 * __cdecl
FUN_00412614(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,0xd,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1710;
  return param_1;
}



/* @00412644 file=? name=FUN_00412644 */

void __cdecl FUN_00412644(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1710;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00412674 file=? name=FUN_00412674 */

bool __cdecl FUN_00412674(float *param_1,float *param_2)

{
  return (*param_2 - param_1[1]) * (param_1[5] - param_1[4]) <=
         (param_2[4] - param_1[4]) * (*param_1 - param_1[1]);
}



/* @004126c0 file=? name=FUN_004126c0 */

bool __cdecl FUN_004126c0(float *param_1,float *param_2)

{
  return (*param_2 - param_1[1]) * (param_1[5] - param_1[4]) <=
         (param_2[2] - param_1[4]) * (*param_1 - param_1[1]);
}



/* @0041270c file=? name=FUN_0041270c */

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

float10 __cdecl FUN_0041270c(float *param_1,float *param_2)

{
  float10 fVar1;
  
  if ((param_2[2] - param_1[4]) * (*param_1 - param_1[1]) <
      (*param_2 - param_1[1]) * (param_1[5] - param_1[4])) {
    fVar1 = (float10)_DAT_00412780;
  }
  else if (param_2[1] - param_1[3] <= _DAT_0041277c) {
    fVar1 = (float10)_DAT_0041277c;
  }
  else {
    fVar1 = (float10)(param_2[1] - param_1[3]);
  }
  return fVar1;
}



/* @00412808 file=? name=FUN_00412808 */

bool __cdecl FUN_00412808(int param_1)

{
  return *(int *)(param_1 + 0x20) == 0xd;
}



/* @00412820 file=? name=FUN_00412820 */

undefined4 * __cdecl
FUN_00412820(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,0x10,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e17d0;
  return param_1;
}



/* @00412850 file=? name=FUN_00412850 */

void __cdecl FUN_00412850(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e17d0;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00412880 file=? name=FUN_00412880 */

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

bool __cdecl FUN_00412880(int param_1,int param_2)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  
  fVar4 = (*(float *)(param_1 + 8) + *(float *)(param_1 + 0xc)) * _DAT_00412940;
  fVar5 = (*(float *)(param_1 + 0x10) + *(float *)(param_1 + 0x14)) * _DAT_00412940;
  fVar1 = *(float *)(param_1 + 0xc) - fVar4;
  if (*(float *)(param_2 + 8) <= fVar4) {
    fVar2 = fVar4;
    if (*(float *)(param_2 + 0xc) < fVar4) {
      fVar2 = *(float *)(param_2 + 0xc);
    }
  }
  else {
    fVar2 = *(float *)(param_2 + 8);
  }
  if (*(float *)(param_2 + 0x10) <= fVar5) {
    fVar3 = fVar5;
    if (*(float *)(param_2 + 0x14) < fVar5) {
      fVar3 = *(float *)(param_2 + 0x14);
    }
  }
  else {
    fVar3 = *(float *)(param_2 + 0x10);
  }
  return (fVar3 - fVar5) * (fVar3 - fVar5) + (fVar2 - fVar4) * (fVar2 - fVar4) <= fVar1 * fVar1;
}



/* @00412c78 file=? name=FUN_00412c78 */

undefined4 * __cdecl
FUN_00412c78(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,0x11,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e17b0;
  return param_1;
}



/* @00412ca8 file=? name=FUN_00412ca8 */

void __cdecl FUN_00412ca8(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e17b0;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00412cd8 file=? name=FUN_00412cd8 */

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

uint __cdecl FUN_00412cd8(float *param_1,undefined4 *param_2)

{
  float *pfVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  uint uVar5;
  
  pfVar1 = (float *)*param_2;
  switch(pfVar1[8]) {
  case 0.0:
  case 1.4013e-45:
  case 4.2039e-45:
  case 5.60519e-45:
  case 7.00649e-45:
  case 8.40779e-45:
  case 9.80909e-45:
  case 1.12104e-44:
  case 1.26117e-44:
  case 1.4013e-44:
  case 1.54143e-44:
  case 1.68156e-44:
  case 1.82169e-44:
  case 1.96182e-44:
  case 2.10195e-44:
  case 2.24208e-44:
  case 2.52234e-44:
  case 2.66247e-44:
  case 2.8026e-44:
    uVar5 = (**(code **)((int)param_1[6] + 4))(param_1,param_2 + 1);
    break;
  case 2.8026e-45:
    fVar3 = (param_1[1] + *param_1) * _DAT_00412e68;
    fVar4 = (pfVar1[1] + *pfVar1) * _DAT_00412e68;
    fVar2 = ((pfVar1[3] - param_1[2]) / (pfVar1[3] - pfVar1[2])) * (pfVar1[1] - fVar4) +
            (param_1[1] - fVar3);
    fVar3 = fVar3 - fVar4;
    fVar4 = (param_1[5] + param_1[4]) * _DAT_00412e68 - (pfVar1[5] + pfVar1[4]) * _DAT_00412e68;
    uVar5 = (uint)(fVar4 * fVar4 + fVar3 * fVar3 <= fVar2 * fVar2);
    break;
  case 2.38221e-44:
    fVar3 = (param_1[1] + *param_1) * _DAT_00412e68;
    fVar4 = (pfVar1[1] + *pfVar1) * _DAT_00412e68;
    fVar2 = (pfVar1[1] - fVar4) + (param_1[1] - fVar3);
    fVar3 = fVar3 - fVar4;
    fVar4 = (param_1[5] + param_1[4]) * _DAT_00412e68 - (pfVar1[5] + pfVar1[4]) * _DAT_00412e68;
    uVar5 = (uint)(fVar4 * fVar4 + fVar3 * fVar3 <= fVar2 * fVar2);
    break;
  default:
    uVar5 = 0;
  }
  return uVar5;
}



/* @004146dc file=? name=FUN_004146dc */

undefined4 * __cdecl
FUN_004146dc(undefined4 *param_1,undefined4 *param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5)

{
  FUN_0040ee38(param_1,param_2,0x12,param_3,param_4,param_5);
  param_1[6] = &PTR_FUN_004e1790;
  return param_1;
}



/* @0041470c file=? name=FUN_0041470c */

void __cdecl FUN_0041470c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    param_1[6] = (int)&PTR_FUN_004e1790;
    FUN_0040eea8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041473c file=? name=FUN_0041473c */

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

bool __cdecl FUN_0041473c(float *param_1,float *param_2)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  
  fVar3 = (*param_1 + param_1[1]) * _DAT_004147fc;
  fVar4 = (param_1[2] + param_1[3]) * _DAT_004147fc;
  if (*param_2 <= fVar3) {
    fVar1 = fVar3;
    if (param_2[1] < fVar3) {
      fVar1 = param_2[1];
    }
  }
  else {
    fVar1 = *param_2;
  }
  if (param_2[2] <= fVar4) {
    fVar2 = fVar4;
    if (param_2[3] < fVar4) {
      fVar2 = param_2[3];
    }
  }
  else {
    fVar2 = param_2[2];
  }
  return (fVar2 - fVar4) * (fVar2 - fVar4) + (fVar1 - fVar3) * (fVar1 - fVar3) <=
         (param_1[1] - fVar3) * (param_1[1] - fVar3);
}



/* @00414b60 file=? name=FUN_00414b60 */

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

undefined * FUN_00414b60(void)

{
  if (DAT_004e17f0 == '\0') {
    DAT_004e17f0 = '\x01';
  }
  if (DAT_00521404 == 0) {
    _DAT_00521f60 = FUN_00401a1c();
    _DAT_00521f60 = _DAT_00521f60 - _DAT_00521408;
  }
  else {
    _DAT_00521f60 = DAT_00521404;
  }
  return &DAT_00521f60;
}



/* @00414b98 file=? name=FUN_00414b98 */

undefined4 FUN_00414b98(void)

{
  return 1;
}



/* @00414ba4 file=? name=FUN_00414ba4 */

void __cdecl FUN_00414ba4(undefined4 param_1,undefined4 *param_2)

{
  undefined4 uVar1;
  
  FUN_004dd1cc(param_1);
  uVar1 = FUN_004dcd94();
  *param_2 = uVar1;
  return;
}



/* @00414be8 file=? name=FUN_00414be8 */

void __cdecl FUN_00414be8(undefined4 *param_1,undefined4 param_2)

{
  *param_1 = &PTR_FUN_004e1bdc;
  param_1[1] = param_2;
  return;
}



/* @00414bfc file=? name=FUN_00414bfc */

void __cdecl FUN_00414bfc(int *param_1,byte param_2)

{
  if ((param_1 != (int *)0x0) && (*param_1 = (int)&PTR_FUN_004e1bdc, (param_2 & 1) != 0)) {
    FUN_004022d0(param_1);
  }
  return;
}



/* @00414c1c file=? name=FUN_00414c1c */

undefined4 * __cdecl FUN_00414c1c(undefined4 *param_1,int *param_2)

{
  undefined1 local_8 [4];
  
  *param_1 = &PTR_FUN_004e1bdc;
  (**(code **)(*param_2 + 0x1c))(param_2,param_1 + 1,4);
  (**(code **)(*param_2 + 0x1c))(param_2,local_8,4);
  return param_1;
}



/* @00414c58 file=? name=FUN_00414c58 */

void __cdecl FUN_00414c58(int *param_1)

{
  int *piVar1;
  
  piVar1 = (int *)(**(code **)(*param_1 + 0x20))(param_1,&stack0x0000000c,4);
  (**(code **)(*piVar1 + 0x20))(piVar1,&stack0x00000010,4);
  return;
}



/* @00414c80 file=? name=FUN_00414c80 */

undefined4 FUN_00414c80(void)

{
  return 1;
}



/* @00414c8c file=? name=FUN_00414c8c */

undefined4 __cdecl FUN_00414c8c(int *param_1)

{
  char *pcVar1;
  char *pcVar2;
  char *pcVar3;
  bool bVar4;
  
  pcVar3 = s_AudioStateTrigger_004e17f8;
  pcVar2 = *(char **)(*param_1 + 8);
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414cc3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414cc3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x1c;
  }
LAB_00414cc3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioMotionScale_004e180a;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414cf3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414cf3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x1d;
  }
LAB_00414cf3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioRenderer_004e181b;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414d23;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414d23;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x1e;
  }
LAB_00414d23:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioLocation_004e1829;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414d53;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414d53;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x1f;
  }
LAB_00414d53:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioMotionTrigger_004e1837;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414d83;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414d83;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x27;
  }
LAB_00414d83:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioControlMixer_004e184a;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414db3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414db3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x2b;
  }
LAB_00414db3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioHingeScale_004e185c;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414de3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414de3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x2c;
  }
LAB_00414de3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioControlSmoother_004e186c;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414e13;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414e13;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x2d;
  }
LAB_00414e13:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioResourceSelector_004e1881;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414e43;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414e43;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x2f;
  }
LAB_00414e43:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_L4AudioCollisionTrigger_004e1897;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414e73;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414e73;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3ee;
  }
LAB_00414e73:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioResourceIndex_004e18af;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414ea3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414ea3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x34;
  }
LAB_00414ea3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioScalarScale_004e18c2;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414ed3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414ed3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x35;
  }
LAB_00414ed3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioControlSend_004e18d3;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414f03;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414f03;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x36;
  }
LAB_00414f03:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_L4AudioLocation_004e18e4;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414f33;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414f33;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 1000;
  }
LAB_00414f33:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_DirectPatchSource_004e18f4;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414f63;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414f63;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3e9;
  }
LAB_00414f63:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_Dynamic3DPatchSource_004e1906;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414f93;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414f93;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3ea;
  }
LAB_00414f93:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_PatchResource_004e191b;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414fc3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414fc3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3ec;
  }
LAB_00414fc3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_Static3DPatchSource_004e1929;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00414ff3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00414ff3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3ed;
  }
LAB_00414ff3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioControlMultiplier_004e193d;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415023;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415023;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x2e;
  }
LAB_00415023:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioSampleAndHold_004e1954;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415053;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415053;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3a;
  }
LAB_00415053:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioScalarTrigger_004e1967;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415083;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415083;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3b;
  }
LAB_00415083:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioEnumerationTrigger_004e197a;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_004150b3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_004150b3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3c;
  }
LAB_004150b3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioIntegerTrigger_004e1992;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_004150e3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_004150e3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3d;
  }
LAB_004150e3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioLogicalTrigger_004e19a6;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415113;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415113;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3e;
  }
LAB_00415113:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioControlsButtonTrigger_004e19ba;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415143;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415143;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x42;
  }
LAB_00415143:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_ExplosionResourceTable_004e19d5;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415173;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415173;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x47;
  }
LAB_00415173:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioIdleWatcher_004e19ec;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_004151a3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_004151a3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x49;
  }
LAB_004151a3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioControlEvent_004e19fd;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_004151d3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_004151d3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x4a;
  }
LAB_004151d3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioControlSequence_004e1a0f;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415203;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415203;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x4b;
  }
LAB_00415203:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioControlSplitter_004e1a24;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415233;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415233;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x4c;
  }
LAB_00415233:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioLFO_004e1a39;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415263;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415263;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x4f;
  }
LAB_00415263:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioEnumerationDeltaTrigger_004e1a42;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415293;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415293;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x50;
  }
LAB_00415293:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioScalarDeltaTrigger_004e1a5f;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_004152c3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_004152c3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x51;
  }
LAB_004152c3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioLevelOfDetail_004e1a77;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_004152f3;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_004152f3;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x55;
  }
LAB_004152f3:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_PatchLevelOfDetail_004e1a8a;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415323;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415323;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x3f3;
  }
LAB_00415323:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioMessageWatcher_004e1a9d;
  do {
    if (*pcVar2 != *pcVar3) goto LAB_00415353;
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) goto LAB_00415353;
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (bVar4) {
    return 0x59;
  }
LAB_00415353:
  pcVar2 = *(char **)(*param_1 + 8);
  pcVar3 = s_AudioControlsButtonMessageWatche_004e1ab1;
  do {
    if (*pcVar2 != *pcVar3) {
      return 0xffffffff;
    }
    bVar4 = true;
    if (*pcVar2 == '\0') break;
    pcVar1 = pcVar2 + 1;
    if (*pcVar1 != pcVar3[1]) {
      return 0xffffffff;
    }
    pcVar2 = pcVar2 + 2;
    pcVar3 = pcVar3 + 2;
    bVar4 = *pcVar1 == '\0';
  } while (!bVar4);
  if (!bVar4) {
    return 0xffffffff;
  }
  return 0x5a;
}



/* @00415389 file=? name=FUN_00415389 */

undefined4 * __cdecl
FUN_00415389(undefined4 *param_1,undefined4 param_2,int param_3,undefined4 *param_4)

{
  FUN_004185bc(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e1b14;
  param_1[7] = *param_4;
  return param_1;
}



/* @004153b4 file=? name=FUN_004153b4 */

void __cdecl FUN_004153b4(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1b14;
    FUN_004185ec(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_00415430(param_1);
    }
  }
  return;
}



/* @004153e0 file=? name=FUN_004153e0 */

void FUN_004153e0(void)

{
  int iVar1;
  undefined4 *puVar2;
  
  iVar1 = DAT_004e1b10;
  DAT_004e1b10 = DAT_004e1b10 + 1;
  puVar2 = DAT_004e1b0c;
  if ((iVar1 == 0) && (puVar2 = (undefined4 *)FUN_00402298(0x28), puVar2 != (undefined4 *)0x0)) {
    FUN_00402b98(puVar2,0x20,100,100,s_VChainLinkOf_004e1af0);
  }
  DAT_004e1b0c = puVar2;
  FUN_00402f74((int)DAT_004e1b0c);
  return;
}



/* @00415430 file=? name=FUN_00415430 */

void __cdecl FUN_00415430(undefined4 *param_1)

{
  FUN_00402f98((int)DAT_004e1b0c,param_1);
  DAT_004e1b10 = DAT_004e1b10 + -1;
  if (DAT_004e1b10 == 0) {
    if (DAT_004e1b0c != (int *)0x0) {
      FUN_00402c28(DAT_004e1b0c,0);
      FUN_004022d0(DAT_004e1b0c);
    }
    DAT_004e1b0c = (int *)0x0;
  }
  return;
}



/* @0041547b file=? name=FUN_0041547b */

undefined4 * __cdecl FUN_0041547b(undefined4 *param_1,int *param_2)

{
  int *piVar1;
  undefined4 *puVar2;
  int iVar3;
  int *local_8;
  
  FUN_00415e90(param_1,1);
  *param_1 = &PTR_FUN_004e1bd8;
  puVar2 = (undefined4 *)FUN_00402298(0x10);
  if (puVar2 == (undefined4 *)0x0) {
    iVar3 = 0;
  }
  else {
    iVar3 = FUN_004023f4(puVar2);
  }
  param_1[3] = iVar3;
  piVar1 = (int *)(param_1[3] + 0xc);
  *piVar1 = *piVar1 + 1;
  FUN_00402a4c((int *)&local_8,param_1 + 3,param_2);
  piVar1 = local_8 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_8,3);
  }
  return param_1;
}



/* @004154e8 file=? name=FUN_004154e8 */

void __cdecl FUN_004154e8(int *param_1,byte param_2)

{
  int *piVar1;
  int *piVar2;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1bd8;
    piVar2 = (int *)param_1[3];
    piVar1 = piVar2 + 3;
    *piVar1 = *piVar1 + -1;
    if (*piVar1 == 0) {
      FUN_004024d8(piVar2,3);
    }
    FUN_00415ed8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00415529 file=? name=FUN_00415529 */

undefined4 * __cdecl FUN_00415529(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_00418bb8(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e1bbc;
  return param_1;
}



/* @0041554c file=? name=FUN_0041554c */

void __cdecl FUN_0041554c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1bbc;
    FUN_00418be0(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00415578 file=? name=FUN_00415578 */

undefined4 __cdecl FUN_00415578(undefined4 param_1,int param_2,int param_3)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_004027d8(*(int *)(param_2 + 0x20),*(int *)(param_3 + 0x20));
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    iVar1 = FUN_004027d8(*(int *)(param_2 + 0x20),*(int *)(param_3 + 0x20));
    if (iVar1 < 1) {
      uVar2 = 0xffffffff;
    }
    else {
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @004155c5 file=? name=FUN_004155c5 */

undefined4 __cdecl FUN_004155c5(undefined4 param_1,int *param_2,int param_3)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_004027d8(*param_2,*(int *)(param_3 + 0x20));
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    iVar1 = FUN_004027d8(*param_2,*(int *)(param_3 + 0x20));
    if (iVar1 < 1) {
      uVar2 = 0xffffffff;
    }
    else {
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @0041560f file=? name=FUN_0041560f */

int * __cdecl FUN_0041560f(int *param_1,int param_2)

{
  FUN_00418f34(param_1,param_2);
  *param_1 = (int)&PTR_FUN_004e1b60;
  return param_1;
}



/* @0041562e file=? name=FUN_0041562e */

int * __cdecl FUN_0041562e(int *param_1,int param_2)

{
  FUN_00418f34(param_1,param_2);
  *param_1 = (int)&PTR_FUN_004e1b60;
  return param_1;
}



/* @0041564d file=? name=FUN_0041564d */

void __cdecl FUN_0041564d(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1b60;
    FUN_00418f5c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00415679 file=? name=FUN_00415679 */

undefined4 * __cdecl FUN_00415679(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_004186ac(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e1b44;
  return param_1;
}



/* @0041569c file=? name=FUN_0041569c */

void __cdecl FUN_0041569c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1b44;
    FUN_004186dc(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_00415773(param_1);
    }
  }
  return;
}



/* @004156c8 file=? name=FUN_004156c8 */

undefined4 __cdecl FUN_004156c8(undefined4 param_1,int param_2,int param_3)

{
  undefined4 uVar1;
  
  if (*(uint *)(param_3 + 0x1c) == *(uint *)(param_2 + 0x1c)) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
    if (*(uint *)(param_2 + 0x1c) <= *(uint *)(param_3 + 0x1c)) {
      uVar1 = 0xffffffff;
    }
  }
  return uVar1;
}



/* @004156f7 file=? name=FUN_004156f7 */

undefined4 __cdecl FUN_004156f7(undefined4 param_1,uint *param_2,int param_3)

{
  undefined4 uVar1;
  
  if (*(uint *)(param_3 + 0x1c) == *param_2) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
    if (*param_2 <= *(uint *)(param_3 + 0x1c)) {
      uVar1 = 0xffffffff;
    }
  }
  return uVar1;
}



/* @00415723 file=? name=FUN_00415723 */

void FUN_00415723(void)

{
  int iVar1;
  undefined4 *puVar2;
  
  iVar1 = DAT_004e1b1c;
  DAT_004e1b1c = DAT_004e1b1c + 1;
  puVar2 = DAT_004e1b18;
  if ((iVar1 == 0) && (puVar2 = (undefined4 *)FUN_00402298(0x28), puVar2 != (undefined4 *)0x0)) {
    FUN_00402b98(puVar2,0x18,100,100,s_VChainOf_004e1ad3);
  }
  DAT_004e1b18 = puVar2;
  FUN_00402f74((int)DAT_004e1b18);
  return;
}



/* @00415773 file=? name=FUN_00415773 */

void __cdecl FUN_00415773(undefined4 *param_1)

{
  FUN_00402f98((int)DAT_004e1b18,param_1);
  DAT_004e1b1c = DAT_004e1b1c + -1;
  if (DAT_004e1b1c == 0) {
    if (DAT_004e1b18 != (int *)0x0) {
      FUN_00402c28(DAT_004e1b18,0);
      FUN_004022d0(DAT_004e1b18);
    }
    DAT_004e1b18 = (int *)0x0;
  }
  return;
}



/* @004157be file=? name=FUN_004157be */

undefined4 * __cdecl FUN_004157be(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_004186ac(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e1b28;
  return param_1;
}



/* @004157e1 file=? name=FUN_004157e1 */

void __cdecl FUN_004157e1(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1b28;
    FUN_004186dc(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004158f4(param_1);
    }
  }
  return;
}



/* @0041580d file=? name=FUN_0041580d */

undefined4 __cdecl FUN_0041580d(undefined4 param_1,int param_2,int param_3)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_004027d8(*(int *)(param_2 + 0x1c),*(int *)(param_3 + 0x1c));
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    iVar1 = FUN_004027d8(*(int *)(param_2 + 0x1c),*(int *)(param_3 + 0x1c));
    if (iVar1 < 1) {
      uVar2 = 0xffffffff;
    }
    else {
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @0041585a file=? name=FUN_0041585a */

undefined4 __cdecl FUN_0041585a(undefined4 param_1,int *param_2,int param_3)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_004027d8(*param_2,*(int *)(param_3 + 0x1c));
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    iVar1 = FUN_004027d8(*param_2,*(int *)(param_3 + 0x1c));
    if (iVar1 < 1) {
      uVar2 = 0xffffffff;
    }
    else {
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @004158a4 file=? name=FUN_004158a4 */

void FUN_004158a4(void)

{
  int iVar1;
  undefined4 *puVar2;
  
  iVar1 = DAT_004e1b24;
  DAT_004e1b24 = DAT_004e1b24 + 1;
  puVar2 = DAT_004e1b20;
  if ((iVar1 == 0) && (puVar2 = (undefined4 *)FUN_00402298(0x28), puVar2 != (undefined4 *)0x0)) {
    FUN_00402b98(puVar2,0x18,100,100,s_VChainOf_004e1adc);
  }
  DAT_004e1b20 = puVar2;
  FUN_00402f74((int)DAT_004e1b20);
  return;
}



/* @004158f4 file=? name=FUN_004158f4 */

void __cdecl FUN_004158f4(undefined4 *param_1)

{
  FUN_00402f98((int)DAT_004e1b20,param_1);
  DAT_004e1b24 = DAT_004e1b24 + -1;
  if (DAT_004e1b24 == 0) {
    if (DAT_004e1b20 != (int *)0x0) {
      FUN_00402c28(DAT_004e1b20,0);
      FUN_004022d0(DAT_004e1b20);
    }
    DAT_004e1b20 = (int *)0x0;
  }
  return;
}



/* @0041593f file=? name=FUN_0041593f */

undefined4 * __cdecl FUN_0041593f(undefined4 param_1,int param_2,int *param_3)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00415bd2();
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00415b1e(puVar1,param_1,param_2,param_3);
  }
  return puVar1;
}



/* @0041596f file=? name=FUN_0041596f */

undefined4 * __cdecl FUN_0041596f(undefined4 param_1,int param_2,undefined4 *param_3)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_004153e0();
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00415389(puVar1,param_1,param_2,param_3);
  }
  return puVar1;
}



/* @0041599f file=? name=FUN_0041599f */

undefined4 * __cdecl FUN_0041599f(undefined4 param_1,int param_2,int *param_3)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00415a83();
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004159cf(puVar1,param_1,param_2,param_3);
  }
  return puVar1;
}



/* @004159cf file=? name=FUN_004159cf */

undefined4 * __cdecl FUN_004159cf(undefined4 *param_1,undefined4 param_2,int param_3,int *param_4)

{
  int *piVar1;
  undefined4 *puVar2;
  int iVar3;
  int *local_8;
  
  FUN_00418ae0(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e1bf4;
  puVar2 = (undefined4 *)FUN_00402298(0x10);
  if (puVar2 == (undefined4 *)0x0) {
    iVar3 = 0;
  }
  else {
    iVar3 = FUN_004023f4(puVar2);
  }
  param_1[8] = iVar3;
  piVar1 = (int *)(param_1[8] + 0xc);
  *piVar1 = *piVar1 + 1;
  FUN_00402a4c((int *)&local_8,param_1 + 8,param_4);
  piVar1 = local_8 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_8,3);
  }
  return param_1;
}



/* @00415a42 file=? name=FUN_00415a42 */

void __cdecl FUN_00415a42(int *param_1,byte param_2)

{
  int *piVar1;
  int *piVar2;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1bf4;
    piVar2 = (int *)param_1[8];
    piVar1 = piVar2 + 3;
    *piVar1 = *piVar1 + -1;
    if (*piVar1 == 0) {
      FUN_004024d8(piVar2,3);
    }
    FUN_00418b14(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_00415ad3(param_1);
    }
  }
  return;
}



/* @00415a83 file=? name=FUN_00415a83 */

void FUN_00415a83(void)

{
  int iVar1;
  undefined4 *puVar2;
  
  iVar1 = DAT_004e1be4;
  DAT_004e1be4 = DAT_004e1be4 + 1;
  puVar2 = DAT_004e1be0;
  if ((iVar1 == 0) && (puVar2 = (undefined4 *)FUN_00402298(0x28), puVar2 != (undefined4 *)0x0)) {
    FUN_00402b98(puVar2,0x24,100,100,s_TreeNodeOf_004e1ae5);
  }
  DAT_004e1be0 = puVar2;
  FUN_00402f74((int)DAT_004e1be0);
  return;
}



/* @00415ad3 file=? name=FUN_00415ad3 */

void __cdecl FUN_00415ad3(undefined4 *param_1)

{
  FUN_00402f98((int)DAT_004e1be0,param_1);
  DAT_004e1be4 = DAT_004e1be4 + -1;
  if (DAT_004e1be4 == 0) {
    if (DAT_004e1be0 != (int *)0x0) {
      FUN_00402c28(DAT_004e1be0,0);
      FUN_004022d0(DAT_004e1be0);
    }
    DAT_004e1be0 = (int *)0x0;
  }
  return;
}



/* @00415b1e file=? name=FUN_00415b1e */

undefined4 * __cdecl FUN_00415b1e(undefined4 *param_1,undefined4 param_2,int param_3,int *param_4)

{
  int *piVar1;
  undefined4 *puVar2;
  int iVar3;
  int *local_8;
  
  FUN_004185bc(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e1bf0;
  puVar2 = (undefined4 *)FUN_00402298(0x10);
  if (puVar2 == (undefined4 *)0x0) {
    iVar3 = 0;
  }
  else {
    iVar3 = FUN_004023f4(puVar2);
  }
  param_1[7] = iVar3;
  piVar1 = (int *)(param_1[7] + 0xc);
  *piVar1 = *piVar1 + 1;
  FUN_00402a4c((int *)&local_8,param_1 + 7,param_4);
  piVar1 = local_8 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_8,3);
  }
  return param_1;
}



/* @00415b91 file=? name=FUN_00415b91 */

void __cdecl FUN_00415b91(int *param_1,byte param_2)

{
  int *piVar1;
  int *piVar2;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1bf0;
    piVar2 = (int *)param_1[7];
    piVar1 = piVar2 + 3;
    *piVar1 = *piVar1 + -1;
    if (*piVar1 == 0) {
      FUN_004024d8(piVar2,3);
    }
    FUN_004185ec(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_00415c22(param_1);
    }
  }
  return;
}



/* @00415bd2 file=? name=FUN_00415bd2 */

void FUN_00415bd2(void)

{
  int iVar1;
  undefined4 *puVar2;
  
  iVar1 = DAT_004e1bec;
  DAT_004e1bec = DAT_004e1bec + 1;
  puVar2 = DAT_004e1be8;
  if ((iVar1 == 0) && (puVar2 = (undefined4 *)FUN_00402298(0x28), puVar2 != (undefined4 *)0x0)) {
    FUN_00402b98(puVar2,0x20,100,100,s_VChainLinkOf_004e1afd);
  }
  DAT_004e1be8 = puVar2;
  FUN_00402f74((int)DAT_004e1be8);
  return;
}



/* @00415c22 file=? name=FUN_00415c22 */

void __cdecl FUN_00415c22(undefined4 *param_1)

{
  FUN_00402f98((int)DAT_004e1be8,param_1);
  DAT_004e1bec = DAT_004e1bec + -1;
  if (DAT_004e1bec == 0) {
    if (DAT_004e1be8 != (int *)0x0) {
      FUN_00402c28(DAT_004e1be8,0);
      FUN_004022d0(DAT_004e1be8);
    }
    DAT_004e1be8 = (int *)0x0;
  }
  return;
}



/* @00415c70 file=? name=FUN_00415c70 */

void __cdecl FUN_00415c70(undefined4 *param_1)

{
  *param_1 = &PTR_FUN_004e1dc4;
  return;
}



/* @00415c80 file=? name=FUN_00415c80 */

void __cdecl FUN_00415c80(int *param_1,byte param_2)

{
  if ((param_1 != (int *)0x0) && (*param_1 = (int)&PTR_FUN_004e1dc4, (param_2 & 1) != 0)) {
    FUN_004022d0(param_1);
  }
  return;
}



/* @00415ca0 file=? name=FUN_00415ca0 */

undefined4 FUN_00415ca0(void)

{
  return 1;
}



/* @00415cac file=munga/iterator.cpp name=FUN_00415cac */

void FUN_00415cac(void)

{
  FUN_0040385c(s_Iterator__First___Should_never_r_004e1bf8,s_d__tesla_bt_munga_ITERATOR_CPP_004e1c22
               ,0x40);
  return;
}



/* @00415cc8 file=munga/iterator.cpp name=FUN_00415cc8 */

void FUN_00415cc8(void)

{
  FUN_0040385c(s_Iterator__Last___Should_never_re_004e1c41,s_d__tesla_bt_munga_ITERATOR_CPP_004e1c6a
               ,0x4b);
  return;
}



/* @00415ce4 file=munga/iterator.cpp name=FUN_00415ce4 */

void FUN_00415ce4(void)

{
  FUN_0040385c(s_Iterator__Next___Should_never_re_004e1c89,s_d__tesla_bt_munga_ITERATOR_CPP_004e1cb2
               ,0x56);
  return;
}



/* @00415d00 file=munga/iterator.cpp name=FUN_00415d00 */

void FUN_00415d00(void)

{
  FUN_0040385c(s_Iterator__Previous___Should_neve_004e1cd1,s_d__tesla_bt_munga_ITERATOR_CPP_004e1cfe
               ,0x61);
  return;
}



/* @00415d1c file=munga/iterator.cpp name=FUN_00415d1c */

undefined4 FUN_00415d1c(void)

{
  FUN_0040385c(s_Iterator__GetSize___Should_never_004e1d1d,s_d__tesla_bt_munga_ITERATOR_CPP_004e1d49
               ,0x6c);
  return 0;
}



/* @00415d38 file=? name=FUN_00415d38 */

int __cdecl FUN_00415d38(int *param_1)

{
  int iVar1;
  
  iVar1 = (**(code **)(*param_1 + 0x30))(param_1);
  if (iVar1 != 0) {
    (**(code **)(*param_1 + 0xc))(param_1);
  }
  return iVar1;
}



/* @00415d5c file=? name=FUN_00415d5c */

int __cdecl FUN_00415d5c(int *param_1)

{
  int iVar1;
  
  iVar1 = (**(code **)(*param_1 + 0x30))(param_1);
  if (iVar1 != 0) {
    (**(code **)(*param_1 + 0x10))(param_1);
  }
  return iVar1;
}



/* @00415d80 file=munga/iterator.cpp name=FUN_00415d80 */

undefined4 FUN_00415d80(void)

{
  FUN_0040385c(s_Iterator__GetCurrentImplementati_004e1d68,s_d__tesla_bt_munga_ITERATOR_CPP_004e1da5
               ,0x9a);
  return 0;
}



/* @00415da0 file=? name=FUN_00415da0 */

int __cdecl FUN_00415da0(int *param_1,int param_2)

{
  int iVar1;
  int iVar2;
  
  iVar2 = 0;
  (**(code **)(*param_1 + 4))(param_1);
  while( true ) {
    iVar1 = (**(code **)(*param_1 + 0x30))(param_1);
    if (iVar1 == 0) {
      return 0;
    }
    if (iVar2 == param_2) break;
    (**(code **)(*param_1 + 0xc))(param_1);
    iVar2 = iVar2 + 1;
  }
  return iVar1;
}



/* @00415ddc file=? name=FUN_00415ddc */

undefined4 * __cdecl FUN_00415ddc(undefined4 *param_1,undefined4 param_2,int param_3)

{
  *param_1 = &PTR_FUN_004e1e0c;
  param_1[1] = param_2;
  param_1[2] = param_3;
  FUN_00415e70((int)param_1,param_3);
  return param_1;
}



/* @00415e04 file=? name=FUN_00415e04 */

void __cdecl FUN_00415e04(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1e0c;
    FUN_00415e38((int)param_1);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00415e2c file=? name=FUN_00415e2c */

undefined4 FUN_00415e2c(void)

{
  return 1;
}



/* @00415e38 file=? name=FUN_00415e38 */

void __cdecl FUN_00415e38(int param_1)

{
  if (param_1 == *(int *)(*(int *)(param_1 + 8) + 8)) {
    *(undefined4 *)(*(int *)(param_1 + 8) + 8) = *(undefined4 *)(param_1 + 0xc);
  }
  if (*(int *)(param_1 + 0x10) != 0) {
    *(undefined4 *)(*(int *)(param_1 + 0x10) + 0xc) = *(undefined4 *)(param_1 + 0xc);
  }
  if (*(int *)(param_1 + 0xc) != 0) {
    *(undefined4 *)(*(int *)(param_1 + 0xc) + 0x10) = *(undefined4 *)(param_1 + 0x10);
  }
  *(undefined4 *)(param_1 + 0xc) = 0;
  *(undefined4 *)(param_1 + 0x10) = 0;
  return;
}



/* @00415e70 file=? name=FUN_00415e70 */

void __cdecl FUN_00415e70(int param_1,int param_2)

{
  int iVar1;
  
  iVar1 = *(int *)(param_2 + 8);
  *(int *)(param_1 + 0xc) = iVar1;
  if (iVar1 != 0) {
    *(int *)(iVar1 + 0x10) = param_1;
  }
  *(undefined4 *)(param_1 + 0x10) = 0;
  *(int *)(param_2 + 8) = param_1;
  return;
}



/* @00415e90 file=? name=FUN_00415e90 */

undefined4 * __cdecl FUN_00415e90(undefined4 *param_1,undefined4 param_2)

{
  FUN_00414be8(param_1,param_2);
  *param_1 = &PTR_FUN_004e1e90;
  param_1[2] = 0;
  return param_1;
}



/* @00415eb4 file=? name=FUN_00415eb4 */

undefined4 * __cdecl FUN_00415eb4(undefined4 *param_1,int *param_2)

{
  FUN_00414c1c(param_1,param_2);
  *param_1 = &PTR_FUN_004e1e90;
  param_1[2] = 0;
  return param_1;
}



/* @00415ed8 file=? name=FUN_00415ed8 */

void __cdecl FUN_00415ed8(int *param_1,byte param_2)

{
  undefined4 *puVar1;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1e90;
    while (puVar1 = (undefined4 *)param_1[2], puVar1 != (undefined4 *)0x0) {
      if (puVar1 != (undefined4 *)0x0) {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_00414bfc(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00415f1c file=? name=FUN_00415f1c */

undefined4 FUN_00415f1c(void)

{
  return 1;
}



/* @00415f30 file=? name=FUN_00415f30 */

undefined4 * __cdecl FUN_00415f30(undefined4 *param_1,int param_2,undefined4 param_3)

{
  FUN_00415c70(param_1);
  *param_1 = &PTR_FUN_004e1e48;
  param_1[1] = param_2;
  param_1[3] = param_3;
  param_1[2] = *(undefined4 *)(param_2 + 8);
  return param_1;
}



/* @00415f60 file=? name=FUN_00415f60 */

undefined4 * __cdecl FUN_00415f60(undefined4 *param_1,int param_2)

{
  FUN_00415c70(param_1);
  *param_1 = &PTR_FUN_004e1e48;
  param_1[1] = *(undefined4 *)(param_2 + 4);
  param_1[3] = *(undefined4 *)(param_2 + 0xc);
  param_1[2] = *(undefined4 *)(param_2 + 8);
  return param_1;
}



/* @00415f90 file=? name=FUN_00415f90 */

void __cdecl FUN_00415f90(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e1e48;
    FUN_00415c80(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00415fbc file=? name=FUN_00415fbc */

undefined4 FUN_00415fbc(void)

{
  return 1;
}



/* @00415fd0 file=? name=FUN_00415fd0 */

void __cdecl FUN_00415fd0(int param_1)

{
  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(*(int *)(param_1 + 4) + 8);
  FUN_00416128(param_1);
  return;
}



/* @00415fe8 file=? name=FUN_00415fe8 */

void __cdecl FUN_00415fe8(int param_1)

{
  int iVar1;
  
  if ((*(int *)(param_1 + 8) != 0) ||
     (iVar1 = *(int *)(*(int *)(param_1 + 4) + 8), *(int *)(param_1 + 8) = iVar1, iVar1 != 0)) {
    while (iVar1 = *(int *)(*(int *)(param_1 + 8) + 0xc), iVar1 != 0) {
      *(int *)(param_1 + 8) = iVar1;
    }
    FUN_0041615c(param_1);
  }
  return;
}



/* @0041601c file=? name=FUN_0041601c */

void __cdecl FUN_0041601c(int param_1)

{
  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(*(int *)(param_1 + 8) + 0xc);
  FUN_00416128(param_1);
  return;
}



/* @00416034 file=? name=FUN_00416034 */

void __cdecl FUN_00416034(int param_1)

{
  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(*(int *)(param_1 + 8) + 0x10);
  FUN_0041615c(param_1);
  return;
}



/* @0041604c file=? name=FUN_0041604c */

undefined4 __cdecl FUN_0041604c(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = *(int *)(param_1 + 8);
  if (iVar1 != 0) {
    uVar2 = *(undefined4 *)(*(int *)(iVar1 + 4) + 4);
    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar1 + 0xc);
    FUN_00416128(param_1);
    return uVar2;
  }
  return 0;
}



/* @00416078 file=? name=FUN_00416078 */

undefined4 __cdecl FUN_00416078(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = *(int *)(param_1 + 8);
  if (iVar1 != 0) {
    uVar2 = *(undefined4 *)(*(int *)(iVar1 + 4) + 4);
    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar1 + 0x10);
    FUN_0041615c(param_1);
    return uVar2;
  }
  return 0;
}



/* @004160a4 file=? name=FUN_004160a4 */

undefined4 __cdecl FUN_004160a4(int param_1)

{
  if (*(int *)(param_1 + 8) != 0) {
    return *(undefined4 *)(*(int *)(*(int *)(param_1 + 8) + 4) + 4);
  }
  return 0;
}



/* @004160c0 file=? name=FUN_004160c0 */

int __cdecl FUN_004160c0(int *param_1)

{
  int iVar1;
  int iVar2;
  
  iVar2 = 0;
  (**(code **)(*param_1 + 4))(param_1);
  while( true ) {
    iVar1 = (**(code **)(*param_1 + 0x30))(param_1);
    if (iVar1 == 0) break;
    iVar2 = iVar2 + 1;
    (**(code **)(*param_1 + 0xc))(param_1);
  }
  return iVar2;
}



/* @004160ec file=? name=FUN_004160ec */

int __cdecl FUN_004160ec(int *param_1,int param_2)

{
  int iVar1;
  int iVar2;
  
  iVar2 = 0;
  (**(code **)(*param_1 + 4))(param_1);
  while( true ) {
    iVar1 = (**(code **)(*param_1 + 0x30))(param_1);
    if (iVar1 == 0) {
      return 0;
    }
    if (iVar2 == param_2) break;
    (**(code **)(*param_1 + 0xc))(param_1);
    iVar2 = iVar2 + 1;
  }
  return iVar1;
}



/* @00416128 file=? name=FUN_00416128 */

void __cdecl FUN_00416128(int param_1)

{
  int iVar1;
  
  while ((*(int *)(param_1 + 8) != 0 &&
         ((iVar1 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 4) + 4), iVar1 == 0 ||
          ((*(int *)(iVar1 + 4) != *(int *)(param_1 + 0xc) && (*(int *)(param_1 + 0xc) != -1)))))))
  {
    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(*(int *)(param_1 + 8) + 0xc);
  }
  return;
}



/* @0041615c file=? name=FUN_0041615c */

void __cdecl FUN_0041615c(int param_1)

{
  int iVar1;
  
  while ((*(int *)(param_1 + 8) != 0 &&
         ((iVar1 = *(int *)(*(int *)(*(int *)(param_1 + 8) + 4) + 4), iVar1 == 0 ||
          ((*(int *)(iVar1 + 4) != *(int *)(param_1 + 0xc) && (*(int *)(param_1 + 0xc) != -1)))))))
  {
    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(*(int *)(param_1 + 8) + 0x10);
  }
  return;
}



/* @00416190 file=? name=FUN_00416190 */

void __cdecl FUN_00416190(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = *(undefined4 **)(param_1 + 8);
  *(undefined4 *)(param_1 + 8) = puVar1[3];
  if (puVar1 != (undefined4 *)0x0) {
    (**(code **)*puVar1)(puVar1,3);
  }
  return;
}



/* @004161b4 file=? name=FUN_004161b4 */

int __cdecl FUN_004161b4(int *param_1,undefined4 param_2,undefined4 param_3)

{
  int iVar1;
  int *piVar2;
  
  (**(code **)(*param_1 + 4))(param_1);
  while( true ) {
    piVar2 = (int *)(**(code **)(*param_1 + 0x30))(param_1);
    if (piVar2 == (int *)0x0) {
      return 0;
    }
    iVar1 = (**(code **)(*piVar2 + 4))(piVar2,param_2,param_3);
    if (iVar1 != 0) break;
    (**(code **)(*param_1 + 0xc))(param_1);
  }
  return iVar1;
}



/* @004161fc file=? name=FUN_004161fc */

void __cdecl FUN_004161fc(int param_1,int param_2)

{
  undefined4 *puVar1;
  
  puVar1 = *(undefined4 **)(*(int *)(param_1 + 4) + 8);
  while( true ) {
    if (puVar1 == (undefined4 *)0x0) {
      return;
    }
    if (param_2 == puVar1[1]) break;
    puVar1 = (undefined4 *)puVar1[3];
  }
  *(undefined4 *)(param_1 + 8) = puVar1[3];
  if (puVar1 == (undefined4 *)0x0) {
    return;
  }
  (**(code **)*puVar1)(puVar1,3);
  return;
}



/* @00416234 file=? name=FUN_00416234 */

undefined4 * __cdecl FUN_00416234(undefined4 *param_1)

{
  FUN_0040328c(param_1,0);
  *param_1 = &PTR_FUN_004e223c;
  param_1[6] = 0;
  param_1[7] = 0;
  return param_1;
}



/* @0041625c file=? name=FUN_0041625c */

undefined4 * __cdecl FUN_0041625c(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_004032dc(param_1,param_2,param_3,0);
  *param_1 = &PTR_FUN_004e223c;
  param_1[6] = 0;
  param_1[7] = 0;
  return param_1;
}



/* @0041628c file=? name=FUN_0041628c */

undefined4 * __cdecl FUN_0041628c(undefined4 *param_1,int param_2)

{
  FUN_004032dc(param_1,*(undefined4 *)(param_2 + 0x3c),*(undefined4 *)(param_2 + 0x40),0);
  *param_1 = &PTR_FUN_004e223c;
  param_1[6] = 0;
  param_1[7] = 0;
  return param_1;
}



/* @004162c0 file=? name=FUN_004162c0 */

void __cdecl FUN_004162c0(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e223c;
    FUN_00403310(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004162ec file=? name=FUN_004162ec */

undefined8 __cdecl FUN_004162ec(int param_1)

{
  return CONCAT44(*(undefined4 *)(param_1 + 0x18),1);
}



/* @00416320 file=? name=FUN_00416320 */

int FUN_00416320(void)

{
  DAT_004e1e94 = DAT_004e1e94 + 1;
  return DAT_004e1e94;
}



/* @0041632c file=? name=FUN_0041632c */

void __cdecl FUN_0041632c(int *param_1)

{
  undefined4 uVar1;
  int iVar2;
  undefined4 local_c;
  undefined4 local_8;
  
  while( true ) {
    iVar2 = (**(code **)(*param_1 + 4))(param_1);
    if (iVar2 == 0) break;
    (**(code **)(*param_1 + 0x1c))(param_1,&local_8,4);
    (**(code **)(*param_1 + 0x1c))(param_1,&local_c,4);
    (**(code **)(*param_1 + 0x18))(param_1,4);
    (**(code **)(*param_1 + 0x18))(param_1,4);
    uVar1 = (**(code **)(*param_1 + 0x2c))(param_1,local_8);
    (**(code **)(*param_1 + 0x30))(param_1,uVar1,local_c);
  }
  return;
}



/* @0041639c file=munga/objstrm.cpp name=FUN_0041639c */

undefined4 FUN_0041639c(void)

{
  FUN_0040385c(s_ObjectStream__MakeObject___Unkno_004e1e98,s_d__tesla_bt_munga_OBJSTRM_CPP_004e1ec4,
               0xcc);
  return 0;
}



/* @004163c4 file=? name=FUN_004163c4 */

void FUN_004163c4(void)

{
  return;
}



/* @004163cc file=? name=FUN_004163cc */

void __cdecl FUN_004163cc(int *param_1,int param_2,int param_3)

{
  undefined4 *puVar1;
  void *this;
  int local_18 [5];
  
  param_1[6] = param_3;
  puVar1 = (undefined4 *)FUN_00402298(0x14);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00415529(puVar1,0,1);
  }
  param_1[7] = (int)puVar1;
  FUN_0041645c(param_1,param_2);
  FUN_0041560f(local_18,param_1[7]);
  FUN_00417858(this,local_18,1);
  FUN_0041564d(local_18,2);
  puVar1 = (undefined4 *)param_1[7];
  if (puVar1 != (undefined4 *)0x0) {
    (**(code **)*puVar1)(puVar1,3);
  }
  param_1[7] = 0;
  param_1[6] = 0;
  return;
}



/* @0041645c file=? name=FUN_0041645c */

void __cdecl FUN_0041645c(int *param_1,int param_2)

{
  int *piVar1;
  uint *puVar2;
  undefined4 *puVar3;
  int *piVar4;
  int iVar5;
  char cVar6;
  undefined4 *puVar7;
  int *local_30;
  undefined4 *local_2c;
  int *local_28;
  char *local_24;
  int local_20;
  undefined4 local_1c;
  int *local_18;
  int *local_14;
  uint *local_10;
  uint *local_c;
  int *local_8;
  
  local_8 = FUN_0040485c(param_2,(char *)0x0);
  puVar7 = (undefined4 *)local_8[1];
  while (puVar7 != (undefined4 *)0x0) {
    while( true ) {
      puVar2 = (uint *)FUN_00402298(0x10);
      if (puVar2 == (uint *)0x0) {
        local_c = (uint *)0x0;
      }
      else {
        local_c = FUN_00402460(puVar2,s_include_004e1ee2);
      }
      local_c[3] = local_c[3] + 1;
      puVar2 = (uint *)FUN_00402298(0x10);
      if (puVar2 == (uint *)0x0) {
        local_10 = (uint *)0x0;
      }
      else {
        local_10 = FUN_00402460(puVar2,s_macro_004e1eea);
      }
      local_10[3] = local_10[3] + 1;
      puVar3 = (undefined4 *)FUN_00402298(0x10);
      if (puVar3 == (undefined4 *)0x0) {
        local_14 = (int *)0x0;
      }
      else {
        local_14 = (int *)FUN_004023f4(puVar3);
      }
      local_14[3] = local_14[3] + 1;
      FUN_00402a98((int *)&local_18,(int *)&local_14,(char *)(puVar7 + 2));
      piVar4 = local_18 + 3;
      *piVar4 = *piVar4 + -1;
      if (*piVar4 == 0) {
        FUN_004024d8(local_18,3);
      }
      if (local_14[1] == 0) {
        cVar6 = '\0';
      }
      else {
        cVar6 = *(char *)local_14[2];
      }
      if (cVar6 == '!') break;
      piVar4 = FUN_00404758(param_2,puVar7[1],(char *)0x0);
      iVar5 = FUN_004027d8((int)local_14,(int)local_c);
      if (iVar5 == 0) {
        FUN_00416714(param_1,(int)piVar4);
      }
      else {
        iVar5 = FUN_004027d8((int)local_14,(int)local_10);
        if (iVar5 == 0) {
          FUN_004167e0((int)param_1,(int)piVar4);
        }
        else {
          local_1c = FUN_00414c8c((int *)&local_14);
          local_20 = FUN_00416320();
          local_2c = (undefined4 *)FUN_00402298(0x10);
          if (local_2c == (undefined4 *)0x0) {
            local_28 = (int *)0x0;
          }
          else {
            local_28 = (int *)FUN_004023f4(local_2c);
          }
          local_28[3] = local_28[3] + 1;
          FUN_00416914((int)param_1,(int)piVar4);
          local_24 = (char *)FUN_00403ad0((int)piVar4,&DAT_004e1ef0);
          if (local_24 != (char *)0x0) {
            FUN_00402a98((int *)&local_30,(int *)&local_28,local_24);
            piVar1 = local_30 + 3;
            *piVar1 = *piVar1 + -1;
            if (*piVar1 == 0) {
              FUN_004024d8(local_30,3);
            }
          }
          (**(code **)(*param_1 + 0x34))(param_1,piVar4,local_1c,local_20);
          FUN_00416d88(param_1,(int)piVar4);
          (**(code **)(*param_1 + 0x38))(param_1,local_1c,local_20,&local_28);
          piVar1 = local_28 + 3;
          *piVar1 = *piVar1 + -1;
          if (*piVar1 == 0) {
            FUN_004024d8(local_28,3);
          }
        }
      }
      if (piVar4 != (int *)0x0) {
        (**(code **)*piVar4)(piVar4,3);
      }
      puVar7 = (undefined4 *)*puVar7;
      piVar4 = local_14 + 3;
      *piVar4 = *piVar4 + -1;
      if (*piVar4 == 0) {
        FUN_004024d8(local_14,3);
      }
      puVar2 = local_10 + 3;
      *puVar2 = *puVar2 - 1;
      if (*puVar2 == 0) {
        FUN_004024d8((int *)local_10,3);
      }
      puVar2 = local_c + 3;
      *puVar2 = *puVar2 - 1;
      if (*puVar2 == 0) {
        FUN_004024d8((int *)local_c,3);
      }
      if (puVar7 == (undefined4 *)0x0) goto LAB_004166f6;
    }
    puVar7 = (undefined4 *)*puVar7;
    piVar4 = local_14 + 3;
    *piVar4 = *piVar4 + -1;
    if (*piVar4 == 0) {
      FUN_004024d8(local_14,3);
    }
    puVar2 = local_10 + 3;
    *puVar2 = *puVar2 - 1;
    if (*puVar2 == 0) {
      FUN_004024d8((int *)local_10,3);
    }
    puVar2 = local_c + 3;
    *puVar2 = *puVar2 - 1;
    if (*puVar2 == 0) {
      FUN_004024d8((int *)local_c,3);
    }
  }
LAB_004166f6:
  if (local_8 != (int *)0x0) {
    (**(code **)*local_8)(local_8,3);
  }
  return;
}



/* @00416714 file=? name=FUN_00416714 */

void __cdecl FUN_00416714(int *param_1,int param_2)

{
  int *piVar1;
  undefined4 *puVar2;
  bool bVar3;
  undefined3 extraout_var;
  undefined4 *puVar4;
  int local_2c [8];
  int *local_c;
  int *local_8;
  
  for (puVar2 = *(undefined4 **)(param_2 + 4); puVar2 != (undefined4 *)0x0;
      puVar2 = (undefined4 *)*puVar2) {
    bVar3 = FUN_00403c20((int)puVar2,&DAT_004e1ef5);
    if (CONCAT31(extraout_var,bVar3) != 0) {
      puVar4 = (undefined4 *)FUN_00402298(0x10);
      if (puVar4 == (undefined4 *)0x0) {
        local_8 = (int *)0x0;
      }
      else {
        local_8 = (int *)FUN_004023f4(puVar4);
      }
      local_8[3] = local_8[3] + 1;
      FUN_00402a98((int *)&local_c,(int *)&local_8,(char *)puVar2[1]);
      piVar1 = local_c + 3;
      *piVar1 = *piVar1 + -1;
      if (*piVar1 == 0) {
        FUN_004024d8(local_c,3);
      }
      FUN_00403e84(local_2c,(char *)local_8[2],1);
      FUN_0041645c(param_1,(int)local_2c);
      FUN_00403ecc(local_2c,2);
      piVar1 = local_8 + 3;
      *piVar1 = *piVar1 + -1;
      if (*piVar1 == 0) {
        FUN_004024d8(local_8,3);
      }
    }
  }
  return;
}



/* @004167e0 file=? name=FUN_004167e0 */

void __cdecl FUN_004167e0(int param_1,int param_2)

{
  int *piVar1;
  undefined4 *puVar2;
  undefined4 *puVar3;
  uint *puVar4;
  uint *local_18;
  char *local_14;
  int *local_10;
  undefined4 *local_c;
  int *local_8;
  
  for (puVar2 = *(undefined4 **)(param_2 + 4); puVar2 != (undefined4 *)0x0;
      puVar2 = (undefined4 *)*puVar2) {
    if (puVar2[1] != 0) {
      puVar3 = (undefined4 *)FUN_00402298(0x10);
      if (puVar3 == (undefined4 *)0x0) {
        local_8 = (int *)0x0;
      }
      else {
        local_8 = (int *)FUN_004023f4(puVar3);
      }
      local_8[3] = local_8[3] + 1;
      FUN_00402a98((int *)&local_10,(int *)&local_8,(char *)(puVar2 + 2));
      piVar1 = local_10 + 3;
      *piVar1 = *piVar1 + -1;
      if (*piVar1 == 0) {
        FUN_004024d8(local_10,3);
      }
      puVar3 = (undefined4 *)FUN_00402298(0x10);
      if (puVar3 == (undefined4 *)0x0) {
        puVar3 = (undefined4 *)0x0;
      }
      else {
        local_14 = (char *)puVar2[1];
        puVar4 = (uint *)FUN_00402298(0x10);
        if (puVar4 == (uint *)0x0) {
          local_18 = (uint *)0x0;
        }
        else {
          local_18 = FUN_00402460(puVar4,local_14);
        }
        local_18[3] = local_18[3] + 1;
        puVar3 = FUN_0041547b(puVar3,(int *)&local_18);
      }
      puVar4 = local_18 + 3;
      *puVar4 = *puVar4 - 1;
      if (*puVar4 == 0) {
        FUN_004024d8((int *)local_18,3);
      }
      local_c = (undefined4 *)
                (**(code **)(**(int **)(param_1 + 0x1c) + 0xc))(*(int **)(param_1 + 0x1c),&local_8);
      if ((local_c != (undefined4 *)0x0) && (local_c != (undefined4 *)0x0)) {
        (**(code **)*local_c)(local_c,3);
      }
      (**(code **)(**(int **)(param_1 + 0x1c) + 8))(*(int **)(param_1 + 0x1c),puVar3,&local_8);
      piVar1 = local_8 + 3;
      *piVar1 = *piVar1 + -1;
      if (*piVar1 == 0) {
        FUN_004024d8(local_8,3);
      }
    }
  }
  return;
}



/* @00416914 file=? name=FUN_00416914 */

void __cdecl FUN_00416914(int param_1,int param_2)

{
  int *piVar1;
  char cVar2;
  uint *puVar3;
  undefined4 *puVar4;
  int iVar5;
  char *pcVar6;
  uint uVar7;
  uint uVar8;
  char *pcVar9;
  char *pcVar10;
  uint local_88 [2];
  char *local_80;
  uint local_78 [2];
  char *local_70;
  uint local_68 [2];
  char *local_60;
  uint *local_58;
  int *local_54;
  int *local_50;
  uint local_4c;
  uint *local_48;
  int *local_44;
  int *local_40;
  uint *local_3c;
  int *local_38;
  uint *local_34;
  char *local_30;
  uint local_2c;
  int *local_28;
  uint local_24;
  int *local_20;
  uint *local_1c;
  int *local_18;
  int *local_14;
  char *local_10;
  uint *local_c;
  undefined4 *local_8;
  
  local_8 = *(undefined4 **)(param_2 + 4);
  do {
    if (local_8 == (undefined4 *)0x0) {
      return;
    }
    if (local_8[1] != 0) {
      local_10 = (char *)local_8[1];
      puVar3 = (uint *)FUN_00402298(0x10);
      if (puVar3 == (uint *)0x0) {
        local_c = (uint *)0x0;
      }
      else {
        local_c = FUN_00402460(puVar3,local_10);
      }
      local_c[3] = local_c[3] + 1;
      puVar4 = (undefined4 *)FUN_00402298(0x10);
      if (puVar4 == (undefined4 *)0x0) {
        local_14 = (int *)0x0;
      }
      else {
        local_14 = (int *)FUN_004023f4(puVar4);
      }
      local_14[3] = local_14[3] + 1;
      puVar4 = (undefined4 *)FUN_00402298(0x10);
      if (puVar4 == (undefined4 *)0x0) {
        local_18 = (int *)0x0;
      }
      else {
        local_18 = (int *)FUN_004023f4(puVar4);
      }
      local_18[3] = local_18[3] + 1;
      puVar3 = (uint *)FUN_00402298(0x10);
      if (puVar3 == (uint *)0x0) {
        local_1c = (uint *)0x0;
      }
      else {
        local_1c = FUN_00402460(puVar3,&DAT_004e1efa);
      }
      local_1c[3] = local_1c[3] + 1;
      puVar4 = (undefined4 *)FUN_00402298(0x10);
      if (puVar4 == (undefined4 *)0x0) {
        local_20 = (int *)0x0;
      }
      else {
        local_20 = (int *)FUN_004023f4(puVar4);
      }
      local_20[3] = local_20[3] + 1;
      local_24 = 0;
      while( true ) {
        local_2c = local_24;
        FUN_00402838(local_68,local_c,local_24,(char *)0x0);
        local_30 = local_60;
        puVar3 = (uint *)FUN_00402298(0x10);
        if (puVar3 == (uint *)0x0) {
          local_34 = (uint *)0x0;
        }
        else {
          local_34 = FUN_00402460(puVar3,local_30);
        }
        local_34[3] = local_34[3] + 1;
        FUN_004024d8((int *)local_68,2);
        FUN_00402a4c((int *)&local_28,(int *)&local_18,(int *)&local_34);
        iVar5 = FUN_004027d8((int)local_28,(int)local_20);
        uVar7 = (uint)(iVar5 != 0);
        piVar1 = local_28 + 3;
        *piVar1 = *piVar1 + -1;
        if (*piVar1 == 0) {
          FUN_004024d8(local_28,3);
        }
        puVar3 = local_34 + 3;
        *puVar3 = *puVar3 - 1;
        if (*puVar3 == 0) {
          FUN_004024d8((int *)local_34,3);
        }
        if (uVar7 == 0) break;
        iVar5 = FUN_004027d8((int)local_14,(int)local_20);
        if (iVar5 != 0) {
          FUN_00402624(local_78,(int)local_14,(int)local_1c);
          pcVar9 = local_70;
          puVar3 = (uint *)FUN_00402298(0x10);
          if (puVar3 == (uint *)0x0) {
            local_3c = (uint *)0x0;
          }
          else {
            local_3c = FUN_00402460(puVar3,pcVar9);
          }
          local_3c[3] = local_3c[3] + 1;
          FUN_004024d8((int *)local_78,2);
          FUN_00402a4c((int *)&local_38,(int *)&local_14,(int *)&local_3c);
          piVar1 = local_38 + 3;
          *piVar1 = *piVar1 + -1;
          if (*piVar1 == 0) {
            FUN_004024d8(local_38,3);
          }
          puVar3 = local_3c + 3;
          *puVar3 = *puVar3 - 1;
          if (*puVar3 == 0) {
            FUN_004024d8((int *)local_3c,3);
          }
        }
        FUN_00416ce8(&local_40,param_1,(int *)&local_18);
        FUN_00402624(local_88,(int)local_14,(int)local_40);
        pcVar9 = local_80;
        puVar3 = (uint *)FUN_00402298(0x10);
        if (puVar3 == (uint *)0x0) {
          local_48 = (uint *)0x0;
        }
        else {
          local_48 = FUN_00402460(puVar3,pcVar9);
        }
        local_48[3] = local_48[3] + 1;
        FUN_004024d8((int *)local_88,2);
        FUN_00402a4c((int *)&local_44,(int *)&local_14,(int *)&local_48);
        piVar1 = local_44 + 3;
        *piVar1 = *piVar1 + -1;
        if (*piVar1 == 0) {
          FUN_004024d8(local_44,3);
        }
        puVar3 = local_48 + 3;
        *puVar3 = *puVar3 - 1;
        if (*puVar3 == 0) {
          FUN_004024d8((int *)local_48,3);
        }
        piVar1 = local_40 + 3;
        *piVar1 = *piVar1 + -1;
        if (*piVar1 == 0) {
          FUN_004024d8(local_40,3);
        }
        local_24 = local_24 + 1;
      }
      local_4c = local_14[1] + 1;
      pcVar6 = (char *)FUN_004022b0(local_4c);
      uVar7 = 0xffffffff;
      pcVar9 = (char *)local_14[2];
      do {
        pcVar10 = pcVar9;
        if (uVar7 == 0) break;
        uVar7 = uVar7 - 1;
        pcVar10 = pcVar9 + 1;
        cVar2 = *pcVar9;
        pcVar9 = pcVar10;
      } while (cVar2 != '\0');
      uVar7 = ~uVar7;
      pcVar9 = pcVar10 + -uVar7;
      pcVar10 = pcVar6;
      for (uVar8 = uVar7 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) {
        *(undefined4 *)pcVar10 = *(undefined4 *)pcVar9;
        pcVar9 = pcVar9 + 4;
        pcVar10 = pcVar10 + 4;
      }
      for (uVar7 = uVar7 & 3; uVar7 != 0; uVar7 = uVar7 - 1) {
        *pcVar10 = *pcVar9;
        pcVar9 = pcVar9 + 1;
        pcVar10 = pcVar10 + 1;
      }
      local_8[1] = pcVar6;
      piVar1 = local_20 + 3;
      *piVar1 = *piVar1 + -1;
      if (*piVar1 == 0) {
        FUN_004024d8(local_20,3);
      }
      puVar3 = local_1c + 3;
      *puVar3 = *puVar3 - 1;
      if (*puVar3 == 0) {
        FUN_004024d8((int *)local_1c,3);
      }
      local_50 = local_18;
      piVar1 = local_18 + 3;
      *piVar1 = *piVar1 + -1;
      if (*piVar1 == 0) {
        FUN_004024d8(local_18,3);
      }
      local_54 = local_14;
      piVar1 = local_14 + 3;
      *piVar1 = *piVar1 + -1;
      if (*piVar1 == 0) {
        FUN_004024d8(local_14,3);
      }
      local_58 = local_c;
      puVar3 = local_c + 3;
      *puVar3 = *puVar3 - 1;
      if (*puVar3 == 0) {
        FUN_004024d8((int *)local_c,3);
      }
    }
    local_8 = (undefined4 *)*local_8;
  } while( true );
}



/* @00416ce8 file=? name=FUN_00416ce8 */

undefined4 * __cdecl FUN_00416ce8(undefined4 *param_1,int param_2,int *param_3)

{
  int *piVar1;
  int iVar2;
  int *local_10;
  int *local_c;
  int *local_8;
  
  local_8 = (int *)*param_3;
  local_8[3] = local_8[3] + 1;
  while( true ) {
    iVar2 = (**(code **)(**(int **)(param_2 + 0x1c) + 0xc))(*(int **)(param_2 + 0x1c),&local_8);
    if (iVar2 == 0) break;
    local_10 = *(int **)(iVar2 + 0xc);
    local_10[3] = local_10[3] + 1;
    FUN_00402a4c((int *)&local_c,(int *)&local_8,(int *)&local_10);
    piVar1 = local_c + 3;
    *piVar1 = *piVar1 + -1;
    if (*piVar1 == 0) {
      FUN_004024d8(local_c,3);
    }
    piVar1 = local_10 + 3;
    *piVar1 = *piVar1 + -1;
    if (*piVar1 == 0) {
      FUN_004024d8(local_10,3);
    }
  }
  *param_1 = local_8;
  local_8[3] = local_8[3] + 1;
  piVar1 = local_8 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_8,3);
  }
  return param_1;
}



/* @00416d88 file=? name=FUN_00416d88 */

void __cdecl FUN_00416d88(undefined4 param_1,int param_2)

{
  undefined4 *puVar1;
  
  for (puVar1 = *(undefined4 **)(param_2 + 4); puVar1 != (undefined4 *)0x0;
      puVar1 = (undefined4 *)*puVar1) {
    if ((int *)puVar1[1] != (int *)0x0) {
      FUN_004022e8((int *)puVar1[1]);
    }
  }
  return;
}



/* @00416db0 file=munga/objstrm.cpp name=FUN_00416db0 */

void FUN_00416db0(void)

{
  FUN_0040385c(s_ObjectStream__BuildFromPage___Un_004e1efc,s_d__tesla_bt_munga_OBJSTRM_CPP_004e1f2b,
               0x296);
  return;
}



/* @00416dd0 file=? name=FUN_00416dd0 */

void FUN_00416dd0(void)

{
  return;
}



/* @00416dd8 file=? name=FUN_00416dd8 */

undefined4 * __cdecl FUN_00416dd8(undefined4 *param_1)

{
  FUN_004178cc(param_1,2);
  *param_1 = &PTR_FUN_004e2230;
  FUN_00417410(param_1 + 3,500,0,1);
  FUN_004174a5(param_1 + 9,0,1);
  return param_1;
}



/* @00416e1c file=? name=FUN_00416e1c */

void __cdecl FUN_00416e1c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2230;
    FUN_00416e80((int)param_1);
    FUN_004174c8(param_1 + 9,2);
    FUN_00417437(param_1 + 3,2);
    FUN_0041790c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00416e6c file=? name=FUN_00416e6c */

undefined4 FUN_00416e6c(void)

{
  FUN_00415f1c();
  return 1;
}



/* @00416e80 file=? name=FUN_00416e80 */

void __cdecl FUN_00416e80(int param_1)

{
  void *this;
  int local_38 [8];
  int local_18 [5];
  
  FUN_0041758b(local_18,param_1 + 0x24);
  FUN_00417858(local_18,local_18,1);
  FUN_004175c9(local_18,2);
  FUN_004175f5(local_38,param_1 + 0xc);
  FUN_00417858(this,local_38,1);
  FUN_00417633(local_38,2);
  return;
}



/* @00416ee8 file=? name=FUN_00416ee8 */

void __cdecl FUN_00416ee8(undefined4 param_1)

{
  (**(code **)(DAT_00521f70 + 8))(&DAT_00521f70,param_1,&stack0x00000008);
  return;
}



/* @00416f08 file=? name=FUN_00416f08 */

void FUN_00416f08(void)

{
  (**(code **)(DAT_00521f70 + 0xc))(&DAT_00521f70,&stack0x00000004);
  return;
}



/* @00416f24 file=? name=FUN_00416f24 */

void __cdecl FUN_00416f24(undefined4 param_1,undefined4 param_2)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x10);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004173bf(puVar1,&param_1);
  }
  (**(code **)(DAT_00521f88 + 8))(&DAT_00521f88,puVar1,param_2);
  return;
}



/* @00416f60 file=? name=FUN_00416f60 */

undefined4 __cdecl FUN_00416f60(undefined4 param_1)

{
  int iVar1;
  
  iVar1 = (**(code **)(DAT_00521f88 + 0xc))(&DAT_00521f88,param_1);
  if (iVar1 != 0) {
    return *(undefined4 *)(iVar1 + 0xc);
  }
  return 0;
}



/* @00416f88 file=? name=FUN_00416f88 */

undefined4 * __cdecl FUN_00416f88(undefined4 *param_1)

{
  FUN_00416234(param_1);
  *param_1 = &PTR_FUN_004e21f4;
  param_1[8] = 0;
  param_1[9] = 0;
  return param_1;
}



/* @00416fac file=? name=FUN_00416fac */

undefined4 * __cdecl FUN_00416fac(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_0041625c(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e21f4;
  param_1[8] = 0;
  param_1[9] = 0;
  return param_1;
}



/* @00416fdc file=? name=FUN_00416fdc */

undefined4 * __cdecl FUN_00416fdc(undefined4 *param_1,int param_2)

{
  FUN_0041628c(param_1,param_2);
  *param_1 = &PTR_FUN_004e21f4;
  param_1[8] = 0;
  param_1[9] = 0;
  return param_1;
}



/* @00417008 file=? name=FUN_00417008 */

void __cdecl FUN_00417008(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e21f4;
    FUN_004162c0(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00417034 file=? name=FUN_00417034 */

undefined8 __cdecl FUN_00417034(int param_1)

{
  undefined8 uVar1;
  
  uVar1 = FUN_004162ec(param_1);
  return CONCAT44((int)((ulonglong)uVar1 >> 0x20),1);
}



/* @00417054 file=? name=FUN_00417054 */

void __cdecl FUN_00417054(int *param_1)

{
  int local_1c [6];
  
  FUN_00415679(local_1c,0,1);
  param_1[8] = (int)local_1c;
  FUN_0041632c(param_1);
  param_1[8] = 0;
  FUN_0041569c(local_1c,2);
  return;
}



/* @00417094 file=? name=FUN_00417094 */

void __cdecl FUN_00417094(int param_1,undefined4 param_2)

{
  FUN_004170b0(param_1,param_2);
  return;
}



/* @004170b0 file=? name=FUN_004170b0 */

void __cdecl FUN_004170b0(int param_1,undefined4 param_2)

{
  (**(code **)(**(int **)(param_1 + 0x20) + 8))(*(int **)(param_1 + 0x20),param_2,&stack0x0000000c);
  return;
}



/* @004170cc file=? name=FUN_004170cc */

void __cdecl FUN_004170cc(undefined4 param_1,undefined4 param_2)

{
  FUN_00416ee8(param_2);
  return;
}



/* @004170e4 file=? name=FUN_004170e4 */

int __cdecl FUN_004170e4(int param_1,undefined4 param_2)

{
  int iVar1;
  
  iVar1 = (**(code **)(**(int **)(param_1 + 0x20) + 0xc))(*(int **)(param_1 + 0x20),&param_2);
  if ((iVar1 == 0) && (iVar1 = FUN_00416f08(), iVar1 == 0)) {
    iVar1 = 0;
  }
  return iVar1;
}



/* @00417120 file=? name=FUN_00417120 */

void __cdecl FUN_00417120(int *param_1,int param_2,int param_3)

{
  void *this;
  int local_30 [5];
  int local_1c [6];
  
  FUN_004157be(local_1c,0,1);
  param_1[9] = (int)local_1c;
  FUN_004163cc(param_1,param_2,param_3);
  FUN_0041765f(local_30,(int)local_1c);
  FUN_00417858(this,local_30,1);
  FUN_004176bc(local_30,2);
  param_1[9] = 0;
  FUN_004157e1(local_1c,2);
  return;
}



/* @00417198 file=? name=FUN_00417198 */

void __cdecl FUN_00417198(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  FUN_004171b4(param_1,param_3,param_4);
  return;
}



/* @004171b4 file=? name=FUN_004171b4 */

void __cdecl FUN_004171b4(int param_1,undefined4 param_2,undefined4 param_3)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x10);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004173bf(puVar1,&param_2);
  }
  (**(code **)(**(int **)(param_1 + 0x24) + 8))(*(int **)(param_1 + 0x24),puVar1,param_3);
  return;
}



/* @004171f0 file=? name=FUN_004171f0 */

void __cdecl FUN_004171f0(undefined4 param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_00416f24(param_2,param_3);
  return;
}



/* @00417208 file=? name=FUN_00417208 */

undefined4 __cdecl FUN_00417208(int param_1,undefined4 param_2)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = (**(code **)(**(int **)(param_1 + 0x24) + 0xc))(*(int **)(param_1 + 0x24),param_2);
  if (iVar1 == 0) {
    uVar2 = FUN_00416f60(param_2);
  }
  else {
    uVar2 = *(undefined4 *)(iVar1 + 0xc);
  }
  return uVar2;
}



/* @00417240 file=munga/objstrm.cpp name=FUN_00417240 */

void __cdecl FUN_00417240(int *param_1,int param_2,int *param_3)

{
  int *piVar1;
  undefined4 *puVar2;
  char *pcVar3;
  int *local_10;
  int local_c;
  int *local_8;
  
  puVar2 = (undefined4 *)FUN_00402298(0x10);
  if (puVar2 == (undefined4 *)0x0) {
    local_8 = (int *)0x0;
  }
  else {
    local_8 = (int *)FUN_004023f4(puVar2);
  }
  local_8[3] = local_8[3] + 1;
  pcVar3 = (char *)FUN_00403ad0(param_2,*(char **)(*param_3 + 8));
  if (pcVar3 == (char *)0x0) {
    FUN_004dbb24(&DAT_00524e20,s_PlugStream_FindEntryAndWriteObje_004e1f49,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,*(char **)(*param_3 + 8),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_004e1f7f,(char *)0x0);
    FUN_0040385c(s_PlugStream_FindEntryAndWriteObje_004e1f81,
                 s_d__tesla_bt_munga_OBJSTRM_CPP_004e1fbb,0x4c1);
  }
  FUN_00402a98((int *)&local_10,(int *)&local_8,pcVar3);
  piVar1 = local_10 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_10,3);
  }
  local_c = FUN_00417208((int)param_1,&local_8);
  if (local_c == 0) {
    FUN_004dbb24(&DAT_00524e20,s_PlugStream_FindEntryAndWriteObje_004e1fd9,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,(char *)local_8[2],(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_004e2010,(char *)0x0);
    FUN_0040385c(s_PlugStream_FindEntryAndWriteObje_004e2012,
                 s_d__tesla_bt_munga_OBJSTRM_CPP_004e2053,0x4cc);
  }
  (**(code **)(*param_1 + 0x20))(param_1,&local_c,4);
  piVar1 = local_8 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_8,3);
  }
  return;
}



/* @004173b8 file=? name=FUN_004173b8 */

undefined4 FUN_004173b8(void)

{
  return 0;
}



/* @004173bf file=? name=FUN_004173bf */

undefined4 * __cdecl FUN_004173bf(undefined4 *param_1,undefined4 *param_2)

{
  FUN_00415e90(param_1,1);
  *param_1 = &PTR_FUN_004e21f0;
  param_1[3] = *param_2;
  return param_1;
}



/* @004173e4 file=? name=FUN_004173e4 */

void __cdecl FUN_004173e4(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e21f0;
    FUN_00415ed8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00417410 file=? name=FUN_00417410 */

undefined4 * __cdecl
FUN_00417410(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  FUN_00419774(param_1,param_2,param_3,param_4);
  *param_1 = &PTR_FUN_004e21d8;
  return param_1;
}



/* @00417437 file=? name=FUN_00417437 */

void __cdecl FUN_00417437(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e21d8;
    FUN_004197d4(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00417463 file=? name=FUN_00417463 */

undefined4 * __cdecl FUN_00417463(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00415723();
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00415679(puVar1,*(undefined4 *)(param_1 + 4),*(undefined4 *)(param_1 + 0xc));
  }
  return puVar1;
}



/* @00417492 file=? name=FUN_00417492 */

int __cdecl FUN_00417492(int param_1,int *param_2)

{
  return *param_2 % *(int *)(param_1 + 0x14);
}



/* @004174a5 file=? name=FUN_004174a5 */

undefined4 * __cdecl FUN_004174a5(undefined4 *param_1,undefined4 param_2,undefined4 param_3)

{
  FUN_00418bb8(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e21bc;
  return param_1;
}



/* @004174c8 file=? name=FUN_004174c8 */

void __cdecl FUN_004174c8(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e21bc;
    FUN_00418be0(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004174f4 file=? name=FUN_004174f4 */

undefined4 __cdecl FUN_004174f4(undefined4 param_1,int param_2,int param_3)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_004027d8(*(int *)(param_2 + 0x20),*(int *)(param_3 + 0x20));
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    iVar1 = FUN_004027d8(*(int *)(param_2 + 0x20),*(int *)(param_3 + 0x20));
    if (iVar1 < 1) {
      uVar2 = 0xffffffff;
    }
    else {
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @00417541 file=? name=FUN_00417541 */

undefined4 __cdecl FUN_00417541(undefined4 param_1,int *param_2,int param_3)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_004027d8(*param_2,*(int *)(param_3 + 0x20));
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    iVar1 = FUN_004027d8(*param_2,*(int *)(param_3 + 0x20));
    if (iVar1 < 1) {
      uVar2 = 0xffffffff;
    }
    else {
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @0041758b file=? name=FUN_0041758b */

int * __cdecl FUN_0041758b(int *param_1,int param_2)

{
  FUN_00418f34(param_1,param_2);
  *param_1 = (int)&PTR_FUN_004e2160;
  return param_1;
}



/* @004175aa file=? name=FUN_004175aa */

int * __cdecl FUN_004175aa(int *param_1,int param_2)

{
  FUN_00418f34(param_1,param_2);
  *param_1 = (int)&PTR_FUN_004e2160;
  return param_1;
}



/* @004175c9 file=? name=FUN_004175c9 */

void __cdecl FUN_004175c9(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2160;
    FUN_00418f5c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004175f5 file=? name=FUN_004175f5 */

int * __cdecl FUN_004175f5(int *param_1,int param_2)

{
  FUN_00419928(param_1,param_2);
  *param_1 = (int)&PTR_FUN_004e2104;
  return param_1;
}



/* @00417614 file=? name=FUN_00417614 */

int * __cdecl FUN_00417614(int *param_1,int param_2)

{
  FUN_00419928(param_1,param_2);
  *param_1 = (int)&PTR_FUN_004e2104;
  return param_1;
}



/* @00417633 file=? name=FUN_00417633 */

void __cdecl FUN_00417633(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2104;
    FUN_00419968(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @0041765f file=? name=FUN_0041765f */

undefined4 * __cdecl FUN_0041765f(undefined4 *param_1,int param_2)

{
  FUN_004188dc(param_1,param_2);
  *param_1 = &PTR_FUN_004e20a8;
  return param_1;
}



/* @0041767e file=? name=FUN_0041767e */

undefined4 * __cdecl FUN_0041767e(undefined4 *param_1,int param_2)

{
  FUN_004188dc(param_1,param_2);
  *param_1 = &PTR_FUN_004e20a8;
  return param_1;
}



/* @0041769d file=? name=FUN_0041769d */

undefined4 * __cdecl FUN_0041769d(undefined4 *param_1,int param_2)

{
  FUN_00418904(param_1,param_2);
  *param_1 = &PTR_FUN_004e20a8;
  return param_1;
}



/* @004176bc file=? name=FUN_004176bc */

void __cdecl FUN_004176bc(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e20a8;
    FUN_00418930(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004176e8 file=? name=FUN_004176e8 */

undefined4 * __cdecl FUN_004176e8(undefined4 param_1,int param_2,int *param_3)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00415a83();
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004159cf(puVar1,param_1,param_2,param_3);
  }
  return puVar1;
}



/* @00417718 file=? name=FUN_00417718 */

void __cdecl FUN_00417718(undefined4 *param_1,undefined4 param_2)

{
  *param_1 = &PTR_FUN_004e23c4;
  param_1[1] = param_2;
  return;
}



/* @0041772c file=? name=FUN_0041772c */

void __cdecl FUN_0041772c(int *param_1,byte param_2)

{
  if ((param_1 != (int *)0x0) && (*param_1 = (int)&PTR_FUN_004e23c4, (param_2 & 1) != 0)) {
    FUN_004022d0(param_1);
  }
  return;
}



/* @0041774c file=? name=FUN_0041774c */

undefined4 FUN_0041774c(void)

{
  return 1;
}



/* @00417758 file=munga/socket.cpp name=FUN_00417758 */

void FUN_00417758(void)

{
  FUN_0040385c(s_Socket__AddImplementation___Shou_004e2278,s_d__tesla_bt_munga_SOCKET_CPP_004e22ac,
               0x46);
  return;
}



/* @00417774 file=? name=FUN_00417774 */

undefined4 * __cdecl FUN_00417774(undefined4 *param_1,undefined4 param_2)

{
  FUN_00415c70(param_1);
  *param_1 = &PTR_FUN_004e2374;
  param_1[1] = param_2;
  return param_1;
}



/* @00417794 file=? name=FUN_00417794 */

void __cdecl FUN_00417794(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2374;
    FUN_00415c80(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004177c0 file=? name=FUN_004177c0 */

undefined4 FUN_004177c0(void)

{
  return 1;
}



/* @004177cc file=munga/socket.cpp name=FUN_004177cc */

void FUN_004177cc(void)

{
  FUN_0040385c(s_SocketIterator__Remove___Should_n_004e22c9,s_d__tesla_bt_munga_SOCKET_CPP_004e22fa,
               0x6f);
  return;
}



/* @004177e8 file=? name=FUN_004177e8 */

undefined4 __cdecl FUN_004177e8(int *param_1,int param_2)

{
  int iVar1;
  
  (**(code **)(*param_1 + 4))(param_1);
  do {
    iVar1 = (**(code **)(*param_1 + 0x28))(param_1);
    if (iVar1 == 0) {
      return 0;
    }
  } while (param_2 != iVar1);
  return 1;
}



/* @0041781c file=? name=FUN_0041781c */

void __cdecl FUN_0041781c(int *param_1,int param_2)

{
  int iVar1;
  
  (**(code **)(*param_1 + 4))(param_1);
  while( true ) {
    iVar1 = (**(code **)(*param_1 + 0x30))(param_1);
    if (iVar1 == 0) {
      return;
    }
    if (param_2 == iVar1) break;
    (**(code **)(*param_1 + 0xc))(param_1);
  }
  (**(code **)(*param_1 + 0x48))(param_1);
  return;
}



/* @00417858 file=? name=FUN_00417858 */

void __thiscall FUN_00417858(void *this,int *param_1,int param_2)

{
  undefined4 *puVar1;
  void *local_8;
  
  local_8 = this;
  if (param_2 != 0) {
    local_8 = *(void **)(param_1[1] + 4);
    *(undefined4 *)(param_1[1] + 4) = 0;
  }
  (**(code **)(*param_1 + 4))(param_1);
  while( true ) {
    puVar1 = (undefined4 *)(**(code **)(*param_1 + 0x28))(param_1);
    if (puVar1 == (undefined4 *)0x0) break;
    if (puVar1 != (undefined4 *)0x0) {
      (**(code **)*puVar1)(puVar1,3);
    }
  }
  if (param_2 != 0) {
    *(void **)(param_1[1] + 4) = local_8;
  }
  return;
}



/* @004178b0 file=munga/socket.cpp name=FUN_004178b0 */

void FUN_004178b0(void)

{
  FUN_0040385c(s_SocketIterator__InsertImplementa_004e2317,s_d__tesla_bt_munga_SOCKET_CPP_004e2356,
               0x116);
  return;
}



/* @004178cc file=? name=FUN_004178cc */

undefined4 * __cdecl FUN_004178cc(undefined4 *param_1,undefined4 param_2)

{
  FUN_00415e90(param_1,param_2);
  *param_1 = &PTR_FUN_004e23cc;
  return param_1;
}



/* @004178ec file=? name=FUN_004178ec */

undefined4 * __cdecl FUN_004178ec(undefined4 *param_1,int *param_2)

{
  FUN_00415eb4(param_1,param_2);
  *param_1 = &PTR_FUN_004e23cc;
  return param_1;
}



/* @0041790c file=? name=FUN_0041790c */

void __cdecl FUN_0041790c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e23cc;
    FUN_00415ed8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00417938 file=? name=FUN_00417938 */

void FUN_00417938(void)

{
  return;
}



/* @00417940 file=? name=FUN_00417940 */

undefined4 * __cdecl FUN_00417940(undefined4 *param_1,undefined4 param_2,int param_3)

{
  FUN_00415ddc(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e2414;
  return param_1;
}



/* @00417964 file=? name=FUN_00417964 */

void __cdecl FUN_00417964(int *param_1,byte param_2)

{
  int iVar1;
  int *piVar2;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e2414;
    iVar1 = param_1[1];
    *(undefined4 *)(iVar1 + 8) = 0;
    FUN_00415e38((int)param_1);
    piVar2 = *(int **)(iVar1 + 4);
    if (piVar2 != (int *)0x0) {
      (**(code **)(*piVar2 + 8))(piVar2,iVar1,param_1[2]);
    }
    FUN_00415e04(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_00402f98(0x4e23d8,param_1);
    }
  }
  return;
}



/* @004179c0 file=? name=FUN_004179c0 */

undefined4 FUN_004179c0(void)

{
  FUN_00415e2c();
  return 1;
}



/* @004179d4 file=? name=FUN_004179d4 */

undefined4 * __cdecl FUN_004179d4(undefined4 *param_1,undefined4 param_2)

{
  FUN_00417718(param_1,param_2);
  *param_1 = &PTR_FUN_004e240c;
  param_1[2] = 0;
  return param_1;
}



/* @004179f8 file=? name=FUN_004179f8 */

void __cdecl FUN_004179f8(int *param_1,byte param_2)

{
  undefined4 *puVar1;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e240c;
    param_1[1] = 0;
    puVar1 = (undefined4 *)param_1[2];
    if ((puVar1 != (undefined4 *)0x0) && (puVar1 != (undefined4 *)0x0)) {
      (**(code **)*puVar1)(puVar1,3);
    }
    FUN_0041772c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00417a40 file=? name=FUN_00417a40 */

undefined4 FUN_00417a40(void)

{
  FUN_0041774c();
  return 1;
}



/* @00417a5c file=? name=FUN_00417a5c */

void __cdecl FUN_00417a5c(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = *(undefined4 **)(param_1 + 8);
  if (puVar1 != (undefined4 *)0x0) {
    if (puVar1 != (undefined4 *)0x0) {
      (**(code **)*puVar1)(puVar1,3);
    }
    *(undefined4 *)(param_1 + 8) = 0;
  }
  return;
}



/* @00417a80 file=? name=FUN_00417a80 */

void __cdecl FUN_00417a80(int param_1,int param_2)

{
  undefined4 *puVar1;
  
  puVar1 = FUN_00402f74(0x4e23d8);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00417940(puVar1,param_1,param_2);
  }
  *(undefined4 **)(param_1 + 8) = puVar1;
  return;
}



/* @00417ab4 file=? name=FUN_00417ab4 */

undefined4 __cdecl FUN_00417ab4(int param_1)

{
  if (*(int *)(param_1 + 8) != 0) {
    return *(undefined4 *)(*(int *)(param_1 + 8) + 8);
  }
  return 0;
}



/* @00417af8 file=? name=FUN_00417af8 */

undefined4 * __cdecl
FUN_00417af8(undefined4 *param_1,undefined4 param_2,int param_3,int param_4,int param_5)

{
  FUN_00415ddc(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_004e24a4;
  param_1[5] = param_4;
  if (param_4 != 0) {
    *(undefined4 **)(param_4 + 0x18) = param_1;
  }
  param_1[6] = param_5;
  if (param_5 != 0) {
    *(undefined4 **)(param_5 + 0x14) = param_1;
  }
  return param_1;
}



/* @00417b38 file=? name=FUN_00417b38 */

void __cdecl FUN_00417b38(int *param_1,byte param_2)

{
  int iVar1;
  int *piVar2;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e24a4;
    iVar1 = param_1[1];
    if (param_1[6] == 0) {
      *(int *)(iVar1 + 8) = param_1[5];
    }
    else {
      *(int *)(param_1[6] + 0x14) = param_1[5];
    }
    if (param_1[5] == 0) {
      *(int *)(iVar1 + 0xc) = param_1[6];
    }
    else {
      *(int *)(param_1[5] + 0x18) = param_1[6];
    }
    param_1[5] = 0;
    param_1[6] = 0;
    FUN_00415e38((int)param_1);
    piVar2 = *(int **)(iVar1 + 4);
    if (piVar2 != (int *)0x0) {
      (**(code **)(*piVar2 + 8))(piVar2,iVar1,param_1[2]);
    }
    FUN_00415e04(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_00402f98(0x4e2418,param_1);
    }
  }
  return;
}



/* @00417bc0 file=? name=FUN_00417bc0 */

undefined4 FUN_00417bc0(void)

{
  FUN_00415e2c();
  return 1;
}



/* @00417be0 file=? name=FUN_00417be0 */

undefined4 * __cdecl FUN_00417be0(undefined4 *param_1,undefined4 param_2)

{
  FUN_00417718(param_1,param_2);
  *param_1 = &PTR_FUN_004e249c;
  param_1[2] = 0;
  param_1[3] = 0;
  return param_1;
}



/* @00417c0c file=? name=FUN_00417c0c */

void __cdecl FUN_00417c0c(int *param_1,byte param_2)

{
  undefined4 *puVar1;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e249c;
    param_1[1] = 0;
    while (puVar1 = (undefined4 *)param_1[2], puVar1 != (undefined4 *)0x0) {
      if (puVar1 != (undefined4 *)0x0) {
        (**(code **)*puVar1)(puVar1,3);
      }
    }
    FUN_0041772c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00417c54 file=? name=FUN_00417c54 */

undefined4 FUN_00417c54(void)

{
  FUN_0041774c();
  return 1;
}



/* @00417c74 file=? name=FUN_00417c74 */

void __cdecl FUN_00417c74(int param_1,int param_2)

{
  undefined4 *puVar1;
  
  puVar1 = FUN_00402f74(0x4e2418);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00417af8(puVar1,param_1,param_2,0,*(int *)(param_1 + 0xc));
  }
  *(undefined4 **)(param_1 + 0xc) = puVar1;
  if (*(int *)(param_1 + 8) == 0) {
    *(undefined4 **)(param_1 + 8) = puVar1;
  }
  return;
}



/* @00417cbc file=? name=FUN_00417cbc */

void __cdecl FUN_00417cbc(int param_1,int param_2,int param_3)

{
  undefined4 *puVar1;
  
  puVar1 = FUN_00402f74(0x4e2418);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_00417af8(puVar1,param_1,param_2,param_3,*(int *)(param_3 + 0x18));
  }
  if (param_3 == *(int *)(param_1 + 8)) {
    *(undefined4 **)(param_1 + 8) = puVar1;
  }
  return;
}



/* @00417d00 file=? name=FUN_00417d00 */

undefined4 * __cdecl FUN_00417d00(undefined4 *param_1,int param_2)

{
  FUN_00417774(param_1,param_2);
  *param_1 = &PTR_FUN_004e244c;
  param_1[2] = *(undefined4 *)(param_2 + 8);
  return param_1;
}



/* @00417d28 file=? name=FUN_00417d28 */

undefined4 * __cdecl FUN_00417d28(undefined4 *param_1,int param_2)

{
  FUN_00417774(param_1,*(undefined4 *)(param_2 + 4));
  *param_1 = &PTR_FUN_004e244c;
  param_1[2] = *(undefined4 *)(param_2 + 8);
  return param_1;
}



/* @00417d54 file=? name=FUN_00417d54 */

void __cdecl FUN_00417d54(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_004e244c;
    FUN_00417794(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @00417d80 file=? name=FUN_00417d80 */

undefined4 FUN_00417d80(void)

{
  FUN_004177c0();
  return 1;
}



/* @00417d9c file=? name=FUN_00417d9c */

void __cdecl FUN_00417d9c(int param_1)

{
  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(*(int *)(param_1 + 4) + 8);
  return;
}



/* @00417db0 file=? name=FUN_00417db0 */

void __cdecl FUN_00417db0(int param_1)

{
  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(*(int *)(param_1 + 4) + 0xc);
  return;
}



/* @00417dc4 file=? name=FUN_00417dc4 */

void __cdecl FUN_00417dc4(int param_1)

{
  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(*(int *)(param_1 + 8) + 0x14);
  return;
}



/* @00417dd8 file=? name=FUN_00417dd8 */

void __cdecl FUN_00417dd8(int param_1)

{
  *(undefined4 *)(param_1 + 8) = *(undefined4 *)(*(int *)(param_1 + 8) + 0x18);
  return;
}



/* @00417dec file=? name=FUN_00417dec */

undefined4 __cdecl FUN_00417dec(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = *(int *)(param_1 + 8);
  if (iVar1 != 0) {
    uVar2 = *(undefined4 *)(iVar1 + 8);
    *(undefined4 *)(param_1 + 8) = *(undefined4 *)(iVar1 + 0x14);
    return uVar2;
  }
  return 0;
}



