/* @004af9cf file=? name=FUN_004af9cf */

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

{
  FUN_004179d4(param_1,param_2);
  *param_1 = &PTR_FUN_0050eccc;
  return param_1;
}



/* @004af9ee file=? name=FUN_004af9ee */

void __cdecl FUN_004af9ee(int *param_1,byte param_2)

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



/* @004afa1a file=? name=FUN_004afa1a */

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

{
  FUN_004179d4(param_1,param_2);
  *param_1 = &PTR_FUN_0050ecc4;
  return param_1;
}



/* @004afa39 file=? name=FUN_004afa39 */

void __cdecl FUN_004afa39(int *param_1,byte param_2)

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



/* @004afa65 file=? name=FUN_004afa65 */

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

{
  FUN_00417be0(param_1,param_2);
  *param_1 = &PTR_FUN_0050ecbc;
  return param_1;
}



/* @004afa84 file=? name=FUN_004afa84 */

void __cdecl FUN_004afa84(int *param_1,byte param_2)

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



/* @004afab0 file=? name=FUN_004afab0 */

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

{
  FUN_00417d00(param_1,param_2);
  *param_1 = &PTR_FUN_0050ec6c;
  return param_1;
}



/* @004afacf file=? name=FUN_004afacf */

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

{
  FUN_00417d00(param_1,param_2);
  *param_1 = &PTR_FUN_0050ec6c;
  return param_1;
}



/* @004afaee file=? name=FUN_004afaee */

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

{
  FUN_00417d28(param_1,param_2);
  *param_1 = &PTR_FUN_0050ec6c;
  return param_1;
}



/* @004afb0d file=? name=FUN_004afb0d */

void __cdecl FUN_004afb0d(int *param_1,byte param_2)

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



/* @004afb39 file=? name=FUN_004afb39 */

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

{
  FUN_00417d00(param_1,param_2);
  *param_1 = &PTR_FUN_0050ec1c;
  return param_1;
}



/* @004afb58 file=? name=FUN_004afb58 */

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

{
  FUN_00417d00(param_1,param_2);
  *param_1 = &PTR_FUN_0050ec1c;
  return param_1;
}



/* @004afb77 file=? name=FUN_004afb77 */

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

{
  FUN_00417d28(param_1,param_2);
  *param_1 = &PTR_FUN_0050ec1c;
  return param_1;
}



/* @004afb96 file=? name=FUN_004afb96 */

void __cdecl FUN_004afb96(int *param_1,byte param_2)

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



/* @004afbe0 file=? name=FUN_004afbe0 */

void __cdecl FUN_004afbe0(int *param_1,int param_2)

{
  int iVar1;
  int iVar2;
  
  if (0 < *(int *)(param_2 + 0xc)) {
    param_1[100] = param_1[100] + 1;
    if (2 < param_1[100]) {
      param_1[100] = 0;
    }
    (**(code **)(*param_1 + 0x48))(param_1,param_1[100]);
    iVar1 = *(int *)(param_1[0x34] + 0x438);
    iVar2 = *(int *)(param_1[0x34] + 0x5b4);
    if (param_1[100] == 0) {
      *(undefined4 *)(iVar1 + 0x1f0) = 0;
      *(undefined4 *)(iVar1 + 0x274) = 1;
      *(undefined4 *)(iVar1 + 0x220) = *(undefined4 *)(iVar1 + 0x228);
      *(undefined4 *)(iVar1 + 0x224) = *(undefined4 *)(iVar1 + 0x22c);
      *(undefined4 *)(iVar2 + 0x2a0) = 1;
    }
    else if (param_1[100] - 1U < 2) {
      *(undefined4 *)(iVar1 + 0x220) = *(undefined4 *)(iVar1 + 0x230);
      *(undefined4 *)(iVar1 + 0x224) = *(undefined4 *)(iVar1 + 0x234);
    }
  }
  return;
}



/* @004afcac file=? name=FUN_004afcac */

void __cdecl FUN_004afcac(int *param_1,int param_2)

{
  if (0 < *(int *)(param_2 + 0xc)) {
    param_1[0x65] = param_1[0x65] + 1;
    if (2 < param_1[0x65]) {
      param_1[0x65] = 0;
    }
    (**(code **)(*param_1 + 0x4c))(param_1,param_1[0x65]);
  }
  return;
}



/* @004afce8 file=? name=FUN_004afce8 */

void __cdecl FUN_004afce8(int param_1,int param_2)

{
  if (0 < *(int *)(param_2 + 0xc)) {
    FUN_004bff74(*(int *)(*(int *)(param_1 + 0xd0) + 400));
  }
  return;
}



/* @004afd10 file=? name=FUN_004afd10 */

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

void __cdecl FUN_004afd10(int param_1)

{
  float fVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  float10 fVar6;
  undefined4 local_44;
  undefined4 local_40;
  int local_38 [3];
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  float local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  iVar2 = *(int *)(param_1 + 0xd0);
  if (*(int *)(param_1 + 0x124) < 1) {
    *(float *)(param_1 + 0x128) =
         *(float *)(iVar2 + 0x34c) * *(float *)(param_1 + 0x11c) * *(float *)(iVar2 + 0x5c0);
  }
  else {
    *(float *)(param_1 + 0x128) = -*(float *)(iVar2 + 0x34c) * *(float *)(param_1 + 0x11c);
  }
  local_8 = *(float *)(param_1 + 0x114) * *(float *)(param_1 + 0x114);
  local_c = *(float *)(param_1 + 0x118) * *(float *)(param_1 + 0x118);
  local_10 = *(float *)(param_1 + 0x120) * *(float *)(param_1 + 0x120) * *(float *)(param_1 + 0x120)
  ;
  if (*(float *)(param_1 + 0x114) < _DAT_004b0274) {
    local_8 = -local_8;
  }
  if (*(float *)(param_1 + 0x118) < _DAT_004b0274) {
    local_c = -local_c;
  }
  *(undefined4 *)(param_1 + 300) = 0;
  iVar5 = *(int *)(iVar2 + 0x438);
  iVar3 = *(int *)(iVar2 + 0x5b4);
  iVar4 = *(int *)(param_1 + 400);
  if (iVar4 == 0) {
    *(float *)(param_1 + 300) = local_8;
    *(float *)(iVar5 + 500) = local_c;
    *(undefined4 *)(iVar5 + 0x1f0) = 0;
    *(undefined4 *)(iVar3 + 0x28c) = 0;
    if (*(float *)(param_1 + 300) <= _DAT_004b0274) {
      fVar1 = -*(float *)(param_1 + 300);
    }
    else {
      fVar1 = *(float *)(param_1 + 300);
    }
    local_14 = (*(float *)(iVar2 + 0x34c) - *(float *)(iVar2 + 0x534)) * (_DAT_004b0278 - fVar1) +
               *(float *)(iVar2 + 0x534);
    if (*(float *)(param_1 + 300) <= _DAT_004b0274) {
      local_18 = -*(float *)(param_1 + 300);
    }
    else {
      local_18 = *(float *)(param_1 + 300);
    }
    fVar6 = FUN_004dcd00((double)local_18);
    if ((float10)_DAT_004b027c < fVar6) {
      if (-local_14 <= *(float *)(param_1 + 0x128)) {
        fVar1 = local_14;
        if (*(float *)(param_1 + 0x128) <= local_14) {
          fVar1 = *(float *)(param_1 + 0x128);
        }
      }
      else {
        fVar1 = -local_14;
      }
      *(float *)(param_1 + 0x128) = fVar1;
    }
  }
  else if (iVar4 == 1) {
    if (*(int *)(iVar5 + 0x250) == 0) {
      *(float *)(iVar3 + 0x28c) = local_8;
    }
    else {
      *(float *)(iVar5 + 0x1f0) = local_8;
    }
    *(float *)(iVar5 + 500) = local_c;
    if (local_10 == _DAT_004b0274) {
      *(undefined4 *)(param_1 + 300) = 0;
    }
    else {
      *(float *)(param_1 + 300) = local_10;
    }
    if (*(float *)(param_1 + 300) <= _DAT_004b0274) {
      fVar1 = -*(float *)(param_1 + 300);
    }
    else {
      fVar1 = *(float *)(param_1 + 300);
    }
    local_14 = (*(float *)(iVar2 + 0x34c) - *(float *)(iVar2 + 0x534)) * (_DAT_004b0278 - fVar1) +
               *(float *)(iVar2 + 0x534);
    if (*(float *)(param_1 + 300) <= _DAT_004b0274) {
      local_1c = -*(float *)(param_1 + 300);
    }
    else {
      local_1c = *(float *)(param_1 + 300);
    }
    fVar6 = FUN_004dcd00((double)local_1c);
    if ((float10)_DAT_004b027c < fVar6) {
      if (-local_14 <= *(float *)(param_1 + 0x128)) {
        fVar1 = local_14;
        if (*(float *)(param_1 + 0x128) <= local_14) {
          fVar1 = *(float *)(param_1 + 0x128);
        }
      }
      else {
        fVar1 = -local_14;
      }
      *(float *)(param_1 + 0x128) = fVar1;
    }
  }
  else if (iVar4 == 2) {
    if (*(int *)(iVar5 + 0x250) == 0) {
      *(float *)(iVar3 + 0x28c) = local_8;
    }
    else {
      *(float *)(iVar5 + 0x1f0) = local_8;
    }
    *(float *)(iVar5 + 500) = local_c;
    if (local_10 == _DAT_004b0274) {
      *(undefined4 *)(param_1 + 300) = 0;
    }
    else {
      *(float *)(param_1 + 300) = local_10;
    }
  }
  *(undefined4 *)(param_1 + 0x19c) = *(undefined4 *)(param_1 + 0x198);
  if (*(int *)(param_1 + 0x134) < 1) {
    if (*(int *)(param_1 + 0x138) < 1) {
      if (*(int *)(param_1 + 0x13c) < 1) {
        if (*(int *)(param_1 + 0x140) < 1) {
          *(undefined4 *)(param_1 + 0x198) = 0;
        }
        else {
          *(undefined4 *)(param_1 + 0x198) = 4;
        }
      }
      else {
        *(undefined4 *)(param_1 + 0x198) = 3;
      }
    }
    else {
      *(undefined4 *)(param_1 + 0x198) = 2;
    }
  }
  else {
    *(undefined4 *)(param_1 + 0x198) = 1;
  }
  if (*(int *)(param_1 + 0x198) != *(int *)(param_1 + 0x19c)) {
    FUN_004afacf(local_38,iVar2 + 0x7bc);
    switch(*(undefined4 *)(param_1 + 0x198)) {
    case 0:
      FUN_00408e90(&local_44,&DAT_004e0f8c);
      *(undefined4 *)(iVar2 + 0x378) = 1;
      while (iVar5 = (**(code **)(local_38[0] + 0x28))(), iVar5 != 0) {
        *(uint *)(iVar5 + 0x3e0) = (uint)(*(int *)(iVar5 + 0x334) == 0);
      }
      break;
    case 1:
      FUN_00408e90(&local_44,&DAT_004e0f8c);
      local_40 = *(undefined4 *)(iVar2 + 0x564);
      *(undefined4 *)(iVar2 + 0x378) = 0;
      local_20 = local_40;
      while (iVar5 = (**(code **)(local_38[0] + 0x28))(), iVar5 != 0) {
        *(undefined4 *)(iVar5 + 0x3e0) = 0;
      }
      break;
    case 2:
      FUN_00408e90(&local_44,&DAT_004e0f8c);
      local_40 = *(undefined4 *)(iVar2 + 0x568);
      *(undefined4 *)(iVar2 + 0x378) = 0;
      local_24 = local_40;
      while (iVar5 = (**(code **)(local_38[0] + 0x28))(), iVar5 != 0) {
        *(undefined4 *)(iVar5 + 0x3e0) = 0;
      }
      break;
    case 3:
      FUN_00408e90(&local_44,&DAT_004e0f8c);
      local_40 = 0x40490fdb;
      local_44 = *(undefined4 *)(iVar2 + 0x570);
      *(undefined4 *)(iVar2 + 0x378) = *(undefined4 *)(iVar2 + 0x410);
      local_28 = local_44;
      while (iVar5 = (**(code **)(local_38[0] + 0x28))(), iVar5 != 0) {
        *(undefined4 *)(iVar5 + 0x3e0) = *(undefined4 *)(iVar5 + 0x334);
      }
      break;
    case 4:
      FUN_00408e90(&local_44,&DAT_004e0f8c);
      local_44 = *(undefined4 *)(iVar2 + 0x56c);
      *(undefined4 *)(iVar2 + 0x378) = 0;
      local_2c = local_44;
      while (iVar5 = (**(code **)(local_38[0] + 0x28))(), iVar5 != 0) {
        *(undefined4 *)(iVar5 + 0x3e0) = 0;
      }
    }
    FUN_00408e90((undefined4 *)(iVar2 + 0x360),&local_44);
    FUN_004afb0d(local_38,2);
  }
  return;
}



/* @004b029c file=bt/mechmppr.cpp name=FUN_004b029c */

void FUN_004b029c(void)

{
  FUN_0040385c(s_ExitConfiguration_not_overridden_0050f3ac,s_d__tesla_bt_bt_MECHMPPR_CPP_0050f3cf,
               0x245);
  return;
}



/* @004b02b8 file=bt/mechmppr.cpp name=FUN_004b02b8 */

void FUN_004b02b8(void)

{
  FUN_0040385c(s_Unhandled_mapping__0050f3eb,s_d__tesla_bt_bt_MECHMPPR_CPP_0050f3ff,0x24f);
  return;
}



/* @004b02d4 file=bt/mechmppr.cpp name=FUN_004b02d4 */

void FUN_004b02d4(void)

{
  FUN_0040385c(s_Unhandled_mapping__0050f41b,s_d__tesla_bt_bt_MECHMPPR_CPP_0050f42f,0x25a);
  return;
}



/* @004b02f0 file=? name=FUN_004b02f0 */

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

{
  int *piVar1;
  int iVar2;
  
  param_4[3] = param_4[3] + 1;
  FUN_004ac530(param_1,param_2,param_3,param_4,param_5,param_6,0,0);
  *param_1 = &PTR_FUN_0050f45c;
  param_1[7] = PTR_FUN_0050f120;
  param_1[8] = DAT_0050f124;
  param_1[9] = DAT_0050f128;
  param_1[0x45] = 0;
  param_1[0x46] = 0;
  param_1[0x47] = 0;
  param_1[0x48] = 0;
  param_1[0x4a] = 0;
  param_1[0x4b] = 0;
  param_1[0x49] = 0;
  param_1[0x4d] = 0;
  param_1[0x4e] = 0;
  param_1[0x4f] = 0;
  param_1[0x50] = 0;
  param_1[0x4c] = 0;
  param_1[0x66] = 0;
  param_1[0x51] = 0;
  param_1[0x52] = 0;
  param_1[0x53] = 0;
  param_1[0x54] = 0;
  param_1[0x55] = 0;
  param_1[100] = 0;
  param_1[0x65] = 0;
  iVar2 = *(int *)(param_1[0x34] + 0x438);
  *(undefined4 *)(iVar2 + 0x220) = *(undefined4 *)(iVar2 + 0x228);
  *(undefined4 *)(iVar2 + 0x224) = *(undefined4 *)(iVar2 + 0x22c);
  param_1[0x56] = 0;
  param_1[0x61] = 0;
  param_1[0x62] = 0;
  param_1[0x57] = 0;
  piVar1 = param_4 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(param_4,3);
  }
  return param_1;
}



/* @004b044c file=? name=FUN_004b044c */

void __cdecl FUN_004b044c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_0050f45c;
    if ((int *)param_1[0x62] != (int *)0x0) {
      FUN_004022e8((int *)param_1[0x62]);
    }
    FUN_004ac868(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004b048c file=? name=FUN_004b048c */

void FUN_004b048c(void)

{
  return;
}



/* @004b0494 file=? name=FUN_004b0494 */

void FUN_004b0494(void)

{
  return;
}



/* @004b049c file=? name=FUN_004b049c */

void __cdecl FUN_004b049c(int param_1,int param_2)

{
  int iVar1;
  undefined4 uVar2;
  
  if ((*(int *)(param_1 + 0x184) != 0) && (*(int *)(param_1 + 0x15c) != 0)) {
    uVar2 = 0;
    iVar1 = *(int *)(param_1 + 0x15c + param_2 * 4);
    if (iVar1 != 0) {
      uVar2 = *(undefined4 *)(iVar1 + 0x1fc);
    }
    *(undefined4 *)(*(int *)(param_1 + 0x15c) + 0x284) = uVar2;
  }
  return;
}



/* @004b04d8 file=? name=FUN_004b04d8 */

void __cdecl FUN_004b04d8(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  float local_28;
  float local_24;
  float local_20;
  int *local_1c;
  float local_18;
  int local_14;
  int local_10;
  float local_c;
  undefined4 local_8;
  
  if ((*(int *)(param_1 + 0x184) != 0) && (*(int *)(param_1 + 0x15c) != 0)) {
    local_8 = 0;
    local_c = 0.0;
    local_1c = (int *)(param_1 + 0x160);
    local_10 = 0;
    local_14 = 1;
    for (iVar3 = 1; iVar3 < *(int *)(param_1 + 0x18c); iVar3 = iVar3 + 1) {
      iVar1 = *(int *)(*local_1c + 0x1fc);
      FUN_00408644(&local_28,(float *)(*local_1c + 0x100),
                   (float *)(*(int *)(param_1 + 0x15c) + 0x100));
      local_18 = local_20 * local_20 + local_24 * local_24 + local_28 * local_28;
      if (local_14 == 1) {
        iVar2 = FUN_0049fb54(iVar1);
        if ((iVar2 == 0) && (iVar1 != param_2)) {
          local_14 = 0;
          local_c = local_18;
          local_10 = iVar3;
        }
      }
      else {
        iVar2 = FUN_0049fb54(iVar1);
        if (((iVar2 == 0) && (iVar1 != param_2)) && (local_18 < local_c)) {
          local_c = local_18;
          local_10 = iVar3;
        }
      }
      local_1c = local_1c + 1;
    }
    if (local_14 != 1) {
      iVar3 = *(int *)(param_1 + 0x15c + local_10 * 4);
      if (iVar3 != 0) {
        local_8 = *(undefined4 *)(iVar3 + 0x1fc);
      }
      *(undefined4 *)(*(int *)(param_1 + 0x15c) + 0x284) = local_8;
    }
  }
  return;
}



/* @004b0600 file=? name=FUN_004b0600 */

void __cdecl FUN_004b0600(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 *puVar3;
  int local_10 [3];
  
  if (*(int *)(param_1 + 0x184) == 0) {
    *(undefined4 *)(param_1 + 0x184) = 1;
    iVar1 = FUN_00403ad0(*(int *)(DAT_004efc94 + 0x24) + 0x18,s_Players_0050f44b);
    *(undefined4 *)(param_1 + 0x18c) = 0;
    if (iVar1 != 0) {
      FUN_00421414(local_10,iVar1 + 0x10);
      while( true ) {
        iVar1 = (**(code **)(local_10[0] + 0x28))(local_10);
        if (iVar1 == 0) break;
        if ((*(byte *)(iVar1 + 0x29) & 0x40) == 0) {
          *(int *)(param_1 + 0x18c) = *(int *)(param_1 + 0x18c) + 1;
        }
      }
      FUN_00421452(local_10,2);
    }
    uVar2 = FUN_004022b0(*(int *)(param_1 + 0x18c) << 2);
    *(undefined4 *)(param_1 + 0x188) = uVar2;
    puVar3 = (undefined4 *)(param_1 + 0x15c);
    for (iVar1 = 0; iVar1 <= *(int *)(param_1 + 0x18c); iVar1 = iVar1 + 1) {
      *puVar3 = 0;
      puVar3 = puVar3 + 1;
    }
    FUN_004b06cc(param_1);
    FUN_004b07f0(param_1);
  }
  return;
}



/* @004b06cc file=? name=FUN_004b06cc */

void __cdecl FUN_004b06cc(int param_1)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int local_18 [3];
  int *local_c;
  int local_8;
  
  local_8 = 1;
  for (iVar1 = 0; iVar1 < *(int *)(param_1 + 0x18c); iVar1 = iVar1 + 1) {
    *(undefined4 *)(*(int *)(param_1 + 0x188) + iVar1 * 4) = 0xffffffff;
  }
  if ((*(int *)(DAT_004efc94 + 0x6c) != 0) &&
     (iVar1 = *(int *)(*(int *)(DAT_004efc94 + 0x6c) + 400), iVar1 != 0)) {
    *(int *)(param_1 + 0x15c) = iVar1;
    **(undefined4 **)(param_1 + 0x188) = *(undefined4 *)(iVar1 + 0x1e0);
    iVar2 = FUN_00403ad0(*(int *)(DAT_004efc94 + 0x24) + 0x18,s_Players_0050f453);
    if (iVar2 != 0) {
      FUN_00421414(local_18,iVar2 + 0x10);
      iVar2 = *(int *)(param_1 + 0x158) * *(int *)(param_1 + 0x18c);
      while ((0 < iVar2 && (iVar3 = (**(code **)(local_18[0] + 0x28))(local_18), iVar3 != 0))) {
        iVar2 = iVar2 + 1;
      }
      local_c = (int *)(param_1 + 0x15c + local_8 * 4);
      do {
        do {
          iVar2 = (**(code **)(local_18[0] + 0x28))(local_18);
          if (iVar2 == 0) goto LAB_004b07d9;
        } while (((*(byte *)(iVar2 + 0x29) & 0x40) != 0) || (iVar1 == iVar2));
        *local_c = iVar2;
        *(undefined4 *)(*(int *)(param_1 + 0x188) + local_8 * 4) = *(undefined4 *)(iVar2 + 0x1e0);
        local_c = local_c + 1;
        local_8 = local_8 + 1;
      } while (local_8 < *(int *)(param_1 + 0x18c));
LAB_004b07d9:
      FUN_00421452(local_18,2);
    }
  }
  return;
}



/* @004b07f0 file=? name=FUN_004b07f0 */

void __cdecl FUN_004b07f0(int param_1)

{
  int *piVar1;
  int iVar2;
  int unaff_ESI;
  int iVar3;
  undefined4 local_8;
  
  local_8 = 0;
  if (*(int *)(param_1 + 0x18c) != 1) {
    if (*(int *)(param_1 + 0x18c) == **(int **)(param_1 + 0x188)) {
      iVar2 = 1;
      piVar1 = *(int **)(param_1 + 0x188);
      while ((piVar1 = piVar1 + 1, iVar3 = unaff_ESI, iVar2 < *(int *)(param_1 + 0x18c) &&
             (iVar3 = iVar2, *piVar1 != 1))) {
        iVar2 = iVar2 + 1;
      }
    }
    else {
      iVar2 = 1;
      piVar1 = *(int **)(param_1 + 0x188);
      while ((piVar1 = piVar1 + 1, iVar3 = unaff_ESI, iVar2 < *(int *)(param_1 + 0x18c) &&
             (iVar3 = iVar2, **(int **)(param_1 + 0x188) + 1 != *piVar1))) {
        iVar2 = iVar2 + 1;
      }
    }
    iVar2 = *(int *)(param_1 + 0x15c + iVar3 * 4);
    if (iVar2 != 0) {
      local_8 = *(undefined4 *)(iVar2 + 0x1fc);
    }
    *(undefined4 *)(*(int *)(param_1 + 0x15c) + 0x284) = local_8;
  }
  return;
}



/* @004b0898 file=? name=FUN_004b0898 */

undefined4 __cdecl FUN_004b0898(int param_1,int param_2)

{
  if (*(int *)(param_1 + 0x18c) <= param_2) {
    return 0;
  }
  if (param_2 < 0) {
    return 0;
  }
  return *(undefined4 *)(param_1 + 0x15c + param_2 * 4);
}



/* @004b08c0 file=? name=FUN_004b08c0 */

void __cdecl FUN_004b08c0(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x50ee10);
  return;
}



/* @004b099c file=? name=FUN_004b099c */

void __cdecl FUN_004b099c(int param_1,int param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  
  bVar1 = FUN_004ac9c8(param_1);
  if ((CONCAT31(extraout_var,bVar1) == 0) && (0 < *(int *)(param_2 + 0xc))) {
    iVar2 = FUN_004b0b18(param_1,1);
    FUN_004b0dd8(param_1,iVar2);
    FUN_0041bbd8(param_1 + 0x2b8,1);
  }
  return;
}



/* @004b09e4 file=? name=FUN_004b09e4 */

void __cdecl FUN_004b09e4(int param_1,int param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  
  bVar1 = FUN_004ac9c8(param_1);
  if ((CONCAT31(extraout_var,bVar1) == 0) && (0 < *(int *)(param_2 + 0xc))) {
    iVar2 = FUN_004b0b18(param_1,2);
    FUN_004b0dd8(param_1,iVar2);
    FUN_0041bbd8(param_1 + 0x2b8,1);
  }
  return;
}



/* @004b0a2c file=? name=FUN_004b0a2c */

void __cdecl FUN_004b0a2c(int param_1,int param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  
  bVar1 = FUN_004ac9c8(param_1);
  if ((CONCAT31(extraout_var,bVar1) == 0) && (0 < *(int *)(param_2 + 0xc))) {
    iVar2 = FUN_004b0b18(param_1,3);
    FUN_004b0dd8(param_1,iVar2);
    FUN_0041bbd8(param_1 + 0x2b8,1);
  }
  return;
}



/* @004b0a74 file=? name=FUN_004b0a74 */

void __cdecl FUN_004b0a74(int param_1,int param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  
  bVar1 = FUN_004ac9c8(param_1);
  if ((CONCAT31(extraout_var,bVar1) == 0) && (0 < *(int *)(param_2 + 0xc))) {
    iVar2 = FUN_004b0b18(param_1,4);
    FUN_004b0dd8(param_1,iVar2);
    FUN_0041bbd8(param_1 + 0x2b8,1);
  }
  return;
}



/* @004b0abc file=? name=FUN_004b0abc */

void __cdecl FUN_004b0abc(int param_1,int param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  
  bVar1 = FUN_004ac9c8(param_1);
  if ((CONCAT31(extraout_var,bVar1) == 0) && (0 < *(int *)(param_2 + 0xc))) {
    if (*(uint *)(param_1 + 0x2cc) < 2) {
      FUN_0041bbd8(param_1 + 0x2b8,2);
      return;
    }
    if (*(uint *)(param_1 + 0x2cc) != 2) {
      return;
    }
    FUN_004b0e30(param_1);
    FUN_0041bbd8(param_1 + 0x2b8,0);
  }
  return;
}



/* @004b0b18 file=? name=FUN_004b0b18 */

int __cdecl FUN_004b0b18(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  int *piVar3;
  
  iVar2 = 0;
  piVar3 = *(int **)(*(int *)(param_1 + 0xd0) + 0x128);
  while( true ) {
    if (*(int *)(*(int *)(param_1 + 0xd0) + 0x124) <= iVar2) {
      return 0;
    }
    iVar1 = *piVar3;
    if ((*(int *)(iVar1 + 4) == 0xbc1) && (param_2 == *(int *)(iVar1 + 0x1e0))) break;
    iVar2 = iVar2 + 1;
    piVar3 = piVar3 + 1;
  }
  return iVar1;
}



/* @004b0b5c file=? name=FUN_004b0b5c */

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

undefined4 __cdecl FUN_004b0b5c(int param_1,int param_2)

{
  float10 fVar1;
  
  if (param_2 == 0) {
    param_2 = FUN_00417ab4(param_1 + 0x1d0);
  }
  if (((param_2 != 0) && (*(int *)(param_2 + 0x210) == 2)) &&
     (fVar1 = FUN_004dcd00((double)(*(float *)(param_2 + 0x1dc) - _DAT_004b0bcc)),
     (float10)_DAT_004b0bcc < fVar1)) {
    return 1;
  }
  return 0;
}



/* @004b0bd0 file=? name=FUN_004b0bd0 */

void __cdecl FUN_004b0bd0(int *param_1,float param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  
  FUN_004ad924(param_1,param_2);
  iVar1 = FUN_00417ab4((int)(param_1 + 0x74));
  if (iVar1 == 0) {
    FUN_0041bbd8((int)(param_1 + 0x99),1);
  }
  else {
    if (*(int *)(iVar1 + 0x210) == 3) {
      FUN_0041bbd8((int)(param_1 + 0x99),2);
    }
    if ((*(int *)(iVar1 + 0x210) == 1) || (*(int *)(iVar1 + 0x210) == 4)) {
      FUN_0041bbd8((int)(param_1 + 0x99),3);
    }
  }
  iVar4 = param_1[0x9e];
  if (iVar4 == 0) {
    param_1[0xc6] = (int)(param_2 + (float)param_1[0xc6]);
    if ((float)param_1[0xc5] <= (float)param_1[0xc6]) {
      FUN_0041bbd8((int)(param_1 + 0x99),4);
    }
  }
  else if (iVar4 == 1) {
    if (iVar1 != 0) {
      FUN_0041bbd8((int)(param_1 + 0x99),0);
      param_1[0xc6] = 0;
    }
  }
  else if (((iVar4 - 2U < 2) && (iVar1 != 0)) && (*(int *)(iVar1 + 0x210) == 2)) {
    FUN_0041bbd8((int)(param_1 + 0x99),0);
    param_1[0xc6] = 0;
  }
  iVar1 = param_1[0xb3];
  if (((iVar1 != 0) && (iVar1 != 1)) &&
     ((iVar1 == 2 && (iVar1 = (**(code **)(*param_1 + 0x40))(param_1,0), iVar1 == 0)))) {
    iVar1 = param_1[0x34];
    iVar4 = 0;
    while ((iVar4 < *(int *)(iVar1 + 0x124) &&
           (((iVar3 = *(int *)(*(int *)(iVar1 + 0x128) + iVar4 * 4), *(int *)(iVar3 + 4) != 0xbc1 ||
             (iVar2 = (**(code **)(*param_1 + 0x40))(param_1,iVar3), iVar2 == 0)) ||
            (iVar3 = FUN_004b0dd8((int)param_1,iVar3), iVar3 == -1))))) {
      iVar4 = iVar4 + 1;
    }
  }
  return;
}



/* @004b0d50 file=? name=FUN_004b0d50 */

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

float10 __cdecl FUN_004b0d50(int param_1)

{
  float fVar1;
  int iVar2;
  
  iVar2 = FUN_00417ab4(param_1 + 0x1d0);
  fVar1 = *(float *)(iVar2 + 0x114) - *(float *)(iVar2 + 0x13c);
  if (fVar1 < _DAT_004b0dd0) {
    fVar1 = _DAT_004b0dd0;
  }
  fVar1 = (*(float *)(param_1 + 0x30c) * fVar1 + _DAT_004b0dd4) * *(float *)(param_1 + 0x310);
  if (fVar1 < *(float *)(param_1 + 0x310)) {
    fVar1 = *(float *)(param_1 + 0x310);
  }
  return (float10)fVar1;
}



/* @004b0dd8 file=? name=FUN_004b0dd8 */

int __cdecl FUN_004b0dd8(int param_1,int param_2)

{
  int iVar1;
  
  if (*(int *)(param_2 + 0x1e8) < *(int *)(param_2 + 0x1e4)) {
    *(int *)(param_2 + 0x1e8) = *(int *)(param_2 + 0x1e8) + 1;
    iVar1 = *(int *)(param_2 + 0x1e8);
  }
  else {
    iVar1 = -1;
  }
  if (-1 < iVar1) {
    FUN_004b0e30(param_1);
    (**(code **)(*(int *)(param_1 + 0x1d0) + 4))(param_1 + 0x1d0,param_2);
  }
  return iVar1;
}



/* @004b0e30 file=? name=FUN_004b0e30 */

void __cdecl FUN_004b0e30(int param_1)

{
  int iVar1;
  
  iVar1 = FUN_00417ab4(param_1 + 0x1d0);
  if (iVar1 != 0) {
    *(int *)(iVar1 + 0x1e8) = *(int *)(iVar1 + 0x1e8) + -1;
    FUN_00417a5c(param_1 + 0x1d0);
  }
  FUN_0041bbd8(param_1 + 0x264,1);
  return;
}



/* @004b0e6c file=? name=FUN_004b0e6c */

void __cdecl FUN_004b0e6c(int *param_1,int param_2)

{
  int iVar1;
  
  FUN_004ad760(param_1);
  if (param_2 == 0) {
    iVar1 = FUN_00417ab4((int)(param_1 + 0x74));
    if (iVar1 != 0) {
      FUN_0041bbd8((int)(param_1 + 0x99),0);
      param_1[0xc6] = 0;
    }
  }
  else {
    iVar1 = FUN_00417ab4((int)(param_1 + 0x74));
    if (iVar1 != 0) {
      iVar1 = FUN_00417ab4((int)(param_1 + 0x74));
      if (*(int *)(iVar1 + 0x210) == 2) {
        FUN_0041bbd8((int)(param_1 + 0x99),4);
        param_1[0xc6] = param_1[0xc5];
      }
    }
  }
  return;
}



/* @004b0efc file=? name=FUN_004b0efc */

void __cdecl FUN_004b0efc(int *param_1,int *param_2)

{
  int iVar1;
  bool bVar2;
  undefined3 extraout_var;
  
  FUN_004ad748(param_1,param_2);
  iVar1 = *(int *)(param_1[0x34] + 400);
  bVar2 = FUN_004ac9c8((int)param_1);
  if (((CONCAT31(extraout_var,bVar2) == 0) && (*(int *)(iVar1 + 0x25c) != 0)) && (*param_2 == 4)) {
    FUN_004b11bc((int)param_1);
  }
  return;
}



/* @004b0f48 file=? name=FUN_004b0f48 */

uint __cdecl FUN_004b0f48(int *param_1)

{
  uint uVar1;
  int iVar2;
  
  uVar1 = FUN_004add30((int)param_1);
  iVar2 = (**(code **)(*param_1 + 0x40))(param_1,0);
  if (iVar2 == 0) {
    uVar1 = uVar1 | 0x40;
  }
  return uVar1;
}



/* @004b0f74 file=bt/powersub.cpp name=FUN_004b0f74 */

int * __cdecl
FUN_004b0f74(int *param_1,int param_2,undefined4 param_3,char *param_4,undefined4 param_5,
            int param_6,int param_7)

{
  char cVar1;
  uint uVar2;
  uint uVar3;
  int *piVar4;
  char *pcVar5;
  char *pcVar6;
  int *piVar7;
  int local_8;
  
  FUN_004adda0(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  *param_1 = (int)&PTR_FUN_0050f9d8;
  FUN_004b1bb1(param_1 + 0x74,0);
  FUN_0041b9ec(param_1 + 0x99,5);
  FUN_0041b9ec(param_1 + 0xae,3);
  local_8 = 0;
  if (*(int *)(param_4 + 0xfc) < *(int *)(param_2 + 0x124)) {
    local_8 = *(int *)(*(int *)(param_2 + 0x128) + *(int *)(param_4 + 0xfc) * 4);
  }
  else {
    FUN_0040385c(s_Bad_voltageSourceIndex_to_connec_0050f700,s_d__tesla_bt_bt_POWERSUB_CPP_0050f72d,
                 0x264);
  }
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_0050f5b0;
    param_1[8] = DAT_0050f5b4;
    param_1[9] = DAT_0050f5b8;
    if (local_8 == 0) {
      FUN_0040385c(s_Master_PoweredSubsystem_is_missi_0050f749,
                   s_d__tesla_bt_bt_POWERSUB_CPP_0050f780,0x272);
    }
    else {
      FUN_004b0dd8((int)param_1,local_8);
    }
  }
  else if (((*(uint *)(param_2 + 0x28) & 0xc) == 4) && (local_8 != 0)) {
    FUN_004b0dd8((int)param_1,local_8);
  }
  param_1[0xc3] = *(int *)(param_4 + 0x100);
  param_1[0xc5] = *(int *)(param_4 + 0x18c);
  param_1[0xc6] = param_1[0xc5];
  FUN_0041bbd8((int)(param_1 + 0x99),4);
  FUN_0041bbd8((int)(param_1 + 0xae),1);
  param_1[0xc4] = 0x3f800000;
  param_1[0x77] = *(int *)(param_4 + 0x104);
  param_1[0x78] = *(int *)(param_4 + 0x108);
  uVar2 = 0xffffffff;
  pcVar5 = param_4 + 0x10c;
  do {
    pcVar6 = pcVar5;
    if (uVar2 == 0) break;
    uVar2 = uVar2 - 1;
    pcVar6 = pcVar5 + 1;
    cVar1 = *pcVar5;
    pcVar5 = pcVar6;
  } while (cVar1 != '\0');
  uVar2 = ~uVar2;
  piVar4 = (int *)(pcVar6 + -uVar2);
  piVar7 = param_1 + 0x79;
  for (uVar3 = uVar2 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) {
    *piVar7 = *piVar4;
    piVar4 = piVar4 + 1;
    piVar7 = piVar7 + 1;
  }
  for (uVar2 = uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) {
    *(char *)piVar7 = (char)*piVar4;
    piVar4 = (int *)((int)piVar4 + 1);
    piVar7 = (int *)((int)piVar7 + 1);
  }
  uVar2 = 0xffffffff;
  pcVar5 = param_4 + 0x14c;
  do {
    pcVar6 = pcVar5;
    if (uVar2 == 0) break;
    uVar2 = uVar2 - 1;
    pcVar6 = pcVar5 + 1;
    cVar1 = *pcVar5;
    pcVar5 = pcVar6;
  } while (cVar1 != '\0');
  uVar2 = ~uVar2;
  piVar4 = (int *)(pcVar6 + -uVar2);
  piVar7 = param_1 + 0x89;
  for (uVar3 = uVar2 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) {
    *piVar7 = *piVar4;
    piVar4 = piVar4 + 1;
    piVar7 = piVar7 + 1;
  }
  for (uVar2 = uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) {
    *(char *)piVar7 = (char)*piVar4;
    piVar4 = (int *)((int)piVar4 + 1);
    piVar7 = (int *)((int)piVar7 + 1);
  }
  return param_1;
}



/* @004b115c file=? name=FUN_004b115c */

void __cdecl FUN_004b115c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_0050f9d8;
    FUN_0041baa4(param_1 + 0xae,2);
    FUN_0041baa4(param_1 + 0x99,2);
    FUN_004b1bd0(param_1 + 0x74,2);
    FUN_004adfd4(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004b11bc file=? name=FUN_004b11bc */

void __cdecl FUN_004b11bc(int param_1)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  undefined3 extraout_var_00;
  
  bVar1 = FUN_004ac9c8(param_1);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    iVar2 = FUN_00417ab4(param_1 + 0x1d0);
    if (iVar2 != 0) {
      bVar1 = FUN_004ac9c8(iVar2);
      if (CONCAT31(extraout_var_00,bVar1) == 0) {
        FUN_0041bbd8(iVar2 + 0x1fc,3);
        *(undefined4 *)(iVar2 + 0x1f8) = 0;
      }
    }
  }
  return;
}



/* @004b1208 file=? name=FUN_004b1208 */

void __cdecl FUN_004b1208(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x50f4bc);
  return;
}



/* @004b1224 file=? name=FUN_004b1224 */

void __cdecl FUN_004b1224(int param_1)

{
  FUN_004ae050(param_1);
  switch(*(undefined4 *)(param_1 + 0x278)) {
  case 0:
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___Starting_0050f79c,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  case 1:
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___NoVoltage_0050f7a8,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  case 2:
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___Shorted_0050f7b5,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  case 3:
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___GeneratorOff_0050f7c0,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  case 4:
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___Ready_0050f7d0,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  default:
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s_Unknown_Electrical_State__0050f7d9,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  }
}



/* @004b13ac file=? name=FUN_004b13ac */

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

undefined4 __cdecl
FUN_004b13ac(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6,
            int param_7)

{
  char *pcVar1;
  char cVar2;
  int iVar3;
  undefined4 uVar4;
  undefined3 extraout_var;
  undefined3 extraout_var_00;
  uint uVar5;
  uint uVar6;
  char *pcVar7;
  char *pcVar8;
  bool bVar9;
  char *local_c;
  char *local_8;
  
  iVar3 = FUN_004ae150(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar3 == 0) {
    uVar4 = 0;
  }
  else {
    param_4[0x24] = -0x70;
    param_4[0x25] = '\x01';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x3e;
    param_4[0x21] = '\v';
    param_4[0x22] = '\0';
    param_4[0x23] = '\0';
    if (param_7 == 1) {
      param_4[0xfc] = -1;
      param_4[0xfd] = -1;
      param_4[0xfe] = -1;
      param_4[0xff] = -1;
      param_4[0x100] = '\0';
      param_4[0x101] = '\0';
      param_4[0x102] = -0x80;
      param_4[0x103] = -0x41;
      param_4[0x104] = -1;
      param_4[0x105] = -1;
      param_4[0x106] = -1;
      param_4[0x107] = -1;
      param_4[0x108] = -1;
      param_4[0x109] = -1;
      param_4[0x10a] = -1;
      param_4[0x10b] = -1;
      param_4[0x18c] = '\0';
      param_4[0x18d] = '\0';
      param_4[0x18e] = -0x80;
      param_4[399] = -0x41;
      iVar3 = 0;
      pcVar7 = param_4 + 0x10c;
      do {
        *pcVar7 = '\0';
        iVar3 = iVar3 + 1;
        pcVar7 = pcVar7 + 1;
      } while (iVar3 < 0x40);
      iVar3 = 0;
      pcVar7 = param_4 + 0x14c;
      do {
        *pcVar7 = '\0';
        iVar3 = iVar3 + 1;
        pcVar7 = pcVar7 + 1;
      } while (iVar3 < 0x40);
    }
    local_8 = s_Unspecified_0050f7f4;
    iVar3 = FUN_00404088(param_5,param_3,s_VoltageSource_0050f800,&local_8);
    if ((iVar3 == 0) && (*(int *)(param_4 + 0xfc) == -1)) {
      FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,s_missing_VoltageSource__0050f80e,(char *)0x0);
      uVar4 = 0;
    }
    else {
      pcVar8 = s_Unspecified_0050f827;
      pcVar7 = local_8;
      do {
        bVar9 = *pcVar7 == *pcVar8;
        if (!bVar9) break;
        if (*pcVar7 == '\0') goto LAB_004b14db;
        pcVar1 = pcVar7 + 1;
        bVar9 = *pcVar1 == pcVar8[1];
        if (!bVar9) break;
        pcVar7 = pcVar7 + 2;
        pcVar8 = pcVar8 + 2;
        bVar9 = *pcVar1 == '\0';
      } while (!bVar9);
      if (!bVar9) {
        iVar3 = FUN_004215b0(param_5,local_8);
        *(int *)(param_4 + 0xfc) = iVar3;
      }
LAB_004b14db:
      if (*(int *)(param_4 + 0xfc) < 0) {
        FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
        FUN_004dbb24(&DAT_00524e20,s_has_an_invalid_voltage_source__0050f833,(char *)0x0);
        uVar4 = 0;
      }
      else {
        pcVar8 = s_Unspecified_0050f854;
        pcVar7 = local_8;
        do {
          bVar9 = *pcVar7 == *pcVar8;
          if (!bVar9) break;
          if (*pcVar7 == '\0') goto LAB_004b153f;
          pcVar1 = pcVar7 + 1;
          bVar9 = *pcVar1 == pcVar8[1];
          if (!bVar9) break;
          pcVar7 = pcVar7 + 2;
          pcVar8 = pcVar8 + 2;
          bVar9 = *pcVar1 == '\0';
        } while (!bVar9);
        if (!bVar9) {
          *(int *)(param_4 + 0xfc) = *(int *)(param_4 + 0xfc) + 2;
        }
LAB_004b153f:
        iVar3 = FUN_00404118(param_5,param_3,s_ThermalResistivityCoefficient_0050f860,
                             (float *)(param_4 + 0x100));
        if ((iVar3 == 0) && (_DAT_004b177c == *(float *)(param_4 + 0x100))) {
          FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
          FUN_004dbb24(&DAT_00524e20,s_missing_ThermalResistivityCoeffi_0050f87e,(char *)0x0);
          uVar4 = 0;
        }
        else {
          bVar9 = FUN_004040d8(param_5,param_3,s_AuxScreenPlacement_0050f8a7,
                               (int *)(param_4 + 0x108));
          if ((CONCAT31(extraout_var,bVar9) == 0) && (*(int *)(param_4 + 0x108) == -1)) {
            param_4[0x108] = -1;
            param_4[0x109] = -1;
            param_4[0x10a] = -1;
            param_4[0x10b] = -1;
          }
          bVar9 = FUN_004040d8(param_5,param_3,s_AuxScreenNumber_0050f8ba,(int *)(param_4 + 0x104));
          if ((CONCAT31(extraout_var_00,bVar9) == 0) && (*(int *)(param_4 + 0x104) == -1)) {
            FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
            FUN_004dbb24(&DAT_00524e20,s_missing_AuxScreenNumber__0050f8ca,(char *)0x0);
            uVar4 = 0;
          }
          else {
            iVar3 = FUN_00404088(param_5,param_3,s_AuxScreenLabel_0050f8e5,&local_c);
            if (iVar3 == 0) {
              if (param_4[0x10c] == '\0') {
                FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
                FUN_004dbb24(&DAT_00524e20,s_missing_AuxScreenLabel__0050f8f4,(char *)0x0);
                return 0;
              }
            }
            else {
              uVar5 = 0xffffffff;
              pcVar7 = local_c;
              do {
                pcVar8 = pcVar7;
                if (uVar5 == 0) break;
                uVar5 = uVar5 - 1;
                pcVar8 = pcVar7 + 1;
                cVar2 = *pcVar7;
                pcVar7 = pcVar8;
              } while (cVar2 != '\0');
              uVar5 = ~uVar5;
              pcVar7 = pcVar8 + -uVar5;
              pcVar8 = param_4 + 0x10c;
              for (uVar6 = uVar5 >> 2; uVar6 != 0; uVar6 = uVar6 - 1) {
                *(undefined4 *)pcVar8 = *(undefined4 *)pcVar7;
                pcVar7 = pcVar7 + 4;
                pcVar8 = pcVar8 + 4;
              }
              for (uVar5 = uVar5 & 3; uVar5 != 0; uVar5 = uVar5 - 1) {
                *pcVar8 = *pcVar7;
                pcVar7 = pcVar7 + 1;
                pcVar8 = pcVar8 + 1;
              }
              param_4[0x14b] = '\0';
            }
            iVar3 = FUN_00404088(param_5,param_3,s_EngScreenLabel_0050f90e,&local_c);
            if (iVar3 == 0) {
              if (param_4[0x14c] == '\0') {
                FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
                FUN_004dbb24(&DAT_00524e20,s_missing_EngScreenLabel__0050f91d,(char *)0x0);
                return 0;
              }
            }
            else {
              uVar5 = 0xffffffff;
              do {
                pcVar7 = local_c;
                if (uVar5 == 0) break;
                uVar5 = uVar5 - 1;
                pcVar7 = local_c + 1;
                cVar2 = *local_c;
                local_c = pcVar7;
              } while (cVar2 != '\0');
              uVar5 = ~uVar5;
              pcVar7 = pcVar7 + -uVar5;
              pcVar8 = param_4 + 0x14c;
              for (uVar6 = uVar5 >> 2; uVar6 != 0; uVar6 = uVar6 - 1) {
                *(undefined4 *)pcVar8 = *(undefined4 *)pcVar7;
                pcVar7 = pcVar7 + 4;
                pcVar8 = pcVar8 + 4;
              }
              for (uVar5 = uVar5 & 3; uVar5 != 0; uVar5 = uVar5 - 1) {
                *pcVar8 = *pcVar7;
                pcVar7 = pcVar7 + 1;
                pcVar8 = pcVar8 + 1;
              }
              param_4[0x18b] = '\0';
            }
            iVar3 = FUN_00404118(param_5,param_3,s_StartTime_0050f937,(float *)(param_4 + 0x18c));
            if ((iVar3 == 0) && (_DAT_004b177c == *(float *)(param_4 + 0x18c))) {
              FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
              FUN_004dbb24(&DAT_00524e20,s_missing_StartTime__0050f941,(char *)0x0);
              uVar4 = 0;
            }
            else {
              uVar4 = 1;
            }
          }
        }
      }
    }
  }
  return uVar4;
}



/* @004b179c file=? name=FUN_004b179c */

void __cdecl FUN_004b179c(int *param_1,int *param_2)

{
  bool bVar1;
  int iVar2;
  undefined3 extraout_var;
  
  if (*param_2 == 4) {
    iVar2 = FUN_00417ab4((int)(param_1 + 0x45));
    iVar2 = FUN_00417ab4(iVar2 + 0x1d0);
    if (iVar2 != 0) {
      bVar1 = FUN_004ac9c8(iVar2);
      if (CONCAT31(extraout_var,bVar1) == 0) {
        FUN_0041bbd8(iVar2 + 0x1fc,3);
        *(undefined4 *)(iVar2 + 0x1f8) = 0;
      }
    }
  }
  FUN_004aea84(param_1,param_2);
  return;
}



/* @004b1804 file=? name=FUN_004b1804 */

void __cdecl FUN_004b1804(int *param_1)

{
  FUN_004aea9c(param_1);
  return;
}



/* @004b181c file=? name=FUN_004b181c */

void __cdecl FUN_004b181c(int param_1)

{
  int iVar1;
  int iVar2;
  
  FUN_004aeac4(param_1);
  iVar1 = FUN_00417ab4(param_1 + 0x114);
  iVar2 = FUN_00417ab4(iVar1 + 0x1d0);
  FUN_0041bbd8(param_1 + 0x184,*(int *)(iVar1 + 0x278));
  if (((*(int *)(iVar1 + 0x278) == 4) && (iVar2 != 0)) &&
     (*(float *)(iVar2 + 0x1dc) <= *(float *)(param_1 + 0x180) * *(float *)(iVar2 + 0x1d8))) {
    FUN_0041bbd8(param_1 + 0x184,1);
  }
  return;
}



/* @004b18a4 file=? name=FUN_004b18a4 */

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

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

{
  FUN_004aeb40(param_1,param_2,param_3,param_4,param_5);
  *param_1 = (int)&PTR_FUN_0050f99c;
  param_1[0x60] = (int)(float)(_DAT_004b1924 * (float10)*(float *)(param_4 + 0xf0));
  FUN_0041b9ec(param_1 + 0x61,5);
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_0050f5fc;
    param_1[8] = DAT_0050f600;
    param_1[9] = DAT_0050f604;
  }
  return param_1;
}



/* @004b1930 file=? name=FUN_004b1930 */

void __cdecl FUN_004b1930(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_0050f99c;
    FUN_0041baa4(param_1 + 0x61,2);
    FUN_004aebe8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004b1970 file=? name=FUN_004b1970 */

void __cdecl FUN_004b1970(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x50f5cc);
  return;
}



/* @004b198c file=? name=FUN_004b198c */

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

undefined4 __cdecl
FUN_004b198c(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6,
            int param_7)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_004aec54(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    param_4[0x24] = -0xc;
    param_4[0x25] = '\0';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x2b;
    param_4[0x21] = '\v';
    param_4[0x22] = '\0';
    param_4[0x23] = '\0';
    if (param_7 == 1) {
      param_4[0xf0] = '\0';
      param_4[0xf1] = '\0';
      param_4[0xf2] = -0x80;
      param_4[0xf3] = -0x41;
    }
    iVar1 = FUN_00404118(param_5,param_3,s_MinVoltagePercent_0050f963,(float *)(param_4 + 0xf0));
    if ((iVar1 == 0) && (_DAT_004b1a3c == *(float *)(param_4 + 0xf0))) {
      FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,s_missing_MinVoltagePercent__0050f975,(char *)0x0);
      uVar2 = 0;
    }
    else {
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @004b1bb1 file=? name=FUN_004b1bb1 */

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

{
  FUN_004179d4(param_1,param_2);
  *param_1 = &PTR_FUN_0050f994;
  return param_1;
}



/* @004b1bd0 file=? name=FUN_004b1bd0 */

void __cdecl FUN_004b1bd0(int *param_1,byte param_2)

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



/* @004b1bfc file=? name=FUN_004b1bfc */

void __cdecl FUN_004b1bfc(int *param_1,int *param_2)

{
  FUN_004b0efc(param_1,param_2);
  return;
}



/* @004b1c18 file=? name=FUN_004b1c18 */

void __cdecl FUN_004b1c18(int *param_1,int param_2)

{
  if (param_2 != 0) {
    param_1[199] = 0x3f800000;
    param_1[200] = 0;
    param_1[0xc9] = 0;
  }
  FUN_004b0e6c(param_1,param_2);
  return;
}



/* @004b1c4c file=? name=FUN_004b1c4c */

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

void __cdecl FUN_004b1c4c(int *param_1,float param_2)

{
  int iVar1;
  
  FUN_004b0bd0(param_1,param_2);
  param_1[199] = (int)(_DAT_004b1d10 - *(float *)(param_1[0x38] + 0x158));
  if (param_1[0x10] == 1) {
    param_1[199] = 0;
    param_1[200] = 0;
  }
  else {
    param_1[200] = 1;
  }
  if (param_1[0x9e] == 4) {
    param_1[0xc9] = 0;
  }
  else {
    param_1[0xc9] = 1;
    param_1[199] = 0;
  }
  iVar1 = param_1[0x61];
  if (iVar1 == 0) {
    param_1[200] = 1;
  }
  else {
    if (iVar1 == 1) {
      param_1[199] = (int)((float)param_1[199] * _DAT_004b1d14);
      param_1[200] = 1;
      return;
    }
    if (iVar1 == 2) {
      param_1[199] = 0;
      param_1[200] = 0;
      return;
    }
  }
  return;
}



/* @004b1d18 file=? name=FUN_004b1d18 */

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

{
  FUN_004b0f74(param_1,param_2,param_3,param_4,&DAT_0050fa1c,0,0);
  *param_1 = (int)&PTR_FUN_0050fb0c;
  param_1[199] = 0x3f800000;
  param_1[200] = 0;
  param_1[0xc9] = 0;
  param_1[10] = param_1[10] | 8;
  if ((*(uint *)(param_2 + 0x28) & 0xc) != 4) {
    param_1[7] = (int)PTR_FUN_0050fa94;
    param_1[8] = DAT_0050fa98;
    param_1[9] = DAT_0050fa9c;
  }
  return param_1;
}



/* @004b1d90 file=? name=FUN_004b1d90 */

void __cdecl FUN_004b1d90(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_0050fb0c;
    *(undefined4 *)(param_1[0x34] + 0x374) = 0;
    FUN_004b115c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004b1dcc file=? name=FUN_004b1dcc */

bool __cdecl
FUN_004b1dcc(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6,
            int param_7)

{
  int iVar1;
  
  iVar1 = FUN_004b13ac(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar1 != 0) {
    param_4[0x24] = -0x70;
    param_4[0x25] = '\x01';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x3d;
    param_4[0x21] = '\v';
    param_4[0x22] = '\0';
    param_4[0x23] = '\0';
  }
  return iVar1 != 0;
}



/* @004b1e18 file=? name=FUN_004b1e18 */

void __cdecl FUN_004b1e18(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x50fa2c);
  return;
}



/* @004b1f7c file=? name=FUN_004b1f7c */

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

void __cdecl FUN_004b1f7c(int *param_1,float param_2)

{
  float fVar1;
  
  FUN_004ad924(param_1,param_2);
  if (param_1[0x10] == 1) {
    FUN_0041bbd8((int)(param_1 + 0x7f),1);
  }
  if (param_1[0x61] == 2) {
    FUN_0041bbd8((int)(param_1 + 0x7f),4);
  }
  switch(param_1[0x84]) {
  case 0:
    param_1[0x77] = 0;
    param_1[0x7c] = (int)(param_2 + (float)param_1[0x7c]);
    if ((float)param_1[0x7b] <= (float)param_1[0x7c]) {
      FUN_0041bbd8((int)(param_1 + 0x7f),2);
      param_1[0x77] =
           (int)((_DAT_004b2154 - *(float *)(param_1[0x38] + 0x158)) * (float)param_1[0x76]);
    }
    break;
  case 1:
    param_1[0x77] = 0;
    break;
  case 3:
    param_1[0x77] = 0;
    param_1[0x7e] = (int)(param_2 + (float)param_1[0x7e]);
    if ((float)param_1[0x7d] <= (float)param_1[0x7e]) {
      FUN_0041bbd8((int)(param_1 + 0x7f),2);
      param_1[0x77] =
           (int)((_DAT_004b2154 - *(float *)(param_1[0x38] + 0x158)) * (float)param_1[0x76]);
    }
    break;
  case 4:
    param_1[0x77] = 0;
    if (param_1[0x61] == 0) {
      if (param_1[0x75] == 0) {
        FUN_0041bbd8((int)(param_1 + 0x7f),1);
      }
      else {
        param_1[0x7c] = 0;
        FUN_0041bbd8((int)(param_1 + 0x7f),0);
      }
    }
  }
  param_1[0x74] = (int)((float)param_1[0x77] / (float)param_1[0x76]);
  fVar1 = _DAT_004b2158;
  if ((_DAT_004b2158 <= (float)param_1[0x74]) &&
     (fVar1 = _DAT_004b2154, (float)param_1[0x74] <= _DAT_004b2154)) {
    fVar1 = (float)param_1[0x74];
  }
  param_1[0x74] = (int)fVar1;
  return;
}



/* @004b21d0 file=? name=FUN_004b21d0 */

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

void __cdecl FUN_004b21d0(int *param_1,int *param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  
  FUN_004ad748(param_1,param_2);
  if (*(int *)(*(int *)(param_1[0x34] + 400) + 0x274) != 0) {
    if (*param_2 == 4) {
      if ((param_1[0x10] == 2) || (param_1[0x10] == 0)) {
        bVar1 = FUN_004ac9c8((int)param_1);
        if (CONCAT31(extraout_var,bVar1) == 0) {
          FUN_0041bbd8((int)(param_1 + 0x7f),3);
          param_1[0x7e] = 0;
        }
      }
    }
    else {
      param_1[0x77] =
           (int)((_DAT_004b2258 - *(float *)(param_1[0x38] + 0x158)) * (float)param_1[0x76]);
    }
  }
  return;
}



/* @004b225c file=? name=FUN_004b225c */

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

{
  char *pcVar1;
  int iVar2;
  
  FUN_004adda0(param_1,param_2,param_3,param_4,&DAT_0050fb50,0,0);
  *param_1 = (int)&PTR_FUN_0050fd74;
  FUN_0041b9ec(param_1 + 0x7f,5);
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_0050fc14;
    param_1[8] = DAT_0050fc18;
    param_1[9] = DAT_0050fc1c;
  }
  param_1[0x76] = *(int *)(param_4 + 0xfc);
  param_1[0x77] = param_1[0x76];
  param_1[0x79] = *(int *)(param_4 + 0x100);
  param_1[0x7a] = 0;
  param_1[0x77] = param_1[0x76];
  param_1[0x74] = 0x3f800000;
  param_1[0x7b] = *(int *)(param_4 + 0x104);
  param_1[0x7c] = param_1[0x7b];
  FUN_0041bbd8((int)(param_1 + 0x7f),2);
  param_1[0x75] = 1;
  param_1[0x7d] = *(int *)(param_4 + 0x108);
  param_1[0x7e] = param_1[0x7d];
  param_1[10] = param_1[10] | 8;
  pcVar1 = (char *)param_1[0x35];
  iVar2 = FUN_004d4a78(pcVar1);
  param_1[0x78] = pcVar1[iVar2 + -1] + -0x40;
  return param_1;
}



/* @004b237c file=? name=FUN_004b237c */

void __cdecl FUN_004b237c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_0050fd74;
    FUN_0041baa4(param_1 + 0x7f,2);
    FUN_004adfd4(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004b23bc file=? name=FUN_004b23bc */

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

undefined4 __cdecl
FUN_004b23bc(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6,
            int param_7)

{
  bool bVar1;
  int iVar2;
  undefined4 uVar3;
  undefined3 extraout_var;
  
  iVar2 = FUN_004ae150(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar2 == 0) {
    uVar3 = 0;
  }
  else {
    param_4[0x24] = '\f';
    param_4[0x25] = '\x01';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x3f;
    param_4[0x21] = '\v';
    param_4[0x22] = '\0';
    param_4[0x23] = '\0';
    if (param_7 == 1) {
      param_4[0xfc] = '\0';
      param_4[0xfd] = '\0';
      param_4[0xfe] = -0x80;
      param_4[0xff] = -0x41;
      param_4[0x104] = '\0';
      param_4[0x105] = '\0';
      param_4[0x106] = -0x80;
      param_4[0x107] = -0x41;
      param_4[0x108] = '\0';
      param_4[0x109] = '\0';
      param_4[0x10a] = -0x80;
      param_4[0x10b] = -0x41;
    }
    iVar2 = FUN_00404118(param_5,param_3,s_RatedVoltage_0050fcde,(float *)(param_4 + 0xfc));
    if ((iVar2 == 0) && (_DAT_004b2580 == *(float *)(param_4 + 0xfc))) {
      FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_missing_RatedVoltage__0050fceb,(char *)0x0);
      uVar3 = 0;
    }
    else {
      bVar1 = FUN_004040d8(param_5,param_3,s_MaxTapCount_0050fd03,(int *)(param_4 + 0x100));
      if ((CONCAT31(extraout_var,bVar1) == 0) && (*(int *)(param_4 + 0x100) == -1)) {
        FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_missing_MaxTapCount__0050fd0f,(char *)0x0);
        uVar3 = 0;
      }
      else {
        iVar2 = FUN_00404118(param_5,param_3,s_StartTime_0050fd26,(float *)(param_4 + 0x104));
        if ((iVar2 == 0) && (_DAT_004b2580 == *(float *)(param_4 + 0x104))) {
          FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
          FUN_004dbb24((int *)&DAT_00524e68,s_missing_StartTime__0050fd30,(char *)0x0);
          uVar3 = 0;
        }
        else {
          iVar2 = FUN_00404118(param_5,param_3,s_ShortRecoveryTime_0050fd45,
                               (float *)(param_4 + 0x108));
          if ((iVar2 == 0) && (_DAT_004b2580 == *(float *)(param_4 + 0x108))) {
            FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
            FUN_004dbb24((int *)&DAT_00524e68,s_missing_ShortRecoveryTime__0050fd57,(char *)0x0);
            uVar3 = 0;
          }
          else {
            uVar3 = 1;
          }
        }
      }
    }
  }
  return uVar3;
}



/* @004b2660 file=? name=FUN_004b2660 */

void __cdecl FUN_004b2660(int *param_1,int *param_2)

{
  FUN_004b179c(param_1,param_2);
  return;
}



/* @004b2678 file=? name=FUN_004b2678 */

void __cdecl FUN_004b2678(int *param_1,int param_2)

{
  if (param_2 != 0) {
    param_1[0xef] = 0;
    param_1[0xf0] = 0;
    param_1[0xea] = 0;
    param_1[0xf1] = 0;
    FUN_00408440(param_1 + 0x77,&DAT_004e0f74);
    FUN_00408440(param_1 + 0x8c,&DAT_004e0f74);
    FUN_00408440(param_1 + 0x8f,&DAT_004e0f74);
    FUN_00408440(param_1 + 0x92,&DAT_004e0f74);
    FUN_00408e90(param_1 + 0xad,&DAT_004e0f8c);
    FUN_00408440(param_1 + 0xc2,&DAT_004e0f74);
    FUN_00408440(param_1 + 0xc5,&DAT_004e0f74);
    FUN_00408440(param_1 + 200,&DAT_004e0f74);
  }
  FUN_004b1804(param_1);
  return;
}



/* @004b275c file=? name=FUN_004b275c */

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

void __cdecl FUN_004b275c(int param_1,float param_2)

{
  float fVar1;
  undefined4 uVar2;
  undefined4 local_c;
  undefined4 local_8;
  
  FUN_004b181c(param_1);
  if (((*(int *)(param_1 + 0x40) == 1) || (*(int *)(param_1 + 0x198) != 4)) ||
     (*(int *)(param_1 + 0x140) == 2)) {
    local_8 = *(float *)(param_1 + 0x3a4) * param_2;
    if (*(float *)(param_1 + 0x3b0) + *(float *)(param_1 + 0x3a8) < *(float *)(param_1 + 0x3bc)) {
      local_8 = -local_8;
    }
    *(float *)(param_1 + 0x3bc) = local_8 + *(float *)(param_1 + 0x3bc);
    if (local_8 <= _DAT_004b297c) {
      if (local_8 < _DAT_004b297c) {
        if (*(float *)(param_1 + 0x3b0) + *(float *)(param_1 + 0x3a8) <= *(float *)(param_1 + 0x3bc)
           ) {
          fVar1 = *(float *)(param_1 + 0x3bc);
        }
        else {
          fVar1 = *(float *)(param_1 + 0x3b0) + *(float *)(param_1 + 0x3a8);
        }
        *(float *)(param_1 + 0x3bc) = fVar1;
      }
    }
    else {
      if (*(float *)(param_1 + 0x3bc) <= *(float *)(param_1 + 0x3b0) + *(float *)(param_1 + 0x3a8))
      {
        fVar1 = *(float *)(param_1 + 0x3bc);
      }
      else {
        fVar1 = *(float *)(param_1 + 0x3b0) + *(float *)(param_1 + 0x3a8);
      }
      *(float *)(param_1 + 0x3bc) = fVar1;
    }
  }
  else {
    local_c = *(float *)(param_1 + 0x3a4) * param_2;
    if (*(float *)(param_1 + 0x3ac) + *(float *)(param_1 + 0x3a8) < *(float *)(param_1 + 0x3bc)) {
      local_c = -local_c;
    }
    *(float *)(param_1 + 0x3bc) = local_c + *(float *)(param_1 + 0x3bc);
    if (local_c <= _DAT_004b297c) {
      if (local_c < _DAT_004b297c) {
        if (*(float *)(param_1 + 0x3ac) + *(float *)(param_1 + 0x3a8) <= *(float *)(param_1 + 0x3bc)
           ) {
          fVar1 = *(float *)(param_1 + 0x3bc);
        }
        else {
          fVar1 = *(float *)(param_1 + 0x3ac) + *(float *)(param_1 + 0x3a8);
        }
        *(float *)(param_1 + 0x3bc) = fVar1;
      }
    }
    else {
      if (*(float *)(param_1 + 0x3bc) <= *(float *)(param_1 + 0x3ac) + *(float *)(param_1 + 0x3a8))
      {
        fVar1 = *(float *)(param_1 + 0x3bc);
      }
      else {
        fVar1 = *(float *)(param_1 + 0x3ac) + *(float *)(param_1 + 0x3a8);
      }
      *(float *)(param_1 + 0x3bc) = fVar1;
    }
  }
  if (*(float *)(param_1 + 0x3bc) <= *(float *)(param_1 + 0x39c)) {
    uVar2 = *(undefined4 *)(param_1 + 0x3bc);
  }
  else {
    uVar2 = *(undefined4 *)(param_1 + 0x39c);
  }
  *(undefined4 *)(param_1 + 0x3bc) = uVar2;
  if (*(float *)(param_1 + 0x3a0) <= *(float *)(param_1 + 0x3bc)) {
    uVar2 = *(undefined4 *)(param_1 + 0x3bc);
  }
  else {
    uVar2 = *(undefined4 *)(param_1 + 0x3a0);
  }
  *(undefined4 *)(param_1 + 0x3bc) = uVar2;
  FUN_004b2ec0(param_1,param_2);
  FUN_004b30ec(param_1,param_2);
  return;
}



/* @004b2d8c file=? name=FUN_004b2d8c */

void __cdecl FUN_004b2d8c(int param_1,float param_2,float param_3,float param_4,float param_5)

{
  param_2 = -param_2;
  param_3 = -param_3;
  param_4 = -param_4;
  param_5 = *(float *)(param_1 + 0x1d8) * param_5;
  FUN_004086ac(&param_2,&param_2,param_5);
  FUN_004085ec((float *)(param_1 + 0x230),&param_2,(float *)(param_1 + 0x230));
  return;
}



/* @004b2de4 file=? name=FUN_004b2de4 */

void __cdecl FUN_004b2de4(int param_1,float param_2,float param_3,float param_4,float param_5)

{
  param_2 = -param_2;
  param_3 = -param_3;
  param_4 = -param_4;
  param_5 = *(float *)(param_1 + 0x1d8) * param_5;
  FUN_004086ac(&param_2,&param_2,param_5);
  FUN_004085ec((float *)(param_1 + 0x308),&param_2,(float *)(param_1 + 0x308));
  *(undefined4 *)(param_1 + 0x30c) = 0;
  *(float *)(param_1 + 0x308) = -*(float *)(param_1 + 0x308);
  return;
}



/* @004b2e50 file=? name=FUN_004b2e50 */

void __cdecl
FUN_004b2e50(int param_1,float param_2,undefined4 param_3,undefined4 param_4,float param_5)

{
  param_3 = 0;
  param_4 = 0;
  param_5 = *(float *)(param_1 + 0x1d8) * param_5;
  FUN_004086ac(&param_2,&param_2,param_5);
  FUN_004085ec((float *)(param_1 + 0x308),&param_2,(float *)(param_1 + 0x308));
  *(undefined4 *)(param_1 + 0x30c) = *(undefined4 *)(param_1 + 0x308);
  return;
}



/* @004b2eac file=? name=FUN_004b2eac */

void __cdecl FUN_004b2eac(int param_1)

{
  FUN_004b33e0(param_1);
  return;
}



/* @004b2ec0 file=? name=FUN_004b2ec0 */

void __cdecl FUN_004b2ec0(int param_1,float param_2)

{
  float *pfVar1;
  float *pfVar2;
  undefined4 uVar3;
  float local_7c [12];
  float local_4c [3];
  float local_40 [3];
  float local_34 [3];
  float local_28 [3];
  float local_1c [3];
  float local_10 [3];
  
  FUN_00408644(local_10,(float *)(param_1 + 0x1dc),(float *)(param_1 + 0x224));
  FUN_00408644(local_1c,(float *)(param_1 + 0x1dc),(float *)(param_1 + 0x218));
  FUN_004086d0(local_28,(float *)(param_1 + 0x1e8),local_10);
  FUN_004086d0(local_34,(float *)(param_1 + 0x1e8),local_1c);
  pfVar1 = (float *)(param_1 + 0x230);
  FUN_004085ec(pfVar1,pfVar1,local_28);
  FUN_004085ec(pfVar1,pfVar1,local_34);
  FUN_00408440((undefined4 *)(param_1 + 0x248),pfVar1);
  FUN_004086ac(local_40,(float *)(param_1 + 0x248),param_2);
  pfVar2 = (float *)(param_1 + 0x23c);
  FUN_004085ec(pfVar2,pfVar2,local_40);
  FUN_004086d0(pfVar1,(float *)(param_1 + 500),pfVar2);
  FUN_00408440((undefined4 *)(param_1 + 0x248),pfVar1);
  FUN_004086ac(local_40,(float *)(param_1 + 0x248),param_2);
  FUN_004085ec(pfVar2,pfVar2,local_40);
  FUN_0040aadc(local_7c);
  FUN_00408744(local_4c,pfVar2,local_7c);
  FUN_004085ec((float *)(param_1 + 0x1dc),(float *)(param_1 + 0x1dc),local_4c);
  if (*(float *)(param_1 + 0x1dc) <= *(float *)(param_1 + 0x200)) {
    uVar3 = *(undefined4 *)(param_1 + 0x1dc);
  }
  else {
    uVar3 = *(undefined4 *)(param_1 + 0x200);
  }
  *(undefined4 *)(param_1 + 0x1dc) = uVar3;
  if (*(float *)(param_1 + 0x1e0) <= *(float *)(param_1 + 0x204)) {
    uVar3 = *(undefined4 *)(param_1 + 0x1e0);
  }
  else {
    uVar3 = *(undefined4 *)(param_1 + 0x204);
  }
  *(undefined4 *)(param_1 + 0x1e0) = uVar3;
  if (*(float *)(param_1 + 0x1e4) <= *(float *)(param_1 + 0x208)) {
    uVar3 = *(undefined4 *)(param_1 + 0x1e4);
  }
  else {
    uVar3 = *(undefined4 *)(param_1 + 0x208);
  }
  *(undefined4 *)(param_1 + 0x1e4) = uVar3;
  if (*(float *)(param_1 + 0x20c) <= *(float *)(param_1 + 0x1dc)) {
    uVar3 = *(undefined4 *)(param_1 + 0x1dc);
  }
  else {
    uVar3 = *(undefined4 *)(param_1 + 0x20c);
  }
  *(undefined4 *)(param_1 + 0x1dc) = uVar3;
  if (*(float *)(param_1 + 0x210) <= *(float *)(param_1 + 0x1e0)) {
    uVar3 = *(undefined4 *)(param_1 + 0x1e0);
  }
  else {
    uVar3 = *(undefined4 *)(param_1 + 0x210);
  }
  *(undefined4 *)(param_1 + 0x1e0) = uVar3;
  if (*(float *)(param_1 + 0x214) <= *(float *)(param_1 + 0x1e4)) {
    uVar3 = *(undefined4 *)(param_1 + 0x1e4);
  }
  else {
    uVar3 = *(undefined4 *)(param_1 + 0x214);
  }
  *(undefined4 *)(param_1 + 0x1e4) = uVar3;
  return;
}



/* @004b30ec file=? name=FUN_004b30ec */

void __cdecl FUN_004b30ec(int param_1,float param_2)

{
  float *pfVar1;
  float *pfVar2;
  undefined4 *puVar3;
  float local_ac [12];
  float local_7c;
  float local_78;
  float local_74;
  float local_70 [3];
  float local_64;
  float local_60;
  float local_5c;
  float local_58;
  float local_54;
  float local_50;
  float local_4c;
  float local_48;
  float local_44;
  float local_40;
  float local_3c;
  float local_38;
  float local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  local_40 = *(float *)(param_1 + 0x2b4) - *(float *)(param_1 + 0x2fc);
  local_3c = *(float *)(param_1 + 0x2b8) - *(float *)(param_1 + 0x300);
  local_38 = *(float *)(param_1 + 700) - *(float *)(param_1 + 0x304);
  local_4c = *(float *)(param_1 + 0x2b4) - *(float *)(param_1 + 0x2f0);
  local_48 = *(float *)(param_1 + 0x2b8) - *(float *)(param_1 + 0x2f4);
  local_44 = *(float *)(param_1 + 700) - *(float *)(param_1 + 0x2f8);
  local_58 = *(float *)(param_1 + 0x2c0) * local_38;
  local_54 = *(float *)(param_1 + 0x2c4) * local_3c;
  local_50 = *(float *)(param_1 + 0x2c8) * local_40;
  local_64 = *(float *)(param_1 + 0x2c0) * local_44;
  local_60 = *(float *)(param_1 + 0x2c4) * local_48;
  local_5c = *(float *)(param_1 + 0x2c8) * local_4c;
  local_1c = local_44;
  local_18 = local_48;
  local_14 = local_4c;
  local_10 = local_38;
  local_c = local_3c;
  local_8 = local_40;
  FUN_004085ec((float *)(param_1 + 0x308),(float *)(param_1 + 0x308),&local_58);
  pfVar1 = (float *)(param_1 + 0x308);
  FUN_004085ec(pfVar1,pfVar1,&local_64);
  FUN_00408440((undefined4 *)(param_1 + 800),pfVar1);
  FUN_004086ac(local_70,(float *)(param_1 + 800),param_2);
  pfVar2 = (float *)(param_1 + 0x314);
  FUN_004085ec(pfVar2,pfVar2,local_70);
  FUN_004086d0(pfVar1,(float *)(param_1 + 0x2cc),pfVar2);
  FUN_00408440((undefined4 *)(param_1 + 800),pfVar1);
  FUN_004086ac(local_70,(float *)(param_1 + 800),param_2);
  FUN_004085ec(pfVar2,pfVar2,local_70);
  FUN_0040aadc(local_ac);
  FUN_00408744(&local_7c,pfVar2,local_ac);
  *(float *)(param_1 + 0x2b4) = local_74 + *(float *)(param_1 + 0x2b4);
  *(float *)(param_1 + 0x2b8) = local_78 + *(float *)(param_1 + 0x2b8);
  *(float *)(param_1 + 700) = local_7c + *(float *)(param_1 + 700);
  if (*(float *)(param_1 + 0x2b8) <= *(float *)(param_1 + 0x2dc)) {
    puVar3 = (undefined4 *)(param_1 + 0x2b8);
  }
  else {
    puVar3 = (undefined4 *)(param_1 + 0x2dc);
  }
  *(undefined4 *)(param_1 + 0x2b8) = *puVar3;
  if (*(float *)(param_1 + 0x2b4) <= *(float *)(param_1 + 0x2d8)) {
    puVar3 = (undefined4 *)(param_1 + 0x2b4);
  }
  else {
    puVar3 = (undefined4 *)(param_1 + 0x2d8);
  }
  *(undefined4 *)(param_1 + 0x2b4) = *puVar3;
  if (*(float *)(param_1 + 700) <= *(float *)(param_1 + 0x2e0)) {
    puVar3 = (undefined4 *)(param_1 + 700);
  }
  else {
    puVar3 = (undefined4 *)(param_1 + 0x2e0);
  }
  *(undefined4 *)(param_1 + 700) = *puVar3;
  if (*(float *)(param_1 + 0x2e8) <= *(float *)(param_1 + 0x2b8)) {
    puVar3 = (undefined4 *)(param_1 + 0x2b8);
  }
  else {
    puVar3 = (undefined4 *)(param_1 + 0x2e8);
  }
  *(undefined4 *)(param_1 + 0x2b8) = *puVar3;
  if (*(float *)(param_1 + 0x2e4) <= *(float *)(param_1 + 0x2b4)) {
    puVar3 = (undefined4 *)(param_1 + 0x2b4);
  }
  else {
    puVar3 = (undefined4 *)(param_1 + 0x2e4);
  }
  *(undefined4 *)(param_1 + 0x2b4) = *puVar3;
  if (*(float *)(param_1 + 0x2ec) <= *(float *)(param_1 + 700)) {
    puVar3 = (undefined4 *)(param_1 + 700);
  }
  else {
    puVar3 = (undefined4 *)(param_1 + 0x2ec);
  }
  *(undefined4 *)(param_1 + 700) = *puVar3;
  return;
}



/* @004b33e0 file=? name=FUN_004b33e0 */

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

void __cdecl FUN_004b33e0(int param_1)

{
  uint uVar1;
  float *pfVar2;
  int iVar3;
  float10 fVar4;
  float local_2c [3];
  float local_20;
  float local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  local_14 = *(float *)(param_1 + 0x3bc);
  uVar1 = *(uint *)(*(int *)(param_1 + 0x3c8) + 0x10);
  local_8 = local_14;
  if (uVar1 < 3) {
    pfVar2 = (float *)(*(int *)(*(int *)(param_1 + 0x3c8) + 0xc) + 4);
    local_10 = *pfVar2;
    local_1c = local_14 * local_10;
    local_20 = *pfVar2;
    local_18 = local_20;
    local_c = local_1c;
    fVar4 = FUN_004dcd00((double)(local_20 - local_1c));
    if ((float10)_DAT_004b34e8 < fVar4) {
      FUN_0041d0a8(*(int *)(param_1 + 0x3c8),&local_c);
    }
  }
  else if (uVar1 - 4 < 2) {
    pfVar2 = (float *)FUN_0041cfa0(*(int *)(param_1 + 0x3c8));
    FUN_004092fc(local_2c,pfVar2,local_14);
    pfVar2 = (float *)FUN_0041cfa0(*(int *)(param_1 + 0x3c8));
    iVar3 = FUN_004091f4(pfVar2,local_2c,0.0001);
    if (iVar3 == 0) {
      FUN_0041d020(*(int *)(param_1 + 0x3c8),local_2c);
    }
  }
  return;
}



/* @004b34ec file=? name=FUN_004b34ec */

void __cdecl FUN_004b34ec(int param_1)

{
  int iVar1;
  float *pfVar2;
  
  if (*(int *)(*(int *)(param_1 + 0x3cc) + 0x10) == 5) {
    iVar1 = FUN_004084fc(*(float **)(*(int *)(param_1 + 0x3cc) + 0xc),(float *)(param_1 + 0x1dc),
                         0.0001);
    if (iVar1 == 0) {
      FUN_0041d11c(*(int *)(param_1 + 0x3cc),(float *)(param_1 + 0x1dc));
    }
    pfVar2 = (float *)FUN_0041cfa0(*(int *)(param_1 + 0x3cc));
    iVar1 = FUN_004091f4(pfVar2,(float *)(param_1 + 0x2b4),0.0001);
    if (iVar1 == 0) {
      FUN_0041d020(*(int *)(param_1 + 0x3cc),(float *)(param_1 + 0x2b4));
    }
  }
  return;
}



/* @004b357c file=? name=FUN_004b357c */

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

bool __cdecl FUN_004b357c(int param_1,float param_2)

{
  float *pfVar1;
  float *pfVar2;
  float fVar3;
  float local_74 [3];
  float local_68 [3];
  float local_5c [4];
  float local_4c;
  undefined4 local_48;
  float local_44;
  undefined4 local_40;
  float local_3c;
  float local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  local_8 = 0;
  local_c = 0;
  local_10 = 0;
  local_5c[0] = 0.0;
  local_5c[1] = 0.0;
  local_5c[2] = 0.0;
  local_1c = 0;
  local_18 = 0;
  local_14 = 0;
  local_28 = 0x3f800000;
  local_24 = 0;
  local_20 = 0x3f800000;
  local_34 = 0x40000000;
  local_30 = 0;
  local_2c = 0x40000000;
  if (*(int *)(param_1 + 0x3c4) == 0) {
    *(undefined4 *)(param_1 + 0x3c4) = 1;
    *(undefined4 *)(param_1 + 0x3c0) = 0x40000000;
  }
  fVar3 = param_2 / *(float *)(param_1 + 0x3c0);
  local_38 = fVar3;
  switch(*(undefined4 *)(*(int *)(param_1 + 0x3c8) + 0x10)) {
  case 0:
    FUN_00408dd4(&local_40,*(undefined4 **)(*(int *)(param_1 + 0x3c8) + 0xc),(int)&local_18,fVar3);
    FUN_0041d0a8(*(int *)(param_1 + 0x3c8),&local_3c);
    break;
  case 1:
    FUN_00408dd4(&local_48,*(undefined4 **)(*(int *)(param_1 + 0x3c8) + 0xc),(int)&local_24,fVar3);
    FUN_0041d0a8(*(int *)(param_1 + 0x3c8),&local_44);
    break;
  case 2:
    FUN_00408dd4(local_5c + 3,*(undefined4 **)(*(int *)(param_1 + 0x3c8) + 0xc),(int)&local_30,fVar3
                );
    FUN_0041d0a8(*(int *)(param_1 + 0x3c8),&local_4c);
    break;
  case 4:
    pfVar2 = local_5c;
    pfVar1 = (float *)FUN_0041cfa0(*(int *)(param_1 + 0x3c8));
    FUN_00409390(local_74,pfVar1,pfVar2,fVar3);
    FUN_0041d020(*(int *)(param_1 + 0x3c8),local_74);
    break;
  case 5:
    pfVar2 = local_5c;
    pfVar1 = (float *)FUN_0041cfa0(*(int *)(param_1 + 0x3c8));
    FUN_00409390(local_68,pfVar1,pfVar2,fVar3);
    FUN_0041d020(*(int *)(param_1 + 0x3c8),local_68);
  }
  *(float *)(param_1 + 0x3c0) = *(float *)(param_1 + 0x3c0) - param_2;
  fVar3 = _DAT_004b3774;
  if (*(float *)(param_1 + 0x3c0) <= _DAT_004b3774) {
    *(undefined4 *)(param_1 + 0x3c4) = 0;
  }
  return *(float *)(param_1 + 0x3c0) <= fVar3;
}



/* @004b3778 file=? name=FUN_004b3778 */

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

{
  uint *puVar1;
  int iVar2;
  int iVar3;
  int *piVar4;
  int *piVar5;
  int local_15c [7];
  int local_140 [7];
  float local_124 [12];
  float local_f4 [12];
  int *local_c4;
  undefined4 local_c0;
  undefined4 local_bc;
  int local_b8;
  int local_b4;
  undefined4 local_b0;
  undefined4 local_ac;
  char *local_a8;
  uint *local_a4;
  uint *local_a0;
  char *local_9c;
  uint *local_98;
  float *local_94;
  float *local_90;
  float *local_8c;
  float *local_88;
  int *local_84;
  char *local_80;
  int *local_7c;
  char *local_78;
  int *local_74;
  int *local_70;
  int *local_6c;
  int *local_68;
  int *local_64;
  int *local_60;
  int *local_5c;
  int *local_58;
  int *local_54;
  int *local_50;
  int *local_4c;
  int *local_48;
  int *local_44;
  int *local_40;
  int *local_3c;
  int *local_38;
  int *local_34;
  int *local_30;
  int *local_2c;
  int *local_28;
  int *local_24;
  int *local_20;
  int *local_1c;
  int *local_18;
  int *local_14;
  int *local_10;
  int *local_c;
  int *local_8;
  
  FUN_004b18a4(param_1,param_2,param_3,param_4,&DAT_0050fdb0);
  *param_1 = (int)&PTR_FUN_00510abc;
  local_8 = param_1 + 0x77;
  local_c = param_1 + 0x7a;
  local_10 = param_1 + 0x7d;
  local_14 = param_1 + 0x80;
  local_18 = param_1 + 0x83;
  local_1c = param_1 + 0x86;
  local_20 = param_1 + 0x89;
  local_24 = param_1 + 0x8c;
  local_28 = param_1 + 0x8f;
  local_2c = param_1 + 0x92;
  local_30 = param_1 + 0x97;
  FUN_0040aadc(local_30);
  local_34 = param_1 + 0xa3;
  local_38 = param_1 + 0xaa;
  local_3c = param_1 + 0xad;
  local_40 = param_1 + 0xb0;
  local_44 = param_1 + 0xb3;
  local_48 = param_1 + 0xb6;
  local_4c = param_1 + 0xb9;
  local_50 = param_1 + 0xbc;
  local_54 = param_1 + 0xbf;
  local_58 = param_1 + 0xc2;
  local_5c = param_1 + 0xc5;
  local_60 = param_1 + 200;
  local_64 = param_1 + 0xe4;
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(byte *)(param_2 + 0x29) & 1) != 0)) {
    param_1[7] = (int)PTR_FUN_0050fe08;
    param_1[8] = DAT_0050fe0c;
    param_1[9] = DAT_0050fe10;
  }
  param_1[0x76] = *(int *)(param_4 + 0xf8);
  param_1[0xe8] = *(int *)(param_4 + 0x100);
  param_1[0xe7] = *(int *)(param_4 + 0xfc);
  param_1[0xe9] = *(int *)(param_4 + 0x104);
  param_1[0xeb] = *(int *)(param_4 + 0x108);
  param_1[0xec] = *(int *)(param_4 + 0x10c);
  param_1[0xed] = *(int *)(param_4 + 0x110);
  local_68 = param_1 + 0x7a;
  param_1[0xee] = *(int *)(param_4 + 0x114);
  FUN_00408440(local_68,(undefined4 *)(param_4 + 0x118));
  local_6c = param_1 + 0x7d;
  FUN_00408440(local_6c,(undefined4 *)(param_4 + 0x124));
  local_70 = param_1 + 0x86;
  FUN_00408440(local_70,(undefined4 *)(param_4 + 0x130));
  local_74 = param_1 + 0x89;
  FUN_00408440(local_74,(undefined4 *)(param_4 + 0x13c));
  local_78 = param_4 + 0x148;
  local_7c = param_1 + 0xb0;
  FUN_00408440(local_7c,(undefined4 *)local_78);
  local_80 = param_4 + 0x154;
  local_84 = param_1 + 0xb3;
  FUN_00408440(local_84,(undefined4 *)local_80);
  FUN_00408e90(param_1 + 0xbc,(undefined4 *)(param_4 + 0x160));
  FUN_00408e90(param_1 + 0xbf,(undefined4 *)(param_4 + 0x16c));
  param_1[0xcb] = *(int *)(param_4 + 0x1b8);
  param_1[0xcc] = *(int *)(param_4 + 0x1bc);
  param_1[0xcd] = *(int *)(param_4 + 0x1c0);
  param_1[0xce] = *(int *)(param_4 + 0x1c4);
  param_1[0xcf] = *(int *)(param_4 + 0x1c8);
  piVar4 = (int *)(param_4 + 0x1cc);
  piVar5 = param_1 + 0xd0;
  for (iVar3 = 4; iVar3 != 0; iVar3 = iVar3 + -1) {
    *piVar5 = *piVar4;
    piVar4 = piVar4 + 1;
    piVar5 = piVar5 + 1;
  }
  piVar4 = (int *)(param_4 + 0x1dc);
  piVar5 = param_1 + 0xd4;
  for (iVar3 = 4; iVar3 != 0; iVar3 = iVar3 + -1) {
    *piVar5 = *piVar4;
    piVar4 = piVar4 + 1;
    piVar5 = piVar5 + 1;
  }
  piVar4 = (int *)(param_4 + 0x1ec);
  piVar5 = param_1 + 0xd8;
  for (iVar3 = 4; iVar3 != 0; iVar3 = iVar3 + -1) {
    *piVar5 = *piVar4;
    piVar4 = piVar4 + 1;
    piVar5 = piVar5 + 1;
  }
  piVar4 = (int *)(param_4 + 0x1fc);
  piVar5 = param_1 + 0xdc;
  for (iVar3 = 4; iVar3 != 0; iVar3 = iVar3 + -1) {
    *piVar5 = *piVar4;
    piVar4 = piVar4 + 1;
    piVar5 = piVar5 + 1;
  }
  piVar4 = (int *)(param_4 + 0x20c);
  piVar5 = param_1 + 0xe0;
  for (iVar3 = 4; iVar3 != 0; iVar3 = iVar3 + -1) {
    *piVar5 = *piVar4;
    piVar4 = piVar4 + 1;
    piVar5 = piVar5 + 1;
  }
  FUN_0040aadc(local_f4);
  local_88 = (float *)(param_1 + 0x86);
  local_8c = (float *)(param_1 + 0x80);
  FUN_00408744(local_8c,local_88,local_f4);
  FUN_0040aadc(local_124);
  local_90 = (float *)(param_1 + 0x89);
  local_94 = (float *)(param_1 + 0x83);
  FUN_00408744(local_94,local_90,local_124);
  FUN_004092fc((float *)(param_1 + 0xb6),(float *)(param_1 + 0xbc),2.0);
  FUN_004092fc((float *)(param_1 + 0xb9),(float *)(param_1 + 0xbf),2.0);
  local_9c = param_4 + 0x178;
  local_a0 = (uint *)FUN_00402298(0x10);
  if (local_a0 == (uint *)0x0) {
    local_98 = (uint *)0x0;
  }
  else {
    local_98 = FUN_00402460(local_a0,local_9c);
  }
  local_98[3] = local_98[3] + 1;
  local_a8 = param_4 + 0x198;
  puVar1 = (uint *)FUN_00402298(0x10);
  if (puVar1 == (uint *)0x0) {
    local_a4 = (uint *)0x0;
  }
  else {
    local_a4 = FUN_00402460(puVar1,local_a8);
  }
  local_a4[3] = local_a4[3] + 1;
  iVar3 = FUN_00417ab4(param_2 + 0x31c);
  local_98[3] = local_98[3] + 1;
  local_b4 = FUN_00424b60(param_2,(int *)local_98);
  local_ac = *(undefined4 *)(local_b4 + 0xc0);
  local_a4[3] = local_a4[3] + 1;
  local_b8 = FUN_00424b60(param_2,(int *)local_a4);
  local_b0 = *(undefined4 *)(local_b8 + 0xc0);
  local_bc = local_ac;
  FUN_0041d3b3(local_140,iVar3 + 0xe4);
  iVar2 = (**(code **)(local_140[0] + 0x34))(local_140,local_bc);
  FUN_0041d3d2(local_140,2);
  param_1[0xf2] = iVar2;
  local_c0 = local_b0;
  FUN_0041d3b3(local_15c,iVar3 + 0xe4);
  iVar3 = (**(code **)(local_15c[0] + 0x34))(local_15c,local_c0);
  FUN_0041d3d2(local_15c,2);
  param_1[0xf3] = iVar3;
  param_1[0xe4] = 0;
  param_1[0xe5] = 0x3f800000;
  param_1[0xe6] = 0;
  param_1[0xef] = 0;
  param_1[0xf0] = 0;
  param_1[0xf1] = 0;
  param_1[0xea] = 0;
  FUN_00409a00((float *)(param_1 + 0xa6),(float *)&DAT_004e0f8c);
  FUN_00408440(param_1 + 0xa3,&DAT_004e0f74);
  FUN_00408e90(param_1 + 0xaa,&DAT_004e0f8c);
  param_1[0x95] = 0;
  local_c4 = param_1 + 0xa3;
  param_1[0x96] = (int)(param_1 + 0x95);
  FUN_0040ab44((float *)(param_1 + 0x97),local_c4);
  FUN_00408440(param_1 + 0x77,&DAT_004e0f74);
  FUN_00408440(param_1 + 0x8c,&DAT_004e0f74);
  FUN_00408440(param_1 + 0x8f,&DAT_004e0f74);
  FUN_00408440(param_1 + 0x92,&DAT_004e0f74);
  FUN_00408e90(param_1 + 0xad,&DAT_004e0f8c);
  FUN_00408440(param_1 + 0xc2,&DAT_004e0f74);
  FUN_00408440(param_1 + 0xc5,&DAT_004e0f74);
  FUN_00408440(param_1 + 200,&DAT_004e0f74);
  puVar1 = local_a4 + 3;
  *puVar1 = *puVar1 - 1;
  if (*puVar1 == 0) {
    FUN_004024d8((int *)local_a4,3);
  }
  puVar1 = local_98 + 3;
  *puVar1 = *puVar1 - 1;
  if (*puVar1 == 0) {
    FUN_004024d8((int *)local_98,3);
  }
  return param_1;
}



/* @004b3e88 file=? name=FUN_004b3e88 */

void __cdecl FUN_004b3e88(int *param_1,byte param_2)

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



/* @004b3eb4 file=? name=FUN_004b3eb4 */

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

undefined4
FUN_004b3eb4(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6,
            int param_7)

{
  char *pcVar1;
  char cVar2;
  int iVar3;
  undefined4 uVar4;
  char *pcVar5;
  int *piVar6;
  int *piVar7;
  uint uVar8;
  uint uVar9;
  char *pcVar10;
  bool bVar11;
  char *local_124;
  char *local_120;
  char *local_11c;
  char *local_118;
  char *local_114;
  char *local_110;
  char *local_10c;
  char *local_108;
  char *local_104;
  char *local_100;
  char *local_fc;
  char *local_f8;
  char *local_f4;
  char *local_f0;
  char *local_ec;
  char *local_e8;
  char *local_e4;
  char *local_e0;
  char *local_dc;
  char *local_d8;
  char *local_d4;
  char *local_d0;
  char *local_cc;
  char *local_c8;
  char *local_c4;
  char *local_c0;
  char *local_bc;
  char *local_b8;
  char *local_b4;
  char *local_b0;
  float local_ac;
  float local_a8;
  char *local_a4;
  float local_a0;
  float local_9c;
  char *local_98;
  float local_94;
  float local_90;
  char *local_8c;
  float local_88;
  float local_84;
  char *local_80;
  float local_7c;
  float local_78;
  char *local_74;
  float local_70;
  float local_6c;
  char *local_68;
  float local_64;
  char *local_60;
  char *local_5c;
  char *local_58;
  char *local_54;
  char *local_50;
  char *local_4c;
  char *local_48;
  char *local_44;
  char *local_40;
  char *local_3c;
  char *local_38;
  char *local_34;
  char *local_30;
  char *local_2c;
  char *local_28;
  char *local_24;
  char *local_20;
  char *local_1c;
  char *local_18;
  char *local_14;
  char *local_10;
  char *local_c;
  char *local_8;
  
  iVar3 = FUN_004b198c(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar3 == 0) {
    uVar4 = 0;
  }
  else {
    param_4[0x24] = '\x1c';
    param_4[0x25] = '\x02';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x3c;
    param_4[0x21] = '\v';
    param_4[0x22] = '\0';
    param_4[0x23] = '\0';
    if (param_7 == 1) {
      param_4[0xf4] = '\0';
      param_4[0xf5] = '\0';
      param_4[0xf6] = -0x80;
      param_4[0xf7] = -0x41;
      param_4[0xf8] = '\0';
      param_4[0xf9] = '\0';
      param_4[0xfa] = -0x80;
      param_4[0xfb] = -0x41;
      param_4[0xfc] = '\0';
      param_4[0xfd] = '\0';
      param_4[0xfe] = -0x80;
      param_4[0xff] = -0x41;
      param_4[0x100] = '\0';
      param_4[0x101] = '\0';
      param_4[0x102] = -0x80;
      param_4[0x103] = -0x41;
      param_4[0x104] = '\0';
      param_4[0x105] = '\0';
      param_4[0x106] = -0x80;
      param_4[0x107] = -0x41;
      param_4[0x108] = '\0';
      param_4[0x109] = '\0';
      param_4[0x10a] = -0x80;
      param_4[0x10b] = -0x41;
      param_4[0x10c] = '\0';
      param_4[0x10d] = '\0';
      param_4[0x10e] = -0x80;
      param_4[0x10f] = -0x41;
      param_4[0x110] = '\0';
      param_4[0x111] = '\0';
      param_4[0x112] = -0x80;
      param_4[0x113] = -0x41;
      param_4[0x114] = '\0';
      param_4[0x115] = '\0';
      param_4[0x116] = -0x80;
      param_4[0x117] = -0x41;
      param_4[0x118] = '\0';
      param_4[0x119] = '\0';
      param_4[0x11a] = -0x80;
      param_4[0x11b] = -0x41;
      param_4[0x11c] = '\0';
      param_4[0x11d] = '\0';
      param_4[0x11e] = -0x80;
      param_4[0x11f] = -0x41;
      param_4[0x120] = '\0';
      param_4[0x121] = '\0';
      param_4[0x122] = -0x80;
      param_4[0x123] = -0x41;
      param_4[0x124] = '\0';
      param_4[0x125] = '\0';
      param_4[0x126] = -0x80;
      param_4[0x127] = -0x41;
      param_4[0x128] = '\0';
      param_4[0x129] = '\0';
      param_4[0x12a] = -0x80;
      param_4[299] = -0x41;
      param_4[300] = '\0';
      param_4[0x12d] = '\0';
      param_4[0x12e] = -0x80;
      param_4[0x12f] = -0x41;
      param_4[0x130] = '\0';
      param_4[0x131] = '\0';
      param_4[0x132] = -0x80;
      param_4[0x133] = -0x41;
      param_4[0x134] = '\0';
      param_4[0x135] = '\0';
      param_4[0x136] = -0x80;
      param_4[0x137] = -0x41;
      param_4[0x138] = '\0';
      param_4[0x139] = '\0';
      param_4[0x13a] = -0x80;
      param_4[0x13b] = -0x41;
      param_4[0x13c] = '\0';
      param_4[0x13d] = '\0';
      param_4[0x13e] = -0x80;
      param_4[0x13f] = -0x41;
      param_4[0x140] = '\0';
      param_4[0x141] = '\0';
      param_4[0x142] = -0x80;
      param_4[0x143] = -0x41;
      param_4[0x144] = '\0';
      param_4[0x145] = '\0';
      param_4[0x146] = -0x80;
      param_4[0x147] = -0x41;
      param_4[0x148] = '\0';
      param_4[0x149] = '\0';
      param_4[0x14a] = -0x80;
      param_4[0x14b] = -0x41;
      param_4[0x14c] = '\0';
      param_4[0x14d] = '\0';
      param_4[0x14e] = -0x80;
      param_4[0x14f] = -0x41;
      param_4[0x150] = '\0';
      param_4[0x151] = '\0';
      param_4[0x152] = -0x80;
      param_4[0x153] = -0x41;
      param_4[0x154] = '\0';
      param_4[0x155] = '\0';
      param_4[0x156] = -0x80;
      param_4[0x157] = -0x41;
      param_4[0x158] = '\0';
      param_4[0x159] = '\0';
      param_4[0x15a] = -0x80;
      param_4[0x15b] = -0x41;
      param_4[0x15c] = '\0';
      param_4[0x15d] = '\0';
      param_4[0x15e] = -0x80;
      param_4[0x15f] = -0x41;
      param_4[0x160] = '\0';
      param_4[0x161] = '\0';
      param_4[0x162] = -0x80;
      param_4[0x163] = -0x41;
      param_4[0x164] = '\0';
      param_4[0x165] = '\0';
      param_4[0x166] = -0x80;
      param_4[0x167] = -0x41;
      param_4[0x168] = '\0';
      param_4[0x169] = '\0';
      param_4[0x16a] = -0x80;
      param_4[0x16b] = -0x41;
      param_4[0x16c] = '\0';
      param_4[0x16d] = '\0';
      param_4[0x16e] = -0x80;
      param_4[0x16f] = -0x41;
      param_4[0x170] = '\0';
      param_4[0x171] = '\0';
      param_4[0x172] = -0x80;
      param_4[0x173] = -0x41;
      param_4[0x174] = '\0';
      param_4[0x175] = '\0';
      param_4[0x176] = -0x80;
      param_4[0x177] = -0x41;
      param_4[0x1b8] = '\0';
      param_4[0x1b9] = '\0';
      param_4[0x1ba] = -0x80;
      param_4[0x1bb] = -0x41;
      param_4[0x1bc] = '\0';
      param_4[0x1bd] = '\0';
      param_4[0x1be] = -0x80;
      param_4[0x1bf] = -0x41;
      param_4[0x1c0] = '\0';
      param_4[0x1c1] = '\0';
      param_4[0x1c2] = -0x80;
      param_4[0x1c3] = -0x41;
      param_4[0x1c4] = '\0';
      param_4[0x1c5] = '\0';
      param_4[0x1c6] = -0x80;
      param_4[0x1c7] = -0x41;
      param_4[0x1c8] = '\0';
      param_4[0x1c9] = '\0';
      param_4[0x1ca] = -0x80;
      param_4[0x1cb] = -0x41;
      param_4[0x1cc] = '\0';
      param_4[0x1cd] = '\0';
      param_4[0x1ce] = -0x80;
      param_4[0x1cf] = -0x41;
      param_4[0x1d0] = '\0';
      param_4[0x1d1] = '\0';
      param_4[0x1d2] = -0x80;
      param_4[0x1d3] = -0x41;
      param_4[0x1d4] = '\0';
      param_4[0x1d5] = '\0';
      param_4[0x1d6] = -0x80;
      param_4[0x1d7] = -0x41;
      param_4[0x1d8] = '\0';
      param_4[0x1d9] = '\0';
      param_4[0x1da] = -0x80;
      param_4[0x1db] = -0x41;
      param_4[0x1dc] = '\0';
      param_4[0x1dd] = '\0';
      param_4[0x1de] = -0x80;
      param_4[0x1df] = -0x41;
      param_4[0x1e0] = '\0';
      param_4[0x1e1] = '\0';
      param_4[0x1e2] = -0x80;
      param_4[0x1e3] = -0x41;
      param_4[0x1e4] = '\0';
      param_4[0x1e5] = '\0';
      param_4[0x1e6] = -0x80;
      param_4[0x1e7] = -0x41;
      param_4[0x1e8] = '\0';
      param_4[0x1e9] = '\0';
      param_4[0x1ea] = -0x80;
      param_4[0x1eb] = -0x41;
      param_4[0x1ec] = '\0';
      param_4[0x1ed] = '\0';
      param_4[0x1ee] = -0x80;
      param_4[0x1ef] = -0x41;
      param_4[0x1f0] = '\0';
      param_4[0x1f1] = '\0';
      param_4[0x1f2] = -0x80;
      param_4[499] = -0x41;
      param_4[500] = '\0';
      param_4[0x1f5] = '\0';
      param_4[0x1f6] = -0x80;
      param_4[0x1f7] = -0x41;
      param_4[0x1f8] = '\0';
      param_4[0x1f9] = '\0';
      param_4[0x1fa] = -0x80;
      param_4[0x1fb] = -0x41;
      param_4[0x1fc] = '\0';
      param_4[0x1fd] = '\0';
      param_4[0x1fe] = -0x80;
      param_4[0x1ff] = -0x41;
      param_4[0x200] = '\0';
      param_4[0x201] = '\0';
      param_4[0x202] = -0x80;
      param_4[0x203] = -0x41;
      param_4[0x204] = '\0';
      param_4[0x205] = '\0';
      param_4[0x206] = -0x80;
      param_4[0x207] = -0x41;
      param_4[0x208] = '\0';
      param_4[0x209] = '\0';
      param_4[0x20a] = -0x80;
      param_4[0x20b] = -0x41;
      param_4[0x20c] = '\0';
      param_4[0x20d] = '\0';
      param_4[0x20e] = -0x80;
      param_4[0x20f] = -0x41;
      param_4[0x210] = '\0';
      param_4[0x211] = '\0';
      param_4[0x212] = -0x80;
      param_4[0x213] = -0x41;
      param_4[0x214] = '\0';
      param_4[0x215] = '\0';
      param_4[0x216] = -0x80;
      param_4[0x217] = -0x41;
      param_4[0x218] = '\0';
      param_4[0x219] = '\0';
      param_4[0x21a] = -0x80;
      param_4[0x21b] = -0x41;
    }
    iVar3 = FUN_00404118(param_5,param_3,s_PercentageOnNormal_0050fe6b,(float *)(param_4 + 0x108));
    if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x108))) {
      FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_missing_PercentageOnNormal__0050fe7e,(char *)0x0);
      uVar4 = 0;
    }
    else {
      iVar3 = FUN_00404118(param_5,param_3,s_PercentageOnDestruction_0050fe9c,
                           (float *)(param_4 + 0x10c));
      if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x10c))) {
        FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_missing_PercentageOnDestruction__0050feb4,(char *)0x0);
        uVar4 = 0;
      }
      else {
        iVar3 = FUN_00404118(param_5,param_3,s_PercentageOnDegradation_0050fed7,
                             (float *)(param_4 + 0x110));
        if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x110))) {
          FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
          FUN_004dbb24((int *)&DAT_00524e68,s_missing_PercentageOnDegradation__0050feef,(char *)0x0)
          ;
          uVar4 = 0;
        }
        else {
          iVar3 = FUN_00404118(param_5,param_3,s_PercentageOnFailure_0050ff12,
                               (float *)(param_4 + 0x114));
          if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x114))) {
            local_8 = param_3;
            FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
            FUN_004dbb24((int *)&DAT_00524e68,s_missing_PercentageOnFailure__0050ff26,(char *)0x0);
            uVar4 = 0;
          }
          else {
            iVar3 = FUN_00404118(param_5,param_3,s_RotationPerSecond_0050ff45,
                                 (float *)(param_4 + 0x104));
            if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x104))) {
              local_c = param_3;
              FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
              FUN_004dbb24((int *)&DAT_00524e68,s_missing_RotationPerSecond__0050ff57,(char *)0x0);
              uVar4 = 0;
            }
            else {
              iVar3 = FUN_00404118(param_5,param_3,s_Exageration_0050ff74,(float *)(param_4 + 0xf8))
              ;
              if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0xf8))) {
                local_10 = param_3;
                FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                FUN_004dbb24((int *)&DAT_00524e68,s_missing_Exageration__0050ff80,(char *)0x0);
                uVar4 = 0;
              }
              else {
                iVar3 = FUN_00404118(param_5,param_3,s_MaxAnimationNoise_0050ff97,
                                     (float *)(param_4 + 0xfc));
                if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0xfc))) {
                  local_14 = param_3;
                  FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                  FUN_004dbb24((int *)&DAT_00524e68,s_missing_MaxAnimationNoise__0050ffa9,
                               (char *)0x0);
                  uVar4 = 0;
                }
                else {
                  iVar3 = FUN_00404118(param_5,param_3,s_MinAnimationNoise_0050ffc6,
                                       (float *)(param_4 + 0x100));
                  if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x100))) {
                    local_18 = param_3;
                    FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                    FUN_004dbb24((int *)&DAT_00524e68,s_missing_MinAnimationNoise__0050ffd8,
                                 (char *)0x0);
                    uVar4 = 0;
                  }
                  else {
                    iVar3 = FUN_00404118(param_5,param_3,s_SpringConstantX_0050fff5,
                                         (float *)(param_4 + 0x118));
                    if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x118))) {
                      local_1c = param_3;
                      FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                      FUN_004dbb24((int *)&DAT_00524e68,s_missing_SpringConstantX__00510005,
                                   (char *)0x0);
                      uVar4 = 0;
                    }
                    else {
                      iVar3 = FUN_00404118(param_5,param_3,s_SpringConstantY_00510020,
                                           (float *)(param_4 + 0x11c));
                      if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x11c))) {
                        local_20 = param_3;
                        FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                        FUN_004dbb24((int *)&DAT_00524e68,s_missing_SpringConstantY__00510030,
                                     (char *)0x0);
                        uVar4 = 0;
                      }
                      else {
                        iVar3 = FUN_00404118(param_5,param_3,s_SpringConstantZ_0051004b,
                                             (float *)(param_4 + 0x120));
                        if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x120))) {
                          local_24 = param_3;
                          FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                          FUN_004dbb24((int *)&DAT_00524e68,s_missing_SpringConstantZ__0051005b,
                                       (char *)0x0);
                          uVar4 = 0;
                        }
                        else {
                          iVar3 = FUN_00404118(param_5,param_3,s_DampingConstantX_00510076,
                                               (float *)(param_4 + 0x124));
                          if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x124))) {
                            local_28 = param_3;
                            FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                            FUN_004dbb24((int *)&DAT_00524e68,s_missing_DampingConstantX__00510087,
                                         (char *)0x0);
                            uVar4 = 0;
                          }
                          else {
                            iVar3 = FUN_00404118(param_5,param_3,s_DampingConstantY_005100a3,
                                                 (float *)(param_4 + 0x128));
                            if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x128))) {
                              local_2c = param_3;
                              FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                              FUN_004dbb24((int *)&DAT_00524e68,s_missing_DampingConstantY__005100b4
                                           ,(char *)0x0);
                              uVar4 = 0;
                            }
                            else {
                              iVar3 = FUN_00404118(param_5,param_3,s_DampingConstantZ_005100d0,
                                                   (float *)(param_4 + 300));
                              if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 300))) {
                                local_30 = param_3;
                                FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                                FUN_004dbb24((int *)&DAT_00524e68,
                                             s_missing_DampingConstantZ__005100e1,(char *)0x0);
                                uVar4 = 0;
                              }
                              else {
                                iVar3 = FUN_00404118(param_5,param_3,s_NegSpringX_005100fd,
                                                     (float *)(param_4 + 0x13c));
                                if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x13c)))
                                {
                                  local_34 = param_3;
                                  FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                                  FUN_004dbb24((int *)&DAT_00524e68,s_missing_NegSpringX__00510108,
                                               (char *)0x0);
                                  uVar4 = 0;
                                }
                                else {
                                  iVar3 = FUN_00404118(param_5,param_3,s_NegSpringY_0051011e,
                                                       (float *)(param_4 + 0x140));
                                  if ((iVar3 == 0) && (_DAT_004b5b20 == *(float *)(param_4 + 0x140))
                                     ) {
                                    local_38 = param_3;
                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                                    FUN_004dbb24((int *)&DAT_00524e68,s_missing_NegSpringY__00510129
                                                 ,(char *)0x0);
                                    uVar4 = 0;
                                  }
                                  else {
                                    iVar3 = FUN_00404118(param_5,param_3,s_NegSpringZ_0051013f,
                                                         (float *)(param_4 + 0x144));
                                    if ((iVar3 == 0) &&
                                       (_DAT_004b5b20 == *(float *)(param_4 + 0x144))) {
                                      local_3c = param_3;
                                      FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                                      FUN_004dbb24((int *)&DAT_00524e68,
                                                   s_missing_NegSpringZ__0051014a,(char *)0x0);
                                      uVar4 = 0;
                                    }
                                    else {
                                      iVar3 = FUN_00404118(param_5,param_3,s_PosSpringX_00510160,
                                                           (float *)(param_4 + 0x130));
                                      if ((iVar3 == 0) &&
                                         (_DAT_004b5b20 == *(float *)(param_4 + 0x130))) {
                                        local_40 = param_3;
                                        FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                                        FUN_004dbb24((int *)&DAT_00524e68,
                                                     s_missing_PosSpringX__0051016b,(char *)0x0);
                                        uVar4 = 0;
                                      }
                                      else {
                                        iVar3 = FUN_00404118(param_5,param_3,s_PosSpringY_00510181,
                                                             (float *)(param_4 + 0x134));
                                        if ((iVar3 == 0) &&
                                           (_DAT_004b5b20 == *(float *)(param_4 + 0x134))) {
                                          local_44 = param_3;
                                          FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                                          FUN_004dbb24((int *)&DAT_00524e68,
                                                       s_missing_PosSpringY__0051018c,(char *)0x0);
                                          uVar4 = 0;
                                        }
                                        else {
                                          iVar3 = FUN_00404118(param_5,param_3,s_PosSpringZ_005101a2
                                                               ,(float *)(param_4 + 0x138));
                                          if ((iVar3 == 0) &&
                                             (_DAT_004b5b20 == *(float *)(param_4 + 0x138))) {
                                            local_48 = param_3;
                                            FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                                            FUN_004dbb24((int *)&DAT_00524e68,
                                                         s_missing_PosSpringZ__005101ad,(char *)0x0)
                                            ;
                                            uVar4 = 0;
                                          }
                                          else {
                                            iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                  
                                                  s_RotationSpringConstantPitch_005101c3,
                                                  (float *)(param_4 + 0x150));
                                            if ((iVar3 == 0) &&
                                               (_DAT_004b5b20 == *(float *)(param_4 + 0x150))) {
                                              local_4c = param_3;
                                              FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0)
                                              ;
                                              FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                      
                                                  s_missing_RotationSpringConstantPi_005101df,
                                                  (char *)0x0);
                                              uVar4 = 0;
                                            }
                                            else {
                                              iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                      
                                                  s_RotationSpringConstantYaw_00510206,
                                                  (float *)(param_4 + 0x14c));
                                              if ((iVar3 == 0) &&
                                                 (_DAT_004b5b20 == *(float *)(param_4 + 0x14c))) {
                                                local_50 = param_3;
                                                FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                             (char *)0x0);
                                                FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                          
                                                  s_missing_RotationSpringConstantYa_00510220,
                                                  (char *)0x0);
                                                uVar4 = 0;
                                              }
                                              else {
                                                iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                          
                                                  s_RotationSpringConstantRoll_00510245,
                                                  (float *)(param_4 + 0x148));
                                                if ((iVar3 == 0) &&
                                                   (_DAT_004b5b20 == *(float *)(param_4 + 0x148))) {
                                                  local_54 = param_3;
                                                  FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                               (char *)0x0);
                                                  FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                              
                                                  s_missing_RotationSpringConstantRo_00510260,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                }
                                                else {
                                                  iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                              
                                                  s_RotationDampingConstantPitch_00510286,
                                                  (float *)(param_4 + 0x15c));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x15c)))
                                                  {
                                                    local_58 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_RotationDampingConstantP_005102a3,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_RotationDampingConstantYaw_005102cb,
                                                  (float *)(param_4 + 0x158));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x158)))
                                                  {
                                                    local_5c = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_RotationDampingConstantY_005102e6,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_RotationDampingConstantRoll_0051030c,
                                                  (float *)(param_4 + 0x154));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x154)))
                                                  {
                                                    local_60 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_RotationDampingConstantR_00510328,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    local_64 = -1.0;
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_RotationNegSpringPitch_0051034f,&local_64);
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x16c)))
                                                  {
                                                    local_68 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_RotationNegSpringPitch__00510366,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    if (local_64 != _DAT_004b5b20) {
                                                      local_6c = local_64;
                                                      local_70 = local_64;
                                                      *(float *)(param_4 + 0x16c) =
                                                           local_64 * _DAT_004b5b24;
                                                    }
                                                    local_64 = -1.0;
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_RotationNegSpringYaw_00510388,&local_64);
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x170)))
                                                  {
                                                    local_74 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_RotationNegSpringYaw__0051039d,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    if (local_64 != _DAT_004b5b20) {
                                                      local_78 = local_64;
                                                      local_7c = local_64;
                                                      *(float *)(param_4 + 0x170) =
                                                           local_64 * _DAT_004b5b24;
                                                    }
                                                    local_64 = -1.0;
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_RotationNegSpringRoll_005103bd,&local_64);
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x174)))
                                                  {
                                                    local_80 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_RotationNegSpringRoll__005103d3,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    if (local_64 != _DAT_004b5b20) {
                                                      local_84 = local_64;
                                                      local_88 = local_64;
                                                      *(float *)(param_4 + 0x174) =
                                                           local_64 * _DAT_004b5b24;
                                                    }
                                                    local_64 = -1.0;
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_RotationPosSpringPitch_005103f4,&local_64);
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x160)))
                                                  {
                                                    local_8c = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_RotationPosSpringPitch__0051040b,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    if (local_64 != _DAT_004b5b20) {
                                                      local_90 = local_64;
                                                      local_94 = local_64;
                                                      *(float *)(param_4 + 0x160) =
                                                           local_64 * _DAT_004b5b24;
                                                    }
                                                    local_64 = -1.0;
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_RotationPosSpringYaw_0051042d,&local_64);
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x164)))
                                                  {
                                                    local_98 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_RotationPosSpringYaw__00510442,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    if (local_64 != _DAT_004b5b20) {
                                                      local_9c = local_64;
                                                      local_a0 = local_64;
                                                      *(float *)(param_4 + 0x164) =
                                                           local_64 * _DAT_004b5b24;
                                                    }
                                                    local_64 = -1.0;
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_RotationPosSpringRoll_00510462,&local_64);
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x168)))
                                                  {
                                                    local_a4 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_RotationPosSpringRoll__00510478,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    if (local_64 != _DAT_004b5b20) {
                                                      local_a8 = local_64;
                                                      local_ac = local_64;
                                                      *(float *)(param_4 + 0x168) =
                                                           local_64 * _DAT_004b5b24;
                                                    }
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_CollisionDamageMultiplier_00510499,
                                                  (float *)(param_4 + 0x1b8));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1b8)))
                                                  {
                                                    local_b0 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_CollisionDamageMultiplie_005104b3,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_BallisticDamageMultiplier_005104d8,
                                                  (float *)(param_4 + 0x1bc));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1bc)))
                                                  {
                                                    local_b4 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_BallisticDamageMultiplie_005104f2,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_ExplosiveDamageMultiplier_00510517,
                                                  (float *)(param_4 + 0x1c0));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1c0)))
                                                  {
                                                    local_b8 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_ExplosiveDamageMultiplie_00510531,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_LaserDamageMultiplier_00510556,
                                                  (float *)(param_4 + 0x1c4));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1c4)))
                                                  {
                                                    local_bc = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_LaserDamageMultiplier__0051056c,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_EnergyDamageMultiplier_0051058d,
                                                  (float *)(param_4 + 0x1c8));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1c8)))
                                                  {
                                                    local_c0 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_EnergyDamageMultiplier__005105a4,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_CollisionDamageTrans_005105c6,
                                                  (float *)(param_4 + 0x1cc));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1cc)))
                                                  {
                                                    local_c4 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_CollisionDamageTrans__005105db,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_CollisionDamagePitchRoll_005105fb,
                                                  (float *)(param_4 + 0x1d0));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1d0)))
                                                  {
                                                    local_c8 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_CollisionDamagePitchRoll_00510614,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_CollisionDamageYaw_00510638,
                                                  (float *)(param_4 + 0x1d4));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1d4)))
                                                  {
                                                    local_cc = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_CollisionDamageYaw__0051064b,(char *)0x0
                                                  );
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_CollisionDamageVibration_00510669,
                                                  (float *)(param_4 + 0x1d8));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1d8)))
                                                  {
                                                    local_d0 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_CollisionDamageVibration_00510682,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_BallisticDamageTrans_005106a6,
                                                  (float *)(param_4 + 0x1dc));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1dc)))
                                                  {
                                                    local_d4 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_BallisticDamageTrans__005106bb,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_BallisticDamagePitchRoll_005106db,
                                                  (float *)(param_4 + 0x1e0));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1e0)))
                                                  {
                                                    local_d8 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_BallisticDamagePitchRoll_005106f4,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_BallisticDamageYaw_00510718,
                                                  (float *)(param_4 + 0x1e4));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1e4)))
                                                  {
                                                    local_dc = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_BallisticDamageYaw__0051072b,(char *)0x0
                                                  );
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_BallisticDamageVibration_00510749,
                                                  (float *)(param_4 + 0x1e8));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1e8)))
                                                  {
                                                    local_e0 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_BallisticDamageVibration_00510762,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_ExplosiveDamageTrans_00510786,
                                                  (float *)(param_4 + 0x1ec));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1ec)))
                                                  {
                                                    local_e4 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_ExplosiveDamageTrans__0051079b,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_ExplosiveDamagePitchRoll_005107bb,
                                                  (float *)(param_4 + 0x1f0));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1f0)))
                                                  {
                                                    local_e8 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_ExplosiveDamagePitchRoll_005107d4,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_ExplosiveDamageYaw_005107f8,
                                                  (float *)(param_4 + 500));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 500))) {
                                                    local_ec = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_ExplosiveDamageYaw__0051080b,(char *)0x0
                                                  );
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_ExplosiveDamageVibration_00510829,
                                                  (float *)(param_4 + 0x1f8));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x1f8)))
                                                  {
                                                    local_f0 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_ExplosiveDamageVibration_00510842,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                         s_LaserDamageTrans_00510866
                                                                         ,(float *)(param_4 + 0x1fc)
                                                                        );
                                                    if ((iVar3 == 0) &&
                                                       (_DAT_004b5b20 == *(float *)(param_4 + 0x1fc)
                                                       )) {
                                                      local_f4 = param_3;
                                                      FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                   (char *)0x0);
                                                      FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                      
                                                  s_missing_LaserDamageTrans__00510877,(char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_LaserDamagePitchRoll_00510893,
                                                  (float *)(param_4 + 0x200));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x200)))
                                                  {
                                                    local_f8 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_LaserDamagePitchRoll__005108a8,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                         s_LaserDamageYaw_005108c8,
                                                                         (float *)(param_4 + 0x204))
                                                    ;
                                                    if ((iVar3 == 0) &&
                                                       (_DAT_004b5b20 == *(float *)(param_4 + 0x204)
                                                       )) {
                                                      local_fc = param_3;
                                                      FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                   (char *)0x0);
                                                      FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                      
                                                  s_missing_LaserDamageYaw__005108d7,(char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_LaserDamageVibration_005108f1,
                                                  (float *)(param_4 + 0x208));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x208)))
                                                  {
                                                    local_100 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_LaserDamageVibration__00510906,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_EnergyDamageTrans_00510926,
                                                  (float *)(param_4 + 0x20c));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x20c)))
                                                  {
                                                    local_104 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_EnergyDamageTrans__00510938,(char *)0x0)
                                                  ;
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_EnergyDamagePitchRoll_00510955,
                                                  (float *)(param_4 + 0x210));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x210)))
                                                  {
                                                    local_108 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_EnergyDamagePitchRoll__0051096b,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                         s_EnergyDamageYaw_0051098c,
                                                                         (float *)(param_4 + 0x214))
                                                    ;
                                                    if ((iVar3 == 0) &&
                                                       (_DAT_004b5b20 == *(float *)(param_4 + 0x214)
                                                       )) {
                                                      local_10c = param_3;
                                                      FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                   (char *)0x0);
                                                      FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                      
                                                  s_missing_EnergyDamageYaw__0051099c,(char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    iVar3 = FUN_00404118(param_5,param_3,
                                                                                                                                                  
                                                  s_EnergyDamageVibration_005109b7,
                                                  (float *)(param_4 + 0x218));
                                                  if ((iVar3 == 0) &&
                                                     (_DAT_004b5b20 == *(float *)(param_4 + 0x218)))
                                                  {
                                                    local_110 = param_3;
                                                    FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                 (char *)0x0);
                                                    FUN_004dbb24((int *)&DAT_00524e68,
                                                                                                                                  
                                                  s_missing_EnergyDamageVibration__005109cd,
                                                  (char *)0x0);
                                                  uVar4 = 0;
                                                  }
                                                  else {
                                                    local_114 = s_Unspecified_005109ee;
                                                    iVar3 = FUN_00404088(param_5,param_3,
                                                                         s_EyeJoint_005109fa,
                                                                         &local_114);
                                                    if (iVar3 == 0) {
                                                      pcVar10 = s_Unspecified_00510a03;
                                                      pcVar5 = local_114;
                                                      do {
                                                        bVar11 = *pcVar5 == *pcVar10;
                                                        if (!bVar11) break;
                                                        if (*pcVar5 == '\0') goto LAB_004b5837;
                                                        pcVar1 = pcVar5 + 1;
                                                        bVar11 = *pcVar1 == pcVar10[1];
                                                        if (!bVar11) break;
                                                        pcVar5 = pcVar5 + 2;
                                                        pcVar10 = pcVar10 + 2;
                                                        bVar11 = *pcVar1 == '\0';
                                                      } while (!bVar11);
                                                      if (!bVar11) {
                                                        local_118 = param_3;
                                                        FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                     (char *)0x0);
                                                        FUN_004dbb24((int *)&DAT_00524e68,
                                                                     s_missing_EyeJoint__00510a0f,
                                                                     (char *)0x0);
                                                        return 0;
                                                      }
                                                    }
LAB_004b5837:
                                                    pcVar10 = s_Unspecified_00510a23;
                                                    pcVar5 = local_114;
                                                    do {
                                                      bVar11 = *pcVar5 == *pcVar10;
                                                      if (!bVar11) break;
                                                      if (*pcVar5 == '\0') goto LAB_004b5891;
                                                      pcVar1 = pcVar5 + 1;
                                                      bVar11 = *pcVar1 == pcVar10[1];
                                                      if (!bVar11) break;
                                                      pcVar5 = pcVar5 + 2;
                                                      pcVar10 = pcVar10 + 2;
                                                      bVar11 = *pcVar1 == '\0';
                                                    } while (!bVar11);
                                                    if (!bVar11) {
                                                      uVar8 = 0xffffffff;
                                                      pcVar5 = local_114;
                                                      do {
                                                        pcVar10 = pcVar5;
                                                        if (uVar8 == 0) break;
                                                        uVar8 = uVar8 - 1;
                                                        pcVar10 = pcVar5 + 1;
                                                        cVar2 = *pcVar5;
                                                        pcVar5 = pcVar10;
                                                      } while (cVar2 != '\0');
                                                      uVar8 = ~uVar8;
                                                      pcVar5 = pcVar10 + -uVar8;
                                                      pcVar10 = param_4 + 0x178;
                                                      for (uVar9 = uVar8 >> 2; uVar9 != 0;
                                                          uVar9 = uVar9 - 1) {
                                                        *(undefined4 *)pcVar10 =
                                                             *(undefined4 *)pcVar5;
                                                        pcVar5 = pcVar5 + 4;
                                                        pcVar10 = pcVar10 + 4;
                                                      }
                                                      for (uVar8 = uVar8 & 3; uVar8 != 0;
                                                          uVar8 = uVar8 - 1) {
                                                        *pcVar10 = *pcVar5;
                                                        pcVar5 = pcVar5 + 1;
                                                        pcVar10 = pcVar10 + 1;
                                                      }
                                                    }
LAB_004b5891:
                                                    local_11c = s_Unspecified_00510a2f;
                                                    iVar3 = FUN_00404088(param_5,param_3,
                                                                         s_MechJoint_00510a3b,
                                                                         &local_11c);
                                                    if (iVar3 == 0) {
                                                      pcVar10 = s_Unspecified_00510a45;
                                                      pcVar5 = local_11c;
                                                      do {
                                                        bVar11 = *pcVar5 == *pcVar10;
                                                        if (!bVar11) break;
                                                        if (*pcVar5 == '\0') goto LAB_004b5915;
                                                        pcVar1 = pcVar5 + 1;
                                                        bVar11 = *pcVar1 == pcVar10[1];
                                                        if (!bVar11) break;
                                                        pcVar5 = pcVar5 + 2;
                                                        pcVar10 = pcVar10 + 2;
                                                        bVar11 = *pcVar1 == '\0';
                                                      } while (!bVar11);
                                                      if (!bVar11) {
                                                        local_120 = param_3;
                                                        FUN_004dbb24((int *)&DAT_00524e68,param_3,
                                                                     (char *)0x0);
                                                        FUN_004dbb24((int *)&DAT_00524e68,
                                                                     s_missing_MechJoint__00510a51,
                                                                     (char *)0x0);
                                                        return 0;
                                                      }
                                                    }
LAB_004b5915:
                                                    pcVar10 = s_Unspecified_00510a66;
                                                    pcVar5 = local_11c;
                                                    do {
                                                      bVar11 = *pcVar5 == *pcVar10;
                                                      if (!bVar11) break;
                                                      if (*pcVar5 == '\0') goto LAB_004b596b;
                                                      pcVar1 = pcVar5 + 1;
                                                      bVar11 = *pcVar1 == pcVar10[1];
                                                      if (!bVar11) break;
                                                      pcVar5 = pcVar5 + 2;
                                                      pcVar10 = pcVar10 + 2;
                                                      bVar11 = *pcVar1 == '\0';
                                                    } while (!bVar11);
                                                    if (!bVar11) {
                                                      uVar8 = 0xffffffff;
                                                      pcVar5 = local_11c;
                                                      do {
                                                        pcVar10 = pcVar5;
                                                        if (uVar8 == 0) break;
                                                        uVar8 = uVar8 - 1;
                                                        pcVar10 = pcVar5 + 1;
                                                        cVar2 = *pcVar5;
                                                        pcVar5 = pcVar10;
                                                      } while (cVar2 != '\0');
                                                      uVar8 = ~uVar8;
                                                      pcVar5 = pcVar10 + -uVar8;
                                                      pcVar10 = param_4 + 0x198;
                                                      for (uVar9 = uVar8 >> 2; uVar9 != 0;
                                                          uVar9 = uVar9 - 1) {
                                                        *(undefined4 *)pcVar10 =
                                                             *(undefined4 *)pcVar5;
                                                        pcVar5 = pcVar5 + 4;
                                                        pcVar10 = pcVar10 + 4;
                                                      }
                                                      for (uVar8 = uVar8 & 3; uVar8 != 0;
                                                          uVar8 = uVar8 - 1) {
                                                        *pcVar10 = *pcVar5;
                                                        pcVar5 = pcVar5 + 1;
                                                        pcVar10 = pcVar10 + 1;
                                                      }
                                                    }
LAB_004b596b:
                                                    iVar3 = FUN_00404088(param_1,s_video_00510a72,
                                                                         s_skeleton_00510a78,
                                                                         &local_124);
                                                    if (iVar3 == 0) {
                                                      FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0
                                                                  );
                                                      FUN_004dbb24(&DAT_00524e20,
                                                                                                                                      
                                                  s_is_missing_skeleton_file__00510a81,(char *)0x0);
                                                  uVar4 = 0xffffffff;
                                                  }
                                                  else {
                                                    piVar6 = (int *)FUN_004064fc(*(char **)(param_6 
                                                  + 0x10),local_124);
                                                  piVar7 = (int *)FUN_00402298(0x20);
                                                  if (piVar7 == (int *)0x0) {
                                                    piVar7 = (int *)0x0;
                                                  }
                                                  else {
                                                    piVar7 = FUN_00403e84(piVar7,(char *)piVar6,1);
                                                  }
                                                  iVar3 = FUN_00403f84((int)piVar7,param_4 + 0x178);
                                                  if (iVar3 == 0) {
                                                    FUN_004dbb24(&DAT_00524e20,param_4 + 0x178,
                                                                 (char *)0x0);
                                                    FUN_004dbb24(&DAT_00524e20,
                                                                 s_not_found_in_00510a9d,(char *)0x0
                                                                );
                                                    FUN_004dbb24(&DAT_00524e20,local_124,(char *)0x0
                                                                );
                                                    FUN_004d9c38(&DAT_00524e20);
                                                  }
                                                  else {
                                                    iVar3 = FUN_00403f84((int)piVar7,param_4 + 0x198
                                                                        );
                                                    if (iVar3 != 0) {
                                                      FUN_004022d0(piVar6);
                                                      FUN_00403ecc(piVar7,3);
                                                      return 1;
                                                    }
                                                    FUN_004dbb24(&DAT_00524e20,param_4 + 0x198,
                                                                 (char *)0x0);
                                                    FUN_004dbb24(&DAT_00524e20,
                                                                 s_not_found_in_00510aac,(char *)0x0
                                                                );
                                                    FUN_004dbb24(&DAT_00524e20,local_124,(char *)0x0
                                                                );
                                                    FUN_004d9c38(&DAT_00524e20);
                                                  }
                                                  FUN_004022d0(piVar6);
                                                  FUN_00403ecc(piVar7,3);
                                                  uVar4 = 0xffffffff;
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                  }
                                                }
                                              }
                                            }
                                          }
                                        }
                                      }
                                    }
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return uVar4;
}



/* @004b5bf8 file=? name=FUN_004b5bf8 */

void __cdecl FUN_004b5bf8(int *param_1,int param_2)

{
  undefined4 local_10 [3];
  
  FUN_004b1804(param_1);
  if (param_2 != 0) {
    param_1[0x91] = param_1[0x8f];
    param_1[0x92] = param_1[0x90];
    param_1[0x96] = 0;
    param_1[0x97] = 0;
    param_1[0x98] = 0;
    param_1[0x99] = 0;
  }
  param_1[0x7e] = 0;
  param_1[0x7f] = 0;
  param_1[0x80] = 0;
  param_1[0x81] = 0;
  param_1[0x82] = 0;
  param_1[0x7c] = 0;
  param_1[0x7d] = 0;
  param_1[0x76] = 0;
  param_1[0x79] = 0;
  param_1[0x7a] = 0;
  param_1[0x7b] = 0;
  param_1[0x87] = 0;
  param_1[0x86] = 0;
  param_1[0x8e] = 0;
  param_1[0x9c] = 0;
  param_1[0x9d] = 0;
  FUN_004b66b4((int)param_1,local_10);
  return;
}



/* @004b5cf0 file=? name=FUN_004b5cf0 */

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

void __cdecl FUN_004b5cf0(int param_1,float param_2)

{
  float fVar1;
  float fVar2;
  int iVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  bool bVar7;
  undefined3 extraout_var;
  undefined4 *puVar8;
  float10 fVar9;
  float local_90;
  
  FUN_004b181c(param_1);
  fVar1 = *(float *)(param_1 + 0x1d8);
  fVar2 = *(float *)(param_1 + 0x1e4);
  *(undefined4 *)(param_1 + 0x244) = *(undefined4 *)(param_1 + 0x23c);
  *(undefined4 *)(param_1 + 0x248) = *(undefined4 *)(param_1 + 0x240);
  if (*(int *)(param_1 + 0x40) == 1) {
    *(undefined4 *)(param_1 + 0x244) = 0;
  }
  if (*(int *)(param_1 + 0x198) != 4) {
    *(undefined4 *)(param_1 + 0x244) = 0;
  }
  iVar3 = *(int *)(param_1 + 0x140);
  if (iVar3 != 0) {
    if (iVar3 == 1) {
      *(float *)(param_1 + 0x244) = _DAT_004b64f8 * *(float *)(param_1 + 0x23c);
    }
    else if (iVar3 == 2) {
      *(undefined4 *)(param_1 + 0x244) = 0;
    }
  }
  fVar4 = *(float *)(param_1 + 0x244) * param_2;
  fVar5 = *(float *)(param_1 + 0x248) * param_2;
  if (*(int *)(param_1 + 0x268) == 0) {
    *(undefined4 *)(param_1 + 0x26c) = *(undefined4 *)(param_1 + 0x214);
  }
  else {
    *(float *)(param_1 + 0x26c) =
         *(float *)(param_1 + 0x210) * param_2 + *(float *)(param_1 + 0x26c);
    fVar6 = _DAT_004b64fc;
    if (*(float *)(param_1 + 0x26c) <= _DAT_004b64fc) {
      fVar6 = *(float *)(param_1 + 0x26c);
    }
    *(float *)(param_1 + 0x26c) = fVar6;
    *(undefined4 *)(param_1 + 0x268) = 0;
  }
  *(undefined4 *)(param_1 + 0x26c) = 0x3f800000;
  if (0 < *(int *)(param_1 + 0x1f8)) {
    *(float *)(param_1 + 0x1e4) = fVar5 * *(float *)(param_1 + 0x26c) + *(float *)(param_1 + 0x1e4);
    if (*(float *)(param_1 + 0x1e4) <= *(float *)(param_1 + 0x220)) {
      puVar8 = (undefined4 *)(param_1 + 0x1e4);
    }
    else {
      puVar8 = (undefined4 *)(param_1 + 0x220);
    }
    *(undefined4 *)(param_1 + 0x1e4) = *puVar8;
    *(undefined4 *)(param_1 + 0x268) = 1;
  }
  if (0 < *(int *)(param_1 + 0x1fc)) {
    *(float *)(param_1 + 0x1e4) = *(float *)(param_1 + 0x1e4) - fVar5 * *(float *)(param_1 + 0x26c);
    if (*(float *)(param_1 + 0x224) <= *(float *)(param_1 + 0x1e4)) {
      puVar8 = (undefined4 *)(param_1 + 0x1e4);
    }
    else {
      puVar8 = (undefined4 *)(param_1 + 0x224);
    }
    *(undefined4 *)(param_1 + 0x1e4) = *puVar8;
    *(undefined4 *)(param_1 + 0x268) = 1;
  }
  if (0 < *(int *)(param_1 + 0x200)) {
    *(float *)(param_1 + 0x1d8) = fVar4 * *(float *)(param_1 + 0x26c) + *(float *)(param_1 + 0x1d8);
    if (*(float *)(param_1 + 0x1d8) <= *(float *)(param_1 + 0x1e0)) {
      puVar8 = (undefined4 *)(param_1 + 0x1d8);
    }
    else {
      puVar8 = (undefined4 *)(param_1 + 0x1e0);
    }
    *(undefined4 *)(param_1 + 0x1d8) = *puVar8;
    *(undefined4 *)(param_1 + 0x274) = 0;
    *(undefined4 *)(param_1 + 0x268) = 1;
  }
  if (0 < *(int *)(param_1 + 0x204)) {
    *(float *)(param_1 + 0x1d8) = *(float *)(param_1 + 0x1d8) - fVar4 * *(float *)(param_1 + 0x26c);
    if (*(float *)(param_1 + 0x1dc) <= *(float *)(param_1 + 0x1d8)) {
      puVar8 = (undefined4 *)(param_1 + 0x1d8);
    }
    else {
      puVar8 = (undefined4 *)(param_1 + 0x1dc);
    }
    *(undefined4 *)(param_1 + 0x1d8) = *puVar8;
    *(undefined4 *)(param_1 + 0x274) = 0;
    *(undefined4 *)(param_1 + 0x268) = 1;
  }
  if (0 < *(int *)(param_1 + 0x208)) {
    *(undefined4 *)(param_1 + 0x274) = 1;
    *(undefined4 *)(param_1 + 0x268) = 0;
  }
  if (*(float *)(param_1 + 0x1f0) != _DAT_004b6500) {
    *(float *)(param_1 + 0x1d8) = *(float *)(param_1 + 0x1f0) * fVar4 + *(float *)(param_1 + 0x1d8);
    if (*(float *)(param_1 + 0x1d8) <= *(float *)(param_1 + 0x1e0)) {
      puVar8 = (undefined4 *)(param_1 + 0x1d8);
    }
    else {
      puVar8 = (undefined4 *)(param_1 + 0x1e0);
    }
    *(undefined4 *)(param_1 + 0x1d8) = *puVar8;
    if (*(float *)(param_1 + 0x1dc) <= *(float *)(param_1 + 0x1d8)) {
      puVar8 = (undefined4 *)(param_1 + 0x1d8);
    }
    else {
      puVar8 = (undefined4 *)(param_1 + 0x1dc);
    }
    *(undefined4 *)(param_1 + 0x1d8) = *puVar8;
    *(undefined4 *)(param_1 + 0x274) = 0;
  }
  if (*(float *)(param_1 + 500) != _DAT_004b6500) {
    *(float *)(param_1 + 0x1e4) = *(float *)(param_1 + 500) * fVar5 + *(float *)(param_1 + 0x1e4);
    if (*(float *)(param_1 + 0x1e4) <= *(float *)(param_1 + 0x220)) {
      puVar8 = (undefined4 *)(param_1 + 0x1e4);
    }
    else {
      puVar8 = (undefined4 *)(param_1 + 0x220);
    }
    *(undefined4 *)(param_1 + 0x1e4) = *puVar8;
    if (*(float *)(param_1 + 0x224) <= *(float *)(param_1 + 0x1e4)) {
      puVar8 = (undefined4 *)(param_1 + 0x1e4);
    }
    else {
      puVar8 = (undefined4 *)(param_1 + 0x224);
    }
    *(undefined4 *)(param_1 + 0x1e4) = *puVar8;
  }
  if (*(int *)(param_1 + 0x274) != 0) {
    bVar7 = FUN_004b6918(param_1,param_2);
    *(uint *)(param_1 + 0x274) = CONCAT31(extraout_var,bVar7);
  }
  local_90 = *(float *)(param_1 + 0x238);
  if (_DAT_004b6500 < param_2) {
    *(float *)(param_1 + 0x1e8) = (*(float *)(param_1 + 0x1d8) - fVar1) / param_2;
    *(float *)(param_1 + 0x1ec) = (*(float *)(param_1 + 0x1e4) - fVar2) / param_2;
    *(undefined4 *)(param_1 + 0x238) = *(undefined4 *)(param_1 + 0x1e8);
    if (*(float *)(param_1 + 0x1e8) <= _DAT_004b6500) {
      fVar1 = -*(float *)(param_1 + 0x1e8);
    }
    else {
      fVar1 = *(float *)(param_1 + 0x1e8);
    }
    *(float *)(param_1 + 0x1e8) = fVar1;
    if (*(float *)(param_1 + 0x1ec) <= _DAT_004b6500) {
      fVar1 = -*(float *)(param_1 + 0x1ec);
    }
    else {
      fVar1 = *(float *)(param_1 + 0x1ec);
    }
    *(float *)(param_1 + 0x1ec) = fVar1;
  }
  fVar9 = FUN_004dcd00((double)*(float *)(param_1 + 0x238));
  if (fVar9 <= (float10)_DAT_004b6504) {
    *(undefined4 *)(param_1 + 0x238) = 0;
  }
  fVar9 = FUN_004dcd00((double)local_90);
  if (fVar9 <= (float10)_DAT_004b6504) {
    local_90 = 0.0;
  }
  FUN_004b6510(param_1);
  fVar1 = *(float *)(param_1 + 0x1d8) - *(float *)(param_1 + 0x218);
  bVar7 = false;
  if ((*(float *)(param_1 + 0x238) == _DAT_004b6500) && (local_90 != _DAT_004b6500)) {
    bVar7 = true;
  }
  local_90 = *(float *)(param_1 + 0x238) - local_90;
  if (fVar1 <= _DAT_004b6500) {
    fVar1 = -fVar1;
  }
  if (fVar1 <= _DAT_004b6508) {
    if (local_90 <= _DAT_004b6500) {
      local_90 = -local_90;
    }
    if ((local_90 <= _DAT_004b650c) && (!bVar7)) goto LAB_004b6318;
  }
  *(ushort *)(param_1 + 0x18) = *(ushort *)(param_1 + 0x18) | 1;
LAB_004b6318:
  *(undefined4 *)(param_1 + 0x20c) = 0;
  fVar9 = FUN_004dcd00((double)(*(float *)(param_1 + 0x1d8) - *(float *)(param_1 + 0x1e0)));
  if ((float10)_DAT_004b6504 < fVar9) {
    *(undefined4 *)(param_1 + 0x260) = 0;
  }
  else if (*(int *)(param_1 + 0x260) == 0) {
    *(undefined4 *)(param_1 + 0x260) = 1;
    *(undefined4 *)(param_1 + 0x20c) = 2;
  }
  fVar9 = FUN_004dcd00((double)(*(float *)(param_1 + 0x1d8) - *(float *)(param_1 + 0x1dc)));
  if ((float10)_DAT_004b6504 < fVar9) {
    *(undefined4 *)(param_1 + 0x264) = 0;
  }
  else if (*(int *)(param_1 + 0x264) == 0) {
    *(undefined4 *)(param_1 + 0x264) = 1;
    *(undefined4 *)(param_1 + 0x20c) = 2;
  }
  fVar9 = FUN_004dcd00((double)(*(float *)(param_1 + 0x1e4) - *(float *)(param_1 + 0x220)));
  if ((float10)_DAT_004b6504 < fVar9) {
    *(undefined4 *)(param_1 + 600) = 0;
  }
  else if (*(int *)(param_1 + 600) == 0) {
    *(undefined4 *)(param_1 + 600) = 1;
    *(undefined4 *)(param_1 + 0x20c) = 2;
  }
  fVar9 = FUN_004dcd00((double)(*(float *)(param_1 + 0x1e4) - *(float *)(param_1 + 0x224)));
  if ((float10)_DAT_004b6504 < fVar9) {
    *(undefined4 *)(param_1 + 0x25c) = 0;
  }
  else if (*(int *)(param_1 + 0x25c) == 0) {
    *(undefined4 *)(param_1 + 0x25c) = 1;
    *(undefined4 *)(param_1 + 0x20c) = 2;
  }
  if (*(int *)(param_1 + 0x274) != 0) {
    *(undefined4 *)(param_1 + 0x20c) = 1;
  }
  return;
}



/* @004b6510 file=? name=FUN_004b6510 */

undefined4 __cdecl FUN_004b6510(int param_1)

{
  undefined4 *puVar1;
  int iVar2;
  undefined4 uVar3;
  undefined4 local_8;
  
  if ((*(int *)(param_1 + 0x24c) == 0) || (*(int *)(param_1 + 0x254) <= *(int *)(param_1 + 0x10))) {
    iVar2 = *(int *)(param_1 + 0x10) - *(int *)(param_1 + 0x14);
    uVar3 = 0;
  }
  else {
    iVar2 = *(int *)(param_1 + 0x254) - *(int *)(param_1 + 0x14);
    uVar3 = 1;
  }
  local_8 = (float)iVar2 / DAT_0052140c;
  *(float *)(param_1 + 0x218) = *(float *)(param_1 + 0x21c) + *(float *)(param_1 + 0x238) * local_8;
  if (*(float *)(param_1 + 0x218) <= *(float *)(param_1 + 0x1e0)) {
    puVar1 = (undefined4 *)(param_1 + 0x218);
  }
  else {
    puVar1 = (undefined4 *)(param_1 + 0x1e0);
  }
  *(undefined4 *)(param_1 + 0x218) = *puVar1;
  if (*(float *)(param_1 + 0x1dc) <= *(float *)(param_1 + 0x218)) {
    puVar1 = (undefined4 *)(param_1 + 0x218);
  }
  else {
    puVar1 = (undefined4 *)(param_1 + 0x1dc);
  }
  *(undefined4 *)(param_1 + 0x218) = *puVar1;
  return uVar3;
}



/* @004b65f8 file=? name=FUN_004b65f8 */

void __cdecl FUN_004b65f8(int param_1,float param_2)

{
  int iVar1;
  undefined4 *puVar2;
  
  iVar1 = FUN_004b6510(param_1);
  if (iVar1 == 0) {
    *(undefined4 *)(param_1 + 0x1d8) = *(undefined4 *)(param_1 + 0x218);
  }
  else {
    FUN_004081e0((float *)(param_1 + 0x1d8),(float *)(param_1 + 0x1d8),(float *)(param_1 + 0x218),
                 param_2 / ((float)(*(int *)(param_1 + 0x254) - *(int *)(param_1 + 0x10)) /
                            DAT_0052140c + param_2));
  }
  if (*(float *)(param_1 + 0x218) <= *(float *)(param_1 + 0x1e0)) {
    puVar2 = (undefined4 *)(param_1 + 0x218);
  }
  else {
    puVar2 = (undefined4 *)(param_1 + 0x1e0);
  }
  *(undefined4 *)(param_1 + 0x218) = *puVar2;
  if (*(float *)(param_1 + 0x1dc) <= *(float *)(param_1 + 0x218)) {
    puVar2 = (undefined4 *)(param_1 + 0x218);
  }
  else {
    puVar2 = (undefined4 *)(param_1 + 0x1dc);
  }
  *(undefined4 *)(param_1 + 0x218) = *puVar2;
  return;
}



/* @004b66b4 file=? name=FUN_004b66b4 */

void __cdecl FUN_004b66b4(int param_1,undefined4 *param_2)

{
  uint uVar1;
  float *pfVar2;
  float local_2c;
  undefined4 local_28;
  float local_24;
  float local_20;
  undefined4 local_1c;
  float local_18;
  undefined4 local_14;
  float local_10;
  undefined4 local_c;
  float local_8;
  
  *param_2 = *(undefined4 *)(param_1 + 0x1e4);
  if (*(int *)(param_1 + 0x250) != 0) {
    uVar1 = *(uint *)(*(int *)(param_1 + 0x278) + 0x10);
    if (uVar1 < 3) {
      local_c = **(undefined4 **)(*(int *)(param_1 + 0x278) + 0xc);
      local_8 = *(float *)(param_1 + 0x1d8);
      FUN_0041d0a8(*(int *)(param_1 + 0x278),&local_8);
    }
    else if (uVar1 - 4 < 2) {
      pfVar2 = (float *)FUN_0041cfa0(*(int *)(param_1 + 0x278));
      local_20 = *pfVar2;
      local_18 = pfVar2[2];
      local_1c = *(undefined4 *)(param_1 + 0x1d8);
      FUN_0041d020(*(int *)(param_1 + 0x278),&local_20);
    }
    uVar1 = *(uint *)(*(int *)(param_1 + 0x27c) + 0x10);
    if (uVar1 < 3) {
      local_14 = **(undefined4 **)(*(int *)(param_1 + 0x27c) + 0xc);
      local_10 = *(float *)(param_1 + 0x1d8);
      FUN_0041d0a8(*(int *)(param_1 + 0x27c),&local_10);
    }
    else if (uVar1 - 4 < 2) {
      pfVar2 = (float *)FUN_0041cfa0(*(int *)(param_1 + 0x27c));
      local_2c = *pfVar2;
      local_24 = pfVar2[2];
      local_28 = *(undefined4 *)(param_1 + 0x1d8);
      FUN_0041d020(*(int *)(param_1 + 0x27c),&local_2c);
    }
  }
  return;
}



/* @004b67ec file=? name=FUN_004b67ec */

void __cdecl FUN_004b67ec(int param_1)

{
  uint uVar1;
  float *pfVar2;
  float local_2c;
  undefined4 local_28;
  float local_24;
  float local_20;
  undefined4 local_1c;
  float local_18;
  undefined4 local_14;
  float local_10;
  undefined4 local_c;
  float local_8;
  
  if (*(int *)(param_1 + 0x250) != 0) {
    uVar1 = *(uint *)(*(int *)(param_1 + 0x278) + 0x10);
    if (uVar1 < 3) {
      local_c = **(undefined4 **)(*(int *)(param_1 + 0x278) + 0xc);
      local_8 = *(float *)(param_1 + 0x1d8);
      FUN_0041d0a8(*(int *)(param_1 + 0x278),&local_8);
    }
    else if (uVar1 - 4 < 2) {
      pfVar2 = (float *)FUN_0041cfa0(*(int *)(param_1 + 0x278));
      local_20 = *pfVar2;
      local_18 = pfVar2[2];
      local_1c = *(undefined4 *)(param_1 + 0x1d8);
      FUN_0041d020(*(int *)(param_1 + 0x278),&local_20);
    }
    uVar1 = *(uint *)(*(int *)(param_1 + 0x27c) + 0x10);
    if (uVar1 < 3) {
      local_14 = **(undefined4 **)(*(int *)(param_1 + 0x27c) + 0xc);
      local_10 = *(float *)(param_1 + 0x1d8);
      FUN_0041d0a8(*(int *)(param_1 + 0x27c),&local_10);
    }
    else if (uVar1 - 4 < 2) {
      pfVar2 = (float *)FUN_0041cfa0(*(int *)(param_1 + 0x27c));
      local_2c = *pfVar2;
      local_24 = pfVar2[2];
      local_28 = *(undefined4 *)(param_1 + 0x1d8);
      FUN_0041d020(*(int *)(param_1 + 0x27c),&local_2c);
    }
  }
  return;
}



/* @004b6918 file=? name=FUN_004b6918 */

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

bool __cdecl FUN_004b6918(int param_1,float param_2)

{
  undefined4 *puVar1;
  float10 fVar2;
  undefined4 local_20;
  undefined4 local_1c;
  float local_18;
  undefined4 local_14;
  undefined4 local_10;
  float local_c;
  float local_8;
  
  local_8 = *(float *)(param_1 + 0x244) * param_2;
  if (_DAT_004b6a14 < *(float *)(param_1 + 0x1d8)) {
    local_c = local_8;
    *(float *)(param_1 + 0x1d8) = *(float *)(param_1 + 0x1d8) - local_8;
    local_10 = 0;
    if (0.0 <= *(float *)(param_1 + 0x1d8)) {
      puVar1 = (undefined4 *)(param_1 + 0x1d8);
    }
    else {
      local_14 = 0;
      puVar1 = &local_14;
    }
    *(undefined4 *)(param_1 + 0x1d8) = *puVar1;
  }
  if (*(float *)(param_1 + 0x1d8) < _DAT_004b6a14) {
    local_18 = local_8;
    *(float *)(param_1 + 0x1d8) = local_8 + *(float *)(param_1 + 0x1d8);
    local_1c = 0;
    if (*(float *)(param_1 + 0x1d8) <= 0.0) {
      puVar1 = (undefined4 *)(param_1 + 0x1d8);
    }
    else {
      local_20 = 0;
      puVar1 = &local_20;
    }
    *(undefined4 *)(param_1 + 0x1d8) = *puVar1;
  }
  fVar2 = FUN_004dcd00((double)(*(float *)(param_1 + 0x1d8) - _DAT_004b6a14));
  return (float10)_DAT_004b6a18 < fVar2;
}



/* @004b6a78 file=? name=FUN_004b6a78 */

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

void __cdecl FUN_004b6a78(int param_1,int param_2)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00414b60();
  *(undefined4 *)(param_1 + 0x254) = *puVar1;
  if ((float)(*(int *)(param_1 + 0x254) - *(int *)(param_1 + 0x14)) / DAT_0052140c < _DAT_004b6b08)
  {
    *(int *)(param_1 + 0x254) =
         *(int *)(param_1 + 0x254) + (*(int *)(param_1 + 0x254) - *(int *)(param_1 + 0x14));
  }
  FUN_0041bd34(param_1,param_2);
  *(undefined4 *)(param_1 + 0x21c) = *(undefined4 *)(param_2 + 0x10);
  *(undefined4 *)(param_1 + 0x1e8) = *(undefined4 *)(param_2 + 0x14);
  *(undefined4 *)(param_1 + 0x238) = *(undefined4 *)(param_2 + 0x18);
  return;
}



/* @004b6b0c file=? name=FUN_004b6b0c */

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

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

{
  uint *puVar1;
  int iVar2;
  int local_cc [7];
  int local_b0 [10];
  uint *local_88;
  uint *local_84;
  undefined4 local_80;
  int local_7c;
  uint *local_78;
  char *local_74;
  uint *local_70;
  undefined4 local_6c;
  int local_68;
  int local_64;
  undefined4 local_60;
  uint *local_5c;
  char *local_58;
  uint *local_54;
  float local_50;
  int *local_4c;
  int *local_48;
  int *local_44;
  int *local_40;
  int *local_3c;
  int *local_38;
  float local_34;
  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_004b18a4(param_1,param_2,param_3,param_4,&DAT_00510af8);
  *param_1 = (int)&PTR_LAB_0051103c;
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(byte *)(param_2 + 0x29) & 1) != 0)) {
    param_1[0x93] = 0;
    param_1[7] = (int)PTR_FUN_00510c10;
    param_1[8] = DAT_00510c14;
    param_1[9] = DAT_00510c18;
  }
  else {
    param_1[0x93] = 1;
    param_1[7] = (int)PTR_FUN_00510c1c;
    param_1[8] = DAT_00510c20;
    param_1[9] = DAT_00510c24;
  }
  param_1[0x83] = 0;
  param_1[0x84] = *(int *)(param_4 + 0x150);
  param_1[0x85] = *(int *)(param_4 + 0x154);
  local_c = *(float *)(param_4 + 0xf4);
  param_1[0x8f] = (int)(local_c * _DAT_004b6fb8);
  local_14 = *(float *)(param_4 + 0xf8);
  param_1[0x90] = (int)(local_14 * _DAT_004b6fb8);
  local_1c = *(float *)(param_4 + 0xfc);
  param_1[0x77] = (int)(local_1c * _DAT_004b6fb8);
  local_24 = *(float *)(param_4 + 0x100);
  param_1[0x78] = (int)(local_24 * _DAT_004b6fb8);
  local_2c = *(float *)(param_4 + 0x104);
  param_1[0x88] = (int)(local_2c * _DAT_004b6fb8);
  local_34 = *(float *)(param_4 + 0x108);
  param_1[0x89] = (int)(local_34 * _DAT_004b6fb8);
  local_38 = param_1 + 0x88;
  local_3c = param_1 + 0x8c;
  local_40 = param_1 + 0x89;
  *local_3c = *local_38;
  local_44 = param_1 + 0x8d;
  local_48 = param_1 + 0x88;
  *local_44 = *local_40;
  local_4c = param_1 + 0x8a;
  *local_4c = *local_48;
  local_50 = (float)param_1[0x89] * _DAT_004b6fbc;
  param_1[0x8b] = (int)local_50;
  param_1[0x9a] = 0;
  param_1[0x9b] = 0;
  param_1[0x94] = *(int *)(param_4 + 0x14c);
  if (param_1[0x94] != 0) {
    local_58 = param_4 + 0x10c;
    local_30 = local_34;
    local_28 = local_2c;
    local_20 = local_24;
    local_18 = local_1c;
    local_10 = local_14;
    local_8 = local_c;
    local_5c = (uint *)FUN_00402298(0x10);
    if (local_5c == (uint *)0x0) {
      local_54 = (uint *)0x0;
    }
    else {
      local_54 = FUN_00402460(local_5c,local_58);
    }
    local_54[3] = local_54[3] + 1;
    local_64 = FUN_00417ab4(param_2 + 0x31c);
    local_54[3] = local_54[3] + 1;
    local_68 = FUN_00424b60(param_2,(int *)local_54);
    local_6c = *(undefined4 *)(local_68 + 0xc0);
    local_60 = local_6c;
    FUN_0041d3b3(local_b0,local_64 + 0xe4);
    iVar2 = (**(code **)(local_b0[0] + 0x34))(local_b0,local_6c);
    FUN_0041d3d2(local_b0,2);
    local_74 = param_4 + 300;
    param_1[0x9e] = iVar2;
    local_78 = (uint *)FUN_00402298(0x10);
    if (local_78 == (uint *)0x0) {
      local_70 = (uint *)0x0;
    }
    else {
      local_70 = FUN_00402460(local_78,local_74);
    }
    local_70[3] = local_70[3] + 1;
    local_70[3] = local_70[3] + 1;
    local_7c = FUN_00424b60(param_2,(int *)local_70);
    local_80 = *(undefined4 *)(local_7c + 0xc0);
    local_60 = local_80;
    FUN_0041d3b3(local_cc,local_64 + 0xe4);
    iVar2 = (**(code **)(local_cc[0] + 0x34))(local_cc,local_80);
    FUN_0041d3d2(local_cc,2);
    param_1[0x9f] = iVar2;
    local_84 = local_70;
    puVar1 = local_70 + 3;
    *puVar1 = *puVar1 - 1;
    if (*puVar1 == 0) {
      FUN_004024d8((int *)local_70,3);
    }
    local_88 = local_54;
    puVar1 = local_54 + 3;
    *puVar1 = *puVar1 - 1;
    if (*puVar1 == 0) {
      FUN_004024d8((int *)local_54,3);
    }
  }
  param_1[0x96] = 0;
  param_1[0x97] = 0;
  param_1[0x98] = 0;
  param_1[0x99] = 0;
  param_1[0x91] = param_1[0x8f];
  param_1[0x92] = param_1[0x90];
  param_1[0x76] = 0;
  param_1[0x79] = 0;
  param_1[0x7a] = 0;
  param_1[0x7b] = 0;
  param_1[0x87] = 0;
  param_1[0x86] = 0;
  param_1[0x8e] = 0;
  param_1[0x9c] = 0;
  param_1[0x9d] = 0;
  param_1[0x7e] = 0;
  param_1[0x7f] = 0;
  param_1[0x80] = 0;
  param_1[0x81] = 0;
  param_1[0x82] = 0;
  param_1[0x7c] = 0;
  param_1[0x7d] = 0;
  param_1[0x95] = param_1[5];
  return param_1;
}



/* @004b6fec file=? name=FUN_004b6fec */

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

undefined4 __cdecl
FUN_004b6fec(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6,
            int param_7)

{
  char *pcVar1;
  char cVar2;
  int iVar3;
  undefined4 uVar4;
  char *pcVar5;
  int *piVar6;
  int *piVar7;
  uint uVar8;
  uint uVar9;
  char *pcVar10;
  bool bVar11;
  char *local_14;
  char *local_10;
  char *local_c;
  char *local_8;
  
  iVar3 = FUN_004b198c(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar3 == 0) {
    uVar4 = 0;
  }
  else {
    param_4[0x24] = 'X';
    param_4[0x25] = '\x01';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x3b;
    param_4[0x21] = '\v';
    param_4[0x22] = '\0';
    param_4[0x23] = '\0';
    if (param_7 == 1) {
      iVar3 = FUN_00404088(param_5,param_3,s_TorsoHorizontalEnabled_00510d43,&local_8);
      if (iVar3 == 0) {
        param_4[0x14c] = '\x01';
        param_4[0x14d] = '\0';
        param_4[0x14e] = '\0';
        param_4[0x14f] = '\0';
      }
      else {
        iVar3 = FUN_004d4b58(local_8,s_false_00510d5a);
        if (iVar3 == 0) {
          param_4[0x14c] = '\0';
          param_4[0x14d] = '\0';
          param_4[0x14e] = '\0';
          param_4[0x14f] = '\0';
        }
        else {
          param_4[0x14c] = '\x01';
          param_4[0x14d] = '\0';
          param_4[0x14e] = '\0';
          param_4[0x14f] = '\0';
        }
      }
    }
    if (param_7 == 1) {
      param_4[0x150] = '\0';
      param_4[0x151] = '\0';
      param_4[0x152] = -0x80;
      param_4[0x153] = -0x41;
      param_4[0x154] = '\0';
      param_4[0x155] = '\0';
      param_4[0x156] = -0x80;
      param_4[0x157] = -0x41;
      param_4[0xf4] = '\0';
      param_4[0xf5] = '\0';
      param_4[0xf6] = -0x80;
      param_4[0xf7] = -0x41;
      param_4[0xf8] = '\0';
      param_4[0xf9] = '\0';
      param_4[0xfa] = -0x80;
      param_4[0xfb] = -0x41;
      param_4[0x100] = '\0';
      param_4[0x101] = '\0';
      param_4[0x102] = -0x80;
      param_4[0x103] = -0x41;
      param_4[0xfc] = '\0';
      param_4[0xfd] = '\0';
      param_4[0xfe] = -0x80;
      param_4[0xff] = -0x41;
      param_4[0x104] = '\0';
      param_4[0x105] = '\0';
      param_4[0x106] = -0x80;
      param_4[0x107] = -0x41;
      param_4[0x108] = '\0';
      param_4[0x109] = '\0';
      param_4[0x10a] = -0x80;
      param_4[0x10b] = -0x41;
    }
    iVar3 = FUN_00404118(param_5,param_3,s_ButtonAccelerationPerSecond_00510d60,
                         (float *)(param_4 + 0x150));
    if ((iVar3 == 0) && (_DAT_004b76c4 == *(float *)(param_4 + 0x150))) {
      FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_missing_ButtonAccelerationPerSec_00510d7c,(char *)0x0);
      uVar4 = 0;
    }
    else {
      iVar3 = FUN_00404118(param_5,param_3,s_ButtonAccelerationStartValue_00510da3,
                           (float *)(param_4 + 0x154));
      if ((iVar3 == 0) && (_DAT_004b76c4 == *(float *)(param_4 + 0x154))) {
        FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_missing_ButtonAccelerationStartV_00510dc0,(char *)0x0);
        uVar4 = 0;
      }
      else {
        iVar3 = FUN_00404118(param_5,param_3,s_HorizontalRotationPerSecond_00510de8,
                             (float *)(param_4 + 0xf4));
        if ((iVar3 == 0) && (_DAT_004b76c4 == *(float *)(param_4 + 0xf4))) {
          FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
          FUN_004dbb24((int *)&DAT_00524e68,s_missing_HorizontalRotationPerSec_00510e04,(char *)0x0)
          ;
          uVar4 = 0;
        }
        else {
          iVar3 = FUN_00404118(param_5,param_3,s_VerticalRotationPerSecond_00510e2b,
                               (float *)(param_4 + 0xf8));
          if ((iVar3 == 0) && (_DAT_004b76c4 == *(float *)(param_4 + 0xf8))) {
            FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
            FUN_004dbb24((int *)&DAT_00524e68,s_missing_VerticalRotationPerSecon_00510e45,
                         (char *)0x0);
            uVar4 = 0;
          }
          else {
            iVar3 = FUN_00404118(param_5,param_3,s_HorizontalLimitRight_00510e6a,
                                 (float *)(param_4 + 0xfc));
            if ((iVar3 == 0) && (_DAT_004b76c4 == *(float *)(param_4 + 0xfc))) {
              FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
              FUN_004dbb24((int *)&DAT_00524e68,s_missing_HorizontalLimitRight__00510e7f,(char *)0x0
                          );
              uVar4 = 0;
            }
            else {
              iVar3 = FUN_00404118(param_5,param_3,s_HorizontalLimitLeft_00510e9f,
                                   (float *)(param_4 + 0x100));
              if ((iVar3 == 0) && (_DAT_004b76c4 == *(float *)(param_4 + 0x100))) {
                FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                FUN_004dbb24((int *)&DAT_00524e68,s_missing_HorizontalLimitLeft__00510eb3,
                             (char *)0x0);
                uVar4 = 0;
              }
              else {
                iVar3 = FUN_00404118(param_5,param_3,s_VerticalLimitTop_00510ed2,
                                     (float *)(param_4 + 0x104));
                if ((iVar3 == 0) && (_DAT_004b76c4 == *(float *)(param_4 + 0x104))) {
                  FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                  FUN_004dbb24((int *)&DAT_00524e68,s_missing_VerticalLimitTop__00510ee3,(char *)0x0
                              );
                  uVar4 = 0;
                }
                else {
                  iVar3 = FUN_00404118(param_5,param_3,s_VerticalLimitBottom_00510eff,
                                       (float *)(param_4 + 0x108));
                  if ((iVar3 == 0) && (_DAT_004b76c4 == *(float *)(param_4 + 0x108))) {
                    FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                    FUN_004dbb24((int *)&DAT_00524e68,s_missing_VerticalLimitBottom__00510f13,
                                 (char *)0x0);
                    uVar4 = 0;
                  }
                  else {
                    local_c = s_Unspecified_00510f32;
                    local_10 = s_Unspecified_00510f3e;
                    if (*(int *)(param_4 + 0x14c) != 0) {
                      iVar3 = FUN_00404088(param_5,param_3,s_TorsoHorizontalJoint_00510f4a,&local_c)
                      ;
                      if (iVar3 == 0) {
                        pcVar10 = s_Unspecified_00510f5f;
                        pcVar5 = local_c;
                        do {
                          bVar11 = *pcVar5 == *pcVar10;
                          if (!bVar11) break;
                          if (*pcVar5 == '\0') goto LAB_004b7420;
                          pcVar1 = pcVar5 + 1;
                          bVar11 = *pcVar1 == pcVar10[1];
                          if (!bVar11) break;
                          pcVar5 = pcVar5 + 2;
                          pcVar10 = pcVar10 + 2;
                          bVar11 = *pcVar1 == '\0';
                        } while (!bVar11);
                        if (!bVar11) {
                          FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                          FUN_004dbb24((int *)&DAT_00524e68,s_missing_TorsoHorizontalJoint__00510f6b
                                       ,(char *)0x0);
                          return 0;
                        }
                      }
LAB_004b7420:
                      pcVar10 = s_Unspecified_00510f8b;
                      pcVar5 = local_c;
                      do {
                        bVar11 = *pcVar5 == *pcVar10;
                        if (!bVar11) break;
                        if (*pcVar5 == '\0') goto LAB_004b7474;
                        pcVar1 = pcVar5 + 1;
                        bVar11 = *pcVar1 == pcVar10[1];
                        if (!bVar11) break;
                        pcVar5 = pcVar5 + 2;
                        pcVar10 = pcVar10 + 2;
                        bVar11 = *pcVar1 == '\0';
                      } while (!bVar11);
                      if (!bVar11) {
                        uVar8 = 0xffffffff;
                        pcVar5 = local_c;
                        do {
                          pcVar10 = pcVar5;
                          if (uVar8 == 0) break;
                          uVar8 = uVar8 - 1;
                          pcVar10 = pcVar5 + 1;
                          cVar2 = *pcVar5;
                          pcVar5 = pcVar10;
                        } while (cVar2 != '\0');
                        uVar8 = ~uVar8;
                        pcVar5 = pcVar10 + -uVar8;
                        pcVar10 = param_4 + 0x10c;
                        for (uVar9 = uVar8 >> 2; uVar9 != 0; uVar9 = uVar9 - 1) {
                          *(undefined4 *)pcVar10 = *(undefined4 *)pcVar5;
                          pcVar5 = pcVar5 + 4;
                          pcVar10 = pcVar10 + 4;
                        }
                        for (uVar8 = uVar8 & 3; uVar8 != 0; uVar8 = uVar8 - 1) {
                          *pcVar10 = *pcVar5;
                          pcVar5 = pcVar5 + 1;
                          pcVar10 = pcVar10 + 1;
                        }
                      }
LAB_004b7474:
                      iVar3 = FUN_00404088(param_5,param_3,s_TorsoHorizontalShadowJoint_00510f97,
                                           &local_10);
                      if (iVar3 == 0) {
                        pcVar10 = s_Unspecified_00510fb2;
                        pcVar5 = local_c;
                        do {
                          bVar11 = *pcVar5 == *pcVar10;
                          if (!bVar11) break;
                          if (*pcVar5 == '\0') goto LAB_004b74de;
                          pcVar1 = pcVar5 + 1;
                          bVar11 = *pcVar1 == pcVar10[1];
                          if (!bVar11) break;
                          pcVar5 = pcVar5 + 2;
                          pcVar10 = pcVar10 + 2;
                          bVar11 = *pcVar1 == '\0';
                        } while (!bVar11);
                        if (!bVar11) {
                          FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
                          FUN_004dbb24((int *)&DAT_00524e68,
                                       s_missing_TorsoHorizontalShadowJoi_00510fbe,(char *)0x0);
                          return 0;
                        }
                      }
LAB_004b74de:
                      pcVar10 = s_Unspecified_00510fe4;
                      pcVar5 = local_10;
                      do {
                        bVar11 = *pcVar5 == *pcVar10;
                        if (!bVar11) break;
                        if (*pcVar5 == '\0') goto LAB_004b752e;
                        pcVar1 = pcVar5 + 1;
                        bVar11 = *pcVar1 == pcVar10[1];
                        if (!bVar11) break;
                        pcVar5 = pcVar5 + 2;
                        pcVar10 = pcVar10 + 2;
                        bVar11 = *pcVar1 == '\0';
                      } while (!bVar11);
                      if (!bVar11) {
                        uVar8 = 0xffffffff;
                        pcVar5 = local_10;
                        do {
                          pcVar10 = pcVar5;
                          if (uVar8 == 0) break;
                          uVar8 = uVar8 - 1;
                          pcVar10 = pcVar5 + 1;
                          cVar2 = *pcVar5;
                          pcVar5 = pcVar10;
                        } while (cVar2 != '\0');
                        uVar8 = ~uVar8;
                        pcVar5 = pcVar10 + -uVar8;
                        pcVar10 = param_4 + 300;
                        for (uVar9 = uVar8 >> 2; uVar9 != 0; uVar9 = uVar9 - 1) {
                          *(undefined4 *)pcVar10 = *(undefined4 *)pcVar5;
                          pcVar5 = pcVar5 + 4;
                          pcVar10 = pcVar10 + 4;
                        }
                        for (uVar8 = uVar8 & 3; uVar8 != 0; uVar8 = uVar8 - 1) {
                          *pcVar10 = *pcVar5;
                          pcVar5 = pcVar5 + 1;
                          pcVar10 = pcVar10 + 1;
                        }
                      }
LAB_004b752e:
                      iVar3 = FUN_00404088(param_1,s_video_00510ff0,s_skeleton_00510ff6,&local_14);
                      if (iVar3 == 0) {
                        FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
                        FUN_004dbb24(&DAT_00524e20,s_is_missing_skeleton_file__00510fff,(char *)0x0)
                        ;
                        return 0xffffffff;
                      }
                      piVar6 = (int *)FUN_004064fc(*(char **)(param_6 + 0x10),local_14);
                      piVar7 = (int *)FUN_00402298(0x20);
                      if (piVar7 == (int *)0x0) {
                        piVar7 = (int *)0x0;
                      }
                      else {
                        piVar7 = FUN_00403e84(piVar7,(char *)piVar6,1);
                      }
                      iVar3 = FUN_00403f84((int)piVar7,param_4 + 0x10c);
                      if (iVar3 == 0) {
                        FUN_004dbb24(&DAT_00524e20,param_4 + 0x10c,(char *)0x0);
                        FUN_004dbb24(&DAT_00524e20,s_not_found_in_0051101b,(char *)0x0);
                        FUN_004dbb24(&DAT_00524e20,local_14,(char *)0x0);
                        FUN_004d9c38(&DAT_00524e20);
                        FUN_004022d0(piVar6);
                        FUN_00403ecc(piVar7,3);
                        return 0xffffffff;
                      }
                      iVar3 = FUN_00403f84((int)piVar7,param_4 + 300);
                      if (iVar3 == 0) {
                        FUN_004dbb24(&DAT_00524e20,param_4 + 300,(char *)0x0);
                        FUN_004dbb24(&DAT_00524e20,s_not_found_in_0051102a,(char *)0x0);
                        FUN_004dbb24(&DAT_00524e20,local_14,(char *)0x0);
                        FUN_004d9c38(&DAT_00524e20);
                        FUN_004022d0(piVar6);
                        FUN_00403ecc(piVar7,3);
                        return 0xffffffff;
                      }
                      FUN_004022d0(piVar6);
                      FUN_00403ecc(piVar7,3);
                    }
                    uVar4 = 1;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return uVar4;
}



/* @004b77bc file=? name=FUN_004b77bc */

void __cdecl FUN_004b77bc(int *param_1,int param_2)

{
  if (param_2 != 0) {
    param_1[0x86] = 0;
    param_1[0x8b] = 0;
    param_1[0x87] = 0;
    param_1[0x8c] = 0;
  }
  param_1[0xa5] = 0;
  param_1[0xa3] = 0;
  param_1[0xa4] = 0;
  FUN_004b1804(param_1);
  return;
}



/* @004b7810 file=? name=FUN_004b7810 */

void __cdecl FUN_004b7810(int param_1,undefined4 *param_2)

{
  FUN_00408440((undefined4 *)(param_1 + 0x208),param_2);
  return;
}



/* @004b7830 file=? name=FUN_004b7830 */

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

void __cdecl FUN_004b7830(int param_1,float param_2)

{
  float fVar1;
  int iVar2;
  int iVar3;
  undefined4 uVar4;
  float10 fVar5;
  float local_16c;
  undefined4 local_168;
  undefined4 local_164;
  int local_160 [7];
  float local_144 [12];
  float local_114 [12];
  float local_e4 [12];
  float local_b4 [12];
  float local_84 [12];
  float local_54;
  undefined4 local_50;
  undefined4 local_4c;
  float local_48 [3];
  float local_3c;
  float local_38;
  float local_34;
  undefined4 local_30;
  int local_2c;
  int local_28;
  float local_24;
  undefined4 *local_20;
  undefined4 *local_1c;
  float local_18;
  float local_14;
  undefined4 local_10;
  int local_c;
  uint local_8;
  
  iVar2 = *(int *)(param_1 + 0xd0);
  FUN_004b181c(param_1);
  local_8 = (uint)(*(int *)(param_1 + 0x40) != 1);
  if (*(int *)(param_1 + 0x198) == 2) {
    local_8 = (uint)(local_8 != 0);
    FUN_0041bbd8(param_1 + 0x238,0);
  }
  else if (*(int *)(param_1 + 0x198) == 4) {
    local_8 = (uint)(local_8 != 0);
    FUN_0041bbd8(param_1 + 0x238,1);
  }
  else {
    FUN_0041bbd8(param_1 + 0x238,1);
    local_8 = 0;
  }
  iVar3 = *(int *)(param_1 + 0x140);
  if (iVar3 == 0) {
    local_8 = (uint)(local_8 != 0);
    FUN_0041bbd8(param_1 + 0x238,1);
  }
  else if (iVar3 == 1) {
    local_8 = (uint)(local_8 != 0);
    FUN_0041bbd8(param_1 + 0x238,0);
  }
  else if (iVar3 == 2) {
    local_8 = 0;
    FUN_0041bbd8(param_1 + 0x238,1);
  }
  if (*(int *)(param_1 + 0x24c) == 0) {
    *(float *)(param_1 + 0x218) = param_2 + *(float *)(param_1 + 0x218);
    if (*(float *)(param_1 + 0x218) != *(float *)(param_1 + 0x1d8)) {
      *(undefined4 *)(param_1 + 0x218) = 0;
      *(uint *)(param_1 + 0x224) = (uint)(*(int *)(param_1 + 0x224) == 0);
    }
  }
  else if (*(int *)(param_1 + 0x24c) == 1) {
    *(undefined4 *)(param_1 + 0x224) = 1;
  }
  if ((local_8 == 0) || (*(int *)(param_1 + 0x224) == 0)) {
    local_8 = 0;
  }
  else {
    local_8 = 1;
  }
  iVar3 = **(int **)(iVar2 + 0x128);
  *(undefined4 *)(param_1 + 500) = 1;
  iVar3 = *(int *)(iVar3 + 0x198);
  if (iVar3 == 0) {
    *(uint *)(iVar2 + 0x390) = *(uint *)(iVar2 + 0x390) | 1;
    *(uint *)(iVar2 + 0x390) = *(uint *)(iVar2 + 0x390) & 0xfffffffd;
    *(uint *)(param_1 + 500) = (uint)(*(int *)(param_1 + 500) != 0);
  }
  else if (iVar3 == 3) {
    *(uint *)(iVar2 + 0x390) = *(uint *)(iVar2 + 0x390) | 2;
    *(uint *)(iVar2 + 0x390) = *(uint *)(iVar2 + 0x390) & 0xfffffffe;
    if ((*(int *)(param_1 + 500) == 0) || (*(int *)(iVar2 + 0x410) == 0)) {
      uVar4 = 0;
    }
    else {
      uVar4 = 1;
    }
    *(undefined4 *)(param_1 + 500) = uVar4;
  }
  else {
    *(undefined4 *)(param_1 + 500) = 0;
  }
  if (*(int *)(param_1 + 500) == 0) {
    *(undefined4 *)(iVar2 + 0x374) = 0;
  }
  else {
    *(undefined4 *)(iVar2 + 0x374) = 1;
  }
  if (local_8 == 0) {
    *(uint *)(iVar2 + 0x390) = *(uint *)(iVar2 + 0x390) & 0xffffffdf;
  }
  else {
    *(uint *)(iVar2 + 0x390) = *(uint *)(iVar2 + 0x390) | 0x20;
  }
  iVar3 = *(int *)(iVar2 + 0x388);
  if (((iVar3 == 0) || (*(int *)(iVar3 + 0x120) == 0)) ||
     (_DAT_004b7ec4 <= *(float *)(*(int *)(param_1 + 0xe0) + 0x158))) {
    *(undefined4 *)(param_1 + 0x1f8) = 0;
  }
  else {
    local_c = *(int *)(iVar2 + 0x38c);
    if (local_c == -1) {
      local_c = 0;
    }
    if (_DAT_004b7ec8 <= *(float *)(*(int *)(*(int *)(iVar3 + 0x120) + local_c * 4) + 0x158)) {
      *(undefined4 *)(param_1 + 0x1f8) = 0;
    }
    else {
      *(undefined4 *)(param_1 + 0x1f8) = 1;
    }
  }
  if (*(int *)(iVar2 + 0x388) == 0) {
    *(undefined4 *)(param_1 + 0x1ec) = 0x44960000;
  }
  else if (*(int *)(param_1 + 0x22c) == 0) {
    FUN_00408644(&local_3c,(float *)(iVar2 + 0x37c),(float *)(iVar2 + 0x100));
    fVar5 = FUN_004dd138((double)(local_34 * local_34 + local_38 * local_38 + local_3c * local_3c));
    *(float *)(param_1 + 0x1ec) = (float)fVar5;
  }
  if (*(int *)(param_1 + 0x22c) != 0) {
    *(float *)(param_1 + 0x1ec) = *(float *)(param_1 + 0x1ec) - _DAT_004b7ecc;
    *(float *)(param_1 + 0x21c) = param_2 + *(float *)(param_1 + 0x21c);
    if (*(float *)(param_1 + 0x1d8) <= *(float *)(param_1 + 0x21c)) {
      *(undefined4 *)(param_1 + 0x21c) = 0;
      *(undefined4 *)(param_1 + 0x22c) = 0;
    }
  }
  local_10 = 0x43fa0000;
  if (param_2 * 500.0 <= _DAT_004b7ed0) {
    local_14 = param_2 * -500.0;
  }
  else {
    local_14 = param_2 * 500.0;
  }
  local_18 = *(float *)(param_1 + 0x1ec) - *(float *)(param_1 + 0x230);
  if (-local_14 <= local_18) {
    if (local_14 < local_18) {
      local_18 = local_14;
    }
  }
  else {
    local_18 = -local_14;
  }
  local_20 = (undefined4 *)(param_1 + 0x1dc);
  *(float *)(param_1 + 0x1ec) = *(float *)(param_1 + 0x230) + local_18;
  *(undefined4 *)(param_1 + 0x230) = *(undefined4 *)(param_1 + 0x1ec);
  local_1c = (undefined4 *)(*(int *)(param_1 + 0x234) + 0x1d8);
  *local_20 = *local_1c;
  *(undefined4 *)(param_1 + 0x1e8) = *(undefined4 *)(*(int *)(param_1 + 0x234) + 0x1e8);
  FUN_0040954c(local_48,(float *)(iVar2 + 0x10c));
  local_24 = local_48[0] + *(float *)(param_1 + 0x1dc);
  *(float *)(param_1 + 0x214) = local_24;
  local_28 = *(int *)(iVar2 + 400);
  local_2c = *(int *)(local_28 + 0x284);
  if (local_2c == 0) {
    FUN_00408440((undefined4 *)(param_1 + 0x1fc),&DAT_004e0f74);
  }
  else {
    FUN_0040aadc(local_84);
    FUN_0040aadc(local_b4);
    FUN_0040aadc(local_e4);
    FUN_0040aadc(local_114);
    FUN_0040aadc(local_144);
    local_30 = *(undefined4 *)(param_1 + 0xdc);
    FUN_0041f216(local_160,iVar2 + 0x300);
    iVar3 = (**(code **)(local_160[0] + 0x34))(local_160);
    FUN_0041f235(local_160,2);
    FUN_00424da8(iVar2,iVar3,local_84);
    FUN_0040bc54(local_b4,local_84);
    FUN_0040ac6c(local_144,(float *)(iVar2 + 0x360));
    FUN_0040bc54(local_114,local_144);
    FUN_0040b104(local_e4,local_b4,local_114);
    FUN_00408440(&local_54,(undefined4 *)(local_2c + 0x100));
    local_16c = local_54;
    local_168 = local_50;
    local_164 = local_4c;
    FUN_00408b98(&local_54,&local_16c,local_e4);
    FUN_00408440((undefined4 *)(param_1 + 0x1fc),&local_54);
  }
  if (*(int *)(local_28 + 0x274) == 0) {
    *(uint *)(iVar2 + 0x390) = *(uint *)(iVar2 + 0x390) & 0xffffffef;
  }
  else {
    *(uint *)(iVar2 + 0x390) = *(uint *)(iVar2 + 0x390) | 0x10;
  }
  if ((*(float *)(param_1 + 0x28c) == _DAT_004b7ed0) || (*(int *)(param_1 + 0x2a0) != 0)) {
    if (*(int *)(param_1 + 0x2a0) != 0) {
      uVar4 = FUN_004b7ed4(param_1,param_2);
      *(undefined4 *)(param_1 + 0x2a0) = uVar4;
    }
  }
  else {
    *(float *)(param_1 + 0x294) =
         -*(float *)(param_1 + 0x28c) * *(float *)(param_1 + 0x298) * param_2 +
         *(float *)(param_1 + 0x294);
    if (*(float *)(param_1 + 0x294) <= *(float *)(param_1 + 0x29c)) {
      uVar4 = *(undefined4 *)(param_1 + 0x294);
    }
    else {
      uVar4 = *(undefined4 *)(param_1 + 0x29c);
    }
    *(undefined4 *)(param_1 + 0x294) = uVar4;
    if (-*(float *)(param_1 + 0x29c) <= *(float *)(param_1 + 0x294)) {
      fVar1 = *(float *)(param_1 + 0x294);
    }
    else {
      fVar1 = -*(float *)(param_1 + 0x29c);
    }
    *(float *)(param_1 + 0x294) = fVar1;
  }
  *(undefined4 *)(iVar2 + 0x36c) = *(undefined4 *)(param_1 + 0x294);
  return;
}



/* @004b7ed4 file=? name=FUN_004b7ed4 */

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

undefined4 __cdecl FUN_004b7ed4(int param_1,float param_2)

{
  float fVar1;
  float fVar2;
  
  fVar1 = *(float *)(param_1 + 0x298) * param_2;
  if (_DAT_004b7f90 < *(float *)(param_1 + 0x294)) {
    *(float *)(param_1 + 0x294) = *(float *)(param_1 + 0x294) - fVar1;
    fVar2 = _DAT_004b7f90;
    if (_DAT_004b7f90 <= *(float *)(param_1 + 0x294)) {
      fVar2 = *(float *)(param_1 + 0x294);
    }
    *(float *)(param_1 + 0x294) = fVar2;
  }
  if (*(float *)(param_1 + 0x294) < _DAT_004b7f90) {
    *(float *)(param_1 + 0x294) = fVar1 + *(float *)(param_1 + 0x294);
    fVar1 = _DAT_004b7f90;
    if (*(float *)(param_1 + 0x294) < _DAT_004b7f90) {
      fVar1 = *(float *)(param_1 + 0x294);
    }
    *(float *)(param_1 + 0x294) = fVar1;
  }
  if (*(float *)(param_1 + 0x294) != _DAT_004b7f90) {
    return 1;
  }
  return 0;
}



/* @004b7f94 file=? name=FUN_004b7f94 */

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

{
  int iVar1;
  
  FUN_004b18a4(param_1,param_2,param_3,param_4,&DAT_00511078);
  *param_1 = (int)&PTR_FUN_00511510;
  param_1[0x76] = 0;
  param_1[0x77] = 0;
  param_1[0x78] = 0;
  param_1[0x79] = 0;
  param_1[0x7a] = 0;
  param_1[0x7b] = 0;
  param_1[0x7d] = 1;
  param_1[0x7e] = 0;
  param_1[0x7f] = DAT_004e0f74;
  param_1[0x80] = DAT_004e0f78;
  param_1[0x81] = DAT_004e0f7c;
  param_1[0x82] = DAT_004e0f74;
  param_1[0x83] = DAT_004e0f78;
  param_1[0x84] = DAT_004e0f7c;
  param_1[0x85] = 0;
  param_1[0x86] = 0;
  param_1[0x87] = 0;
  param_1[0x88] = 0;
  param_1[0x89] = 1;
  param_1[0x8a] = 0;
  param_1[0x8b] = 0;
  param_1[0x8c] = 0;
  FUN_0041b9ec(param_1 + 0x8e,2);
  param_1[0xa3] = 0;
  param_1[0xa4] = 0;
  param_1[0xa5] = 0;
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_00511170;
    param_1[8] = DAT_00511174;
    param_1[9] = DAT_00511178;
  }
  param_1[0x76] = *(int *)(param_4 + 0xf4);
  param_1[0xa6] = *(int *)(param_4 + 0xfc);
  param_1[0xa7] = *(int *)(param_4 + 0x100);
  iVar1 = *(int *)(param_2 + 0x438);
  param_1[0x8d] = iVar1;
  param_1[0x78] = *(int *)(iVar1 + 0x1dc);
  param_1[0x79] = *(int *)(param_1[0x8d] + 0x1e0);
  param_1[0x77] = *(int *)(param_1[0x8d] + 0x1d8);
  param_1[0x7a] = *(int *)(param_1[0x8d] + 0x1e8);
  return param_1;
}



/* @004b816c file=? name=FUN_004b816c */

void __cdecl FUN_004b816c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_00511510;
    *(undefined4 *)(param_1[0x34] + 0x374) = 0;
    FUN_0041baa4(param_1 + 0x8e,2);
    FUN_004b1930(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004b81b8 file=? name=FUN_004b81b8 */

void __cdecl FUN_004b81b8(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x511088);
  return;
}



/* @004b81d4 file=? name=FUN_004b81d4 */

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

undefined4 __cdecl
FUN_004b81d4(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6,
            int param_7)

{
  int iVar1;
  undefined4 uVar2;
  
  iVar1 = FUN_004b198c(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    param_4[0x24] = '\x04';
    param_4[0x25] = '\x01';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x2a;
    param_4[0x21] = '\v';
    param_4[0x22] = '\0';
    param_4[0x23] = '\0';
    if (param_7 == 1) {
      param_4[0xf4] = '\0';
      param_4[0xf5] = '\0';
      param_4[0xf6] = -0x80;
      param_4[0xf7] = -0x41;
      *(undefined4 *)(param_4 + 0xf8) = *(undefined4 *)(param_4 + 0x28);
    }
    if ((*(int *)(param_4 + 0xf8) == -1) && (1 < param_7)) {
      FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,s_missing_SegmentPageName__00511395,(char *)0x0);
      uVar2 = 0;
    }
    else {
      if (1 < param_7) {
        *(undefined4 *)(param_4 + 0x28) = *(undefined4 *)(param_4 + 0xf8);
      }
      iVar1 = FUN_00404118(param_5,param_3,s_FlickerRate_005113af,(float *)(param_4 + 0xf4));
      if ((iVar1 == 0) && (_DAT_004b8388 == *(float *)(param_4 + 0xf4))) {
        FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_missing_FlickerRate__005113bb,(char *)0x0);
        uVar2 = 0;
      }
      else {
        iVar1 = FUN_00404118(param_5,param_3,s_HorizontalMovementPerSecond_005113d2,
                             (float *)(param_4 + 0xfc));
        if ((iVar1 == 0) && (_DAT_004b8388 == *(float *)(param_4 + 0xfc))) {
          FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
          FUN_004dbb24((int *)&DAT_00524e68,s_missing_HorizontalMovementPerSec_005113ee,(char *)0x0)
          ;
          uVar2 = 0;
        }
        else {
          iVar1 = FUN_00404118(param_5,param_3,s_HorizontalLimit_00511415,(float *)(param_4 + 0x100)
                              );
          if ((iVar1 == 0) && (_DAT_004b8388 == *(float *)(param_4 + 0x100))) {
            FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
            FUN_004dbb24((int *)&DAT_00524e68,s_missing_HorizontalLimit__00511425,(char *)0x0);
            uVar2 = 0;
          }
          else {
            uVar2 = 1;
          }
        }
      }
    }
  }
  return uVar2;
}



/* @004b83b8 file=? name=FUN_004b83b8 */

void __cdecl FUN_004b83b8(int param_1,int param_2)

{
  int iVar1;
  
  FUN_0041bd34(param_1,param_2);
  iVar1 = *(int *)(param_2 + 0x10);
  *(int *)(param_1 + 0x1d8) = iVar1;
  FUN_0041bbd8(param_1 + 0x1e4,iVar1);
  return;
}



/* @004b83f0 file=? name=FUN_004b83f0 */

void __cdecl FUN_004b83f0(int param_1,undefined4 *param_2,undefined2 param_3)

{
  FUN_0041c500(param_1,param_2,param_3);
  *param_2 = 0x14;
  param_2[4] = *(undefined4 *)(param_1 + 0x1d8);
  return;
}



/* @004b841c file=? name=FUN_004b841c */

void __cdecl FUN_004b841c(int param_1)

{
  int iVar1;
  
  FUN_004b181c(param_1);
  iVar1 = *(int *)(param_1 + 0x1d8);
  if (*(int *)(param_1 + 0x40) == 1) {
    *(undefined4 *)(param_1 + 0x1d8) = 0;
  }
  else {
    *(undefined4 *)(param_1 + 0x1d8) = *(undefined4 *)(param_1 + 0x1e0);
  }
  if (*(int *)(param_1 + 0x198) == 4) {
    *(uint *)(param_1 + 0x1d8) = (uint)(*(int *)(param_1 + 0x1d8) != 0);
  }
  else {
    *(undefined4 *)(param_1 + 0x1d8) = 0;
  }
  if (*(uint *)(param_1 + 0x140) < 2) {
    *(uint *)(param_1 + 0x1d8) = (uint)(*(int *)(param_1 + 0x1d8) != 0);
  }
  else if (*(uint *)(param_1 + 0x140) == 2) {
    *(undefined4 *)(param_1 + 0x1d8) = 0;
  }
  FUN_0041bbd8(param_1 + 0x1e4,*(int *)(param_1 + 0x1d8));
  if (iVar1 != *(int *)(param_1 + 0x1d8)) {
    *(ushort *)(param_1 + 0x18) = *(ushort *)(param_1 + 0x18) | 1;
  }
  return;
}



/* @004b84dc file=? name=FUN_004b84dc */

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

{
  FUN_004b18a4(param_1,param_2,param_3,param_4,&DAT_00511198);
  *param_1 = (int)&PTR_FUN_005114d4;
  param_1[0x76] = 0;
  param_1[0x78] = 0;
  FUN_0041b9ec(param_1 + 0x79,2);
  param_1[0x77] = *(int *)(param_4 + 0x28);
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_00511200;
    param_1[8] = DAT_00511204;
    param_1[9] = DAT_00511208;
  }
  else {
    param_1[10] = param_1[10] | 2;
  }
  return param_1;
}



/* @004b8568 file=? name=FUN_004b8568 */

void __cdecl FUN_004b8568(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_005114d4;
    FUN_0041baa4(param_1 + 0x79,2);
    FUN_004b1930(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004b85a8 file=? name=FUN_004b85a8 */

undefined4 __cdecl
FUN_004b85a8(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6,
            int param_7)

{
  int iVar1;
  
  iVar1 = FUN_004b198c(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar1 == 0) {
    return 0;
  }
  param_4[0x24] = -0xc;
  param_4[0x25] = '\0';
  param_4[0x26] = '\0';
  param_4[0x27] = '\0';
  param_4[0x20] = -0x28;
  param_4[0x21] = '\v';
  param_4[0x22] = '\0';
  param_4[0x23] = '\0';
  return 1;
}



/* @004b85f0 file=? name=FUN_004b85f0 */

void __cdecl FUN_004b85f0(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x5111a8);
  return;
}



/* @004b860c file=? name=FUN_004b860c */

void __cdecl FUN_004b860c(int param_1,int param_2)

{
  if ((0 < *(int *)(param_2 + 0xc)) &&
     (*(int *)(*(int *)(*(int *)(param_1 + 0xd0) + 400) + 0x25c) != 0)) {
    *(uint *)(param_1 + 0x1dc) = (uint)(*(int *)(param_1 + 0x1dc) == 0);
  }
  return;
}



/* @004b8648 file=? name=FUN_004b8648 */

void __cdecl FUN_004b8648(int param_1)

{
  int iVar1;
  
  FUN_004b181c(param_1);
  iVar1 = *(int *)(param_1 + 0x1d8);
  if (*(int *)(param_1 + 0x40) == 1) {
    *(undefined4 *)(param_1 + 0x1d8) = 0;
  }
  else {
    *(undefined4 *)(param_1 + 0x1d8) = *(undefined4 *)(param_1 + 0x1dc);
  }
  if (*(int *)(param_1 + 0x198) == 4) {
    *(uint *)(param_1 + 0x1d8) = (uint)(*(int *)(param_1 + 0x1d8) != 0);
  }
  else {
    *(undefined4 *)(param_1 + 0x1d8) = 0;
  }
  if (*(uint *)(param_1 + 0x140) < 2) {
    *(uint *)(param_1 + 0x1d8) = (uint)(*(int *)(param_1 + 0x1d8) != 0);
  }
  else if (*(uint *)(param_1 + 0x140) == 2) {
    *(undefined4 *)(param_1 + 0x1d8) = 0;
  }
  FUN_0041bbd8(param_1 + 0x1e0,*(int *)(param_1 + 0x1d8));
  if ((iVar1 != *(int *)(param_1 + 0x1d8)) && (*(int *)(*(int *)PTR_DAT_004fd4b8 + 0x48) != 0)) {
    FUN_0045fe44();
  }
  return;
}



/* @004b8718 file=? name=FUN_004b8718 */

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

{
  FUN_004b18a4(param_1,param_2,param_3,param_4,&DAT_00511228);
  *param_1 = (int)&PTR_FUN_00511498;
  param_1[0x76] = 0;
  param_1[0x77] = 0;
  FUN_0041b9ec(param_1 + 0x78,2);
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_00511290;
    param_1[8] = DAT_00511294;
    param_1[9] = DAT_00511298;
  }
  return param_1;
}



/* @004b8794 file=? name=FUN_004b8794 */

void __cdecl FUN_004b8794(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_00511498;
    FUN_0041baa4(param_1 + 0x78,2);
    FUN_004b1930(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004b87d4 file=? name=FUN_004b87d4 */

undefined4 __cdecl
FUN_004b87d4(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6,
            int param_7)

{
  int iVar1;
  
  iVar1 = FUN_004b198c(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar1 == 0) {
    return 0;
  }
  param_4[0x24] = -0xc;
  param_4[0x25] = '\0';
  param_4[0x26] = '\0';
  param_4[0x27] = '\0';
  param_4[0x20] = -0x22;
  param_4[0x21] = '\v';
  param_4[0x22] = '\0';
  param_4[0x23] = '\0';
  return 1;
}



/* @004b881c file=? name=FUN_004b881c */

void __cdecl FUN_004b881c(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x511238);
  return;
}



/* @004b8a8c file=? name=FUN_004b8a8c */

void __cdecl FUN_004b8a8c(int *param_1,int *param_2)

{
  FUN_004b0efc(param_1,param_2);
  return;
}



/* @004b8aa4 file=? name=FUN_004b8aa4 */

void __cdecl FUN_004b8aa4(int *param_1,int param_2)

{
  FUN_004b0e6c(param_1,param_2);
  return;
}



/* @004b8ac0 file=? name=FUN_004b8ac0 */

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

float10 __cdecl FUN_004b8ac0(int param_1,float param_2)

{
  float fVar1;
  float fVar2;
  undefined4 local_10;
  
  fVar1 = *(float *)(*(int *)(param_1 + 0xd0) + 0x34c) *
          (param_2 / *(float *)(param_1 + 0x330 + *(int *)(param_1 + 0x324) * 4));
  if (*(float *)(param_1 + 0x118) <= *(float *)(param_1 + 0x114)) {
    if (*(float *)(param_1 + 0x11c) <= *(float *)(param_1 + 0x114)) {
      local_10 = 0.0;
    }
    else {
      fVar2 = *(float *)(param_1 + 0x114) - *(float *)(param_1 + 0x118);
      if (fVar1 == _DAT_004b8b94) {
        local_10 = 1.0;
      }
      else {
        local_10 = (fVar1 - fVar2 * fVar2 * (fVar1 / *(float *)(param_1 + 0x34c))) / fVar1;
      }
    }
  }
  else {
    local_10 = 1.0;
  }
  return (float10)((_DAT_004b8b98 - *(float *)(*(int *)(param_1 + 0xe0) + 0x158)) * fVar1 * local_10
                  );
}



/* @004b8d18 file=? name=FUN_004b8d18 */

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

void __cdecl FUN_004b8d18(int 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;
  int iVar12;
  float10 fVar13;
  
  iVar12 = *(int *)(param_1 + 0xd0);
  fVar1 = *(float *)(iVar12 + 0x1c4);
  fVar2 = *(float *)(iVar12 + 0x1c4);
  fVar3 = *(float *)(iVar12 + 0x1c8);
  fVar4 = *(float *)(iVar12 + 0x1c8);
  fVar5 = *(float *)(iVar12 + 0x1cc);
  fVar6 = *(float *)(iVar12 + 0x1cc);
  fVar13 = FUN_004dd138((double)(*(float *)(iVar12 + 0x1cc) * *(float *)(iVar12 + 0x1cc) +
                                *(float *)(iVar12 + 0x1c8) * *(float *)(iVar12 + 0x1c8) +
                                *(float *)(iVar12 + 0x1c4) * *(float *)(iVar12 + 0x1c4)));
  fVar7 = (float)fVar13;
  fVar13 = FUN_004dd138((double)(*(float *)(iVar12 + 0x834) * *(float *)(iVar12 + 0x834) +
                                *(float *)(iVar12 + 0x830) * *(float *)(iVar12 + 0x830) +
                                *(float *)(iVar12 + 0x82c) * *(float *)(iVar12 + 0x82c)));
  fVar8 = (float)fVar13;
  fVar9 = *(float *)(iVar12 + 0x1c8);
  fVar10 = *(float *)(iVar12 + 0x20c);
  fVar11 = **(float **)(iVar12 + 0x250);
  fVar1 = fVar10 * (fVar5 * fVar6 + fVar3 * fVar4 + fVar1 * fVar2) * _DAT_004b8ee4;
  if (fVar8 <= _DAT_004b8ee8) {
    fVar8 = -fVar8;
  }
  if (fVar7 <= _DAT_004b8ee8) {
    fVar7 = -fVar7;
  }
  if (fVar9 <= _DAT_004b8ee8) {
    fVar9 = -fVar9;
  }
  fVar3 = _DAT_004b8eec - *(float *)(param_1 + 0x354);
  fVar5 = _DAT_004b8eec - *(float *)(param_1 + 0x350);
  fVar4 = _DAT_004b8eec - *(float *)(param_1 + 0x354);
  fVar6 = _DAT_004b8eec + *(float *)(*(int *)(param_1 + 0xe0) + 0x158);
  fVar2 = *(float *)(param_1 + 0x330 + *(int *)(param_1 + 800) * 4) /
          *(float *)(param_1 + 0x330 + *(int *)(param_1 + 0x324) * 4);
  if (fVar2 < _DAT_004b8eec) {
    fVar2 = _DAT_004b8eec;
  }
  iVar12 = FUN_004ad7d4(param_1);
  if (iVar12 != 0) {
    *(float *)(param_1 + 0x1c8) =
         fVar2 * fVar2 *
         fVar6 * (fVar4 * fVar9 * fVar10 * fVar11 * param_2 +
                 fVar5 * fVar1 + fVar3 * fVar7 * fVar8 * fVar10 * param_2) +
         *(float *)(param_1 + 0x1c8);
  }
  return;
}



/* @004b8ef0 file=? name=FUN_004b8ef0 */

void __cdecl FUN_004b8ef0(int param_1)

{
  float fVar1;
  int iVar2;
  float10 fVar3;
  
  iVar2 = *(int *)(param_1 + 0xd0);
  fVar3 = FUN_004b8ac0(param_1,*(float *)(param_1 + 0x330 + *(int *)(param_1 + 0x32c) * 4));
  fVar1 = (float)fVar3;
  if (fVar1 < *(float *)(iVar2 + 0x7a0)) {
    fVar1 = *(float *)(iVar2 + 0x7a0);
  }
  *(float *)(iVar2 + 0x7a0) = fVar1;
  return;
}



/* @004b8f3c file=? name=FUN_004b8f3c */

undefined4 __cdecl FUN_004b8f3c(int param_1,int param_2)

{
  if (param_2 == 0) {
    param_2 = FUN_00417ab4(param_1 + 0x1d0);
  }
  if (param_2 == 0) {
    return 0;
  }
  if ((*(float *)(param_1 + 0x330 + *(int *)(param_1 + 800) * 4) <= *(float *)(param_2 + 0x1dc)) &&
     (*(int *)(param_2 + 0x210) == 2)) {
    return 1;
  }
  return 0;
}



/* @004b8f94 file=? name=FUN_004b8f94 */

void __cdecl FUN_004b8f94(int param_1,float param_2)

{
  float10 fVar1;
  
  fVar1 = FUN_004b8ac0(param_1,param_2);
  FUN_004dd138((double)(((float)(fVar1 * (float10)3.6) - 0.0) / 350.0));
  return;
}



/* @004b8fec file=? name=FUN_004b8fec */

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

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

{
  int iVar1;
  int iVar2;
  float *pfVar3;
  float *pfVar4;
  
  FUN_004b0f74(param_1,param_2,param_3,param_4,&DAT_0051154c,0,0);
  *param_1 = (int)&PTR_LAB_005117dc;
  param_1[199] = 0x3f800000;
  param_1[0xd2] = (int)((float)param_1[0x47] - (float)param_1[0x46]);
  param_1[0xd3] = (int)((float)param_1[0xd2] * (float)param_1[0xd2]);
  param_1[0xd4] = *(int *)(param_4 + 400);
  param_1[0xd5] = *(int *)(param_4 + 0x194);
  param_1[0x54] = 0x3e19999a;
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_LAB_00511620;
    param_1[8] = DAT_00511624;
    param_1[9] = DAT_00511628;
  }
  iVar1 = FUN_00417ab4((int)(param_1 + 0x74));
  param_1[10] = param_1[10] | 8;
  iVar2 = 0;
  pfVar4 = (float *)(param_1 + 0xcc);
  pfVar3 = (float *)(param_4 + 0x198);
  do {
    if (*pfVar3 == _DAT_004b9110) {
      param_1[0xcb] = iVar2 + -1;
      break;
    }
    *pfVar4 = *pfVar3 * *(float *)(iVar1 + 0x1d8);
    iVar2 = iVar2 + 1;
    pfVar4 = pfVar4 + 1;
    pfVar3 = pfVar3 + 1;
  } while (iVar2 < 5);
  iVar1 = *(int *)(param_4 + 0x1ac);
  param_1[0xc9] = iVar1;
  param_1[200] = iVar1;
  param_1[0xca] = 0;
  return param_1;
}



/* @004b9140 file=? name=FUN_004b9140 */

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

undefined4 __cdecl
FUN_004b9140(int param_1,char *param_2,char *param_3,char *param_4,int param_5,int param_6,
            int param_7)

{
  int *piVar1;
  uint *puVar2;
  undefined4 *puVar3;
  int iVar4;
  undefined4 uVar5;
  char *pcVar6;
  undefined4 *puVar7;
  uint *puVar8;
  char cVar9;
  float10 fVar10;
  float *local_1c;
  int *local_10;
  int *local_c;
  int *local_8;
  
  iVar4 = FUN_004b13ac(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar4 == 0) {
    uVar5 = 0;
  }
  else {
    param_4[0x24] = -0x50;
    param_4[0x25] = '\x01';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x3a;
    param_4[0x21] = '\v';
    param_4[0x22] = '\0';
    param_4[0x23] = '\0';
    if (param_7 == 1) {
      param_4[400] = '\0';
      param_4[0x191] = '\0';
      param_4[0x192] = -0x80;
      param_4[0x193] = -0x41;
      param_4[0x194] = '\0';
      param_4[0x195] = '\0';
      param_4[0x196] = -0x80;
      param_4[0x197] = -0x41;
      iVar4 = 0;
      pcVar6 = param_4 + 0x198;
      do {
        pcVar6[0] = '\0';
        pcVar6[1] = '\0';
        pcVar6[2] = -0x80;
        pcVar6[3] = -0x41;
        iVar4 = iVar4 + 1;
        pcVar6 = pcVar6 + 4;
      } while (iVar4 < 5);
      param_4[0x1ac] = -1;
      param_4[0x1ad] = -1;
      param_4[0x1ae] = -1;
      param_4[0x1af] = -1;
    }
    iVar4 = FUN_00404118(param_5,param_3,s_VelocityEfficiency_00511709,(float *)(param_4 + 400));
    if ((iVar4 == 0) && (_DAT_004b9470 == *(float *)(param_4 + 400))) {
      FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,s_Missing_VelocityEfficiency__0051171c,(char *)0x0);
      FUN_004d9c38(&DAT_00524e20);
      uVar5 = 0;
    }
    else {
      iVar4 = FUN_00404118(param_5,param_3,s_AccelerationEfficiency_00511739,
                           (float *)(param_4 + 0x194));
      if ((iVar4 == 0) && (_DAT_004b9470 == *(float *)(param_4 + 0x194))) {
        FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
        FUN_004dbb24(&DAT_00524e20,s_Missing_AccelerationEfficiency__00511750,(char *)0x0);
        FUN_004d9c38(&DAT_00524e20);
        uVar5 = 0;
      }
      else {
        local_8 = FUN_00404720(param_5,param_3,s_SeekVoltage_00511771);
        iVar4 = FUN_00403b60((int)local_8);
        if ((iVar4 == 0) && (*(int *)(param_4 + 0x1ac) == -1)) {
          if (local_8 != (int *)0x0) {
            (**(code **)*local_8)(local_8,3);
          }
          FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
          FUN_004dbb24(&DAT_00524e20,s_missing_SeekVoltage_0051177d,(char *)0x0);
          FUN_004d9c38(&DAT_00524e20);
        }
        else {
          local_1c = (float *)(param_4 + 0x198);
          puVar3 = (undefined4 *)local_8[1];
          while (puVar3 != (undefined4 *)0x0) {
            puVar7 = (undefined4 *)FUN_00402298(0x10);
            if (puVar7 == (undefined4 *)0x0) {
              local_c = (int *)0x0;
            }
            else {
              local_c = (int *)FUN_004023f4(puVar7);
            }
            local_c[3] = local_c[3] + 1;
            FUN_00402a98((int *)&local_10,(int *)&local_c,(char *)(puVar3 + 2));
            piVar1 = local_10 + 3;
            *piVar1 = *piVar1 + -1;
            if (*piVar1 == 0) {
              FUN_004024d8(local_10,3);
            }
            puVar8 = (uint *)FUN_00402298(0x10);
            if (puVar8 == (uint *)0x0) {
              puVar8 = (uint *)0x0;
            }
            else {
              puVar8 = FUN_00402460(puVar8,s_SeekVoltageRecommendedIndex_00511793);
            }
            puVar8[3] = puVar8[3] + 1;
            iVar4 = FUN_004027d8((int)local_c,(int)puVar8);
            cVar9 = iVar4 == 0;
            puVar2 = puVar8 + 3;
            *puVar2 = *puVar2 - 1;
            if (*puVar2 == 0) {
              FUN_004024d8((int *)puVar8,3);
            }
            if (cVar9 == '\0') {
              fVar10 = (float10)FUN_004dd1cc(puVar3[1]);
              *local_1c = (float)fVar10;
              local_1c = local_1c + 1;
            }
            else {
              iVar4 = FUN_004dd1e0((char *)puVar3[1]);
              *(int *)(param_4 + 0x1ac) = iVar4;
            }
            puVar3 = (undefined4 *)*puVar3;
            piVar1 = local_c + 3;
            *piVar1 = *piVar1 + -1;
            if (*piVar1 == 0) {
              FUN_004024d8(local_c,3);
            }
          }
          if (*(int *)(param_4 + 0x1ac) == -1) {
            FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
            FUN_004dbb24(&DAT_00524e20,s_missing_SeekVoltageRecommendedIn_005117af,(char *)0x0);
            if (local_8 != (int *)0x0) {
              (**(code **)*local_8)(local_8,3);
            }
            return 0;
          }
          if (local_8 != (int *)0x0) {
            (**(code **)*local_8)(local_8,3);
          }
        }
        uVar5 = 1;
      }
    }
  }
  return uVar5;
}



/* @004b9550 file=? name=FUN_004b9550 */

void __cdecl FUN_004b9550(int param_1,int param_2)

{
  int *piVar1;
  int iVar2;
  uint uVar3;
  
  uVar3 = (int)*(uint *)(param_2 + 0xc) >> 0x1f;
  iVar2 = ((*(uint *)(param_2 + 0xc) ^ uVar3) - uVar3) + -1;
  piVar1 = (int *)**(undefined4 **)(*(int *)(param_1 + 0xd0) + 0x128);
  if (*(int *)(param_2 + 0xc) < 1) {
    (**(code **)(*piVar1 + 0x3c))(piVar1,iVar2);
    *(undefined4 *)(param_1 + 0x110) = 0xffffffff;
  }
  else {
    *(undefined4 *)(param_1 + 0x110) = 0;
    (**(code **)(*piVar1 + 0x38))(piVar1,iVar2,param_1 + 0x31c,param_1,10,9,0);
  }
  return;
}



/* @004b95b8 file=? name=FUN_004b95b8 */

void __cdecl FUN_004b95b8(int param_1,int param_2)

{
  int *piVar1;
  
  if (0 < *(int *)(param_2 + 0xc)) {
    piVar1 = (int *)**(undefined4 **)(*(int *)(param_1 + 0xd0) + 0x128);
    (**(code **)(*piVar1 + 0x44))(piVar1,*(int *)(param_2 + 0xc),param_1 + 0x31c);
  }
  return;
}



/* @004b95ec file=bt/mechweap.cpp name=FUN_004b95ec */

void FUN_004b95ec(void)

{
  FUN_0040385c(s_MechWeapon_abstract_class_should_00511a4c,s_d__tesla_bt_bt_MECHWEAP_CPP_00511a86,
               0xc9);
  return;
}



/* @004b9608 file=? name=FUN_004b9608 */

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

undefined4 __cdecl FUN_004b9608(int param_1)

{
  undefined4 uVar1;
  
  if (((float)*(int *)(param_1 + 0x31c) <= _DAT_004b9648) ||
     (_DAT_004b9648 < (float)*(int *)(param_1 + 0x3a4))) {
    uVar1 = 0;
  }
  else {
    uVar1 = 1;
  }
  *(undefined4 *)(param_1 + 0x3a4) = *(undefined4 *)(param_1 + 0x31c);
  return uVar1;
}



/* @004b964c file=? name=FUN_004b964c */

void __cdecl FUN_004b964c(int param_1,int param_2)

{
  FUN_0041bd34(param_1,param_2);
  if (*(int *)(param_2 + 0x14) != 0) {
    FUN_0041bbd8(param_1 + 0x350,0);
  }
  FUN_0041bbd8(param_1 + 0x350,*(int *)(param_2 + 0x10));
  return;
}



/* @004b9690 file=? name=FUN_004b9690 */

void __cdecl FUN_004b9690(int param_1,undefined4 *param_2,undefined2 param_3)

{
  FUN_0041c500(param_1,param_2,param_3);
  *param_2 = 0x18;
  param_2[4] = *(undefined4 *)(param_1 + 0x364);
  if (*(int *)(param_1 + 0x360) == 0) {
    param_2[5] = 1;
  }
  else {
    param_2[5] = 0;
  }
  return;
}



/* @004b96d4 file=? name=FUN_004b96d4 */

void __cdecl FUN_004b96d4(int *param_1,int *param_2)

{
  FUN_004b0efc(param_1,param_2);
  return;
}



/* @004b96ec file=? name=FUN_004b96ec */

void __cdecl FUN_004b96ec(int *param_1,int param_2)

{
  FUN_004b0e6c(param_1,param_2);
  param_1[0xfa] = 0;
  param_1[200] = 0x3f800000;
  param_1[199] = 0;
  param_1[0xe9] = 0;
  return;
}



/* @004b9728 file=? name=FUN_004b9728 */

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

{
  int iVar1;
  int iVar2;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  undefined4 local_64 [2];
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54 [2];
  int local_4c;
  uint local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  int local_14;
  uint local_10;
  undefined4 *local_c;
  int local_8;
  
  iVar1 = *(int *)(param_1 + 0xd0);
  iVar2 = FUN_0041a1a4(**(int **)(param_2 + 0xc),0x50bdb4);
  if ((iVar2 == 0) || (*(int *)(iVar1 + 0x38c) != -1)) {
    FUN_00408440(param_3 + 8,(undefined4 *)(iVar1 + 0x37c));
    local_8 = *(int *)(param_1 + 0xd8);
    local_c = (undefined4 *)(iVar1 + 0x184);
    iVar2 = *(int *)(iVar1 + 0x38c);
    local_70 = 100;
    local_6c = 0x12;
    local_68 = 1;
    FUN_00420ea4(local_64,(undefined4 *)&DAT_00522524);
    local_5c = 0;
    local_58 = 0;
    FUN_00420ea4(local_54,local_c);
    local_48 = (uint)(iVar2 < 0);
    local_44 = *param_3;
    local_40 = param_3[1];
    local_3c = param_3[2];
    local_38 = param_3[3];
    local_34 = param_3[4];
    local_30 = param_3[5];
    local_2c = param_3[6];
    local_28 = param_3[7];
    local_24 = param_3[8];
    local_20 = param_3[9];
    local_1c = param_3[10];
    local_18 = param_3[0xb];
    local_14 = local_8;
    local_10 = (uint)(local_8 < 0);
    local_4c = iVar2;
    FUN_0049b6d8(*(int *)(iVar1 + 0x434),param_2,(int)&local_70);
  }
  return;
}



/* @004b9864 file=? name=FUN_004b9864 */

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

{
  float10 fVar1;
  float local_68 [12];
  float local_38;
  float local_34;
  undefined4 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_004087f4(&local_2c,param_3);
  fVar1 = FUN_004dc8ec((double)-local_2c,SUB84((double)-local_24,0),
                       (uint)((ulonglong)(double)-local_24 >> 0x20));
  local_c = (float)fVar1;
  local_8 = local_c;
  fVar1 = FUN_00408110(local_c);
  local_10 = (float)fVar1;
  local_8 = local_10;
  fVar1 = FUN_004dd138((double)(local_24 * local_24 + local_2c * local_2c));
  local_14 = (float)fVar1;
  fVar1 = FUN_004dc8ec((double)local_28,SUB84((double)local_14,0),
                       (uint)((ulonglong)(double)local_14 >> 0x20));
  local_1c = (float)fVar1;
  local_18 = local_1c;
  fVar1 = FUN_00408110(local_1c);
  local_34 = (float)fVar1;
  local_38 = local_8;
  local_30 = 0;
  local_20 = local_34;
  local_18 = local_34;
  FUN_0040aadc(local_68);
  FUN_0040ad2c(local_68,&local_38);
  FUN_00409a70(param_2,local_68);
  return;
}



/* @004b9948 file=? name=FUN_004b9948 */

void __cdecl FUN_004b9948(int param_1,float *param_2)

{
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  int local_20 [7];
  
  iVar1 = *(int *)(param_1 + 0xd0);
  uVar2 = *(undefined4 *)(param_1 + 0xdc);
  FUN_0041f216(local_20,iVar1 + 0x300);
  iVar3 = (**(code **)(local_20[0] + 0x34))(local_20,uVar2);
  FUN_0041f235(local_20,2);
  FUN_00424da8(iVar1,iVar3,param_2);
  return;
}



/* @004b99a8 file=? name=FUN_004b99a8 */

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

int * __cdecl
FUN_004b99a8(int *param_1,int param_2,undefined4 param_3,char *param_4,undefined4 param_5,
            undefined4 param_6,int *param_7,int param_8)

{
  int *piVar1;
  int iVar2;
  char *pcVar3;
  int local_24 [7];
  int *local_8;
  
  if (param_7 == (int *)0x0) {
    param_7 = param_1 + 199;
  }
  FUN_004b0f74(param_1,param_2,param_3,param_4,param_5,(int)param_7,param_8);
  *param_1 = (int)&PTR_FUN_00511d2c;
  iVar2 = _DAT_004b9b98;
  param_1[0xd1] = _DAT_004b9b98;
  param_1[0xd0] = iVar2;
  param_1[0xcf] = iVar2;
  FUN_0041b9ec(param_1 + 0xd4,param_6);
  FUN_0041db7c((int)(param_1 + 0xea));
  param_1[0xf7] = *(int *)(param_4 + 400);
  param_1[0xf9] = *(int *)(param_4 + 0x198);
  param_1[0xea] = *(int *)(param_4 + 0x1a0);
  param_1[0xeb] = *(int *)(param_4 + 0x19c);
  param_1[0xfb] = *(int *)(param_4 + 0x28);
  param_1[0xca] = *(int *)(param_4 + 0x194);
  param_1[0xf6] = *(int *)(param_4 + 0x1a4);
  param_1[0xce] = *(int *)(param_4 + 0x1a8);
  param_1[0xcf] = *(int *)(param_4 + 0x1ac);
  param_1[0xd0] = *(int *)(param_4 + 0x1b0);
  param_1[0xd1] = *(int *)(param_4 + 0x1b4);
  param_1[0xd2] = *(int *)(param_4 + 0x1b8);
  param_1[0xcb] = param_1[0xca];
  param_1[10] = param_1[10] | 8;
  param_1[0xc9] = 0;
  param_1[0xd3] = 0;
  iVar2 = param_1[0x37];
  FUN_0041f216(local_24,param_2 + 0x300);
  iVar2 = (**(code **)(local_24[0] + 0x34))(local_24,iVar2);
  FUN_0041f235(local_24,2);
  local_8 = *(int **)(iVar2 + 0x11c);
  local_8[3] = local_8[3] + 1;
  pcVar3 = FUN_004d4c78((char *)local_8[2],&DAT_00511aa2);
  if (pcVar3 == (char *)0x0) {
    param_1[0xcd] = 0;
  }
  else {
    param_1[0xcd] = 1;
  }
  param_1[0xfa] = 0;
  param_1[200] = 0x3f800000;
  param_1[199] = 0;
  param_1[0xe9] = 0;
  param_1[0xf8] = (uint)(param_1[0xcd] == 0);
  param_1[0xcc] = 0;
  piVar1 = local_8 + 3;
  *piVar1 = *piVar1 + -1;
  if (*piVar1 == 0) {
    FUN_004024d8(local_8,3);
  }
  return param_1;
}



/* @004b9b9c file=? name=FUN_004b9b9c */

void __cdecl FUN_004b9b9c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_00511d2c;
    FUN_0041baa4(param_1 + 0xd4,2);
    FUN_004b115c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004b9bdc file=? name=FUN_004b9bdc */

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

void __cdecl FUN_004b9bdc(int param_1)

{
  int iVar1;
  float10 fVar2;
  float local_10;
  float local_c;
  float local_8;
  
  iVar1 = *(int *)(param_1 + 0xd0);
  if (*(int *)(iVar1 + 0x388) == 0) {
    *(undefined4 *)(param_1 + 0x324) = 0xbf800000;
    *(undefined4 *)(param_1 + 0x34c) = 0;
  }
  else {
    FUN_00408644(&local_10,(float *)(iVar1 + 0x37c),(float *)(iVar1 + 0x100));
    fVar2 = FUN_004dd138((double)(local_8 * local_8 + local_c * local_c + local_10 * local_10));
    *(float *)(param_1 + 0x324) = (float)fVar2;
    *(float *)(param_1 + 0x328) =
         (_DAT_004b9c98 - *(float *)(*(int *)(param_1 + 0xe0) + 0x158)) *
         *(float *)(param_1 + 0x32c);
    if (*(float *)(param_1 + 0x328) <= *(float *)(param_1 + 0x324)) {
      *(undefined4 *)(param_1 + 0x34c) = 0;
    }
    else {
      *(undefined4 *)(param_1 + 0x34c) = 1;
    }
  }
  return;
}



/* @004b9cbc file=? name=FUN_004b9cbc */

void __cdecl FUN_004b9cbc(int param_1,undefined4 *param_2)

{
  FUN_0040a7f4(param_2,(undefined4 *)(*(int *)(param_1 + 0xd0) + 0x1c4));
  return;
}



/* @004b9cdc file=? name=FUN_004b9cdc */

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

{
  FUN_00408644(param_3,(float *)(*(int *)(param_1 + 0xd0) + 0x37c),param_2);
  return;
}



/* @004b9d00 file=? name=FUN_004b9d00 */

void __cdecl FUN_004b9d00(int param_1)

{
  FUN_004b1224(param_1);
  return;
}



/* @004b9d10 file=? name=FUN_004b9d10 */

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

undefined4 __cdecl
FUN_004b9d10(int param_1,int param_2,char *param_3,char *param_4,char *param_5,int param_6,
            int param_7,int param_8)

{
  char *pcVar1;
  float fVar2;
  bool bVar3;
  int iVar4;
  undefined4 uVar5;
  undefined3 extraout_var;
  char *pcVar6;
  char *pcVar7;
  undefined4 *puVar8;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  float local_1c;
  float local_18;
  char *local_14;
  char *local_10;
  byte *local_c;
  char *local_8;
  
  iVar4 = FUN_004b13ac(param_2,param_3,param_4,param_5,param_6,param_7,param_8);
  if (iVar4 == 0) {
    uVar5 = 0;
  }
  else {
    param_5[0x24] = -0x44;
    param_5[0x25] = '\x01';
    param_5[0x26] = '\0';
    param_5[0x27] = '\0';
    param_5[0x20] = -0x33;
    param_5[0x21] = '\v';
    param_5[0x22] = '\0';
    param_5[0x23] = '\0';
    if (param_8 == 1) {
      param_5[0x19c] = '\0';
      param_5[0x19d] = '\0';
      param_5[0x19e] = -0x80;
      param_5[0x19f] = -0x41;
      param_5[400] = '\0';
      param_5[0x191] = '\0';
      param_5[0x192] = -0x80;
      param_5[0x193] = -0x41;
      param_5[0x194] = '\0';
      param_5[0x195] = '\0';
      param_5[0x196] = -0x80;
      param_5[0x197] = -0x41;
      param_5[0x1a4] = '\0';
      param_5[0x1a5] = '\0';
      param_5[0x1a6] = -0x80;
      param_5[0x1a7] = -0x41;
      param_5[0x1a0] = -1;
      param_5[0x1a1] = -1;
      param_5[0x1a2] = -1;
      param_5[0x1a3] = -1;
      param_5[0x198] = -1;
      param_5[0x199] = -1;
      param_5[0x19a] = -1;
      param_5[0x19b] = -1;
      param_5[0x1a8] = -1;
      fVar2 = _DAT_004ba37c;
      param_5[0x1a9] = -1;
      param_5[0x1aa] = -1;
      param_5[0x1ab] = -1;
      local_18 = _DAT_004ba37c;
      local_1c = _DAT_004ba37c;
      local_20 = _DAT_004ba37c;
      *(float *)(param_5 + 0x1ac) = _DAT_004ba37c;
      *(float *)(param_5 + 0x1b0) = fVar2;
      *(float *)(param_5 + 0x1b4) = fVar2;
      param_5[0x1b8] = -1;
      param_5[0x1b9] = -1;
      param_5[0x1ba] = -1;
      param_5[0x1bb] = -1;
    }
    if ((*(int *)(param_5 + 0x28) == -1) && (1 < param_8)) {
      FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,s_missing_SegmentPageName__00511aa4,(char *)0x0);
      uVar5 = 0;
    }
    else {
      iVar4 = FUN_00404118(param_6,param_4,s_DamageAmount_00511abe,(float *)(param_5 + 0x19c));
      if ((iVar4 == 0) && (_DAT_004ba37c == *(float *)(param_5 + 0x19c))) {
        FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
        FUN_004dbb24(&DAT_00524e20,s_Missing_DamageAmount_00511acb,(char *)0x0);
        FUN_004d9c38(&DAT_00524e20);
        uVar5 = 0;
      }
      else {
        iVar4 = FUN_00404118(param_6,param_4,s_HeatCostToFire_00511ae1,(float *)(param_5 + 0x1a4));
        if ((iVar4 == 0) && (_DAT_004ba37c == *(float *)(param_5 + 0x1a4))) {
          FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
          FUN_004dbb24(&DAT_00524e20,s_missing_HeatCostToFire___00511af0,(char *)0x0);
          uVar5 = 0;
        }
        else {
          bVar3 = FUN_004040d8(param_6,param_4,s_PipPosition_00511b0a,(int *)(param_5 + 0x1a8));
          if ((CONCAT31(extraout_var,bVar3) == 0) && (*(int *)(param_5 + 0x1a8) == -1)) {
            FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
            FUN_004dbb24(&DAT_00524e20,s_missing_PipPosition___00511b16,(char *)0x0);
            uVar5 = 0;
          }
          else {
            local_8 = s_Unspecified_00511b2d;
            iVar4 = FUN_00404088(param_6,param_4,s_PipColor_00511b39,&local_8);
            if (iVar4 == 0) {
              local_c = (byte *)(param_5 + 0x1ac);
              local_24 = _DAT_004ba37c;
              local_28 = _DAT_004ba37c;
              local_2c = _DAT_004ba37c;
              iVar4 = FUN_004d4b14((byte *)&local_2c,local_c,0xc);
              if (iVar4 == 0) {
                FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
                FUN_004dbb24(&DAT_00524e20,s_missing_PipColor__00511b42,(char *)0x0);
                return 0;
              }
            }
            pcVar7 = s_Unspecified_00511b55;
            pcVar6 = local_8;
            do {
              bVar3 = *pcVar6 == *pcVar7;
              if (!bVar3) break;
              if (*pcVar6 == '\0') goto LAB_004b9fcd;
              pcVar1 = pcVar6 + 1;
              bVar3 = *pcVar1 == pcVar7[1];
              if (!bVar3) break;
              pcVar6 = pcVar6 + 2;
              pcVar7 = pcVar7 + 2;
              bVar3 = *pcVar1 == '\0';
            } while (!bVar3);
            if (!bVar3) {
              FUN_00406824(local_8,(float *)(param_5 + 0x1ac));
            }
LAB_004b9fcd:
            iVar4 = FUN_00404190(param_6,param_4,s_PipExtendedRange_00511b61,
                                 (undefined4 *)(param_5 + 0x1b8));
            if ((iVar4 == 0) && (*(int *)(param_5 + 0x1b8) == -1)) {
              FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
              FUN_004dbb24(&DAT_00524e20,s_missing_PipExtendedRange__00511b72,(char *)0x0);
              FUN_004d9c38(&DAT_00524e20);
              uVar5 = 0;
            }
            else {
              iVar4 = FUN_00404118(param_6,param_4,s_RechargeRate_00511b8e,(float *)(param_5 + 400))
              ;
              if ((iVar4 == 0) && (_DAT_004ba37c == *(float *)(param_5 + 400))) {
                FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
                FUN_004dbb24(&DAT_00524e20,s_Missing_RechargeRate_00511b9b,(char *)0x0);
                FUN_004d9c38(&DAT_00524e20);
                uVar5 = 0;
              }
              else {
                iVar4 = FUN_00404118(param_6,param_4,s_WeaponRange_00511bb1,
                                     (float *)(param_5 + 0x194));
                if ((iVar4 == 0) && (_DAT_004ba37c == *(float *)(param_5 + 0x194))) {
                  FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
                  FUN_004dbb24(&DAT_00524e20,s_Missing_WeaponRange_00511bbd,(char *)0x0);
                  FUN_004d9c38(&DAT_00524e20);
                  uVar5 = 0;
                }
                else {
                  local_10 = s_Unspecified_00511bd2;
                  iVar4 = FUN_00404088(param_6,param_4,s_DamageType_00511bde,&local_10);
                  if ((iVar4 == 0) && (_DAT_004ba37c == *(float *)(param_5 + 0x19c))) {
                    FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
                    FUN_004dbb24(&DAT_00524e20,s_missing_DamageType__00511be9,(char *)0x0);
                    uVar5 = 0;
                  }
                  else {
                    pcVar7 = s_Unspecified_00511bff;
                    pcVar6 = local_10;
                    do {
                      if (*pcVar7 != *pcVar6) goto LAB_004ba177;
                      bVar3 = true;
                      if (*pcVar7 == '\0') break;
                      pcVar1 = pcVar7 + 1;
                      if (*pcVar1 != pcVar6[1]) goto LAB_004ba177;
                      pcVar7 = pcVar7 + 2;
                      pcVar6 = pcVar6 + 2;
                      bVar3 = *pcVar1 == '\0';
                    } while (!bVar3);
                    if (!bVar3) {
LAB_004ba177:
                      iVar4 = FUN_004d4b58(local_10,s_CollisionDamage_00511c0b);
                      if (iVar4 == 0) {
                        param_5[0x1a0] = '\0';
                        param_5[0x1a1] = '\0';
                        param_5[0x1a2] = '\0';
                        param_5[0x1a3] = '\0';
                      }
                      else {
                        iVar4 = FUN_004d4b58(local_10,s_BallisticDamage_00511c1b);
                        if (iVar4 == 0) {
                          param_5[0x1a0] = '\x01';
                          param_5[0x1a1] = '\0';
                          param_5[0x1a2] = '\0';
                          param_5[0x1a3] = '\0';
                        }
                        else {
                          iVar4 = FUN_004d4b58(local_10,s_ExplosiveDamage_00511c2b);
                          if (iVar4 == 0) {
                            param_5[0x1a0] = '\x02';
                            param_5[0x1a1] = '\0';
                            param_5[0x1a2] = '\0';
                            param_5[0x1a3] = '\0';
                          }
                          else {
                            iVar4 = FUN_004d4b58(local_10,s_LaserDamage_00511c3b);
                            if (iVar4 == 0) {
                              param_5[0x1a0] = '\x03';
                              param_5[0x1a1] = '\0';
                              param_5[0x1a2] = '\0';
                              param_5[0x1a3] = '\0';
                            }
                            else {
                              iVar4 = FUN_004d4b58(local_10,s_EnergyDamage_00511c47);
                              pcVar6 = local_10;
                              if (iVar4 != 0) {
                                FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
                                FUN_004dbb24(&DAT_00524e20,s_has_an_unknown_DamageType_of_00511c54,
                                             (char *)0x0);
                                FUN_004dbb24(&DAT_00524e20,pcVar6,(char *)0x0);
                                FUN_004d9c38(&DAT_00524e20);
                                return 0;
                              }
                              param_5[0x1a0] = '\x04';
                              param_5[0x1a1] = '\0';
                              param_5[0x1a2] = '\0';
                              param_5[0x1a3] = '\0';
                            }
                          }
                        }
                      }
                    }
                    local_14 = s_Unspecified_00511c73;
                    iVar4 = FUN_00404088(param_6,param_4,s_ExplosionModelFile_00511c7f,&local_14);
                    if ((iVar4 == 0) && (*(int *)(param_5 + 0x198) == -1)) {
                      FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
                      FUN_004dbb24(&DAT_00524e20,s_missing_ExplosionModelFile__00511c92,(char *)0x0)
                      ;
                      uVar5 = 0;
                    }
                    else {
                      puVar8 = (undefined4 *)0x0;
                      pcVar7 = s_Unspecified_00511cb0;
                      pcVar6 = local_14;
                      do {
                        bVar3 = *pcVar6 == *pcVar7;
                        if (!bVar3) break;
                        if (*pcVar6 == '\0') goto LAB_004ba302;
                        pcVar1 = pcVar6 + 1;
                        bVar3 = *pcVar1 == pcVar7[1];
                        if (!bVar3) break;
                        pcVar6 = pcVar6 + 2;
                        pcVar7 = pcVar7 + 2;
                        bVar3 = *pcVar1 == '\0';
                      } while (!bVar3);
                      if (!bVar3) {
                        puVar8 = (undefined4 *)FUN_00406ff8(param_1,local_14,1,-1);
                      }
LAB_004ba302:
                      pcVar6 = local_14;
                      if ((puVar8 == (undefined4 *)0x0) && (*(int *)(param_5 + 0x198) == -1)) {
                        FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
                        FUN_004dbb24(&DAT_00524e20,s_cannot_find_00511cbc,(char *)0x0);
                        FUN_004dbb24(&DAT_00524e20,pcVar6,(char *)0x0);
                        FUN_004dbb24(&DAT_00524e20,s_in_resource_file__00511cca,(char *)0x0);
                        uVar5 = 0;
                      }
                      else {
                        if (puVar8 != (undefined4 *)0x0) {
                          *(undefined4 *)(param_5 + 0x198) = *puVar8;
                        }
                        uVar5 = 1;
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  return uVar5;
}



/* @004ba45c file=bt/mechweap.hpp name=FUN_004ba45c */

void FUN_004ba45c(void)

{
  FUN_0040385c(s_ERROR__Accessing_Pure_Virtual_Me_00511cde,s_d__tesla_bt_bt_mechweap_hpp_00511d0f,
               0x157);
  return;
}



/* @004ba478 file=? name=FUN_004ba478 */

int __cdecl FUN_004ba478(int param_1,int param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  int iVar2;
  int iVar3;
  int iVar4;
  int iVar5;
  
  bVar1 = FUN_004ac9c8(param_1);
  iVar4 = CONCAT31(extraout_var,bVar1);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    iVar2 = FUN_004ad7d4(param_1);
    iVar4 = 0;
    if ((iVar2 != 0) && (iVar4 = param_2, 0 < *(int *)(param_2 + 0xc))) {
      iVar2 = *(int *)(param_1 + 0x3f0);
      iVar5 = *(int *)(param_1 + 0x3fc) + 1;
      iVar3 = iVar2 + 1;
      iVar4 = iVar3 / iVar5;
      iVar3 = iVar3 % iVar5;
      *(int *)(param_1 + 0x3f0) = iVar3;
      if (iVar2 < iVar3) {
        iVar4 = FUN_004ba9a8(param_1);
      }
    }
  }
  return iVar4;
}



/* @004ba4d0 file=? name=FUN_004ba4d0 */

void __cdecl FUN_004ba4d0(int *param_1,int param_2)

{
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  FUN_004b96ec(param_1,param_2);
  FUN_0041bbd8((int)(param_1 + 0xd4),3);
  param_1[0x105] = 0;
  param_1[0x117] = 0;
  param_1[0x11b] = 0;
  param_1[0x11d] = 0;
  local_10 = 0x3f800000;
  local_c = 0x3f800000;
  local_8 = 0x3f800000;
  FUN_00408440(param_1 + 0x10b,&local_10);
  FUN_00409968(param_1 + 0x107,&DAT_004e0fa4);
  param_1[0x106] = 0;
  *(ushort *)(param_1 + 6) = *(ushort *)(param_1 + 6) | 1;
  return;
}



/* @004ba568 file=? name=FUN_004ba568 */

void __cdecl FUN_004ba568(int param_1,int param_2)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 local_14 [2];
  int local_c;
  int local_8;
  
  iVar1 = FUN_00421070((int *)(param_2 + 0x30),(int *)&DAT_00522524);
  if (iVar1 == 0) {
    *(undefined4 *)(param_1 + 0x474) = 0;
  }
  else {
    local_c = param_2 + 0x30;
    local_8 = *(int *)(DAT_004efc94 + 0x2c);
    uVar2 = (**(code **)(*(int *)(local_8 + 0x54) + 0xc))(local_8 + 0x54,local_c);
    *(undefined4 *)(param_1 + 0x474) = uVar2;
    if (*(int *)(param_1 + 0x474) == 0) {
      return;
    }
  }
  FUN_004b964c(param_1,param_2);
  iVar1 = *(int *)(param_2 + 0x18);
  *(int *)(param_1 + 0x418) = iVar1;
  if (iVar1 == 0) {
    FUN_0041bbd8(param_1 + 0x350,2);
  }
  else {
    FUN_0041bbd8(param_1 + 0x350,0);
  }
  *(undefined4 *)(param_1 + 0x46c) = *(undefined4 *)(param_2 + 0x28);
  FUN_00408440((undefined4 *)(param_1 + 0x460),(undefined4 *)(param_2 + 0x1c));
  FUN_00420ea4(local_14,(undefined4 *)(param_2 + 0x30));
  *(undefined4 *)(param_1 + 0x470) = *(undefined4 *)(param_2 + 0x2c);
  *(uint *)(param_1 + 0x28) = *(uint *)(param_1 + 0x28) & 0xfffffffd;
  *(undefined4 *)(param_1 + 0x10) = *(undefined4 *)(param_1 + 0x14);
  return;
}



/* @004ba65c file=? name=FUN_004ba65c */

void __cdecl FUN_004ba65c(int param_1,undefined4 *param_2,undefined2 param_3)

{
  FUN_004b9690(param_1,param_2,param_3);
  *param_2 = 0x38;
  param_2[6] = *(undefined4 *)(param_1 + 0x418);
  param_2[10] = *(undefined4 *)(param_1 + 0x46c);
  FUN_00408440(param_2 + 7,(undefined4 *)(param_1 + 0x460));
  param_2[0xb] = *(undefined4 *)(param_1 + 0x470);
  if (*(int *)(param_1 + 0x474) == 0) {
    FUN_00420ef4(param_2 + 0xc,(undefined4 *)&DAT_00522524);
  }
  else {
    FUN_00420ef4(param_2 + 0xc,(undefined4 *)(*(int *)(param_1 + 0x474) + 0x184));
  }
  return;
}



/* @004ba6e0 file=? name=FUN_004ba6e0 */

undefined4 __cdecl FUN_004ba6e0(int param_1,int param_2)

{
  if (param_2 == 0) {
    param_2 = FUN_00417ab4(param_1 + 0x1d0);
  }
  if (param_2 == 0) {
    return 0;
  }
  if ((*(float *)(param_1 + 0x400 + *(int *)(param_1 + 0x3f0) * 4) <= *(float *)(param_2 + 0x1dc))
     && (*(int *)(param_2 + 0x210) == 2)) {
    return 1;
  }
  return 0;
}



/* @004ba738 file=? name=FUN_004ba738 */

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

void __cdecl FUN_004ba738(int param_1)

{
  float fVar1;
  float10 fVar2;
  
  fVar2 = FUN_004dcd00((double)(*(float *)(param_1 + 0x414) - _DAT_004ba818));
  if ((float10)_DAT_004ba81c < fVar2) {
    *(float *)(param_1 + 800) =
         *(float *)(param_1 + 0x414) / *(float *)(param_1 + 0x400 + *(int *)(param_1 + 0x3f0) * 4);
  }
  else {
    *(undefined4 *)(param_1 + 800) = 0;
  }
  fVar2 = FUN_004dcd00((double)(*(float *)(param_1 + 800) - _DAT_004ba820));
  if (fVar2 <= (float10)_DAT_004ba824) {
    *(undefined4 *)(param_1 + 800) = 0x3f800000;
  }
  if (_DAT_004ba818 <= *(float *)(param_1 + 800)) {
    if (*(float *)(param_1 + 800) <= _DAT_004ba820) {
      fVar1 = *(float *)(param_1 + 800);
    }
    else {
      fVar1 = (float)_DAT_004ba830;
    }
  }
  else {
    fVar1 = (float)_DAT_004ba828;
  }
  *(float *)(param_1 + 800) = fVar1;
  return;
}



/* @004ba838 file=? name=FUN_004ba838 */

void __cdecl FUN_004ba838(int param_1,float param_2)

{
  int iVar1;
  float10 fVar2;
  
  iVar1 = FUN_00417ab4(param_1 + 0x1d0);
  fVar2 = FUN_004b0d50(param_1);
  *(float *)(param_1 + 0x45c) =
       (*(float *)(iVar1 + 0x1dc) - *(float *)(param_1 + 0x414)) / (float)fVar2;
  *(float *)(param_1 + 0x414) =
       (*(float *)(param_1 + 0x45c) / *(float *)(param_1 + 0x454)) * param_2 +
       *(float *)(param_1 + 0x414);
  iVar1 = FUN_004ad7d4(param_1);
  if (iVar1 != 0) {
    iVar1 = FUN_00417ab4(param_1 + 0x1d0);
    *(float *)(iVar1 + 0x1c8) =
         *(float *)(param_1 + 0x45c) * *(float *)(param_1 + 0x45c) * (float)fVar2 * param_2 +
         *(float *)(iVar1 + 0x1c8);
  }
  return;
}



/* @004ba8d0 file=? name=FUN_004ba8d0 */

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

void __cdecl FUN_004ba8d0(int param_1,float param_2)

{
  int iVar1;
  
  if (*(int *)(param_1 + 0x418) == 0) {
    *(uint *)(param_1 + 0x28) = *(uint *)(param_1 + 0x28) | 2;
    return;
  }
  FUN_0041bbd8(param_1 + 0x350,0);
  *(float *)(param_1 + 0x440) = *(float *)(param_1 + 0x440) - param_2;
  if (*(float *)(param_1 + 0x440) <= _DAT_004ba9a4) {
LAB_004ba916:
    *(undefined4 *)(param_1 + 0x418) = 0;
    FUN_0041bbd8(param_1 + 0x350,2);
    *(undefined4 *)(param_1 + 0x46c) = 0;
    *(undefined4 *)(param_1 + 0x440) = *(undefined4 *)(param_1 + 0x43c);
    *(uint *)(param_1 + 0x28) = *(uint *)(param_1 + 0x28) | 2;
    return;
  }
  if (*(int *)(param_1 + 0x474) != 0) {
    iVar1 = FUN_0041a1a4(**(int **)(*(int *)(param_1 + 0x474) + 0xc),0x50bdb4);
    if (iVar1 != 0) {
      iVar1 = FUN_0049fb54(*(int *)(param_1 + 0x474));
      if (iVar1 != 0) goto LAB_004ba916;
    }
  }
  FUN_0041c350(param_1,PTR_LAB_00511e6c,DAT_00511e70,DAT_00511e74);
  return;
}



/* @004ba9a8 file=? name=FUN_004ba9a8 */

void __cdecl FUN_004ba9a8(int param_1)

{
  undefined4 local_10;
  undefined4 local_c;
  undefined4 local_8;
  
  FUN_00409968((undefined4 *)(param_1 + 0x41c),&DAT_004e0fa4);
  local_10 = 0x3f800000;
  local_c = 0x3f800000;
  local_8 = 0x3f800000;
  FUN_00408440((undefined4 *)(param_1 + 0x42c),&local_10);
  *(undefined4 *)(param_1 + 0x474) = 0;
  *(undefined4 *)(param_1 + 0x418) = 0;
  *(undefined4 *)(param_1 + 0x46c) = 0;
  FUN_0041bbd8(param_1 + 0x350,3);
  return;
}



/* @004baa20 file=? name=FUN_004baa20 */

void __cdecl FUN_004baa20(int param_1)

{
  int iVar1;
  
  if (*(int *)(param_1 + 0x46c) != 0) {
    iVar1 = FUN_0041a1a4(**(int **)(*(int *)(param_1 + 0x474) + 0xc),0x50bdb4);
    if (iVar1 != 0) {
      iVar1 = FUN_0049fb54(*(int *)(param_1 + 0x474));
      if (iVar1 != 0) {
        FUN_004ba9a8(param_1);
        return;
      }
    }
    FUN_0041c350(param_1,PTR_LAB_00511e78,DAT_00511e7c,DAT_00511e80);
  }
  return;
}



/* @004baa88 file=? name=FUN_004baa88 */

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

void __cdecl FUN_004baa88(int *param_1,float param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  
  FUN_004b0bd0(param_1,param_2);
  iVar1 = FUN_004b9608((int)param_1);
  iVar2 = FUN_004b9bdc((int)param_1);
  param_1[0xd3] = iVar2;
  iVar2 = param_1[0x34];
  if (((param_1[0x10] == 1) || (param_1[0x61] == 2)) || (iVar3 = FUN_0049fb54(iVar2), iVar3 != 0)) {
    FUN_004ba9a8((int)param_1);
    param_1[0x105] = 0;
    (**(code **)(*param_1 + 0x44))(param_1);
    return;
  }
  iVar3 = param_1[0xd9];
  if (iVar3 == 0) {
    param_1[0x110] = (int)((float)param_1[0x110] - param_2);
    if ((float)param_1[0x110] <= _DAT_004bac08) {
      FUN_004ba9a8((int)param_1);
      return;
    }
    FUN_004baa20((int)param_1);
    return;
  }
  if (iVar3 != 2) {
    if (iVar3 != 3) {
      return;
    }
    if (iVar1 != 0) {
      FUN_0041bbd8((int)(param_1 + 0xd4),4);
      FUN_0041bbd8((int)(param_1 + 0xd4),3);
    }
    if (param_1[0x9e] == 4) {
      FUN_004ba838((int)param_1,param_2);
    }
    (**(code **)(*param_1 + 0x44))(param_1);
    if (_DAT_004bac04 != (float)param_1[200]) {
      return;
    }
    FUN_0041bbd8((int)(param_1 + 0xd4),2);
    return;
  }
  if (iVar1 == 0) {
    return;
  }
  if ((param_1[0xf8] != 0) && (*(int *)(iVar2 + 0x388) != 0)) {
    FUN_0041bbd8((int)(param_1 + 0xd4),0);
    (**(code **)(*param_1 + 0x48))(param_1);
    FUN_004baa20((int)param_1);
    return;
  }
  FUN_0041bbd8((int)(param_1 + 0xd4),4);
  FUN_0041bbd8((int)(param_1 + 0xd4),2);
  return;
}



/* @004bace8 file=? name=FUN_004bace8 */

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

void __cdecl FUN_004bace8(int *param_1)

{
  float *pfVar1;
  int iVar2;
  int iVar3;
  float10 fVar4;
  float local_c4;
  float local_c0;
  float local_bc;
  float local_b8 [3];
  float local_ac [12];
  int local_7c [7];
  float local_60 [7];
  float local_44 [12];
  int *local_14;
  int *local_10;
  float local_c;
  float local_8;
  
  iVar2 = param_1[0x34];
  if (*(int *)(iVar2 + 0x388) != 0) {
    param_1[0x110] = param_1[0x10f];
    local_8 = (float)param_1[0x105] * (float)param_1[0x105] * _DAT_004bafb8 * (float)param_1[0x115];
    param_1[0x113] = (int)((float)param_1[0x111] * local_8);
    param_1[0x114] = (int)(local_8 - (float)param_1[0x113]);
    param_1[0x113] = (int)(float)(_DAT_004bafbc * (float10)(float)param_1[0x113]);
    iVar3 = FUN_004ad7d4((int)param_1);
    if (iVar3 != 0) {
      local_c = (float)param_1[0x114];
      param_1[0x72] = (int)(local_c + (float)param_1[0x72]);
    }
    (**(code **)(*param_1 + 0x44))();
    param_1[0x105] = 0;
    param_1[0x106] = 1;
    FUN_0040aadc(local_44);
    FUN_004b9948((int)param_1,local_44);
    FUN_0040a968(local_60,local_44);
    FUN_0041f216(local_7c,iVar2 + 0x300);
    iVar3 = (**(code **)(local_7c[0] + 0x34))(local_7c);
    FUN_0041f235(local_7c,2);
    FUN_0040aadc(local_ac);
    FUN_00424da8(iVar2,iVar3,local_ac);
    param_1[0x11b] = 1;
    pfVar1 = (float *)(iVar2 + 0x37c);
    FUN_00408bf8(local_b8,pfVar1,local_ac);
    FUN_004b9864(param_1,(float *)(param_1 + 0x107),local_b8);
    FUN_0040a138((float *)(param_1 + 0x107));
    FUN_00408644(&local_c4,pfVar1,local_60);
    fVar4 = FUN_004dd138((double)(local_bc * local_bc + local_c0 * local_c0 + local_c4 * local_c4));
    param_1[0x10d] = (int)(float)(fVar4 / (float10)(float)param_1[0x10e]);
    fVar4 = FUN_004dd138((double)(local_bc * local_bc + local_c0 * local_c0 + local_c4 * local_c4));
    if (fVar4 <= (float10)(float)param_1[0xca]) {
      local_10 = param_1 + 0xf2;
      FUN_00408440(local_10,pfVar1);
      local_14 = param_1 + 0xec;
      FUN_00408440(local_14,&local_c4);
      param_1[0xeb] = param_1[0x113];
      FUN_004b9728((int)param_1,*(int *)(iVar2 + 0x388),param_1 + 0xea);
    }
    iVar3 = *(int *)(iVar2 + 0x388);
    param_1[0x11d] = iVar3;
    if ((*(byte *)(iVar3 + 0x29) & 1) == 0) {
      param_1[0x11c] = 1;
      FUN_00408440(param_1 + 0x118,pfVar1);
    }
    else {
      param_1[0x11c] = 0;
      FUN_00408bf8((float *)(param_1 + 0x118),pfVar1,(float *)(*(int *)(iVar2 + 0x388) + 0xd0));
    }
    *(ushort *)(param_1 + 6) = *(ushort *)(param_1 + 6) | 1;
  }
  return;
}



/* @004bb014 file=? name=FUN_004bb014 */

void __cdecl FUN_004bb014(int param_1)

{
  int iVar1;
  
  FUN_004b9d00(param_1);
  iVar1 = *(int *)(param_1 + 0x364);
  if (iVar1 == 0) {
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___Firing_00511f8e,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  }
  if (iVar1 == 2) {
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___Loaded_00511f98,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  }
  if (iVar1 == 3) {
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___Loading_00511fa2,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  }
  if (iVar1 == 4) {
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___TriggerDuringLoad_00511fad,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
  }
  return;
}



/* @004bb120 file=? name=FUN_004bb120 */

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

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

{
  float fVar1;
  double dVar2;
  int *piVar3;
  float *pfVar4;
  int iVar5;
  float *pfVar6;
  float10 fVar7;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  int local_8;
  
  FUN_004b99a8(param_1,param_2,param_3,param_4,param_5,5,(int *)0x0,0);
  *param_1 = (int)&PTR_FUN_00512078;
  if ((*(uint *)(param_2 + 0x28) & 0xc) == 4) {
    param_1[7] = (int)PTR_FUN_00511e90;
    param_1[8] = DAT_00511e94;
    param_1[9] = DAT_00511e98;
    param_1[10] = param_1[10] | 2;
  }
  else {
    param_1[7] = (int)PTR_FUN_00511e84;
    param_1[8] = DAT_00511e88;
    param_1[9] = DAT_00511e8c;
  }
  FUN_0041bbd8((int)(param_1 + 0xd4),3);
  FUN_00408440(param_1 + 0x118,&DAT_004e0f80);
  param_1[0x11b] = 0;
  param_1[0x11d] = 0;
  param_1[0x11c] = 0;
  local_18 = 0x3f800000;
  local_14 = 0x3f800000;
  local_10 = 0x3f800000;
  FUN_00408440(param_1 + 0x10b,&local_18);
  FUN_00409968(param_1 + 0x107,&DAT_004e0fa4);
  param_1[0x106] = 0;
  param_1[0x105] = 0;
  param_1[0x113] = 0;
  param_1[0x114] = 0;
  param_1[0x116] = 0;
  param_1[0x10e] = *(int *)(param_4 + 0x1bc);
  param_1[0x10f] = *(int *)(param_4 + 0x1c0);
  param_1[0x110] = param_1[0x10f];
  param_1[0x112] = (int)(((float)param_1[0xeb] + (float)param_1[0xf6]) * _DAT_004bb3ac);
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    local_8 = FUN_00417ab4((int)(param_1 + 0x74));
    iVar5 = 0;
    piVar3 = param_1 + 0x100;
    do {
      iVar5 = iVar5 + 1;
      *piVar3 = 0;
      piVar3 = piVar3 + 1;
    } while (iVar5 < 5);
    iVar5 = 0;
    pfVar6 = (float *)(param_1 + 0x100);
    pfVar4 = (float *)(param_4 + 0x1c4);
    do {
      if (*pfVar4 == _DAT_004bb3b0) {
        param_1[0xff] = iVar5 + -1;
        break;
      }
      iVar5 = iVar5 + 1;
      fVar1 = *pfVar4;
      pfVar4 = pfVar4 + 1;
      *pfVar6 = fVar1 * *(float *)(local_8 + 0x1d8);
      pfVar6 = pfVar6 + 1;
    } while (iVar5 < 5);
    iVar5 = *(int *)(param_4 + 0x1d8);
    param_1[0xfd] = iVar5;
    param_1[0xfc] = iVar5;
    param_1[0xfe] = 0;
    param_1[0x115] =
         (int)((float)param_1[0x112] /
              ((float)param_1[param_1[0xfd] + 0x100] * (float)param_1[param_1[0xfd] + 0x100] *
              _DAT_004bb3b4));
    dVar2 = (double)((float10)_DAT_004bb3c4 -
                    _DAT_004bb3b8 * (float10)(float)param_1[param_1[0xfd] + 0x100]);
    fVar7 = (float10)FUN_004dce24(SUB84(dVar2,0),(int)((ulonglong)dVar2 >> 0x20));
    param_1[0xc4] = (int)((float)((float10)(float)param_1[0xf7] / -fVar7) / (float)param_1[0x115]);
  }
  param_1[0x111] = (int)((float)param_1[0xeb] / ((float)param_1[0xeb] + (float)param_1[0xf6]));
  param_1[0x117] = 0;
  return param_1;
}



/* @004bb3c8 file=? name=FUN_004bb3c8 */

void __cdecl FUN_004bb3c8(int *param_1,byte param_2)

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



/* @004bb3f4 file=? name=FUN_004bb3f4 */

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

float10 __cdecl FUN_004bb3f4(int param_1,float param_2)

{
  return (float10)(*(float *)(param_1 + 0x444) *
                  param_2 * param_2 * _DAT_004bb428 * *(float *)(param_1 + 0x454));
}



/* @004bb478 file=? name=FUN_004bb478 */

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

undefined4 __cdecl
FUN_004bb478(int param_1,int param_2,char *param_3,char *param_4,char *param_5,int param_6,
            int param_7,int param_8)

{
  int *piVar1;
  uint *puVar2;
  undefined4 *puVar3;
  int iVar4;
  undefined4 uVar5;
  char *pcVar6;
  undefined4 *puVar7;
  uint *puVar8;
  char cVar9;
  float10 fVar10;
  float *local_1c;
  int *local_10;
  int *local_c;
  int *local_8;
  
  iVar4 = FUN_004b9d10(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8);
  if (iVar4 == 0) {
    uVar5 = 0;
  }
  else {
    param_5[0x24] = -0x24;
    param_5[0x25] = '\x01';
    param_5[0x26] = '\0';
    param_5[0x27] = '\0';
    param_5[0x20] = -0x38;
    param_5[0x21] = '\v';
    param_5[0x22] = '\0';
    param_5[0x23] = '\0';
    if (param_8 == 1) {
      param_5[0x1bc] = '\0';
      param_5[0x1bd] = '\0';
      param_5[0x1be] = -0x80;
      param_5[0x1bf] = -0x41;
      param_5[0x1c0] = '\0';
      param_5[0x1c1] = '\0';
      param_5[0x1c2] = -0x80;
      param_5[0x1c3] = -0x41;
      iVar4 = 0;
      pcVar6 = param_5 + 0x1c4;
      do {
        pcVar6[0] = '\0';
        pcVar6[1] = '\0';
        pcVar6[2] = -0x80;
        pcVar6[3] = -0x41;
        iVar4 = iVar4 + 1;
        pcVar6 = pcVar6 + 4;
      } while (iVar4 < 5);
      param_5[0x1d8] = -1;
      param_5[0x1d9] = -1;
      param_5[0x1da] = -1;
      param_5[0x1db] = -1;
    }
    iVar4 = FUN_00404118(param_6,param_4,s_DischargeTime_00511fc2,(float *)(param_5 + 0x1c0));
    if ((iVar4 == 0) && (_DAT_004bb798 == *(float *)(param_5 + 0x1c0))) {
      FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_missing_DischargeTime__00511fd0,(char *)0x0);
      uVar5 = 0;
    }
    else {
      iVar4 = FUN_00404118(param_6,param_4,s_GraphicLength_00511fe9,(float *)(param_5 + 0x1bc));
      if ((iVar4 == 0) && (_DAT_004bb798 == *(float *)(param_5 + 0x1bc))) {
        FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_missing_GraphicLength__00511ff7,(char *)0x0);
        uVar5 = 0;
      }
      else {
        local_8 = FUN_00404720(param_6,param_4,s_SeekVoltage_00512010);
        iVar4 = FUN_00403b60((int)local_8);
        if ((iVar4 == 0) && (*(int *)(param_5 + 0x1d8) == -1)) {
          if (local_8 != (int *)0x0) {
            (**(code **)*local_8)(local_8,3);
          }
          FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
          FUN_004dbb24((int *)&DAT_00524e68,s_missing_SeekVoltage_0051201c,(char *)0x0);
          FUN_004d9c38((int *)&DAT_00524e68);
        }
        else {
          local_1c = (float *)(param_5 + 0x1c4);
          puVar3 = (undefined4 *)local_8[1];
          while (puVar3 != (undefined4 *)0x0) {
            puVar7 = (undefined4 *)FUN_00402298(0x10);
            if (puVar7 == (undefined4 *)0x0) {
              local_c = (int *)0x0;
            }
            else {
              local_c = (int *)FUN_004023f4(puVar7);
            }
            local_c[3] = local_c[3] + 1;
            FUN_00402a98((int *)&local_10,(int *)&local_c,(char *)(puVar3 + 2));
            piVar1 = local_10 + 3;
            *piVar1 = *piVar1 + -1;
            if (*piVar1 == 0) {
              FUN_004024d8(local_10,3);
            }
            puVar8 = (uint *)FUN_00402298(0x10);
            if (puVar8 == (uint *)0x0) {
              puVar8 = (uint *)0x0;
            }
            else {
              puVar8 = FUN_00402460(puVar8,s_SeekVoltageRecommendedIndex_00512032);
            }
            puVar8[3] = puVar8[3] + 1;
            iVar4 = FUN_004027d8((int)local_c,(int)puVar8);
            cVar9 = iVar4 == 0;
            puVar2 = puVar8 + 3;
            *puVar2 = *puVar2 - 1;
            if (*puVar2 == 0) {
              FUN_004024d8((int *)puVar8,3);
            }
            if (cVar9 == '\0') {
              fVar10 = (float10)FUN_004dd1cc(puVar3[1]);
              *local_1c = (float)fVar10;
              local_1c = local_1c + 1;
            }
            else {
              iVar4 = FUN_004dd1e0((char *)puVar3[1]);
              *(int *)(param_5 + 0x1d8) = iVar4;
            }
            puVar3 = (undefined4 *)*puVar3;
            piVar1 = local_c + 3;
            *piVar1 = *piVar1 + -1;
            if (*piVar1 == 0) {
              FUN_004024d8(local_c,3);
            }
          }
          if (*(int *)(param_5 + 0x1d8) == -1) {
            FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
            FUN_004dbb24((int *)&DAT_00524e68,s_missing_SeekVoltageRecommendedIn_0051204e,
                         (char *)0x0);
            if (local_8 != (int *)0x0) {
              (**(code **)*local_8)(local_8,3);
            }
            return 0;
          }
          if (local_8 != (int *)0x0) {
            (**(code **)*local_8)(local_8,3);
          }
        }
        uVar5 = 1;
      }
    }
  }
  return uVar5;
}



/* @004bb878 file=? name=FUN_004bb878 */

void __cdecl FUN_004bb878(int *param_1)

{
  FUN_004bace8(param_1);
  return;
}



/* @004bb888 file=? name=FUN_004bb888 */

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

{
  FUN_004bb120(param_1,param_2,param_3,param_4,param_5);
  *param_1 = (int)&PTR_FUN_0051214c;
  return param_1;
}



/* @004bb8b4 file=? name=FUN_004bb8b4 */

void __cdecl FUN_004bb8b4(int *param_1,byte param_2)

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



/* @004bb8e0 file=? name=FUN_004bb8e0 */

undefined4 __cdecl
FUN_004bb8e0(int param_1,int param_2,char *param_3,char *param_4,char *param_5,int param_6,
            int param_7,int param_8)

{
  int iVar1;
  
  iVar1 = FUN_004bb478(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8);
  if (iVar1 == 0) {
    return 0;
  }
  param_5[0x24] = -0x24;
  param_5[0x25] = '\x01';
  param_5[0x26] = '\0';
  param_5[0x27] = '\0';
  param_5[0x20] = -0x2c;
  param_5[0x21] = '\v';
  param_5[0x22] = '\0';
  param_5[0x23] = '\0';
  return 1;
}



/* @004bb92c file=? name=FUN_004bb92c */

void __cdecl FUN_004bb92c(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x5120d4);
  return;
}



/* @004bbae0 file=? name=FUN_004bbae0 */

void __cdecl FUN_004bbae0(int *param_1,int *param_2)

{
  FUN_004b96d4(param_1,param_2);
  return;
}



/* @004bbaf8 file=? name=FUN_004bbaf8 */

void __cdecl FUN_004bbaf8(int *param_1,int param_2)

{
  FUN_004b96ec(param_1,param_2);
  FUN_0041bbd8((int)(param_1 + 0xd4),3);
  param_1[0xfa] = param_1[0xf7];
  param_1[0xfd] = param_1[0xfc];
  param_1[0xfe] = 0;
  param_1[0x100] = -1;
  *(ushort *)(param_1 + 6) = *(ushort *)(param_1 + 6) | 1;
  return;
}



/* @004bbb50 file=? name=FUN_004bbb50 */

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

void __cdecl FUN_004bbb50(int param_1,float param_2)

{
  float fVar1;
  int iVar2;
  float10 fVar3;
  
  if (*(int *)(param_1 + 0x400) == 0) {
    *(float *)(param_1 + 0x3f4) = *(float *)(param_1 + 0x3f4) - param_2;
    fVar1 = _DAT_004bbc18;
    if (_DAT_004bbc18 <= *(float *)(param_1 + 0x3f4)) {
      fVar1 = *(float *)(param_1 + 0x3f4);
    }
    *(float *)(param_1 + 0x3f4) = fVar1;
    *(float *)(param_1 + 0x3f8) =
         (*(float *)(param_1 + 0x3f0) - *(float *)(param_1 + 0x3f4)) / *(float *)(param_1 + 0x3f0);
  }
  fVar3 = FUN_004dcd00((double)(*(float *)(param_1 + 0x3f4) - _DAT_004bbc18));
  if (fVar3 <= (float10)_DAT_004bbc1c) {
    iVar2 = FUN_00417ab4(param_1 + 0x43c);
    if (iVar2 != 0) {
      FUN_004bd588(iVar2);
      FUN_0041bbd8(param_1 + 0x350,7);
    }
    *(undefined4 *)(param_1 + 0x400) = 0xffffffff;
  }
  return;
}



/* @004bbc78 file=? name=FUN_004bbc78 */

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

void __cdecl FUN_004bbc78(int param_1,float param_2)

{
  float fVar1;
  int iVar2;
  float10 fVar3;
  float local_c;
  
  fVar3 = FUN_004b0d50(param_1);
  fVar1 = (float)((float10)_DAT_004bbd00 / fVar3);
  if (fVar1 < _DAT_004bbd00) {
    fVar1 = _DAT_004bbd00;
  }
  iVar2 = FUN_00417ab4(param_1 + 0x1d0);
  local_c = *(float *)(iVar2 + 0x1dc) / *(float *)(iVar2 + 0x1d8);
  if (local_c < *(float *)(param_1 + 0x404)) {
    local_c = 0.0;
  }
  *(float *)(param_1 + 1000) = *(float *)(param_1 + 1000) - (param_2 * local_c) / fVar1;
  return;
}



/* @004bbfcc file=? name=FUN_004bbfcc */

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

undefined4 __cdecl FUN_004bbfcc(int param_1)

{
  float fVar1;
  float10 fVar2;
  
  if (*(int *)(*(int *)(*(int *)(param_1 + 0xd0) + 400) + 0x25c) == 0) {
    return 0;
  }
  if (*(int *)(param_1 + 0x184) != 0) {
    fVar1 = (_DAT_004bc064 * *(float *)(param_1 + 0x114)) / *(float *)(param_1 + 0x11c);
    if (*(float *)(param_1 + 0x3fc) <= fVar1) {
      if (_DAT_004bc068 < fVar1) {
        fVar1 = _DAT_004bc068;
      }
    }
    else {
      fVar1 = *(float *)(param_1 + 0x3fc);
    }
    fVar2 = FUN_00408050();
    if ((float10)fVar1 <= fVar2) {
      return 0;
    }
    return 1;
  }
  return 0;
}



/* @004bc06c file=? name=FUN_004bc06c */

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

float10 __cdecl FUN_004bc06c(int param_1)

{
  float *pfVar1;
  int iVar2;
  float10 fVar3;
  
  pfVar1 = (float *)(param_1 + 0x420);
  FUN_004b9cbc(param_1,pfVar1);
  *(float *)(param_1 + 0x420) = *(float *)(param_1 + 0x410) + *(float *)(param_1 + 0x420);
  *(float *)(param_1 + 0x424) = *(float *)(param_1 + 0x414) + *(float *)(param_1 + 0x424);
  *(undefined4 *)(param_1 + 0x428) = *(undefined4 *)(param_1 + 0x418);
  iVar2 = FUN_004b9bdc(param_1);
  if (iVar2 == 0) {
    fVar3 = (float10)*(float *)(param_1 + 0x40c) + (float10)_DAT_004bc100;
  }
  else {
    fVar3 = FUN_004dd138((double)(*(float *)(param_1 + 0x428) * *(float *)(param_1 + 0x428) +
                                 *(float *)(param_1 + 0x424) * *(float *)(param_1 + 0x424) +
                                 *pfVar1 * *pfVar1));
    fVar3 = (float10)*(float *)(param_1 + 0x324) / fVar3;
  }
  return fVar3;
}



/* @004bc3fc file=? name=FUN_004bc3fc */

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

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

{
  int iVar1;
  int iVar2;
  float10 fVar3;
  undefined4 local_60;
  float local_5c;
  float local_44 [12];
  undefined4 *local_14;
  undefined4 *local_10;
  int *local_c;
  float local_8;
  
  FUN_004b99a8(param_1,param_2,param_3,param_4,param_5,8,(int *)0x0,0);
  *param_1 = (int)&PTR_FUN_0051242c;
  FUN_004bcbb0(param_1 + 0x10f,0);
  param_1[0x10e] = *(int *)(param_4 + 0x1bc);
  param_1[0x103] = *(int *)(param_4 + 0x1c4);
  param_1[0xff] = *(int *)(param_4 + 0x1cc);
  FUN_0040a7f4(param_1 + 0x108,(undefined4 *)&DAT_004e0fd4);
  param_1[0x101] = *(int *)(param_4 + 0x1c8);
  param_1[0x102] = 0;
  FUN_0040aadc(local_44);
  FUN_004b9948((int)param_1,local_44);
  FUN_0040a968(&local_60,local_44);
  fVar3 = FUN_004dd138((double)(_DAT_004bc67c * (float10)_DAT_004bc678 * (float10)local_5c));
  local_8 = (float)fVar3;
  local_c = param_1 + 0x104;
  FUN_00408440(local_c,&DAT_004e0f74);
  param_1[0x106] = (int)-((float)param_1[0xca] / local_8);
  param_1[0xfc] = 0x40400000;
  param_1[0xfd] = param_1[0xfc];
  param_1[0xfe] = 0;
  param_1[0x100] = -1;
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_LAB_0051222c;
    param_1[8] = DAT_00512230;
    param_1[9] = DAT_00512234;
  }
  else {
    param_1[10] = param_1[10] | 2;
  }
  if (*(int *)(param_4 + 0x1c0) < *(int *)(param_2 + 0x124)) {
    iVar1 = *(int *)(*(int *)(param_2 + 0x128) + *(int *)(param_4 + 0x1c0) * 4);
    (**(code **)(param_1[0x10f] + 4))(param_1 + 0x10f);
    *(int *)(iVar1 + 0x1f0) = param_1[0xea];
    *(int *)(iVar1 + 500) = param_1[0xeb];
    local_10 = (undefined4 *)(iVar1 + 0x1f8);
    *(int *)(iVar1 + 0x21c) = param_1[0xf5];
    FUN_00408440(local_10,param_1 + 0xec);
    local_14 = (undefined4 *)(iVar1 + 0x204);
    FUN_00408440(local_14,param_1 + 0xef);
    FUN_00408440((undefined4 *)(iVar1 + 0x210),param_1 + 0xf2);
  }
  iVar1 = FUN_00417ab4((int)(param_1 + 0x10f));
  if (iVar1 == 0) {
    FUN_004dbb24(&DAT_00524e20,(char *)param_1[0x35],(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s_Could_not_get_ammo_bin__005122c0,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
  }
  iVar2 = FUN_00407064(*(int *)(DAT_004efc94 + 0x68),*(int *)(iVar1 + 0x1e8),0xf);
  iVar1 = *(int *)(iVar2 + 4);
  *(int *)(iVar2 + 4) = *(int *)(iVar2 + 4) + 1;
  if (iVar1 == 0) {
    FUN_00406cd0(iVar2);
  }
  param_1[0x107] = **(int **)(iVar2 + 0x3c);
  *(int *)(iVar2 + 4) = *(int *)(iVar2 + 4) + -1;
  return param_1;
}



/* @004bc688 file=? name=FUN_004bc688 */

void __cdecl FUN_004bc688(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_0051242c;
    FUN_004bcbcf(param_1 + 0x10f,2);
    FUN_004b9b9c(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004bc6c8 file=? name=FUN_004bc6c8 */

void __cdecl FUN_004bc6c8(int param_1)

{
  int iVar1;
  
  FUN_004b9d00(param_1);
  iVar1 = *(int *)(param_1 + 0x364);
  if (iVar1 == 5) {
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___Jammed_005122e3,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  }
  if (iVar1 != 6) {
    if (iVar1 == 7) {
      FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,s___NoAmmo_005122d9,(char *)0x0);
      FUN_004d9c38(&DAT_00524e20);
      return;
    }
    FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s_Unknown_weapon_state__00512301,(char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    return;
  }
  FUN_004dbb24(&DAT_00524e20,*(char **)(param_1 + 0xd4),(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s___TriggerDuringJam_005122ed,(char *)0x0);
  FUN_004d9c38(&DAT_00524e20);
  return;
}



/* @004bc7cc file=? name=FUN_004bc7cc */

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

undefined4 __cdecl
FUN_004bc7cc(int param_1,int param_2,char *param_3,char *param_4,char *param_5,int param_6,
            int param_7,int param_8)

{
  char *pcVar1;
  bool bVar2;
  int iVar3;
  undefined4 uVar4;
  undefined3 extraout_var;
  char *pcVar5;
  char *pcVar6;
  char *local_8;
  
  iVar3 = FUN_004b9d10(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8);
  if (iVar3 == 0) {
    uVar4 = 0;
  }
  else {
    param_5[0x24] = -0x30;
    param_5[0x25] = '\x01';
    param_5[0x26] = '\0';
    param_5[0x27] = '\0';
    param_5[0x20] = -0x33;
    param_5[0x21] = '\v';
    param_5[0x22] = '\0';
    param_5[0x23] = '\0';
    if (param_8 == 1) {
      param_5[0x1bc] = -1;
      param_5[0x1bd] = -1;
      param_5[0x1be] = -1;
      param_5[0x1bf] = -1;
      param_5[0x1c0] = -1;
      param_5[0x1c1] = -1;
      param_5[0x1c2] = -1;
      param_5[0x1c3] = -1;
      param_5[0x1c4] = '\0';
      param_5[0x1c5] = '\0';
      param_5[0x1c6] = -0x80;
      param_5[0x1c7] = -0x41;
      param_5[0x1c8] = '\0';
      param_5[0x1c9] = '\0';
      param_5[0x1ca] = -0x80;
      param_5[0x1cb] = -0x41;
      param_5[0x1cc] = '\0';
      param_5[0x1cd] = '\0';
      param_5[0x1ce] = -0x80;
      param_5[0x1cf] = -0x41;
    }
    bVar2 = FUN_004040d8(param_6,param_4,s_TracerInterval_00512318,(int *)(param_5 + 0x1bc));
    if ((CONCAT31(extraout_var,bVar2) == 0) && (*(int *)(param_5 + 0x1bc) == -1)) {
      FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,s_missing_TracerInterval__00512327,(char *)0x0);
      uVar4 = 0;
    }
    else {
      local_8 = s_Unspecified_00512340;
      iVar3 = FUN_00404088(param_6,param_4,s_AmmoBin_0051234c,&local_8);
      if ((iVar3 == 0) && (*(int *)(param_5 + 0x1c0) == -1)) {
        FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
        FUN_004dbb24(&DAT_00524e20,s_missing_AmmoBin__00512354,(char *)0x0);
        uVar4 = 0;
      }
      else {
        pcVar6 = s_Unspecified_00512366;
        pcVar5 = local_8;
        do {
          bVar2 = *pcVar5 == *pcVar6;
          if (!bVar2) break;
          if (*pcVar5 == '\0') goto LAB_004bc929;
          pcVar1 = pcVar5 + 1;
          bVar2 = *pcVar1 == pcVar6[1];
          if (!bVar2) break;
          pcVar5 = pcVar5 + 2;
          pcVar6 = pcVar6 + 2;
          bVar2 = *pcVar1 == '\0';
        } while (!bVar2);
        if (!bVar2) {
          iVar3 = FUN_004215b0(param_6,local_8);
          *(int *)(param_5 + 0x1c0) = iVar3;
        }
LAB_004bc929:
        if (*(int *)(param_5 + 0x1c0) < 0) {
          FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
          FUN_004dbb24(&DAT_00524e20,s_has_an_invalid_Ammo_Bin__00512372,(char *)0x0);
          uVar4 = 0;
        }
        else {
          pcVar6 = s_Unspecified_0051238d;
          pcVar5 = local_8;
          do {
            bVar2 = *pcVar5 == *pcVar6;
            if (!bVar2) break;
            if (*pcVar5 == '\0') goto LAB_004bc98d;
            pcVar1 = pcVar5 + 1;
            bVar2 = *pcVar1 == pcVar6[1];
            if (!bVar2) break;
            pcVar5 = pcVar5 + 2;
            pcVar6 = pcVar6 + 2;
            bVar2 = *pcVar1 == '\0';
          } while (!bVar2);
          if (!bVar2) {
            *(int *)(param_5 + 0x1c0) = *(int *)(param_5 + 0x1c0) + 2;
          }
LAB_004bc98d:
          iVar3 = FUN_00404118(param_6,param_4,s_MinTimeOfFlight_00512399,(float *)(param_5 + 0x1c4)
                              );
          if ((iVar3 == 0) && (_DAT_004bca9c == *(float *)(param_5 + 0x1c4))) {
            FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
            FUN_004dbb24(&DAT_00524e20,s_missing_MinTimeOfFlight___005123a9,(char *)0x0);
            uVar4 = 0;
          }
          else {
            iVar3 = FUN_00404118(param_6,param_4,s_MinJamChance_005123c4,(float *)(param_5 + 0x1cc))
            ;
            if ((iVar3 == 0) && (_DAT_004bca9c == *(float *)(param_5 + 0x1cc))) {
              FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
              FUN_004dbb24(&DAT_00524e20,s_missing_MinJamChance___005123d1,(char *)0x0);
              uVar4 = 0;
            }
            else {
              iVar3 = FUN_00404118(param_6,param_4,s_MinVoltagePercentToFire_005123e9,
                                   (float *)(param_5 + 0x1c8));
              if ((iVar3 == 0) && (_DAT_004bca9c == *(float *)(param_5 + 0x1c8))) {
                FUN_004dbb24(&DAT_00524e20,param_4,(char *)0x0);
                FUN_004dbb24(&DAT_00524e20,s_missing_MinVoltagePercentToFire___00512401,(char *)0x0)
                ;
                uVar4 = 0;
              }
              else {
                uVar4 = 1;
              }
            }
          }
        }
      }
    }
  }
  return uVar4;
}



/* @004bcabc file=? name=FUN_004bcabc */

undefined4 __cdecl FUN_004bcabc(int *param_1,int param_2)

{
  undefined4 uVar1;
  
  if (param_2 == 2) {
    FUN_0041bbd8((int)(param_1 + 0xd4),5);
    return 1;
  }
  uVar1 = FUN_004add6c(param_1,param_2);
  return uVar1;
}



/* @004bcbb0 file=? name=FUN_004bcbb0 */

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

{
  FUN_004179d4(param_1,param_2);
  *param_1 = &PTR_FUN_00512424;
  return param_1;
}



/* @004bcbcf file=? name=FUN_004bcbcf */

void __cdecl FUN_004bcbcf(int *param_1,byte param_2)

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



/* @004bcc60 file=? name=FUN_004bcc60 */

void __cdecl FUN_004bcc60(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  undefined4 uVar7;
  undefined4 uVar8;
  undefined4 uVar9;
  undefined4 uVar10;
  undefined4 uVar11;
  undefined4 uVar12;
  undefined4 uVar13;
  undefined4 uVar14;
  undefined4 uVar15;
  int iVar16;
  undefined4 local_168;
  undefined4 local_164;
  undefined4 local_160;
  undefined4 local_15c [2];
  undefined4 local_154;
  undefined4 local_150;
  undefined4 local_14c;
  undefined4 local_148 [2];
  undefined4 local_140;
  undefined4 local_13c;
  undefined4 local_138;
  undefined4 local_134;
  undefined4 local_130;
  undefined4 local_12c;
  undefined4 local_128;
  undefined4 local_124;
  undefined4 local_120;
  undefined4 local_11c [6];
  undefined4 local_104 [6];
  undefined4 local_ec [2];
  undefined4 local_e4;
  undefined4 local_e0;
  undefined4 local_dc;
  undefined4 local_d8;
  undefined4 local_d4;
  undefined4 local_d0;
  undefined4 local_cc;
  undefined4 local_c8;
  undefined4 local_c4;
  undefined4 local_c0;
  undefined4 local_bc;
  undefined4 local_b8;
  undefined4 local_b4;
  undefined4 local_b0;
  undefined4 local_ac [2];
  float local_a4;
  undefined4 local_a0;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_90;
  undefined4 local_8c;
  undefined4 local_88;
  undefined4 local_84;
  undefined4 local_80;
  undefined4 local_7c;
  float local_78 [12];
  float local_48;
  float local_44;
  float local_40;
  float local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24 [2];
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14 [2];
  float local_c;
  int local_8;
  
  iVar1 = *(int *)(param_1 + 0xd0);
  local_8 = FUN_00417ab4(param_1 + 0x43c);
  iVar16 = FUN_004ad7d4(param_1);
  if (iVar16 != 0) {
    local_c = *(float *)(param_1 + 0x3d8);
    *(float *)(param_1 + 0x1c8) = local_c + *(float *)(param_1 + 0x1c8);
  }
  local_30 = DAT_004e0f80;
  local_2c = DAT_004e0f84;
  local_28 = DAT_004e0f88;
  FUN_00420e8c(local_14);
  iVar16 = *(int *)(iVar1 + 0x388);
  if (iVar16 != 0) {
    FUN_00420ef4(local_14,(undefined4 *)(iVar16 + 0x184));
    FUN_00408bf8(&local_30,(float *)(iVar1 + 0x37c),(float *)(iVar16 + 0xd0));
  }
  uVar2 = *(undefined4 *)(*(int *)(iVar1 + 400) + 0x264);
  FUN_004b9cbc(param_1,&local_48);
  local_48 = *(float *)(param_1 + 0x410) + local_48;
  local_44 = *(float *)(param_1 + 0x414) + local_44;
  local_40 = local_40 - *(float *)(param_1 + 0x418);
  FUN_0040aadc(local_78);
  FUN_004b9948(param_1,local_78);
  FUN_0040a968(&local_94,local_78);
  local_1c = *(undefined4 *)(param_1 + 0x3e4);
  uVar3 = *(undefined4 *)(param_1 + 0x3a8);
  uVar4 = *(undefined4 *)(param_1 + 0x3ac);
  uVar5 = *(undefined4 *)(param_1 + 0x3b0);
  uVar6 = *(undefined4 *)(param_1 + 0x3b4);
  uVar7 = *(undefined4 *)(param_1 + 0x3b8);
  uVar8 = *(undefined4 *)(param_1 + 0x3bc);
  uVar9 = *(undefined4 *)(param_1 + 0x3c0);
  uVar10 = *(undefined4 *)(param_1 + 0x3c4);
  uVar11 = *(undefined4 *)(param_1 + 0x3c8);
  uVar12 = *(undefined4 *)(param_1 + 0x3cc);
  uVar13 = *(undefined4 *)(param_1 + 0x3d0);
  uVar14 = *(undefined4 *)(param_1 + 0x3d4);
  uVar15 = *(undefined4 *)(local_8 + 0x1e8);
  local_18 = uVar2;
  FUN_00420ebc(local_24,0xbd0);
  uVar2 = *(undefined4 *)(param_1 + 0xd8);
  local_168 = 0xd4;
  local_164 = 3;
  local_160 = 1;
  FUN_00420ea4(local_15c,(undefined4 *)&DAT_00522524);
  local_154 = 0;
  local_150 = 0;
  local_14c = 0xbba;
  FUN_00420ea4(local_148,local_24);
  local_13c = 0xc100;
  local_138 = local_94;
  local_134 = local_90;
  local_130 = local_8c;
  local_12c = local_88;
  local_128 = local_84;
  local_124 = local_80;
  local_120 = local_7c;
  local_140 = uVar15;
  FUN_0040a7c0(local_11c,&local_48);
  FUN_0040a7c0(local_104,(undefined4 *)&DAT_004e0fd4);
  FUN_00420ea4(local_ec,(undefined4 *)(iVar1 + 0x184));
  local_b0 = local_1c;
  local_e4 = uVar2;
  local_e0 = uVar3;
  local_dc = uVar4;
  local_d8 = uVar5;
  local_d4 = uVar6;
  local_d0 = uVar7;
  local_cc = uVar8;
  local_c8 = uVar9;
  local_c4 = uVar10;
  local_c0 = uVar11;
  local_bc = uVar12;
  local_b8 = uVar13;
  local_b4 = uVar14;
  FUN_00420ea4(local_ac,local_14);
  local_a4 = local_30;
  local_a0 = local_2c;
  local_9c = local_28;
  local_98 = local_18;
  FUN_004bf8bc((int)&local_168);
  return;
}



/* @004bcff0 file=? name=FUN_004bcff0 */

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

{
  FUN_004bc3fc(param_1,param_2,param_3,param_4,param_5);
  *param_1 = (int)&PTR_FUN_00512570;
  param_1[0x112] = *(int *)(param_4 + 0x1d0);
  FUN_00408440(param_1 + 0x104,(undefined4 *)(param_4 + 0x1d4));
  param_1[0xf5] = param_1[0x112];
  param_1[0xeb] = (int)((float)param_1[0xeb] / (float)param_1[0x112]);
  return param_1;
}



/* @004bd060 file=? name=FUN_004bd060 */

void __cdecl FUN_004bd060(int *param_1,byte param_2)

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



/* @004bd08c file=? name=FUN_004bd08c */

undefined4 __cdecl
FUN_004bd08c(int param_1,int param_2,char *param_3,char *param_4,char *param_5,int param_6,
            int param_7,int param_8)

{
  char *pcVar1;
  bool bVar2;
  int iVar3;
  undefined4 uVar4;
  undefined3 extraout_var;
  char *pcVar5;
  char *pcVar6;
  char *local_8;
  
  iVar3 = FUN_004bc7cc(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8);
  if (iVar3 == 0) {
    uVar4 = 0;
  }
  else {
    param_5[0x24] = -0x20;
    param_5[0x25] = '\x01';
    param_5[0x26] = '\0';
    param_5[0x27] = '\0';
    param_5[0x20] = -0x30;
    param_5[0x21] = '\v';
    param_5[0x22] = '\0';
    param_5[0x23] = '\0';
    if (param_8 == 1) {
      param_5[0x1d0] = -1;
      param_5[0x1d1] = -1;
      param_5[0x1d2] = -1;
      param_5[0x1d3] = -1;
    }
    bVar2 = FUN_004040d8(param_6,param_4,s_MissileCount_00512509,(int *)(param_5 + 0x1d0));
    if ((CONCAT31(extraout_var,bVar2) == 0) && (*(int *)(param_5 + 0x1d0) == -1)) {
      FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_missing_MissileCount__00512516,(char *)0x0);
      uVar4 = 0;
    }
    else {
      local_8 = s_Unspecified_0051252d;
      iVar3 = FUN_00404088(param_6,param_4,s_MuzzleVelocity_00512539,&local_8);
      if ((iVar3 == 0) &&
         (iVar3 = FUN_004084fc((float *)&DAT_004e0f74,(float *)(param_5 + 0x1d4),0.0001), iVar3 != 0
         )) {
        FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_missing_MuzzleVelocity__00512548,(char *)0x0);
        return 0;
      }
      pcVar6 = s_Unspecified_00512561;
      pcVar5 = local_8;
      do {
        bVar2 = *pcVar5 == *pcVar6;
        if (!bVar2) break;
        if (*pcVar5 == '\0') goto LAB_004bd1d2;
        pcVar1 = pcVar5 + 1;
        bVar2 = *pcVar1 == pcVar6[1];
        if (!bVar2) break;
        pcVar5 = pcVar5 + 2;
        pcVar6 = pcVar6 + 2;
        bVar2 = *pcVar1 == '\0';
      } while (!bVar2);
      if (!bVar2) {
        FUN_00408944(local_8,(float *)(param_5 + 0x1d4));
      }
LAB_004bd1d2:
      uVar4 = 1;
    }
  }
  return uVar4;
}



/* @004bd1e0 file=? name=FUN_004bd1e0 */

void __cdecl FUN_004bd1e0(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x512488);
  return;
}



/* @004bd2c0 file=? name=FUN_004bd2c0 */

void __cdecl FUN_004bd2c0(int *param_1,undefined4 param_2)

{
  int iVar1;
  
  iVar1 = param_1[0x10];
  FUN_004aea84(param_1,param_2);
  if ((param_1[0x10] == 1) && (iVar1 != 1)) {
    param_1[0x60] = 0;
    FUN_0041bbd8((int)(param_1 + 0x65),2);
  }
  return;
}



/* @004bd300 file=? name=FUN_004bd300 */

void __cdecl FUN_004bd300(int *param_1)

{
  int local_34;
  float local_30;
  int local_2c;
  int local_28;
  int local_24;
  int local_20;
  int local_1c;
  int local_18;
  int local_14;
  int local_10;
  int local_c;
  int local_8;
  
  local_34 = param_1[0x7c];
  local_2c = param_1[0x7e];
  local_28 = param_1[0x7f];
  local_24 = param_1[0x80];
  local_20 = param_1[0x81];
  local_1c = param_1[0x82];
  local_18 = param_1[0x83];
  local_14 = param_1[0x84];
  local_10 = param_1[0x85];
  local_c = param_1[0x86];
  local_8 = param_1[0x87];
  local_30 = (float)param_1[0x60] * (float)param_1[0x7d];
  FUN_004ac274(param_1,&local_34);
  param_1[0x60] = 0;
  FUN_0041bbd8((int)(param_1 + 0x65),2);
  return;
}



/* @004bd394 file=? name=FUN_004bd394 */

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

void __cdecl FUN_004bd394(int *param_1,float param_2)

{
  int *piVar1;
  int iVar2;
  int *piVar3;
  
  FUN_004aeac4((int)param_1);
  if (param_1[0x10] == 1) {
    FUN_0041bbd8((int)(param_1 + 0x65),2);
  }
  if ((_DAT_004bd4e8 < param_2) && (param_1[0x6a] == 0)) {
    if (param_2 < (float)param_1[0x61]) {
      param_1[0x61] = (int)((float)param_1[0x61] - param_2);
    }
    else {
      param_1[0x61] = 0;
      FUN_0041bbd8((int)(param_1 + 0x65),1);
    }
  }
  if (((param_1[0x50] == 2) && (param_1[0x6a] != 2)) && (param_1[99] == 0)) {
    param_1[99] = 1;
    piVar1 = (int *)FUN_00414b60();
    piVar3 = param_1 + 100;
    *piVar3 = *piVar1;
    iVar2 = FUN_004dcd94();
    *piVar3 = *piVar3 + iVar2;
  }
  if (param_1[99] != 0) {
    if (param_1[0x6a] == 2) {
      param_1[99] = 0;
    }
    else {
      piVar3 = (int *)FUN_00414b60();
      if (param_1[100] < *piVar3) {
        param_1[99] = 0;
        FUN_0041bbd8((int)(param_1 + 0xb),1);
        if (param_1[0x41] != 0) {
          (**(code **)(*param_1 + 0x34))(param_1);
        }
        FUN_004bd300(param_1);
      }
    }
  }
  if (param_1[0x60] < 1) {
    FUN_0041bbd8((int)(param_1 + 0x65),2);
  }
  return;
}



/* @004bd4f4 file=? name=FUN_004bd4f4 */

undefined4 __cdecl FUN_004bd4f4(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  
  if (*(int *)(param_1 + 0x40) == 1) {
    uVar2 = 0;
  }
  else {
    iVar1 = *(int *)(param_1 + 0x1a8);
    if (iVar1 == 0) {
      uVar2 = 0;
    }
    else if (iVar1 == 1) {
      FUN_0041bbd8(param_1 + 0x194,0);
      *(undefined4 *)(param_1 + 0x184) = *(undefined4 *)(param_1 + 0x224);
      *(int *)(param_1 + 0x180) = *(int *)(param_1 + 0x180) + -1;
      if (*(int *)(param_1 + 0x180) < 1) {
        FUN_0041bbd8(param_1 + 0x194,2);
      }
      if (*(int *)(param_1 + 0x180) < 0) {
        uVar2 = 0;
      }
      else {
        uVar2 = *(undefined4 *)(param_1 + 0x180);
      }
      *(undefined4 *)(param_1 + 0x180) = uVar2;
      uVar2 = 1;
    }
    else if (iVar1 == 2) {
      uVar2 = 0;
    }
    else if (iVar1 == 3) {
      uVar2 = 0;
    }
    else {
      uVar2 = 0;
    }
  }
  return uVar2;
}



/* @004bd588 file=? name=FUN_004bd588 */

void __cdecl FUN_004bd588(int param_1)

{
  if (*(int *)(param_1 + 0x1a8) != 2) {
    *(undefined4 *)(param_1 + 0x180) = 0;
    FUN_0041bbd8(param_1 + 0x194,5);
    FUN_0041bbd8(param_1 + 0x194,2);
  }
  return;
}



/* @004bd5c4 file=? name=FUN_004bd5c4 */

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

{
  FUN_004aeb40(param_1,param_2,param_3,param_4,&DAT_005125bc);
  *param_1 = (int)&PTR_FUN_0051286c;
  FUN_0041b9ec(param_1 + 0x65,6);
  FUN_0041db7c((int)(param_1 + 0x7c));
  param_1[0x8a] = 0;
  param_1[0x60] = *(int *)(param_4 + 0xfc);
  param_1[0x89] = *(int *)(param_4 + 0x100);
  param_1[0x62] = *(int *)(param_4 + 0xf0);
  param_1[0x7a] = *(int *)(param_4 + 0xf4);
  param_1[0x7b] = *(int *)(param_4 + 0xf8);
  param_1[0x61] = 0;
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_00512654;
    param_1[8] = DAT_00512658;
    param_1[9] = DAT_0051265c;
  }
  FUN_0041bbd8((int)(param_1 + 0x65),1);
  param_1[0x88] = param_1[0x60];
  param_1[99] = 0;
  return param_1;
}



/* @004bd6b0 file=? name=FUN_004bd6b0 */

void __cdecl FUN_004bd6b0(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_0051286c;
    FUN_0041baa4(param_1 + 0x65,2);
    FUN_004aebe8(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004bd6f0 file=? name=FUN_004bd6f0 */

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

undefined4 __cdecl
FUN_004bd6f0(int param_1,int param_2,char *param_3,char *param_4,char *param_5,int param_6,
            int param_7,int param_8)

{
  char *pcVar1;
  bool bVar2;
  int iVar3;
  undefined4 uVar4;
  undefined3 extraout_var;
  char *pcVar5;
  char *pcVar6;
  char *pcVar7;
  undefined4 *puVar8;
  char *local_14;
  undefined4 *local_10;
  char *local_c;
  char *local_8;
  
  iVar3 = FUN_004aec54(param_2,param_3,param_4,param_5,param_6,param_7,param_8);
  if (iVar3 == 0) {
    uVar4 = 0;
  }
  else {
    param_5[0x24] = '\x04';
    param_5[0x25] = '\x01';
    param_5[0x26] = '\0';
    param_5[0x27] = '\0';
    param_5[0x20] = -0x35;
    param_5[0x21] = '\v';
    param_5[0x22] = '\0';
    param_5[0x23] = '\0';
    if (param_8 == 1) {
      param_5[0xfc] = -1;
      param_5[0xfd] = -1;
      param_5[0xfe] = -1;
      param_5[0xff] = -1;
      param_5[0x100] = '\0';
      param_5[0x101] = '\0';
      param_5[0x102] = -0x80;
      param_5[0x103] = -0x41;
      param_5[0xf0] = -1;
      param_5[0xf1] = -1;
      param_5[0xf2] = -1;
      param_5[0xf3] = -1;
      param_5[0xf4] = -1;
      param_5[0xf5] = -1;
      param_5[0xf6] = -1;
      param_5[0xf7] = -1;
      param_5[0xf8] = -1;
      param_5[0xf9] = -1;
      param_5[0xfa] = -1;
      param_5[0xfb] = -1;
    }
    bVar2 = FUN_004040d8(param_6,param_4,s_AmmoCount_005126ea,(int *)(param_5 + 0xfc));
    if ((CONCAT31(extraout_var,bVar2) == 0) && (*(int *)(param_5 + 0xfc) == -1)) {
      FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_missing_AmmoCount__005126f4,(char *)0x0);
      uVar4 = 0;
    }
    else {
      iVar3 = FUN_00404118(param_6,param_4,s_FeedRate_00512708,(float *)(param_5 + 0x100));
      if ((iVar3 == 0) && (_DAT_004bdb74 == *(float *)(param_5 + 0x100))) {
        FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_missing_FeedRate__00512711,(char *)0x0);
        uVar4 = 0;
      }
      else {
        local_8 = s_Unspecified_00512724;
        iVar3 = FUN_00404088(param_6,param_4,s_AmmoClassID_00512730,&local_8);
        pcVar6 = local_8;
        if ((iVar3 == 0) && (*(int *)(param_5 + 0xf0) == -1)) {
          FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
          FUN_004dbb24((int *)&DAT_00524e68,s_missing_AmmoClassID__0051273c,(char *)0x0);
          uVar4 = 0;
        }
        else {
          pcVar5 = s_Unspecified_00512752;
          pcVar7 = local_8;
          do {
            if (*pcVar5 != *pcVar7) goto LAB_004bd894;
            bVar2 = true;
            if (*pcVar5 == '\0') break;
            pcVar1 = pcVar5 + 1;
            if (*pcVar1 != pcVar7[1]) goto LAB_004bd894;
            pcVar5 = pcVar5 + 2;
            pcVar7 = pcVar7 + 2;
            bVar2 = *pcVar1 == '\0';
          } while (!bVar2);
          if (!bVar2) {
LAB_004bd894:
            pcVar5 = s_ProjectileClassID_0051275e;
            pcVar7 = local_8;
            do {
              if (*pcVar5 != *pcVar7) goto LAB_004bd8c9;
              bVar2 = true;
              if (*pcVar5 == '\0') break;
              pcVar1 = pcVar5 + 1;
              if (*pcVar1 != pcVar7[1]) goto LAB_004bd8c9;
              pcVar5 = pcVar5 + 2;
              pcVar7 = pcVar7 + 2;
              bVar2 = *pcVar1 == '\0';
            } while (!bVar2);
            if (bVar2) {
              param_5[0xf0] = -0x2f;
              param_5[0xf1] = '\v';
              param_5[0xf2] = '\0';
              param_5[0xf3] = '\0';
            }
            else {
LAB_004bd8c9:
              pcVar5 = s_MissileClassID_00512770;
              pcVar7 = local_8;
              do {
                if (*pcVar5 != *pcVar7) goto LAB_004bd8fb;
                bVar2 = true;
                if (*pcVar5 == '\0') break;
                pcVar1 = pcVar5 + 1;
                if (*pcVar1 != pcVar7[1]) goto LAB_004bd8fb;
                pcVar5 = pcVar5 + 2;
                pcVar7 = pcVar7 + 2;
                bVar2 = *pcVar1 == '\0';
              } while (!bVar2);
              if (bVar2) {
                param_5[0xf0] = -0x46;
                param_5[0xf1] = '\v';
                param_5[0xf2] = '\0';
                param_5[0xf3] = '\0';
              }
              else {
LAB_004bd8fb:
                if (*(int *)(param_5 + 0xf0) == -1) {
                  FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
                  FUN_004dbb24((int *)&DAT_00524e68,s_invalid_AmmoClassID_0051277f,(char *)0x0);
                  FUN_004dbb24((int *)&DAT_00524e68,pcVar6,(char *)0x0);
                  FUN_004d9c38((int *)&DAT_00524e68);
                  return 0;
                }
              }
            }
          }
          local_c = s_Unspecified_00512794;
          iVar3 = FUN_00404088(param_6,param_4,s_AmmoModelFile_005127a0,&local_c);
          if ((iVar3 == 0) && (*(int *)(param_5 + 0xf4) == -1)) {
            FUN_004dbb24((int *)&DAT_00524e68,param_4,(char *)0x0);
            FUN_004dbb24((int *)&DAT_00524e68,s_missing_AmmoModelFile__005127ae,(char *)0x0);
            uVar4 = 0;
          }
          else {
            local_10 = (undefined4 *)0x0;
            pcVar7 = s_Unspecified_005127c6;
            pcVar6 = local_c;
            do {
              bVar2 = *pcVar6 == *pcVar7;
              if (!bVar2) break;
              if (*pcVar6 == '\0') goto LAB_004bd9e5;
              pcVar5 = pcVar6 + 1;
              bVar2 = *pcVar5 == pcVar7[1];
              if (!bVar2) break;
              pcVar6 = pcVar6 + 2;
              pcVar7 = pcVar7 + 2;
              bVar2 = *pcVar5 == '\0';
            } while (!bVar2);
            if (!bVar2) {
              local_10 = (undefined4 *)FUN_00406ff8(param_1,local_c,1,-1);
            }
LAB_004bd9e5:
            if ((local_10 == (undefined4 *)0x0) && (*(int *)(param_5 + 0xf4) == -1)) {
              FUN_004dbb24((int *)&DAT_00524e68,local_c,(char *)0x0);
              FUN_004dbb24((int *)&DAT_00524e68,s_must_be_declared_before_005127d2,(char *)0x0);
              FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
              FUN_004dbb24((int *)&DAT_00524e68,s_in_the__bld_file_005127ec,(char *)0x0);
              FUN_004d9c38((int *)&DAT_00524e68);
              uVar4 = 0;
            }
            else {
              if (local_10 != (undefined4 *)0x0) {
                *(undefined4 *)(param_5 + 0xf4) = *local_10;
              }
              local_14 = s_Unspecified_005127ff;
              iVar3 = FUN_00404088(param_6,param_4,s_ExplosionModelFile_0051280b,&local_14);
              if ((iVar3 == 0) && (*(int *)(param_5 + 0xf8) == -1)) {
                FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
                FUN_004dbb24(&DAT_00524e20,s_missing_ExplosionModelFile__0051281e,(char *)0x0);
                uVar4 = 0;
              }
              else {
                puVar8 = (undefined4 *)0x0;
                pcVar7 = s_Unspecified_0051283c;
                pcVar6 = local_14;
                do {
                  bVar2 = *pcVar6 == *pcVar7;
                  if (!bVar2) break;
                  if (*pcVar6 == '\0') goto LAB_004bdafa;
                  pcVar5 = pcVar6 + 1;
                  bVar2 = *pcVar5 == pcVar7[1];
                  if (!bVar2) break;
                  pcVar6 = pcVar6 + 2;
                  pcVar7 = pcVar7 + 2;
                  bVar2 = *pcVar5 == '\0';
                } while (!bVar2);
                if (!bVar2) {
                  puVar8 = (undefined4 *)FUN_00406ff8(param_1,local_14,1,-1);
                }
LAB_004bdafa:
                pcVar6 = local_14;
                if ((puVar8 == (undefined4 *)0x0) && (*(int *)(param_5 + 0xf8) == -1)) {
                  FUN_004dbb24(&DAT_00524e20,param_3,(char *)0x0);
                  FUN_004dbb24(&DAT_00524e20,s_cannot_find_00512848,(char *)0x0);
                  FUN_004dbb24(&DAT_00524e20,pcVar6,(char *)0x0);
                  FUN_004dbb24(&DAT_00524e20,s_in_resource_file__00512856,(char *)0x0);
                  uVar4 = 0;
                }
                else {
                  if (puVar8 != (undefined4 *)0x0) {
                    *(undefined4 *)(param_5 + 0xf8) = *puVar8;
                  }
                  uVar4 = 1;
                }
              }
            }
          }
        }
      }
    }
  }
  return uVar4;
}



/* @004bdb94 file=? name=FUN_004bdb94 */

undefined4 __cdecl FUN_004bdb94(int *param_1,int param_2)

{
  int *piVar1;
  int *piVar2;
  int iVar3;
  undefined4 uVar4;
  
  if (param_2 != 1) {
    uVar4 = FUN_004ac1d4(param_1,param_2);
    return uVar4;
  }
  if (param_1[99] == 0) {
    param_1[99] = 1;
    piVar2 = (int *)FUN_00414b60();
    piVar1 = param_1 + 100;
    *piVar1 = *piVar2;
    iVar3 = FUN_004dcd94();
    *piVar1 = *piVar1 + iVar3;
    return 1;
  }
  return 0;
}



/* @004bdcb4 file=? name=FUN_004bdcb4 */

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

{
  FUN_004bb120(param_1,param_2,param_3,param_4,param_5);
  *param_1 = (int)&PTR_FUN_00512934;
  param_1[0x105] = 0;
  return param_1;
}



/* @004bdce8 file=? name=FUN_004bdce8 */

void __cdecl FUN_004bdce8(int *param_1,byte param_2)

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



/* @004bdd14 file=? name=FUN_004bdd14 */

undefined4 __cdecl
FUN_004bdd14(int param_1,int param_2,char *param_3,char *param_4,char *param_5,int param_6,
            int param_7,int param_8)

{
  int iVar1;
  
  iVar1 = FUN_004bb478(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8);
  if (iVar1 == 0) {
    return 0;
  }
  param_5[0x24] = -0x20;
  param_5[0x25] = '\x01';
  param_5[0x26] = '\0';
  param_5[0x27] = '\0';
  param_5[0x20] = -0x32;
  param_5[0x21] = '\v';
  param_5[0x22] = '\0';
  param_5[0x23] = '\0';
  return 1;
}



/* @004bdd60 file=? name=FUN_004bdd60 */

void __cdecl FUN_004bdd60(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x5128b8);
  return;
}



/* @004be078 file=? name=FUN_004be078 */

void FUN_004be078(int param_1,int *param_2)

{
  int iVar1;
  int iVar2;
  undefined4 uStack_74;
  undefined4 uStack_70;
  undefined4 uStack_6c;
  undefined4 auStack_68 [2];
  undefined4 uStack_60;
  undefined4 uStack_5c;
  undefined4 auStack_58 [2];
  undefined4 uStack_50;
  undefined4 uStack_4c;
  undefined4 uStack_48;
  undefined4 uStack_44;
  undefined4 uStack_40;
  undefined4 uStack_3c;
  undefined4 uStack_38;
  undefined4 uStack_34;
  undefined4 uStack_30;
  undefined4 uStack_2c;
  undefined4 uStack_28;
  undefined4 uStack_24;
  undefined4 uStack_20;
  undefined4 uStack_1c;
  int iStack_18;
  uint uStack_14;
  float fStack_10;
  undefined4 uStack_c;
  undefined4 uStack_8;
  
  FUN_00408440((undefined4 *)(param_1 + 0x32c),(undefined4 *)(param_1 + 0x100));
  fStack_10 = DAT_004e0f74;
  uStack_c = DAT_004e0f78;
  uStack_8 = DAT_004e0f7c;
  FUN_004086ac(&fStack_10,(float *)(param_1 + 500),*(float *)(param_1 + 0x20c));
  FUN_00408440((undefined4 *)(param_1 + 0x314),&fStack_10);
  iVar1 = *(int *)(param_1 + 0x300);
  iVar2 = *(int *)(param_1 + 0x308);
  uStack_74 = 100;
  uStack_70 = 0x12;
  uStack_6c = 1;
  FUN_00420ea4(auStack_68,(undefined4 *)&DAT_00522524);
  uStack_60 = 0;
  uStack_5c = 0;
  FUN_00420ea4(auStack_58,(undefined4 *)(iVar1 + 0x184));
  uStack_50 = 0xffffffff;
  uStack_4c = 1;
  uStack_48 = *(undefined4 *)(param_1 + 0x30c);
  uStack_44 = *(undefined4 *)(param_1 + 0x310);
  uStack_40 = *(undefined4 *)(param_1 + 0x314);
  uStack_3c = *(undefined4 *)(param_1 + 0x318);
  uStack_38 = *(undefined4 *)(param_1 + 0x31c);
  uStack_34 = *(undefined4 *)(param_1 + 800);
  uStack_30 = *(undefined4 *)(param_1 + 0x324);
  uStack_2c = *(undefined4 *)(param_1 + 0x328);
  uStack_28 = *(undefined4 *)(param_1 + 0x32c);
  uStack_24 = *(undefined4 *)(param_1 + 0x330);
  uStack_20 = *(undefined4 *)(param_1 + 0x334);
  uStack_1c = *(undefined4 *)(param_1 + 0x338);
  uStack_14 = (uint)(iVar2 < 0);
  iStack_18 = iVar2;
  (**(code **)(*param_2 + 0xc))(param_2,&uStack_74);
  return;
}



/* @004be07e file=? name=FUN_004be07e */

void FUN_004be07e(void)

{
  int iVar1;
  int iVar2;
  undefined4 uVar3;
  int unaff_EBP;
  
  iVar1 = *(int *)(unaff_EBP + 8);
  FUN_00408440((undefined4 *)(iVar1 + 0x32c),(undefined4 *)(iVar1 + 0x100));
  *(undefined4 *)(unaff_EBP + -0xc) = DAT_004e0f74;
  *(undefined4 *)(unaff_EBP + -8) = DAT_004e0f78;
  *(undefined4 *)(unaff_EBP + -4) = DAT_004e0f7c;
  FUN_004086ac((float *)(unaff_EBP + -0xc),(float *)(iVar1 + 500),*(float *)(iVar1 + 0x20c));
  FUN_00408440((undefined4 *)(iVar1 + 0x314),(undefined4 *)(unaff_EBP + -0xc));
  iVar2 = *(int *)(iVar1 + 0x300);
  uVar3 = *(undefined4 *)(iVar1 + 0x308);
  *(undefined4 *)(unaff_EBP + -0x70) = 100;
  *(undefined4 *)(unaff_EBP + -0x6c) = 0x12;
  *(undefined4 *)(unaff_EBP + -0x68) = 1;
  FUN_00420ea4((undefined4 *)(unaff_EBP + -100),(undefined4 *)&DAT_00522524);
  *(undefined4 *)(unaff_EBP + -0x5c) = 0;
  *(undefined4 *)(unaff_EBP + -0x58) = 0;
  FUN_00420ea4((undefined4 *)(unaff_EBP + -0x54),(undefined4 *)(iVar2 + 0x184));
  *(undefined4 *)(unaff_EBP + -0x4c) = 0xffffffff;
  *(undefined4 *)(unaff_EBP + -0x48) = 1;
  *(undefined4 *)(unaff_EBP + -0x44) = *(undefined4 *)(iVar1 + 0x30c);
  *(undefined4 *)(unaff_EBP + -0x40) = *(undefined4 *)(iVar1 + 0x310);
  *(undefined4 *)(unaff_EBP + -0x3c) = *(undefined4 *)(iVar1 + 0x314);
  *(undefined4 *)(unaff_EBP + -0x38) = *(undefined4 *)(iVar1 + 0x318);
  *(undefined4 *)(unaff_EBP + -0x34) = *(undefined4 *)(iVar1 + 0x31c);
  *(undefined4 *)(unaff_EBP + -0x30) = *(undefined4 *)(iVar1 + 800);
  *(undefined4 *)(unaff_EBP + -0x2c) = *(undefined4 *)(iVar1 + 0x324);
  *(undefined4 *)(unaff_EBP + -0x28) = *(undefined4 *)(iVar1 + 0x328);
  *(undefined4 *)(unaff_EBP + -0x24) = *(undefined4 *)(iVar1 + 0x32c);
  *(undefined4 *)(unaff_EBP + -0x20) = *(undefined4 *)(iVar1 + 0x330);
  *(undefined4 *)(unaff_EBP + -0x1c) = *(undefined4 *)(iVar1 + 0x334);
  *(undefined4 *)(unaff_EBP + -0x18) = *(undefined4 *)(iVar1 + 0x338);
  *(undefined4 *)(unaff_EBP + -0x14) = uVar3;
  *(uint *)(unaff_EBP + -0x10) = (uint)(*(int *)(unaff_EBP + -0x14) < 0);
  (**(code **)(**(int **)(unaff_EBP + 0xc) + 0xc))(*(int **)(unaff_EBP + 0xc),unaff_EBP + -0x70);
  return;
}



/* @004be1bc file=? name=FUN_004be1bc */

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

{
  int iVar1;
  
  FUN_004234f0(param_1,param_2,param_3);
  *param_1 = (int)&PTR_FUN_00512a5c;
  FUN_0041db7c((int)(param_1 + 0xc3));
  param_1[10] = param_1[10] | 0x10;
  FUN_0041bbd8((int)(param_1 + 0xb),2);
  iVar1 = (**(code **)(*(int *)(*(int *)(DAT_004efc94 + 0x2c) + 0x54) + 0xc))
                    (*(int *)(DAT_004efc94 + 0x2c) + 0x54,param_2 + 0x7c);
  param_1[0xc0] = iVar1;
  param_1[0xc1] = *(int *)(*(int *)(param_1[0xc0] + 0x128) + *(int *)(param_2 + 0x84) * 4);
  param_1[0xc2] = *(int *)(param_2 + 0x84);
  param_1[0xc3] = *(int *)(param_2 + 0x88);
  param_1[0xc4] = *(int *)(param_2 + 0x8c);
  param_1[0xce] = *(int *)(param_2 + 0xb4);
  FUN_00408440(param_1 + 0xc5,(undefined4 *)(param_2 + 0x90));
  FUN_00408440(param_1 + 200,(undefined4 *)(param_2 + 0x9c));
  FUN_00408440(param_1 + 0xcb,(undefined4 *)(param_2 + 0xa8));
  param_1[0xcf] = *(int *)(param_2 + 0xb8);
  iVar1 = FUN_00433ed4(*(int *)(DAT_004efc94 + 0x30) + 0x14);
  param_1[0x94] = *(int *)(iVar1 + 0x34) + 0x2c;
  param_1[0x95] = (int)PTR_FUN_005129dc;
  param_1[0x96] = DAT_005129e0;
  param_1[0x97] = DAT_005129e4;
  if ((param_1[10] & 0xcU) == 4) {
    param_1[7] = (int)PTR_LAB_005129e8;
    param_1[8] = DAT_005129ec;
    param_1[9] = DAT_005129f0;
  }
  else {
    param_1[7] = (int)PTR_LAB_005129f4;
    param_1[8] = DAT_005129f8;
    param_1[9] = DAT_005129fc;
  }
  (**(code **)(*param_1 + 0x38))(param_1);
  return param_1;
}



/* @004be358 file=? name=FUN_004be358 */

void __cdecl FUN_004be358(int *param_1,byte param_2)

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



/* @004be384 file=? name=FUN_004be384 */

int * __cdecl FUN_004be384(int param_1)

{
  int *piVar1;
  
  piVar1 = (int *)FUN_00402298(0x340);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    piVar1 = FUN_004be1bc(piVar1,param_1,&DAT_005129b0);
  }
  return piVar1;
}



/* @004be3b4 file=? name=FUN_004be3b4 */

void __cdecl FUN_004be3b4(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x512980);
  return;
}



/* @004be7c4 file=? name=FUN_004be7c4 */

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

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

{
  FUN_0041c52c(param_1,param_2,param_3,param_4,&DAT_00512a9c);
  *param_1 = &PTR_LAB_00512bbc;
  param_1[0x39] = *(undefined4 *)(param_4 + 0x30);
  param_1[0x3b] = *(undefined4 *)(param_4 + 0x38);
  param_1[0x3c] = *(undefined4 *)(param_4 + 0x3c);
  if ((*(uint *)(param_2 + 0x28) & 0xc) != 4) {
    param_1[7] = PTR_LAB_00512b14;
    param_1[8] = DAT_00512b18;
    param_1[9] = DAT_00512b1c;
  }
  param_1[7] = PTR_LAB_00512b20;
  param_1[8] = DAT_00512b24;
  param_1[9] = DAT_00512b28;
  param_1[0x3a] = *(float *)(param_4 + 0x34) * _DAT_004be8b8;
  FUN_0041bbd8((int)(param_1 + 0xb),1);
  FUN_00408440(param_1 + 0x3d,&DAT_004e0f74);
  param_1[0x3f] = (float)param_1[0x3f] - (float)param_1[0x3b];
  FUN_00408440(param_1 + 0x40,&DAT_004e0f74);
  return param_1;
}



/* @004be8e8 file=? name=FUN_004be8e8 */

void __cdecl FUN_004be8e8(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x512aac);
  return;
}



/* @004beae4 file=? name=FUN_004beae4 */

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

void __cdecl FUN_004beae4(int param_1)

{
  int iVar1;
  int iVar2;
  float10 fVar3;
  float local_1c;
  float local_18;
  float local_14;
  float local_10;
  float local_c;
  float local_8;
  
  if (*(int *)(param_1 + 0xfc) != 0) {
    iVar2 = *(int *)(param_1 + 0xd0);
    iVar1 = *(int *)(*(int *)(iVar2 + 0x128) + 4);
    FUN_00408644(&local_1c,(float *)(param_1 + 0xe4),(float *)(iVar2 + 0x100));
    fVar3 = FUN_004dd138((double)(local_14 * local_14 + local_18 * local_18 + local_1c * local_1c));
    local_8 = (float)fVar3;
    local_c = local_8 / *(float *)(iVar2 + 0x348);
    if ((_DAT_004bec18 < local_8) && (_DAT_004bec1c < *(float *)(iVar1 + 0xf0))) {
      local_10 = local_8 - _DAT_004bec18;
      if ((_DAT_004bec20 <= local_18) && (_DAT_004bec24 < local_10)) {
        local_10 = _DAT_004bec24;
      }
      *(float *)(param_1 + 0xe8) =
           (float)(_DAT_004bec28 * (float10)local_10 + (float10)*(float *)(param_1 + 0xe8));
    }
    iVar2 = FUN_0041a1a4(**(int **)(*(int *)(param_1 + 0xfc) + 0xc),0x4e4518);
    if (iVar2 != 0) {
      FUN_004086ac(&local_1c,(float *)(*(int *)(param_1 + 0xfc) + 500),local_c);
      FUN_004085ec((float *)(param_1 + 0xe4),(float *)(param_1 + 0xe4),&local_1c);
    }
  }
  return;
}



/* @004bec34 file=? name=FUN_004bec34 */

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

undefined4 * __cdecl
FUN_004bec34(undefined4 *param_1,int param_2,undefined4 param_3,char *param_4,undefined4 param_5,
            undefined4 param_6,undefined4 param_7,undefined4 param_8)

{
  float10 fVar1;
  float local_24;
  float local_20;
  float local_1c;
  float local_18;
  float local_14;
  float local_10;
  int local_c;
  undefined4 *local_8;
  
  FUN_0041c52c(param_1,param_2,param_3,param_4,&DAT_00512bec);
  *param_1 = &PTR_LAB_00512ce8;
  local_8 = (undefined4 *)(param_2 + 0x100);
  param_1[0x3c] = *local_8;
  param_1[0x3d] = *(undefined4 *)(param_2 + 0x104);
  param_1[0x3e] = *(undefined4 *)(param_2 + 0x108);
  param_1[0x3f] = param_5;
  param_1[0x40] = param_6;
  param_1[0x41] = param_7;
  param_1[0x42] = param_8;
  if ((*(uint *)(param_2 + 0x28) & 0xc) != 4) {
    param_1[7] = PTR_LAB_00512c64;
    param_1[8] = DAT_00512c68;
    param_1[9] = DAT_00512c6c;
  }
  FUN_0041bbd8((int)(param_1 + 0xb),1);
  if (param_1[0x3f] == 0) {
    local_c = *(int *)(param_2 + 0x300);
    FUN_00408440(param_1 + 0x39,&DAT_004e0f80);
    param_1[0x3b] = (float)param_1[0x3b] - _DAT_004bee40;
    FUN_00408b98((float *)(param_1 + 0x39),(float *)(param_1 + 0x40),(float *)(local_c + 0xd0));
  }
  else {
    FUN_00408440(param_1 + 0x39,&DAT_004e0f80);
    FUN_00408b98((float *)(param_1 + 0x39),(float *)(param_1 + 0x40),(float *)(param_1[0x3f] + 0xd0)
                );
  }
  local_18 = DAT_004e0f74;
  local_14 = DAT_004e0f78;
  local_10 = DAT_004e0f7c;
  FUN_00408644(&local_18,(float *)(param_1 + 0x39),(float *)(param_2 + 0x100));
  fVar1 = FUN_004dd138((double)(local_10 * local_10 + local_14 * local_14 + local_18 * local_18));
  param_1[0x43] = (float)fVar1;
  param_1[0x45] = param_1[0x43];
  local_24 = DAT_004e0f74;
  local_20 = DAT_004e0f78;
  local_1c = DAT_004e0f7c;
  FUN_00408644(&local_24,(float *)(param_2 + 0x100),(float *)(param_1 + 0x3c));
  fVar1 = FUN_004dd138((double)(local_1c * local_1c + local_20 * local_20 + local_24 * local_24));
  param_1[0x44] = (float)fVar1;
  return param_1;
}



/* @004bee70 file=? name=FUN_004bee70 */

void __cdecl FUN_004bee70(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x512bfc);
  return;
}



/* @004bef4c file=? name=FUN_004bef4c */

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

{
  FUN_004225a4(param_1,param_2,param_3);
  *param_2 = 0x78;
  param_2[0x1d] = *(int *)(param_1 + 0x35c);
  return;
}



/* @004bef78 file=? name=FUN_004bef78 */

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

void __cdecl FUN_004bef78(int param_1,float param_2)

{
  int iVar1;
  int iVar2;
  uint uVar3;
  uint uVar4;
  int *piVar5;
  undefined4 in_stack_fffffef0;
  undefined4 in_stack_fffffef4;
  undefined4 *puVar6;
  float fVar7;
  float local_e8;
  float local_e4;
  float local_e0;
  undefined4 local_dc;
  undefined4 local_d8;
  undefined4 local_d4;
  undefined4 local_d0 [2];
  undefined4 local_c8;
  undefined4 local_c4;
  undefined4 local_c0;
  undefined4 local_bc [2];
  undefined4 local_b4;
  undefined4 local_b0;
  float local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_a0;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_90 [2];
  undefined4 local_88 [2];
  float local_80;
  undefined4 local_7c;
  undefined4 local_78;
  undefined4 local_74;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  float local_64 [3];
  float local_58;
  float local_54;
  float local_50;
  float local_4c;
  undefined4 local_48;
  undefined4 local_44;
  float local_40;
  undefined4 local_3c;
  undefined4 local_38;
  float local_34 [6];
  float local_1c;
  undefined4 *local_18;
  undefined4 local_14;
  int *local_10;
  float local_c;
  float local_8;
  
  *(float *)(param_1 + 0x35c) = param_2 + *(float *)(param_1 + 0x35c);
  if (_DAT_004bf594 < (float)(*(int *)(param_1 + 0x10) - *(int *)(param_1 + 0x14)) / DAT_0052140c) {
    *(ushort *)(param_1 + 0x18) = *(ushort *)(param_1 + 0x18) | 1;
  }
  if (*(float *)(param_1 + 0x35c) <= *(float *)(param_1 + 0x340)) {
    *(float *)(param_1 + 0x344) = *(float *)(param_1 + 0x35c) / *(float *)(param_1 + 0x340);
  }
  else {
    *(undefined4 *)(param_1 + 0x344) = 0x3f800000;
  }
  piVar5 = (int *)0x0;
  FUN_0040d150(local_34,(undefined4 *)(param_1 + 0x100));
  iVar2 = *(int *)(param_1 + 0x250);
  local_40 = *(float *)(iVar2 + 0x14);
  local_3c = *(undefined4 *)(iVar2 + 0x18);
  local_38 = *(undefined4 *)(iVar2 + 0x1c);
  local_8 = *(float *)(iVar2 + 4);
  FUN_00408644(&local_58,(float *)(param_1 + 0x1c4),&local_40);
  if (local_58 <= _DAT_004bf598) {
    local_4c = *(float *)(param_1 + 0x228);
  }
  else {
    local_4c = *(float *)(param_1 + 0x21c);
  }
  if (local_54 <= _DAT_004bf598) {
    local_48 = *(undefined4 *)(param_1 + 0x22c);
  }
  else {
    local_48 = *(undefined4 *)(param_1 + 0x220);
  }
  if (local_50 <= _DAT_004bf598) {
    local_44 = *(undefined4 *)(param_1 + 0x230);
  }
  else {
    local_44 = *(undefined4 *)(param_1 + 0x224);
  }
  local_c = local_8;
  FUN_004086ac(&local_4c,&local_4c,local_8);
  if (_DAT_004bf59c <= local_58) {
    uVar3 = (uint)(_DAT_004bf5a0 < local_58);
  }
  else {
    uVar3 = 0xffffffff;
  }
  local_58 = (float)(int)uVar3 * local_58 * local_58;
  if (_DAT_004bf59c <= local_54) {
    uVar3 = (uint)(_DAT_004bf5a0 < local_54);
  }
  else {
    uVar3 = 0xffffffff;
  }
  local_54 = (float)(int)uVar3 * local_54 * local_54;
  if (_DAT_004bf59c <= local_50) {
    uVar3 = (uint)(_DAT_004bf5a0 < local_50);
  }
  else {
    uVar3 = 0xffffffff;
  }
  local_50 = (float)(int)uVar3 * local_50 * local_50;
  FUN_004086d0(&local_4c,&local_4c,&local_58);
  FUN_00408644((float *)(param_1 + 0x1dc),(float *)(param_1 + 0x1dc),&local_4c);
  FUN_004086d0(&local_4c,(float *)(param_1 + 0x234),(float *)(param_1 + 0x1d0));
  FUN_00408644((float *)(param_1 + 0x1e8),(float *)(param_1 + 0x1e8),&local_4c);
  iVar2 = **(int **)(param_1 + 0x128);
  if (*(int *)((*(int **)(param_1 + 0x128))[1] + 0x40) == 1) {
    *(undefined4 *)(param_1 + 0x1dc) = 0;
    *(undefined4 *)(param_1 + 0x1e0) = 0;
    *(undefined4 *)(param_1 + 0x1c4) = 0;
    *(undefined4 *)(param_1 + 0x1c8) = 0;
    FUN_00421b2c(param_1);
  }
  else {
    FUN_00421b2c(param_1);
    *(float *)(param_1 + 0x204) = *(float *)(param_1 + 0x204) - **(float **)(param_1 + 0x250);
  }
  FUN_00421bac(param_1,param_2);
  if (((*(int *)(iVar2 + 0xfc) != 0) &&
      (iVar1 = FUN_0041a1a4(**(int **)(*(int *)(iVar2 + 0xfc) + 0xc),0x50bdb4), iVar1 != 0)) &&
     (iVar1 = FUN_0049fb54(*(int *)(iVar2 + 0xfc)), iVar1 != 0)) {
    *(undefined4 *)(iVar2 + 0xfc) = 0;
  }
  if (*(float *)(iVar2 + 0x10c) < _DAT_004bf5a4) {
    piVar5 = *(int **)(iVar2 + 0xfc);
  }
  FUN_00408644(local_64,(float *)(param_1 + 0x100),local_34);
  FUN_0040d100((int)local_34,local_64);
  FUN_0040ab44((float *)(param_1 + 0xd0),(undefined4 *)(param_1 + 0x100));
  iVar2 = FUN_0042291c(param_1,local_34,*(int *)(param_1 + 0x300));
  if (iVar2 != 0) {
    piVar5 = *(int **)(iVar2 + 0x1c);
  }
  if (piVar5 == (int *)0x0) {
    FUN_00421b6c(param_1);
    (**(code **)(param_1 + 0x254))();
    FUN_00408644(&local_e8,(float *)(param_1 + 0x260),(float *)(param_1 + 0x100));
    if (_DAT_004bf5a8 < local_e0 * local_e0 + local_e4 * local_e4 + local_e8 * local_e8) {
      *(ushort *)(param_1 + 0x18) = *(ushort *)(param_1 + 0x18) | 1;
    }
  }
  else {
    FUN_0042061c(param_1);
    local_80 = *(float *)(param_1 + 0x100);
    local_7c = *(undefined4 *)(param_1 + 0x104);
    local_78 = *(undefined4 *)(param_1 + 0x108);
    local_74 = *(undefined4 *)(param_1 + 0x10c);
    local_70 = *(undefined4 *)(param_1 + 0x110);
    local_6c = *(undefined4 *)(param_1 + 0x114);
    local_68 = *(undefined4 *)(param_1 + 0x118);
    FUN_00409968(&local_74,&DAT_004e0fa4);
    FUN_0040cdf4(local_34,local_1c,&local_80);
    iVar2 = *(int *)(param_1 + 0x300);
    local_10 = piVar5 + 0x61;
    local_14 = *(undefined4 *)(param_1 + 0x33c);
    local_dc = 0x5c;
    local_d8 = 3;
    local_d4 = 1;
    FUN_00420ea4(local_d0,(undefined4 *)&DAT_00522524);
    local_c8 = 0;
    local_c4 = 0;
    local_c0 = 0x31;
    FUN_00420ea4(local_bc,(undefined4 *)&DAT_00522524);
    local_b4 = local_14;
    local_b0 = 0x100;
    local_ac = local_80;
    local_a8 = local_7c;
    local_a4 = local_78;
    local_a0 = local_74;
    local_9c = local_70;
    local_98 = local_6c;
    local_94 = local_68;
    FUN_00420ea4(local_90,local_10);
    FUN_00420ea4(local_88,(undefined4 *)(iVar2 + 0x184));
    local_18 = FUN_004302ec((int)&local_dc);
    uVar3 = *(uint *)(param_1 + 0x338);
    iVar2 = FUN_0040807c(&DAT_00521f5c,uVar3);
    uVar4 = uVar3;
    if ((int)uVar3 < 0) {
      uVar4 = uVar3 + 3;
    }
    uVar4 = iVar2 + ((int)uVar4 >> 2);
    if ((int)uVar3 < (int)uVar4) {
      uVar4 = uVar3;
    }
    *(uint *)(param_1 + 0x338) = uVar4;
    FUN_004be078(param_1,piVar5);
    if (*(int *)(param_1 + 0x360) != 0) {
      *(uint *)(param_1 + 0x338) = uVar3;
      puVar6 = (undefined4 *)(param_1 + 0x30c);
      fVar7 = *(float *)(param_1 + 0x364);
      FUN_00420ea4((undefined4 *)&stack0xfffffef0,(undefined4 *)(*(int *)(param_1 + 0x300) + 0x184))
      ;
      FUN_0042fad0((int)local_18,in_stack_fffffef0,in_stack_fffffef4,puVar6,fVar7);
    }
  }
  if ((*(float *)(param_1 + 0x340) + _DAT_004bf5ac <
       (float)(*(int *)(param_1 + 0x10) - *(int *)(param_1 + 0x19c)) / DAT_0052140c) ||
     (*(float *)(param_1 + 0x104) < _DAT_004bf5b0)) {
    FUN_0042061c(param_1);
    *(ushort *)(param_1 + 0x18) = *(ushort *)(param_1 + 0x18) | 1;
  }
  return;
}



/* @004bf5b4 file=? name=FUN_004bf5b4 */

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

{
  int iVar1;
  int iVar2;
  int iVar3;
  undefined4 *puVar4;
  char *pcVar5;
  char *pcVar6;
  float10 fVar7;
  char local_88 [2];
  char acStack_86 [30];
  undefined4 local_68;
  undefined4 local_64;
  undefined4 local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  undefined4 local_4c;
  char local_48 [4];
  char acStack_44 [2];
  char cStack_42;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  int *local_14;
  undefined4 *local_10;
  int local_c;
  int *local_8;
  
  FUN_004be1bc(param_1,param_2,param_3);
  *param_1 = (int)&PTR_FUN_00512f2c;
  param_1[0xd1] = 0;
  local_8 = (int *)(param_2 + 0xc4);
  param_1[0xd4] = *local_8;
  param_1[0xd5] = *(int *)(param_2 + 200);
  param_1[0xd6] = *(int *)(param_2 + 0xcc);
  param_1[0xd7] = 0;
  param_1[0xd8] = *(int *)(param_2 + 0xd0);
  param_1[10] = param_1[10] | 0x10;
  local_c = param_2 + 0xbc;
  iVar1 = (**(code **)(*(int *)(*(int *)(DAT_004efc94 + 0x2c) + 0x54) + 0xc))
                    (*(int *)(DAT_004efc94 + 0x2c) + 0x54);
  param_1[0xd3] = iVar1;
  param_1[0x95] = (int)PTR_FUN_00512d94;
  param_1[0x96] = DAT_00512d98;
  param_1[0x97] = DAT_00512d9c;
  if ((param_1[10] & 0xcU) == 4) {
    param_1[7] = (int)PTR_LAB_00512da0;
    param_1[8] = DAT_00512da4;
    param_1[9] = DAT_00512da8;
  }
  else {
    param_1[7] = (int)PTR_FUN_00512dac;
    param_1[8] = DAT_00512db0;
    param_1[9] = DAT_00512db4;
  }
  iVar2 = FUN_00407064(*(int *)(DAT_004efc94 + 0x68),param_1[0x6f],0xf);
  iVar1 = *(int *)(iVar2 + 4);
  *(int *)(iVar2 + 4) = *(int *)(iVar2 + 4) + 1;
  if (iVar1 == 0) {
    FUN_00406cd0(iVar2);
  }
  iVar1 = *(int *)(iVar2 + 0x3c);
  param_1[0x49] = 2;
  iVar3 = FUN_004022b0(param_1[0x49] << 2);
  param_1[0x4a] = iVar3;
  param_1[0xd0] = *(int *)(iVar1 + 0x44);
  param_1[0xd9] = *(int *)(iVar1 + 0x50);
  local_48[0] = s_Seeker_00512e1e[0];
  local_48[1] = s_Seeker_00512e1e[1];
  local_48[2] = s_Seeker_00512e1e[2];
  local_48[3] = s_Seeker_00512e1e[3];
  acStack_44[0] = s_Seeker_00512e1e[4];
  acStack_44[1] = s_Seeker_00512e1e[5];
  cStack_42 = s_Seeker_00512e1e[6];
  local_28 = 0xf;
  local_24 = 0x30;
  local_20 = 0xffffffff;
  local_1c = 0;
  local_10 = (undefined4 *)FUN_00402298(0x118);
  if (local_10 == (undefined4 *)0x0) {
    puVar4 = (undefined4 *)0x0;
  }
  else {
    local_14 = param_1 + 0xd4;
    puVar4 = FUN_004bec34(local_10,(int)param_1,0,local_48,param_1[0xd3],*local_14,param_1[0xd5],
                          param_1[0xd6]);
  }
  *(undefined4 **)param_1[0x4a] = puVar4;
  pcVar5 = s_MissleThruster_00512e25;
  pcVar6 = local_88;
  for (iVar3 = 3; iVar3 != 0; iVar3 = iVar3 + -1) {
    *(undefined4 *)pcVar6 = *(undefined4 *)pcVar5;
    pcVar5 = pcVar5 + 4;
    pcVar6 = pcVar6 + 4;
  }
  *(undefined2 *)pcVar6 = *(undefined2 *)pcVar5;
  pcVar6[2] = pcVar5[2];
  local_68 = 0xf;
  local_64 = 0x40;
  local_58 = *(undefined4 *)(iVar1 + 0x44);
  local_54 = *(undefined4 *)(iVar1 + 0x40);
  local_50 = *(undefined4 *)(iVar1 + 0x48);
  local_4c = *(undefined4 *)(iVar1 + 0x4c);
  local_60 = 0xffffffff;
  local_5c = 0;
  local_18 = local_54;
  fVar7 = FUN_004dd138((double)(*(float *)(iVar1 + 0x48) / (float)param_1[0x8c]));
  param_1[0xd2] = (int)(float)fVar7;
  puVar4 = (undefined4 *)FUN_00402298(0x10c);
  if (puVar4 == (undefined4 *)0x0) {
    puVar4 = (undefined4 *)0x0;
  }
  else {
    puVar4 = FUN_004be7c4(puVar4,(int)param_1,1,local_88);
  }
  *(undefined4 **)(param_1[0x4a] + 4) = puVar4;
  if (param_1[0xd3] != 0) {
    iVar1 = FUN_0041a1a4(**(int **)(param_1[0xd3] + 0xc),0x50bdb4);
    if (iVar1 != 0) {
      (**(code **)(*(int *)(param_1[0xd3] + 0x418) + 4))(param_1[0xd3] + 0x418,param_1);
    }
  }
  *(int *)(iVar2 + 4) = *(int *)(iVar2 + 4) + -1;
  return param_1;
}



/* @004bf890 file=? name=FUN_004bf890 */

void __cdecl FUN_004bf890(int *param_1,byte param_2)

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



/* @004bf8bc file=? name=FUN_004bf8bc */

int * __cdecl FUN_004bf8bc(int param_1)

{
  int *piVar1;
  
  piVar1 = (int *)FUN_00402298(0x368);
  if (piVar1 == (int *)0x0) {
    piVar1 = (int *)0x0;
  }
  else {
    piVar1 = FUN_004bf5b4(piVar1,param_1,&DAT_00512d48);
  }
  return piVar1;
}



/* @004bf8ec file=? name=FUN_004bf8ec */

undefined4 __cdecl
FUN_004bf8ec(int param_1,char *param_2,int param_3,undefined4 param_4,float *param_5)

{
  float *pfVar1;
  int iVar2;
  undefined4 *puVar3;
  
  pfVar1 = param_5;
  if (param_5 == (float *)0x0) {
    pfVar1 = (float *)FUN_00402298(0x54);
  }
  iVar2 = FUN_004238bc(param_1,param_2,param_3,param_4,pfVar1);
  if (iVar2 != -1) {
    iVar2 = FUN_00404118(param_3,s_gamedata_00512e34,s_BurnTime_00512e3d,pfVar1 + 0x11);
    if (iVar2 == 0) {
      FUN_004dbb24((int *)&DAT_00524e68,param_2,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_Missing_BurnTime_00512e46,(char *)0x0);
      FUN_004d9c38((int *)&DAT_00524e68);
    }
    else {
      iVar2 = FUN_00404118(param_3,s_gamedata_00512e57,s_MaxThrusterRotationRate_00512e60,
                           pfVar1 + 0x10);
      if (iVar2 == 0) {
        FUN_004dbb24((int *)&DAT_00524e68,param_2,(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_MaxThrusterRotationRate_Missing_00512e78,(char *)0x0);
        FUN_004d9c38((int *)&DAT_00524e68);
      }
      else {
        iVar2 = FUN_00404118(param_3,s_gamedata_00512e98,s_ThrusterAcceleration_00512ea1,
                             pfVar1 + 0x12);
        if (iVar2 == 0) {
          FUN_004dbb24((int *)&DAT_00524e68,param_2,(char *)0x0);
          FUN_004dbb24((int *)&DAT_00524e68,s_ThrusterAcceleration_Missing_00512eb6,(char *)0x0);
          FUN_004d9c38((int *)&DAT_00524e68);
        }
        else {
          iVar2 = FUN_00404118(param_3,s_gamedata_00512ed3,s_ThrusterClimb_00512edc,pfVar1 + 0x13);
          if (iVar2 == 0) {
            FUN_004dbb24((int *)&DAT_00524e68,param_2,(char *)0x0);
            FUN_004dbb24((int *)&DAT_00524e68,s_ThrusterClimb_missing_00512eea,(char *)0x0);
            FUN_004d9c38((int *)&DAT_00524e68);
          }
          else {
            iVar2 = FUN_00404118(param_3,s_gamedata_00512f00,s_SplashRadius_00512f09,pfVar1 + 0x14);
            if (iVar2 != 0) {
              if (param_5 == (float *)0x0) {
                puVar3 = (undefined4 *)FUN_00406db4(param_1,param_2,0xf,1,0,pfVar1,0x54,-1);
                FUN_004022d0((int *)pfVar1);
                return *puVar3;
              }
              return 1;
            }
            FUN_004dbb24((int *)&DAT_00524e68,param_2,(char *)0x0);
            FUN_004dbb24((int *)&DAT_00524e68,s_Splash_Radius_missing_00512f16,(char *)0x0);
            FUN_004d9c38((int *)&DAT_00524e68);
          }
        }
      }
    }
  }
  if (param_5 == (float *)0x0) {
    FUN_004022d0((int *)pfVar1);
  }
  return 0xffffffff;
}



/* @004bfb28 file=? name=FUN_004bfb28 */

void __cdecl FUN_004bfb28(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x512d18);
  return;
}



/* @004bfc20 file=? name=FUN_004bfc20 */

void __cdecl FUN_004bfc20(int param_1)

{
  int iVar1;
  
  FUN_0042d9e0(param_1);
  iVar1 = FUN_004dcd94();
  *(int *)(param_1 + 0x288) = *(int *)(param_1 + 0x288) - iVar1;
  if (*(int *)(DAT_004efc94 + 0x88) == 8) {
    iVar1 = FUN_0041a1a4(**(int **)(*(int *)(param_1 + 0x1fc) + 0xc),0x50bdb4);
    if (iVar1 != 0) {
      FUN_0049fb74(*(int *)(param_1 + 0x1fc),(undefined4 *)&DAT_00524b38,1);
      *(ushort *)(param_1 + 0x18) = *(ushort *)(param_1 + 0x18) | 1;
    }
  }
  return;
}



/* @004bfee0 file=? name=FUN_004bfee0 */

void __cdecl FUN_004bfee0(int param_1)

{
  uint local_30 [5];
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14 [2];
  undefined4 local_c [2];
  
  FUN_00420ea4(local_c,(undefined4 *)(param_1 + 0x184));
  local_30[0] = 0x24;
  local_30[1] = 0x14;
  local_30[2] = 1;
  FUN_00420ea4(local_30 + 3,(undefined4 *)&DAT_00522524);
  local_1c = 0;
  local_18 = 0;
  FUN_00420e8c(local_14);
  FUN_00420ef4(local_14,local_c);
  (**(code **)(**(int **)(param_1 + 0x1fc) + 0xc))(*(int **)(param_1 + 0x1fc),local_30);
  FUN_0041f640(*(int *)(param_1 + 0x1fc),local_30);
  return;
}



/* @004bff74 file=? name=FUN_004bff74 */

void __cdecl FUN_004bff74(int param_1)

{
  undefined4 uVar1;
  
  if ((*(int *)(param_1 + 0x270) == 0) && (*(int *)(param_1 + 0x274) != 0)) {
    uVar1 = 1;
  }
  else {
    uVar1 = 0;
  }
  *(undefined4 *)(param_1 + 0x270) = uVar1;
  return;
}



/* @004bffa0 file=? name=FUN_004bffa0 */

void __cdecl FUN_004bffa0(int param_1,uint *param_2)

{
  if ((param_2[1] == 0x16) && (param_2[8] == 0)) {
    FUN_004c0200(param_1,(int)param_2);
    return;
  }
  FUN_0041f59c(param_1,param_2);
  return;
}



/* @004bffd0 file=? name=FUN_004bffd0 */

void __cdecl FUN_004bffd0(int *param_1,uint *param_2)

{
  if (param_1[0x7f] == 0) {
    FUN_0040a938((undefined4 *)&DAT_00524b38,param_2 + 7);
    (**(code **)(*param_1 + 0x40))
              (param_1,param_2[7],param_2[8],param_2[9],param_2[10],param_2[0xb],param_2[0xc],
               param_2[0xd]);
    FUN_004bfee0((int)param_1);
    if (*(int *)(param_1[0x7f] + 4) == 0x45) {
      param_1[7] = (int)PTR_LAB_00513064;
      param_1[8] = DAT_00513068;
      param_1[9] = DAT_0051306c;
      param_1[0x73] = -1;
    }
    else if (*(int *)(param_1[0x7f] + 4) == 0xbb9) {
      param_1[7] = (int)PTR_LAB_00513058;
      param_1[8] = DAT_0051305c;
      param_1[9] = DAT_00513060;
    }
    param_1[0x80] = 0;
    param_1[10] = param_1[10] & 0xfffffffd;
  }
  else {
    if (param_2[0xe] != param_1[0x80]) {
      return;
    }
    if (param_1[0x10] == 4) {
      return;
    }
    if (param_1[0x10] != 1) {
      FUN_004c012c((int)param_1,param_2);
      return;
    }
  }
  FUN_0041bbd8((int)(param_1 + 0xb),2);
  if (*(int *)(param_1[0x7f] + 4) == 0xbb9) {
    if (param_1[0x99] == 0) {
      FUN_0049fb74(param_1[0x7f],param_2 + 7,1);
    }
    else {
      FUN_0049fb74(param_1[0x7f],(undefined4 *)&DAT_00524b38,1);
    }
  }
  return;
}



/* @004c012c file=? name=FUN_004c012c */

void __cdecl FUN_004c012c(int param_1,uint *param_2)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  
  *(int *)(param_1 + 0x200) = *(int *)(param_1 + 0x200) + 1;
  param_2[0xe] = *(uint *)(param_1 + 0x200);
  *(int *)(*(int *)(param_1 + 0x208) + 0x28) = *(int *)(*(int *)(param_1 + 0x208) + 0x28) + -1;
  *(ushort *)(param_1 + 0x18) = *(ushort *)(param_1 + 0x18) | 1;
  FUN_0041bbd8(param_1 + 0x2c,1);
  if (*(int *)(param_1 + 0x264) == 0) {
    FUN_00408440((undefined4 *)(param_1 + 0x1d0),param_2 + 7);
  }
  else {
    FUN_00408440((undefined4 *)(param_1 + 0x1d0),(undefined4 *)&DAT_00524b38);
  }
  piVar2 = (int *)FUN_00414b60();
  iVar1 = *piVar2;
  iVar3 = FUN_004dcd94();
  FUN_0041acbc(*(int *)(DAT_004efc94 + 0x60),3,param_1,param_2,iVar1 + iVar3);
  *(undefined4 *)(param_1 + 0x290) = 0;
  *(undefined4 *)(param_1 + 600) = 0;
  return;
}



/* @004c0200 file=bt/btplayer.cpp name=FUN_004c0200 */

void __cdecl FUN_004c0200(int param_1,int param_2)

{
  int iVar1;
  int iVar2;
  float10 fVar3;
  float local_10;
  
  if (*(int *)(param_2 + 0x20) != 0) {
    FUN_0040385c(s_BTPlayer__ScoreInflictedMessageH_00513110,s_d__tesla_bt_bt_btplayer_cpp_0051316a,
                 0x18b);
  }
  iVar2 = (**(code **)(*(int *)(*(int *)(DAT_004efc94 + 0x2c) + 0x54) + 0xc))
                    (*(int *)(DAT_004efc94 + 0x2c) + 0x54,param_2 + 0x34);
  iVar1 = *(int *)(param_1 + 0x1fc);
  fVar3 = FUN_004c052c(param_1,(float *)(param_2 + 0x24),iVar2,0.0);
  local_10 = (float)fVar3;
  if (iVar2 == iVar1) {
    local_10 = -local_10;
  }
  *(float *)(param_1 + 0x278) =
       (*(float *)(iVar2 + 0x4bc) / *(float *)(iVar1 + 0x4bc)) * local_10 +
       *(float *)(param_1 + 0x278);
  return;
}



/* @004c02a8 file=bt/btplayer.cpp name=FUN_004c02a8 */

void __cdecl FUN_004c02a8(int param_1,int param_2)

{
  if ((*(uint *)(param_1 + 0x28) & 0xc) == 4) {
    FUN_0040385c(s_BTPlayer__ScoreUpdateMessageHand_00513186,s_d__tesla_bt_bt_btplayer_cpp_005131cf,
                 0x1d5);
  }
  FUN_0042da20(param_1,param_2);
  return;
}



/* @004c02e4 file=bt/btplayer.cpp name=FUN_004c02e4 */

void __cdecl FUN_004c02e4(int param_1,int param_2)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  undefined4 uVar4;
  float10 fVar5;
  undefined4 uVar6;
  undefined4 local_4c [10];
  int local_24;
  undefined4 local_20;
  int local_1c;
  undefined4 local_18;
  undefined4 *local_14;
  float local_10;
  int local_c;
  int local_8;
  
  if ((*(uint *)(param_1 + 0x28) & 0xc) == 4) {
    FUN_0040385c(s_BTPlayer__ScoreMessageHandler_sh_005131eb,s_d__tesla_bt_bt_btplayer_cpp_0051322e,
                 0x1e9);
  }
  if (*(int *)(param_1 + 0x40) != 4) {
    local_8 = param_2 + 0x34;
    iVar3 = (**(code **)(*(int *)(*(int *)(DAT_004efc94 + 0x2c) + 0x54) + 0xc))
                      (*(int *)(DAT_004efc94 + 0x2c) + 0x54,local_8);
    local_c = *(int *)(param_1 + 0x1fc);
    iVar2 = *(int *)(param_2 + 0x20);
    if (iVar2 == 0) {
      FUN_0040385c(s_BTPlayer__ScoreMessageHandler_sh_0051324a,
                   s_d__tesla_bt_bt_btplayer_cpp_0051329a,0x296);
    }
    else if (iVar2 == 1) {
      if (iVar3 != local_c) {
        fVar5 = FUN_00429b94(*(int *)(param_1 + 0x208),(float *)(param_2 + 0x24));
        local_10 = (*(float *)(local_c + 0x4bc) / *(float *)(iVar3 + 0x4bc)) * (float)fVar5;
      }
      local_1c = FUN_00429078(*(int *)(DAT_004efc94 + 0x2c));
      if ((local_1c != 0) && (*(int *)(param_1 + 600) == 0)) {
        local_20 = *(undefined4 *)(param_2 + 0x30);
        local_24 = FUN_004078fc(*(float *)(param_2 + 0x24));
        uVar6 = local_20;
        uVar4 = FUN_004dcd94();
        FUN_004c1944(local_4c,*(undefined4 *)(param_1 + 0x18c),
                     *(undefined4 *)(*(int *)(iVar3 + 400) + 0x18c),local_24,
                     *(undefined4 *)(param_2 + 0x2c),*(undefined4 *)(param_2 + 0x28),uVar4,uVar6);
        (**(code **)(**(int **)(DAT_004efc94 + 0x20) + 0x18))
                  (*(int **)(DAT_004efc94 + 0x20),local_4c,5,*(undefined4 *)(local_1c + 0xc));
      }
    }
    else if (iVar2 == 2) {
      fVar5 = FUN_004c052c(param_1,(float *)(param_2 + 0x24),iVar3,*(float *)(param_2 + 0x1c));
      local_10 = (*(float *)(iVar3 + 0x4bc) / *(float *)(local_c + 0x4bc)) * (float)fVar5;
      if (iVar3 == local_c) {
        local_10 = -local_10;
      }
      else {
        *(int *)(param_1 + 0x27c) = *(int *)(param_1 + 0x27c) + 1;
        piVar1 = (int *)(*(int *)(iVar3 + 400) + 0x27c);
        *piVar1 = *piVar1 + 1;
      }
      local_14 = FUN_00402f74(0x512f6c);
      if (local_14 != (undefined4 *)0x0) {
        local_18 = *(undefined4 *)(iVar3 + 400);
        FUN_0042d990(local_14,local_18,0,0x40c00000);
        *local_14 = &PTR_LAB_00513344;
        local_14[6] = 0;
      }
      FUN_0042e580(param_1,local_14);
      if (iVar3 == *(int *)(param_1 + 0x284)) {
        FUN_004b04d8(**(int **)(*(int *)(param_1 + 0x1fc) + 0x128),iVar3);
      }
    }
    *(float *)(param_2 + 0x1c) = local_10;
    FUN_0042da20(param_1,param_2);
  }
  return;
}



/* @004c052c file=? name=FUN_004c052c */

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

float10 __cdecl FUN_004c052c(int param_1,float *param_2,int param_3,float param_4)

{
  char *pcVar1;
  char *pcVar2;
  char *pcVar3;
  bool bVar4;
  float local_8;
  
  if (*(int *)(param_1 + 0x250) == 0) {
    pcVar2 = (char *)(*(int *)(param_3 + 400) + 0x20c);
    pcVar3 = (char *)(param_1 + 0x20c);
    do {
      if (*pcVar2 != *pcVar3) goto LAB_004c0599;
      bVar4 = true;
      if (*pcVar2 == '\0') break;
      pcVar1 = pcVar2 + 1;
      if (*pcVar1 != pcVar3[1]) goto LAB_004c0599;
      pcVar2 = pcVar2 + 2;
      pcVar3 = pcVar3 + 2;
      bVar4 = *pcVar1 == '\0';
    } while (!bVar4);
    if (bVar4) {
      local_8 = -*(float *)(*(int *)(param_1 + 0x208) + 0x14);
      goto LAB_004c05b1;
    }
  }
LAB_004c0599:
  local_8 = *(float *)(param_3 + 0x354) * *(float *)(*(int *)(param_1 + 0x208) + 0x18) +
            _DAT_004c05c0;
LAB_004c05b1:
  return (float10)((*param_2 + param_4) * *(float *)(*(int *)(param_1 + 0x208) + 0xc)) *
         (float10)local_8;
}



/* @004c083c file=? name=FUN_004c083c */

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

void __cdecl FUN_004c083c(int *param_1)

{
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined4 local_1c [2];
  undefined4 local_14;
  undefined4 local_10;
  int local_c;
  int local_8;
  
  FUN_0042e168((int)param_1);
  if (((_DAT_004c08fc <= (float)(param_1[4] - param_1[0xa3]) / DAT_0052140c) ||
      (*(int *)(DAT_004efc94 + 0x88) == 6)) &&
     (param_1[0xa3] = param_1[4], (float)param_1[0x9e] != _DAT_004c0900)) {
    local_8 = param_1[0x9e];
    local_28 = 0x20;
    local_24 = 0x1a;
    local_20 = 1;
    FUN_00420ea4(local_1c,(undefined4 *)&DAT_00522524);
    local_14 = 0;
    local_10 = 0;
    local_c = local_8;
    (**(code **)(*param_1 + 0xc))(param_1,&local_28);
    param_1[0x9e] = 0;
  }
  return;
}



/* @004c0bc8 file=? name=FUN_004c0bc8 */

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

{
  char *pcVar1;
  char cVar2;
  undefined4 *puVar3;
  char *pcVar4;
  int iVar5;
  uint *puVar6;
  undefined4 uVar7;
  uint uVar8;
  uint uVar9;
  char *pcVar10;
  bool bVar11;
  int local_2c [5];
  int local_18 [3];
  uint *local_c;
  char *local_8;
  
  FUN_0042e328(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_00513300;
  param_1[0x95] = 0;
  param_1[0x96] = 0;
  param_1[0x9e] = 0;
  param_1[0xa4] = 0;
  uVar8 = 0xffffffff;
  pcVar4 = (char *)(param_2 + 0x50);
  do {
    pcVar10 = pcVar4;
    if (uVar8 == 0) break;
    uVar8 = uVar8 - 1;
    pcVar10 = pcVar4 + 1;
    cVar2 = *pcVar4;
    pcVar4 = pcVar10;
  } while (cVar2 != '\0');
  uVar8 = ~uVar8;
  pcVar4 = pcVar10 + -uVar8;
  pcVar10 = (char *)(param_1 + 0x83);
  for (uVar9 = uVar8 >> 2; uVar9 != 0; uVar9 = uVar9 - 1) {
    *(undefined4 *)pcVar10 = *(undefined4 *)pcVar4;
    pcVar4 = pcVar4 + 4;
    pcVar10 = pcVar10 + 4;
  }
  for (uVar8 = uVar8 & 3; uVar8 != 0; uVar8 = uVar8 - 1) {
    *pcVar10 = *pcVar4;
    pcVar4 = pcVar4 + 1;
    pcVar10 = pcVar10 + 1;
  }
  puVar3 = FUN_004212b0(*(int *)(DAT_004efc94 + 0x24),s_Teams_005132ee);
  if (puVar3 != (undefined4 *)0x0) {
    FUN_00421414(local_18,(int)(puVar3 + 4));
LAB_004c0c95:
    do {
      iVar5 = (**(code **)(local_18[0] + 0x28))(local_18);
      if (iVar5 == 0) goto LAB_004c0ca6;
      pcVar4 = (char *)(iVar5 + 0x1c4);
      pcVar10 = (char *)(param_1 + 0x83);
      do {
        if (*pcVar4 != *pcVar10) goto LAB_004c0c95;
        bVar11 = true;
        if (*pcVar4 == '\0') break;
        pcVar1 = pcVar4 + 1;
        if (*pcVar1 != pcVar10[1]) goto LAB_004c0c95;
        pcVar4 = pcVar4 + 2;
        pcVar10 = pcVar10 + 2;
        bVar11 = *pcVar1 == '\0';
      } while (!bVar11);
    } while (!bVar11);
    param_1[0x93] = iVar5;
LAB_004c0ca6:
    FUN_00421452(local_18,2);
  }
  iVar5 = FUN_004d4b58(*(char **)(*(int *)(DAT_004efc94 + 200) + 0x38),s_freeforall_005132f4);
  if (iVar5 == 0) {
    param_1[0x94] = 1;
  }
  else {
    param_1[0x94] = 1;
  }
  if (((param_1[10] & 0xc) == 4) && (param_1[0x7e] == 0)) {
    param_1[0x7e] = *(undefined4 *)(DAT_004efc94 + 200);
  }
  local_8 = (char *)(param_2 + 0x90);
  puVar6 = (uint *)FUN_00402298(0x10);
  if (puVar6 == (uint *)0x0) {
    local_c = (uint *)0x0;
  }
  else {
    local_c = FUN_00402460(puVar6,local_8);
  }
  local_c[3] = local_c[3] + 1;
  FUN_004323c7(local_2c,param_1[0x7e] + 0x50);
  uVar7 = (**(code **)(local_2c[0] + 0x54))(local_2c,&local_c);
  FUN_00432405(local_2c,2);
  param_1[0x82] = uVar7;
  puVar6 = local_c + 3;
  *puVar6 = *puVar6 - 1;
  if (*puVar6 == 0) {
    FUN_004024d8((int *)local_c,3);
  }
  if ((param_1[10] & 0xc) == 4) {
    param_1[7] = PTR_FUN_00513070;
    param_1[8] = DAT_00513074;
    param_1[9] = DAT_00513078;
  }
  else {
    iVar5 = *(int *)(param_1[0x7e] + 0xe4);
    param_1[0x9d] = iVar5;
    if (iVar5 == 0) {
      param_1[0x98] = 0;
      param_1[0x97] = 0;
      param_1[0x9c] = 0;
      param_1[0x9b] = 0;
    }
    else if (iVar5 == 1) {
      param_1[0x98] = 0;
      param_1[0x97] = 1;
      param_1[0x9c] = 1;
      param_1[0x9b] = 1;
    }
    else if (iVar5 == 2) {
      param_1[0x98] = 1;
      param_1[0x97] = 1;
      param_1[0x9c] = 1;
      param_1[0x9b] = 1;
    }
    else if (iVar5 == 3) {
      param_1[0x98] = 1;
      param_1[0x97] = 1;
      param_1[0x9c] = 1;
      param_1[0x9b] = 0;
    }
    uVar7 = *(undefined4 *)(param_1[0x7e] + 0xf0);
    param_1[0x99] = uVar7;
    param_1[0x9a] = uVar7;
  }
  param_1[0x9f] = 0;
  param_1[0xa0] = 0;
  param_1[0xa1] = 0;
  param_1[0xa2] = param_1[4];
  param_1[0xa3] = param_1[4];
  return param_1;
}



/* @004c0ecc file=? name=FUN_004c0ecc */

undefined4 * __cdecl FUN_004c0ecc(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x294);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004c0bc8(puVar1,param_1,&DAT_00512fc4);
  }
  return puVar1;
}



/* @004c0efc file=? name=FUN_004c0efc */

void __cdecl FUN_004c0efc(int *param_1,byte param_2)

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



/* @004c0f28 file=? name=FUN_004c0f28 */

void __cdecl FUN_004c0f28(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x512f94);
  return;
}



/* @004c10dc file=? name=FUN_004c10dc */

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

{
  FUN_00429ea4(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_005133dc;
  param_1[0x82] = param_1[4];
  return param_1;
}



/* @004c110c file=? name=FUN_004c110c */

void __cdecl FUN_004c110c(int *param_1,byte param_2)

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



/* @004c1138 file=? name=FUN_004c1138 */

undefined4 * __cdecl FUN_004c1138(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x20c);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004c10dc(puVar1,param_1,&DAT_00513380);
  }
  return puVar1;
}



/* @004c1168 file=? name=FUN_004c1168 */

undefined4 __cdecl FUN_004c1168(undefined4 *param_1)

{
  int iVar1;
  
  iVar1 = FUN_00429f8c(param_1);
  if (iVar1 == 0) {
    return 0;
  }
  param_1[7] = 0xbd9;
  return 1;
}



/* @004c1198 file=? name=FUN_004c1198 */

void __cdecl FUN_004c1198(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x513350);
  return;
}



/* @004c1408 file=? name=FUN_004c1408 */

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

{
  FUN_0042eec8(param_1,param_2,param_3);
  *param_1 = &PTR_FUN_005134c4;
  if ((param_1[10] & 0xc) != 4) {
    param_1[7] = PTR_LAB_00513464;
    param_1[8] = DAT_00513468;
    param_1[9] = DAT_0051346c;
  }
  return param_1;
}



/* @004c1454 file=? name=FUN_004c1454 */

undefined4 * __cdecl FUN_004c1454(int param_1)

{
  undefined4 *puVar1;
  
  puVar1 = (undefined4 *)FUN_00402298(0x238);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004c1408(puVar1,param_1,&DAT_00513444);
  }
  return puVar1;
}



/* @004c1484 file=? name=FUN_004c1484 */

void __cdecl FUN_004c1484(int *param_1,byte param_2)

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



/* @004c14b0 file=? name=FUN_004c14b0 */

void __cdecl FUN_004c14b0(int param_1)

{
  FUN_0041a1a4(**(int **)(param_1 + 0xc),0x513414);
  return;
}



/* @004c1548 file=? name=FUN_004c1548 */

undefined4 * __cdecl FUN_004c1548(undefined4 *param_1)

{
  FUN_00433220(param_1);
  *param_1 = &PTR_FUN_00513588;
  return param_1;
}



/* @004c1564 file=? name=FUN_004c1564 */

void __cdecl FUN_004c1564(int *param_1,byte param_2)

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



/* @004c1590 file=? name=FUN_004c1590 */

undefined * __cdecl FUN_004c1590(undefined4 param_1,int param_2)

{
  undefined *puVar1;
  
  if (param_2 < 0xbd2) {
    if (param_2 == 0xbd1) {
      return &DAT_005129b0;
    }
    if (param_2 == 0xbb9) {
      return &DAT_0050bde4;
    }
    if (param_2 == 0xbba) {
      return &DAT_00512d48;
    }
  }
  else {
    if (param_2 == 0xbd9) {
      return &DAT_00513380;
    }
    if (param_2 == 0xbda) {
      return &DAT_00512fc4;
    }
  }
  puVar1 = FUN_004332fc(param_1,param_2);
  return puVar1;
}



/* @004c15f0 file=? name=FUN_004c15f0 */

undefined4 * __cdecl FUN_004c15f0(undefined4 param_1,int param_2)

{
  char *pcVar1;
  int *piVar2;
  char cVar3;
  undefined4 uVar4;
  char *pcVar5;
  undefined4 *puVar6;
  uint uVar7;
  uint uVar8;
  char *pcVar9;
  bool bVar10;
  undefined4 local_12c;
  undefined4 local_128;
  undefined4 local_124;
  undefined4 local_120 [2];
  undefined4 local_118;
  undefined4 local_114;
  undefined4 local_110;
  undefined4 local_10c [2];
  undefined4 local_104;
  undefined4 local_100;
  undefined4 local_fc;
  undefined4 local_f8;
  undefined4 local_f4;
  undefined4 local_f0;
  undefined4 local_ec;
  undefined4 local_e8;
  undefined4 local_e4;
  undefined4 local_e0;
  undefined4 local_dc;
  undefined4 local_d8;
  undefined4 local_d4;
  undefined4 local_d0 [2];
  undefined4 local_c8;
  undefined4 local_c4;
  undefined4 local_c0;
  undefined4 local_bc [2];
  undefined4 local_b4;
  undefined4 local_b0;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_a0;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_90;
  char local_8c [64];
  char local_4c [64];
  int *local_c;
  int *local_8;
  
  pcVar9 = s_camera_00513549;
  pcVar5 = *(char **)(param_2 + 0x2c);
  do {
    bVar10 = *pcVar5 == *pcVar9;
    if (!bVar10) break;
    if (*pcVar5 == '\0') goto LAB_004c17c9;
    pcVar1 = pcVar5 + 1;
    bVar10 = *pcVar1 == pcVar9[1];
    if (!bVar10) break;
    pcVar5 = pcVar5 + 2;
    pcVar9 = pcVar9 + 2;
    bVar10 = *pcVar1 == '\0';
  } while (!bVar10);
  if (bVar10) {
LAB_004c17c9:
    uVar4 = *(undefined4 *)(param_2 + 0x4c);
    local_12c = 0x50;
    local_128 = 3;
    local_124 = 1;
    FUN_00420ea4(local_120,(undefined4 *)&DAT_00522524);
    local_118 = 0;
    local_114 = 0;
    local_110 = 0x46;
    FUN_00420ea4(local_10c,(undefined4 *)&DAT_00522524);
    local_104 = 0xffffffff;
    local_100 = 0x9100;
    local_fc = DAT_004e0fec;
    local_f8 = DAT_004e0ff0;
    local_f4 = DAT_004e0ff4;
    local_f0 = DAT_004e0ff8;
    local_ec = DAT_004e0ffc;
    local_e8 = DAT_004e1000;
    local_e4 = DAT_004e1004;
    local_e0 = uVar4;
    puVar6 = (undefined4 *)FUN_00402298(0x238);
    if (puVar6 == (undefined4 *)0x0) {
      puVar6 = (undefined4 *)0x0;
    }
    else {
      puVar6 = FUN_004c1408(puVar6,(int)&local_12c,&DAT_00513444);
    }
  }
  else {
    local_8 = *(int **)(param_2 + 0xec);
    local_8[3] = local_8[3] + 1;
    local_c = *(int **)(param_2 + 0xe8);
    local_c[3] = local_c[3] + 1;
    uVar4 = *(undefined4 *)(param_2 + 0x4c);
    local_dc = 0xd0;
    local_d8 = 3;
    local_d4 = 1;
    FUN_00420ea4(local_d0,(undefined4 *)&DAT_00522524);
    local_c8 = 0;
    local_c4 = 0;
    local_c0 = 0xbda;
    FUN_00420ea4(local_bc,(undefined4 *)&DAT_00522524);
    local_b4 = 0xffffffff;
    local_b0 = 0x5100;
    local_ac = DAT_004e0fec;
    local_a8 = DAT_004e0ff0;
    local_a4 = DAT_004e0ff4;
    local_a0 = DAT_004e0ff8;
    local_9c = DAT_004e0ffc;
    local_98 = DAT_004e1000;
    local_94 = DAT_004e1004;
    uVar7 = 0xffffffff;
    pcVar5 = (char *)local_8[2];
    do {
      pcVar9 = pcVar5;
      if (uVar7 == 0) break;
      uVar7 = uVar7 - 1;
      pcVar9 = pcVar5 + 1;
      cVar3 = *pcVar5;
      pcVar5 = pcVar9;
    } while (cVar3 != '\0');
    uVar7 = ~uVar7;
    pcVar5 = pcVar9 + -uVar7;
    pcVar9 = local_8c;
    for (uVar8 = uVar7 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) {
      *(undefined4 *)pcVar9 = *(undefined4 *)pcVar5;
      pcVar5 = pcVar5 + 4;
      pcVar9 = pcVar9 + 4;
    }
    for (uVar7 = uVar7 & 3; uVar7 != 0; uVar7 = uVar7 - 1) {
      *pcVar9 = *pcVar5;
      pcVar5 = pcVar5 + 1;
      pcVar9 = pcVar9 + 1;
    }
    uVar7 = 0xffffffff;
    pcVar5 = (char *)local_c[2];
    do {
      pcVar9 = pcVar5;
      if (uVar7 == 0) break;
      uVar7 = uVar7 - 1;
      pcVar9 = pcVar5 + 1;
      cVar3 = *pcVar5;
      pcVar5 = pcVar9;
    } while (cVar3 != '\0');
    uVar7 = ~uVar7;
    pcVar5 = pcVar9 + -uVar7;
    pcVar9 = local_4c;
    for (uVar8 = uVar7 >> 2; uVar8 != 0; uVar8 = uVar8 - 1) {
      *(undefined4 *)pcVar9 = *(undefined4 *)pcVar5;
      pcVar5 = pcVar5 + 4;
      pcVar9 = pcVar9 + 4;
    }
    for (uVar7 = uVar7 & 3; uVar7 != 0; uVar7 = uVar7 - 1) {
      *pcVar9 = *pcVar5;
      pcVar5 = pcVar5 + 1;
      pcVar9 = pcVar9 + 1;
    }
    piVar2 = local_c + 3;
    *piVar2 = *piVar2 + -1;
    local_90 = uVar4;
    if (*piVar2 == 0) {
      FUN_004024d8(local_c,3);
    }
    piVar2 = local_8 + 3;
    *piVar2 = *piVar2 + -1;
    if (*piVar2 == 0) {
      FUN_004024d8(local_8,3);
    }
    puVar6 = (undefined4 *)FUN_00402298(0x294);
    if (puVar6 == (undefined4 *)0x0) {
      puVar6 = (undefined4 *)0x0;
    }
    else {
      puVar6 = FUN_004c0bc8(puVar6,(int)&local_dc,&DAT_00512fc4);
    }
  }
  return puVar6;
}



/* @004c18f4 file=? name=FUN_004c18f4 */

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

{
  *param_1 = 0x14;
  param_1[1] = 9;
  param_1[2] = 1;
  param_1[3] = param_2;
  param_1[4] = param_3;
  return;
}



/* @004c191c file=? name=FUN_004c191c */

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

{
  *param_1 = 0x14;
  param_1[1] = 0xd;
  param_1[2] = 1;
  param_1[3] = param_2;
  param_1[4] = param_3;
  return;
}



/* @004c1944 file=? name=FUN_004c1944 */

void __cdecl
FUN_004c1944(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,
            undefined4 param_5,undefined4 param_6,undefined4 param_7,undefined4 param_8)

{
  *param_1 = 0x28;
  param_1[1] = 10;
  param_1[2] = 1;
  param_1[3] = param_2;
  param_1[4] = param_3;
  param_1[5] = param_4;
  param_1[6] = param_7;
  param_1[7] = param_5;
  param_1[8] = param_6;
  param_1[9] = param_8;
  return;
}



/* @004c198c file=? name=FUN_004c198c */

void __cdecl FUN_004c198c(undefined4 *param_1,undefined4 param_2)

{
  *param_1 = 0x10;
  param_1[1] = 0xf;
  param_1[2] = 1;
  param_1[3] = param_2;
  return;
}



/* @004c19fc file=? name=FUN_004c19fc */

void __cdecl FUN_004c19fc(float *param_1,int param_2,float *param_3,int param_4,int param_5)

{
  float fVar1;
  undefined4 local_c;
  int local_8;
  
  if (param_2 == param_4) {
    param_1[6] = 0.0;
  }
  else {
    if (*(int *)(param_2 + 400) == 0) {
      param_1[6] = 0.0;
    }
    else {
      local_8 = *(int *)(DAT_004efc94 + 200);
      local_c = *(undefined4 *)(*(int *)(param_2 + 400) + 0x1e0);
      fVar1 = (float)(**(code **)(*(int *)(local_8 + 0x80) + 0xc))(local_8 + 0x80,&local_c);
      param_1[6] = fVar1;
    }
    FUN_00408b98(param_1,(float *)(param_2 + 0x100),param_3);
    fVar1 = (float)FUN_004c2f88();
    param_1[7] = fVar1;
    param_1[8] = (float)(uint)(param_2 == param_5);
    param_1[3] = -1.0;
    param_1[4] = 0.0;
    param_1[5] = 0.0;
  }
  return;
}



/* @004c1ab0 file=? name=FUN_004c1ab0 */

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

{
  int iVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  
  if (*(int *)(param_1 + 0x18) != 0) {
    uVar2 = FUN_004dcd94();
    uVar3 = FUN_004dcd94();
    (**(code **)(*param_2 + 0x24))(param_2,uVar2,uVar3);
    if (*(int *)(param_1 + 0x20) == 0) {
      (**(code **)(*param_2 + 0x18))(param_2,*(undefined4 *)(param_1 + 0x1c));
    }
    else {
      (**(code **)(*param_2 + 0x18))(param_2,param_3);
    }
    iVar1 = *(int *)(param_1 + 0x18);
    (**(code **)(*param_2 + 0x54))
              (param_2,0,iVar1,0,0,*(int *)(iVar1 + 0xc) + -1,*(int *)(iVar1 + 0x10) + -1);
  }
  return;
}



/* @004c1c24 file=? name=FUN_004c1c24 */

int * __cdecl
FUN_004c1c24(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,int param_7,int param_8,undefined4 param_9,int param_10,int param_11,
            int param_12,int param_13,int param_14,int param_15,int param_16,int param_17,
            undefined4 param_18,undefined4 param_19,undefined4 param_20,undefined4 param_21,
            int param_22)

{
  int iVar1;
  undefined4 *puVar2;
  int *piVar3;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,s_MapDisplay_00514011);
  *param_1 = (int)&PTR_FUN_0051422c;
  piVar3 = FUN_004de998(param_1 + 0x24,0x24,0x10,1,FUN_004c2a1d);
  FUN_00443474(param_1 + 0xde);
  FUN_00443474(param_1 + 0xe5);
  FUN_0044a5b4((uint *)(param_1 + 0xec));
  (**(code **)(param_1[0x12] + 8))(param_1 + 0x12,param_7,param_8,piVar3,param_10);
  if (param_11 == 1) {
    (**(code **)(param_1[0x12] + 0x10))(param_1 + 0x12,(int)piVar3 - param_7 >> 1,0);
  }
  else {
    (**(code **)(param_1[0x12] + 0x10))
              (param_1 + 0x12,(int)piVar3 - param_7 >> 1,param_10 - param_8 >> 1);
  }
  param_1[0xd6] = param_13;
  param_1[0xd7] = param_14;
  param_1[0xd8] = param_15;
  param_1[0xbc] = param_16;
  param_1[0xdc] = param_22;
  param_1[0xd9] = (int)piVar3 - param_7 >> 1;
  param_1[0xda] = param_10 - param_8 >> 1;
  param_1[0xb4] = param_11;
  param_1[0xf0] = param_12 >> 1;
  iVar1 = FUN_004022b0((param_12 >> 1) << 3);
  param_1[0xf1] = iVar1;
  param_1[199] = 0;
  param_1[200] = 0x3ec90fdb;
  param_1[0xdd] = 0;
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0xb5,param_18);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_004c2a3e(puVar2,0,param_1 + 0xb6,param_19);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_004c2bc0(puVar2,0,param_1 + 0xb7,param_20);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0xb8,param_21);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  if (*(int *)(param_17 + 4) == 0xbb9) {
    iVar1 = FUN_0041f98c(param_17,s_Torso_0051401c);
    if (iVar1 != 0) {
      puVar2 = (undefined4 *)FUN_00402298(0x18);
      if (puVar2 == (undefined4 *)0x0) {
        puVar2 = (undefined4 *)0x0;
      }
      else {
        puVar2 = FUN_004c2d42(puVar2,0,param_1 + 199,iVar1 + 0x1d8);
      }
      (**(code **)(*param_1 + 0x34))(param_1,puVar2);
    }
  }
  return param_1;
}



/* @004c1ea8 file=? name=FUN_004c1ea8 */

void __cdecl FUN_004c1ea8(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_0051422c;
    FUN_004022e8((int *)param_1[0xf1]);
    FUN_0044a5dc(param_1 + 0xec,2);
    FUN_004434a0(param_1 + 0xe5,2);
    FUN_004434a0(param_1 + 0xde,2);
    FUN_004de8d4(param_1 + 0x24,0x24,0x10,1,FUN_004c2a25);
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004c1f30 file=? name=FUN_004c1f30 */

void FUN_004c1f30(void)

{
  FUN_004448ac();
  return;
}



/* @004c1f40 file=? name=FUN_004c1f40 */

void __cdecl FUN_004c1f40(int param_1,char *param_2)

{
  char cVar1;
  uint uVar2;
  uint uVar3;
  char *pcVar4;
  char *pcVar5;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_ThreatIndicator__00514022,(char *)0x0);
  uVar2 = 0xffffffff;
  do {
    pcVar4 = param_2;
    if (uVar2 == 0) break;
    uVar2 = uVar2 - 1;
    pcVar4 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar4;
  } while (cVar1 != '\0');
  uVar2 = ~uVar2;
  pcVar4 = pcVar4 + -uVar2;
  pcVar5 = local_54;
  for (uVar3 = uVar2 >> 2; uVar3 != 0; uVar3 = uVar3 - 1) {
    *(undefined4 *)pcVar5 = *(undefined4 *)pcVar4;
    pcVar4 = pcVar4 + 4;
    pcVar5 = pcVar5 + 4;
  }
  for (uVar2 = uVar2 & 3; uVar2 != 0; uVar2 = uVar2 - 1) {
    *pcVar5 = *pcVar4;
    pcVar4 = pcVar4 + 1;
    pcVar5 = pcVar5 + 1;
  }
  FUN_004d49b8(local_54,&DAT_00514034);
  FUN_004448bc(param_1,local_54);
  return;
}



/* @004c1fc0 file=? name=FUN_004c1fc0 */

void __cdecl FUN_004c1fc0(int param_1)

{
  *(undefined4 *)(param_1 + 0x354) = 0;
  return;
}



/* @004c1fd0 file=? name=FUN_004c1fd0 */

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

void __cdecl FUN_004c1fd0(int param_1)

{
  int iVar1;
  uint uVar2;
  
  iVar1 = *(int *)(param_1 + 0x354);
  *(int *)(param_1 + 0x354) = *(int *)(param_1 + 0x354) + 1;
  if (iVar1 == 0) {
    uVar2 = (uint)(_DAT_004c2174 < *(float *)(param_1 + 0x2e0));
    *(uint *)(param_1 + 0x36c) = uVar2;
    if (uVar2 != 0) {
      *(float *)(param_1 + 0x2f4) = *(float *)(param_1 + 0x2e0) * *(float *)(param_1 + 0x2f0);
      *(float *)(param_1 + 0x2f4) = *(float *)(param_1 + 0x2f4) * *(float *)(param_1 + 0x2f4);
      FUN_004c2178(param_1);
    }
  }
  else if (iVar1 == 1) {
    FUN_004435ac(param_1 + 0x378);
    if (*(int *)(param_1 + 0x36c) != 0) {
      FUN_00443ba4(*(int *)(param_1 + 0x1c) + 0xb0,param_1 + 0x378,*(float *)(param_1 + 0x2f8),
                   *(undefined4 *)(param_1 + 0x2fc),*(float *)(param_1 + 0x300),
                   *(float *)(param_1 + 0x304),*(undefined4 *)(param_1 + 0x308),
                   *(float *)(param_1 + 0x30c),0);
    }
  }
  else if (iVar1 == 2) {
    FUN_004435ac(param_1 + 0x394);
    if (*(int *)(param_1 + 0x36c) != 0) {
      FUN_0044366c(*(int *)(param_1 + 0x1c) + 0x94,param_1 + 0x394,*(float *)(param_1 + 0x2f8),
                   *(undefined4 *)(param_1 + 0x2fc),*(float *)(param_1 + 0x300),
                   *(float *)(param_1 + 0x304),*(undefined4 *)(param_1 + 0x308),
                   *(float *)(param_1 + 0x30c),0);
    }
  }
  else {
    if ((iVar1 == 3) && (FUN_004c2294(param_1), *(int *)(param_1 + 0x36c) != 0)) {
      FUN_004c22c4(param_1);
    }
    *(undefined4 *)(param_1 + 0x354) = 0;
  }
  return;
}



/* @004c2178 file=bt_l4/btl4rdr.cpp name=FUN_004c2178 */

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

void __cdecl FUN_004c2178(int param_1)

{
  float fVar1;
  float fVar2;
  int iVar3;
  
  if (*(float *)(param_1 + 0x2d4) <= _DAT_004c2284) {
    FUN_0040385c(s_MapDisplay__CalculateBounds_dete_00514038,
                 s_d__tesla_bt_bt_l4_BTL4RDR_CPP_00514071,0x224);
    *(undefined4 *)(param_1 + 0x2d4) = 0x3f800000;
  }
  *(float *)(param_1 + 0x2e8) = (float)(*(int *)(param_1 + 0x364) * 2) / *(float *)(param_1 + 0x2d4)
  ;
  *(float *)(param_1 + 0x2ec) = _DAT_004c2288 / *(float *)(param_1 + 0x2e8);
  *(undefined4 *)(param_1 + 0x2e4) = *(undefined4 *)(param_1 + 0x2ec);
  fVar1 = (float)*(int *)(param_1 + 0x364) / *(float *)(param_1 + 0x2e8);
  fVar2 = (float)*(int *)(param_1 + 0x368) / *(float *)(param_1 + 0x2e8);
  iVar3 = FUN_00417ab4(*(int *)(param_1 + 0x1c) + 0x40);
  FUN_00408440((undefined4 *)(param_1 + 0x310),(undefined4 *)(iVar3 + 0x100));
  *(float *)(param_1 + 0x2f8) = *(float *)(param_1 + 0x310) - fVar1;
  *(float *)(param_1 + 0x304) = *(float *)(param_1 + 0x310) + fVar1;
  *(undefined4 *)(param_1 + 0x2fc) = 0xc7000000;
  *(undefined4 *)(param_1 + 0x308) = 0x47000000;
  *(float *)(param_1 + 0x300) = *(float *)(param_1 + 0x318) - fVar2;
  *(float *)(param_1 + 0x30c) = *(float *)(param_1 + 0x318) + fVar2;
  return;
}



/* @004c228c file=? name=FUN_004c228c */

void FUN_004c228c(void)

{
  return;
}



/* @004c2294 file=? name=FUN_004c2294 */

void __cdecl FUN_004c2294(int param_1)

{
  FUN_0044a650((int *)(param_1 + 0x3b0),param_1 + 0x48,*(uint *)(param_1 + 0x358));
  FUN_0044a630(param_1 + 0x3b0);
  return;
}



/* @004c22c4 file=? name=FUN_004c22c4 */

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

void __cdecl FUN_004c22c4(int param_1)

{
  float *pfVar1;
  int iVar2;
  float *pfVar3;
  float *pfVar4;
  float local_b8 [12];
  float local_88 [4];
  float local_78 [3];
  float local_6c [4];
  undefined4 local_5c [3];
  float local_50 [12];
  float local_20;
  undefined4 local_1c;
  undefined4 local_18;
  float local_14;
  float local_10;
  float local_c;
  undefined4 local_8;
  
  FUN_0040aadc(local_50);
  FUN_0040aadc(local_50);
  iVar2 = FUN_00417ab4(*(int *)(param_1 + 0x1c) + 0x40);
  if ((*(int *)(param_1 + 0x2d8) == 0) && (iVar2 != 0)) {
    *(int *)(param_1 + 0x2d8) = iVar2 + 0x100;
  }
  if (*(undefined4 **)(param_1 + 0x2d8) != (undefined4 *)0x0) {
    FUN_00408440(local_5c,*(undefined4 **)(param_1 + 0x2d8));
    FUN_0040b0ac((int)local_50,3,local_5c);
    if (*(undefined4 **)(param_1 + 0x2dc) != (undefined4 *)0x0) {
      if (*(int *)(param_1 + 0x370) == 0) {
        FUN_0040954c(local_78,*(float **)(param_1 + 0x2dc));
        local_14 = local_78[0] * _DAT_004c2480;
        local_10 = local_14;
        FUN_00408328(&local_c,&local_14);
        FUN_00409948(local_88,0,local_c,0,local_8);
        FUN_0040adec(local_50,local_88);
      }
      else {
        FUN_00409968(local_6c,*(undefined4 **)(param_1 + 0x2dc));
        FUN_0040adec(local_50,local_6c);
      }
    }
  }
  pfVar1 = (float *)(param_1 + 0x324);
  FUN_0040b244(pfVar1,local_50);
  local_20 = *(float *)(param_1 + 0x2e8);
  local_1c = *(undefined4 *)(param_1 + 0x2e8);
  local_18 = *(undefined4 *)(param_1 + 0x2e8);
  pfVar3 = pfVar1;
  pfVar4 = local_b8;
  for (iVar2 = 0xc; iVar2 != 0; iVar2 = iVar2 + -1) {
    *pfVar4 = *pfVar3;
    pfVar3 = pfVar3 + 1;
    pfVar4 = pfVar4 + 1;
  }
  FUN_0040b374(pfVar1,local_b8,&local_20);
  FUN_004c228c();
  *(uint *)(param_1 + 0x374) = *(uint *)(param_1 + 0x374) ^ 1;
  (**(code **)(*(int *)(param_1 + 0x48) + 100))(param_1 + 0x48,param_1 + 0x3b0);
  FUN_004c2484(param_1);
  FUN_004c25b4(param_1,pfVar1);
  FUN_004c2788(param_1,pfVar1);
  FUN_004c28c4(param_1,pfVar1);
  (**(code **)(*(int *)(param_1 + 0x48) + 0x68))(param_1 + 0x48);
  return;
}



/* @004c2484 file=? name=FUN_004c2484 */

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

void __cdecl FUN_004c2484(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  undefined4 uVar3;
  float local_34;
  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;
  
  local_c = *(float *)(param_1 + 0x31c) - *(float *)(param_1 + 800);
  iVar1 = param_1 + 0x48;
  local_14 = *(float *)(param_1 + 0x31c) + *(float *)(param_1 + 800);
  local_10 = local_14;
  local_8 = local_c;
  (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(iVar1,*(undefined4 *)(param_1 + 0x35c));
  local_2c = -local_8;
  local_28 = local_2c;
  FUN_00408328(&local_24,&local_2c);
  local_18 = local_24 * _DAT_004c25ac;
  local_1c = local_20 * _DAT_004c25ac;
  (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(iVar1,0,0);
  uVar2 = FUN_004dcd94();
  uVar3 = FUN_004dcd94();
  (**(code **)(*(int *)(param_1 + 0x48) + 0x30))(iVar1,uVar3,uVar2);
  local_34 = -local_10;
  local_30 = local_34;
  FUN_00408328(&local_24,&local_34);
  local_18 = local_24 * _DAT_004c25ac;
  local_1c = local_20 * _DAT_004c25ac;
  (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(iVar1,0,0);
  uVar2 = FUN_004dcd94();
  uVar3 = FUN_004dcd94();
  (**(code **)(*(int *)(param_1 + 0x48) + 0x30))(iVar1,uVar3,uVar2);
  return;
}



/* @004c25b4 file=? name=FUN_004c25b4 */

void __cdecl FUN_004c25b4(int param_1,float *param_2)

{
  int *piVar1;
  int iVar2;
  undefined4 uVar3;
  int iVar4;
  float local_80 [3];
  float local_74;
  float local_70;
  float local_6c;
  int local_68 [3];
  float local_5c [15];
  undefined4 local_20;
  undefined4 local_1c;
  undefined4 local_18;
  undefined4 local_14;
  undefined4 local_10;
  int local_c;
  int local_8;
  
  FUN_0042ac1c(local_68,param_1 + 900);
  local_20 = 0;
  local_1c = 0;
  local_18 = 0;
  local_8 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  local_c = *(int *)(DAT_004efc94 + 200);
  while( true ) {
    iVar4 = (**(code **)(local_68[0] + 0x28))(local_68);
    if (iVar4 == 0) break;
    FUN_00408644(&local_74,(float *)(param_1 + 0x310),(float *)(iVar4 + 0x100));
    if (local_6c * local_6c + local_70 * local_70 + local_74 * local_74 <=
        *(float *)(param_1 + 0x2f4)) {
      piVar1 = FUN_004688ce(local_8 + 0x58,*(int *)(iVar4 + 0x1bc),0);
      if (piVar1 != (int *)0x0) {
        FUN_0040b104(local_5c,(float *)(iVar4 + 0xd0),param_2);
        FUN_0046f0c0(piVar1,*(float *)(param_1 + 0x2e4),*(float *)(param_1 + 0x2ec),
                     (int *)(param_1 + 0x48),*(int *)(param_1 + 0x35c),local_5c,0);
      }
      iVar2 = FUN_0041a1a4(**(int **)(iVar4 + 0xc),0x4e70c4);
      if (iVar2 != 0) {
        local_10 = *(undefined4 *)(iVar4 + 0x21c);
        iVar2 = (**(code **)(*(int *)(local_c + 0x68) + 0xc))(local_c + 0x68,&local_10);
        if (iVar2 != 0) {
          FUN_00408b98(local_80,(float *)(iVar4 + 0x100),param_2);
          local_14 = FUN_004dcd94();
          uVar3 = FUN_004dcd94();
          (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(param_1 + 0x48,local_14,uVar3);
          uVar3 = FUN_004c2f88();
          (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(param_1 + 0x48,uVar3);
          (**(code **)(*(int *)(param_1 + 0x48) + 0x54))
                    (param_1 + 0x48,0,iVar2,0,0,*(int *)(iVar2 + 0xc) + -1,
                     *(int *)(iVar2 + 0x10) + -1);
        }
      }
    }
  }
  FUN_0042ac79(local_68,2);
  return;
}



/* @004c2788 file=? name=FUN_004c2788 */

void __cdecl FUN_004c2788(int param_1,float *param_2)

{
  int iVar1;
  int iVar2;
  int iVar3;
  float *pfVar4;
  float local_58;
  float local_54;
  float local_50;
  float local_4c [12];
  int local_1c [3];
  int local_10;
  int local_c;
  int *local_8;
  
  FUN_0042ac1c(local_1c,param_1 + 0x3a0);
  local_c = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  iVar1 = FUN_00417ab4(*(int *)(param_1 + 0x1c) + 0x40);
  local_10 = 0;
  if (iVar1 != 0) {
    local_10 = *(int *)(*(int *)(iVar1 + 400) + 0x284);
  }
  while( true ) {
    iVar3 = (**(code **)(local_1c[0] + 0x28))(local_1c);
    if (iVar3 == 0) break;
    if (iVar1 != iVar3) {
      FUN_00408644(&local_58,(float *)(param_1 + 0x310),(float *)(iVar3 + 0x100));
      if (local_50 * local_50 + local_54 * local_54 + local_58 * local_58 <=
          *(float *)(param_1 + 0x2f4)) {
        local_8 = FUN_004688ce(local_c + 0x58,*(int *)(iVar3 + 0x1bc),0);
        if (local_8 != (int *)0x0) {
          FUN_0040b104(local_4c,(float *)(iVar3 + 0xd0),param_2);
          if (iVar3 == local_10) {
            iVar3 = *(int *)(param_1 + 0x360);
          }
          else {
            iVar3 = 0;
          }
          pfVar4 = local_4c;
          iVar2 = FUN_004c2f88();
          FUN_0046f0c0(local_8,*(float *)(param_1 + 0x2e4),*(float *)(param_1 + 0x2ec),
                       (int *)(param_1 + 0x48),iVar2,pfVar4,iVar3);
        }
      }
    }
  }
  FUN_0042ac79(local_1c,2);
  return;
}



/* @004c28c4 file=bt_l4/btl4rdr.cpp name=FUN_004c28c4 */

void __cdecl FUN_004c28c4(int param_1,float *param_2)

{
  int iVar1;
  float *pfVar2;
  int iVar3;
  undefined4 uVar4;
  int local_1c [3];
  int local_10;
  int local_c;
  int local_8;
  
  local_8 = FUN_00417ab4(*(int *)(param_1 + 0x1c) + 0x40);
  local_c = 0;
  if (local_8 != 0) {
    local_c = *(int *)(*(int *)(local_8 + 400) + 0x284);
  }
  FUN_0042ac1c(local_1c,param_1 + 0x3a0);
  local_10 = (**(code **)(local_1c[0] + 0x14))(local_1c);
  if (local_10 < 1) {
    FUN_0042ac79(local_1c,2);
  }
  else {
    if (0x10 < local_10) {
      local_10 = 0x10;
    }
    iVar3 = 0;
    pfVar2 = (float *)(param_1 + 0x90);
    if (0 < local_10) {
      do {
        iVar1 = (**(code **)(local_1c[0] + 0x28))(local_1c);
        if (iVar1 == 0) {
          FUN_0040385c(s_MapDisplay__DrawNames___GetSize__0051408f,
                       s_d__tesla_bt_bt_l4_BTL4RDR_CPP_005140b7,0x408);
        }
        FUN_004c19fc(pfVar2,iVar1,param_2,local_8,local_c);
        iVar3 = iVar3 + 1;
        pfVar2 = pfVar2 + 9;
      } while (iVar3 < local_10);
    }
    if (*(int *)(param_1 + 0x374) == 0) {
      uVar4 = 0;
    }
    else {
      uVar4 = *(undefined4 *)(param_1 + 0x360);
    }
    iVar1 = 0;
    iVar3 = param_1 + 0x90;
    if (0 < local_10) {
      do {
        FUN_004c1ab0(iVar3,(int *)(param_1 + 0x48),uVar4);
        iVar1 = iVar1 + 1;
        iVar3 = iVar3 + 0x24;
      } while (iVar1 < local_10);
    }
    FUN_0042ac79(local_1c,2);
  }
  return;
}



/* @004c2a1d file=? name=FUN_004c2a1d */

undefined4 __cdecl FUN_004c2a1d(undefined4 param_1)

{
  return param_1;
}



/* @004c2a25 file=? name=FUN_004c2a25 */

void __cdecl FUN_004c2a25(int *param_1,byte param_2)

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



/* @004c2a3e file=? name=FUN_004c2a3e */

undefined4 * __cdecl
FUN_004c2a3e(undefined4 *param_1,undefined4 param_2,undefined4 *param_3,undefined4 param_4)

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00514220;
  param_1[4] = param_4;
  param_1[5] = param_3;
  *param_3 = *(undefined4 *)param_1[4];
  return param_1;
}



/* @004c2a70 file=? name=FUN_004c2a70 */

void __cdecl FUN_004c2a70(int *param_1,byte param_2)

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



/* @004c2a9c file=? name=FUN_004c2a9c */

void __cdecl FUN_004c2a9c(int param_1)

{
  **(undefined4 **)(param_1 + 0x14) = **(undefined4 **)(param_1 + 0x10);
  return;
}



/* @004c2aae file=? name=FUN_004c2aae */

void __cdecl FUN_004c2aae(int param_1,char *param_2)

{
  undefined8 uVar1;
  uint uVar2;
  uint uVar3;
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_GaugeConnectionDirectOf__00514121,(char *)0x0);
  uVar3 = **(uint **)(param_1 + 0x10);
  uVar2 = *(uint *)(param_1 + 0x10);
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s____dataSource_at_0051413b,(char *)0x0);
  uVar1 = FUN_004dbd4c(&DAT_00524e20,uVar2);
  FUN_004dbb24((int *)uVar1,&DAT_00514151,(char *)0x0);
  uVar1 = FUN_004dbd4c((int *)uVar1,uVar3);
  FUN_004dbb24((int *)uVar1,&DAT_00514153,(char *)0x0);
  uVar3 = *(uint *)(param_1 + 0x10);
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s____dataDestination_at_00514155,(char *)0x0);
  uVar1 = FUN_004dbd4c(&DAT_00524e20,uVar3);
  FUN_004dbb24((int *)uVar1,&DAT_0051416b,(char *)0x0);
  FUN_004d9c70((int *)uVar1);
  FUN_0044419c(param_1,param_2);
  return;
}



/* @004c2bb1 file=? name=FUN_004c2bb1 */

void FUN_004c2bb1(void)

{
  FUN_00415f1c();
  return;
}



/* @004c2bc0 file=? name=FUN_004c2bc0 */

undefined4 * __cdecl
FUN_004c2bc0(undefined4 *param_1,undefined4 param_2,undefined4 *param_3,undefined4 param_4)

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00514214;
  param_1[4] = param_4;
  param_1[5] = param_3;
  *param_3 = *(undefined4 *)param_1[4];
  return param_1;
}



/* @004c2bf2 file=? name=FUN_004c2bf2 */

void __cdecl FUN_004c2bf2(int *param_1,byte param_2)

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



/* @004c2c1e file=? name=FUN_004c2c1e */

void __cdecl FUN_004c2c1e(int param_1)

{
  **(undefined4 **)(param_1 + 0x14) = **(undefined4 **)(param_1 + 0x10);
  return;
}



/* @004c2c30 file=? name=FUN_004c2c30 */

void __cdecl FUN_004c2c30(int param_1,char *param_2)

{
  undefined8 uVar1;
  uint uVar2;
  uint uVar3;
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_GaugeConnectionDirectOf__0051416d,(char *)0x0);
  uVar3 = **(uint **)(param_1 + 0x10);
  uVar2 = *(uint *)(param_1 + 0x10);
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s____dataSource_at_00514187,(char *)0x0);
  uVar1 = FUN_004dbd4c(&DAT_00524e20,uVar2);
  FUN_004dbb24((int *)uVar1,&DAT_0051419d,(char *)0x0);
  uVar1 = FUN_004dbd4c((int *)uVar1,uVar3);
  FUN_004dbb24((int *)uVar1,&DAT_0051419f,(char *)0x0);
  uVar3 = *(uint *)(param_1 + 0x10);
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s____dataDestination_at_005141a1,(char *)0x0);
  uVar1 = FUN_004dbd4c(&DAT_00524e20,uVar3);
  FUN_004dbb24((int *)uVar1,&DAT_005141b7,(char *)0x0);
  FUN_004d9c70((int *)uVar1);
  FUN_0044419c(param_1,param_2);
  return;
}



/* @004c2d33 file=? name=FUN_004c2d33 */

void FUN_004c2d33(void)

{
  FUN_00415f1c();
  return;
}



/* @004c2d42 file=? name=FUN_004c2d42 */

undefined4 * __cdecl
FUN_004c2d42(undefined4 *param_1,undefined4 param_2,undefined4 *param_3,undefined4 param_4)

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00514208;
  param_1[4] = param_4;
  param_1[5] = param_3;
  *param_3 = *(undefined4 *)param_1[4];
  return param_1;
}



/* @004c2d74 file=? name=FUN_004c2d74 */

void __cdecl FUN_004c2d74(int *param_1,byte param_2)

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



/* @004c2da0 file=? name=FUN_004c2da0 */

void __cdecl FUN_004c2da0(int param_1)

{
  **(undefined4 **)(param_1 + 0x14) = **(undefined4 **)(param_1 + 0x10);
  return;
}



/* @004c2db2 file=? name=FUN_004c2db2 */

void __cdecl FUN_004c2db2(int param_1,char *param_2)

{
  int *piVar1;
  undefined8 uVar2;
  uint uVar3;
  float *pfVar4;
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_GaugeConnectionDirectOf__005141b9,(char *)0x0);
  pfVar4 = *(float **)(param_1 + 0x10);
  uVar3 = *(uint *)(param_1 + 0x10);
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s____dataSource_at_005141d3,(char *)0x0);
  uVar2 = FUN_004dbd4c(&DAT_00524e20,uVar3);
  FUN_004dbb24((int *)uVar2,&DAT_005141e9,(char *)0x0);
  piVar1 = FUN_00408270((int *)uVar2,pfVar4);
  FUN_004dbb24(piVar1,&DAT_005141eb,(char *)0x0);
  uVar3 = *(uint *)(param_1 + 0x10);
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s____dataDestination_at_005141ed,(char *)0x0);
  uVar2 = FUN_004dbd4c(&DAT_00524e20,uVar3);
  FUN_004dbb24((int *)uVar2,&DAT_00514203,(char *)0x0);
  FUN_004d9c70((int *)uVar2);
  FUN_0044419c(param_1,param_2);
  return;
}



/* @004c2eb3 file=? name=FUN_004c2eb3 */

void FUN_004c2eb3(void)

{
  FUN_00415f1c();
  return;
}



/* @004c2ec4 file=? name=FUN_004c2ec4 */

void __cdecl
FUN_004c2ec4(undefined4 param_1,undefined4 param_2,int *param_3,int param_4,char *param_5)

{
  undefined4 *puVar1;
  
  (**(code **)(*param_3 + 0x24))(param_3,param_1,param_2);
  puVar1 = FUN_00442aec(param_4 + 4,param_5,0);
  if (puVar1 != (undefined4 *)0x0) {
    (**(code **)(*param_3 + 0x58))(param_3,0,0,puVar1,0,0,puVar1[3] + -1,puVar1[4] + -1);
  }
  FUN_00442c12(param_4 + 4,param_5);
  return;
}



/* @004c2f28 file=? name=FUN_004c2f28 */

void __cdecl
FUN_004c2f28(undefined4 param_1,undefined4 param_2,int *param_3,int param_4,char *param_5)

{
  int *piVar1;
  
  (**(code **)(*param_3 + 0x24))(param_3,param_1,param_2);
  piVar1 = FUN_00442d2b(param_4 + 0x20,param_5,0);
  if (piVar1 != (int *)0x0) {
    (**(code **)(*param_3 + 0x5c))(param_3,1,0,piVar1,0,0,*piVar1 + -1,piVar1[1] + -1);
  }
  FUN_00442c12(param_4 + 4,param_5);
  return;
}



/* @004c2f88 file=? name=FUN_004c2f88 */

undefined4 FUN_004c2f88(void)

{
  return 7;
}



/* @004c2f94 file=? name=FUN_004c2f94 */

uint __cdecl FUN_004c2f94(int param_1)

{
  int iVar1;
  uint *puVar2;
  uint local_8;
  
  iVar1 = FUN_0041a1a4(**(int **)(param_1 + 0xc),0x50bdb4);
  if (iVar1 != 0) {
    local_8 = (uint)**(uint3 **)(*(int *)(param_1 + 0x848) + 8);
    for (puVar2 = &DAT_00514274; 0 < (int)puVar2[1]; puVar2 = puVar2 + 2) {
      if (*puVar2 == local_8) {
        return puVar2[1];
      }
    }
  }
  return 0xff;
}



/* @004c2ff8 file=? name=FUN_004c2ff8 */

void __cdecl
FUN_004c2ff8(int *param_1,int param_2,int param_3,int param_4,int param_5,undefined4 param_6,
            int param_7)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  int iVar4;
  int local_30 [3];
  int local_24 [3];
  int local_18;
  int local_14;
  int local_10;
  int local_c;
  int local_8;
  
  local_8 = *(int *)(param_7 + 0xc);
  local_c = *(int *)(param_7 + 0x10);
  iVar4 = 0;
  if (0 < param_5) {
    do {
      local_24[2] = param_3 - iVar4;
      local_24[1] = 0;
      if (param_3 - iVar4 < 0) {
        piVar2 = local_24 + 1;
      }
      else {
        piVar2 = local_24 + 2;
      }
      local_10 = *piVar2;
      if (*piVar2 < local_c) {
        local_24[0] = (param_5 - iVar4) + 1;
        if (local_c < local_24[0]) {
          piVar2 = &local_c;
        }
        else {
          piVar2 = local_24;
        }
        local_18 = *piVar2;
        if (0 < local_18) {
          local_18 = local_18 + -1;
          iVar3 = 0;
          if (0 < param_4) {
            do {
              local_30[2] = param_2 - iVar3;
              local_30[1] = 0;
              if (param_2 - iVar3 < 0) {
                piVar2 = local_30 + 1;
              }
              else {
                piVar2 = local_30 + 2;
              }
              iVar1 = *piVar2;
              if (iVar1 < local_8) {
                local_30[0] = (param_4 - iVar3) + 1;
                if (local_8 < local_30[0]) {
                  piVar2 = &local_8;
                }
                else {
                  piVar2 = local_30;
                }
                local_14 = *piVar2;
                if (0 < local_14) {
                  local_14 = local_14 + -1;
                  (**(code **)(*param_1 + 0x24))(param_1,iVar3,iVar4);
                  (**(code **)(*param_1 + 0x58))
                            (param_1,param_6,0,param_7,iVar1,local_10,local_14,local_18);
                }
              }
              iVar3 = iVar3 + local_8;
            } while (iVar3 < param_4);
          }
        }
      }
      iVar4 = iVar4 + local_c;
    } while (iVar4 < param_5);
  }
  return;
}



/* @004c3134 file=? name=FUN_004c3134 */

undefined4 * __cdecl
FUN_004c3134(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00518ea8;
  param_1[4] = param_4;
  param_1[5] = param_3;
  return param_1;
}



/* @004c3160 file=? name=FUN_004c3160 */

void __cdecl FUN_004c3160(int *param_1,byte param_2)

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



/* @004c318c file=? name=FUN_004c318c */

undefined4 FUN_004c318c(void)

{
  return 1;
}



/* @004c3198 file=? name=FUN_004c3198 */

void FUN_004c3198(void)

{
  return;
}



/* @004c31a0 file=? name=FUN_004c31a0 */

void __cdecl FUN_004c31a0(int param_1)

{
  int iVar1;
  int iVar2;
  
  iVar2 = 0;
  if (*(int *)(*(int *)(param_1 + 0x10) + 0x134) == 1) {
    iVar1 = FUN_0041bf44(*(int *)(param_1 + 0x10),3);
    if (iVar1 != 0) {
      iVar2 = FUN_00417ab4(iVar1);
    }
  }
  if (iVar2 == 0) {
    **(undefined4 **)(param_1 + 0x14) = 0;
  }
  else {
    **(undefined4 **)(param_1 + 0x14) = *(undefined4 *)(iVar2 + 0x1d4);
  }
  return;
}



/* @004c31ec file=? name=FUN_004c31ec */

undefined4 * __cdecl
FUN_004c31ec(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00518e9c;
  param_1[4] = param_4;
  param_1[5] = param_3;
  return param_1;
}



/* @004c3218 file=? name=FUN_004c3218 */

void __cdecl FUN_004c3218(int *param_1,byte param_2)

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



/* @004c3244 file=? name=FUN_004c3244 */

undefined4 FUN_004c3244(void)

{
  return 1;
}



/* @004c3250 file=? name=FUN_004c3250 */

void FUN_004c3250(void)

{
  return;
}



/* @004c3258 file=? name=FUN_004c3258 */

void __cdecl FUN_004c3258(int param_1)

{
  int iVar1;
  
  iVar1 = FUN_00417ab4(*(int *)(param_1 + 0x10));
  if (iVar1 == 0) {
    **(undefined4 **)(param_1 + 0x14) = 0;
    return;
  }
  **(undefined4 **)(param_1 + 0x14) = *(undefined4 *)(iVar1 + 0x1e0);
  return;
}



/* @004c3288 file=? name=FUN_004c3288 */

undefined4 * __cdecl
FUN_004c3288(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00518e90;
  param_1[4] = param_4;
  param_1[5] = param_3;
  return param_1;
}



/* @004c32b4 file=? name=FUN_004c32b4 */

void __cdecl FUN_004c32b4(int *param_1,byte param_2)

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



/* @004c32e0 file=? name=FUN_004c32e0 */

undefined4 FUN_004c32e0(void)

{
  return 1;
}



/* @004c32ec file=? name=FUN_004c32ec */

void FUN_004c32ec(void)

{
  return;
}



/* @004c32f4 file=? name=FUN_004c32f4 */

void __cdecl FUN_004c32f4(int param_1)

{
  int iVar1;
  
  iVar1 = FUN_00417ab4(*(int *)(param_1 + 0x10));
  if (iVar1 == 0) {
    **(undefined4 **)(param_1 + 0x14) = 0;
    return;
  }
  **(undefined4 **)(param_1 + 0x14) = *(undefined4 *)(iVar1 + 0x1dc);
  return;
}



/* @004c3324 file=? name=FUN_004c3324 */

undefined4 * __cdecl
FUN_004c3324(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00518e84;
  param_1[4] = param_4;
  param_1[5] = param_3;
  return param_1;
}



/* @004c3350 file=? name=FUN_004c3350 */

void __cdecl FUN_004c3350(int *param_1,byte param_2)

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



/* @004c337c file=? name=FUN_004c337c */

undefined4 FUN_004c337c(void)

{
  return 1;
}



/* @004c3388 file=? name=FUN_004c3388 */

void FUN_004c3388(void)

{
  return;
}



/* @004c3390 file=? name=FUN_004c3390 */

void __cdecl FUN_004c3390(int param_1)

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



/* @004c33a4 file=? name=FUN_004c33a4 */

undefined4 * __cdecl
FUN_004c33a4(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,int param_5)

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00518e78;
  if (param_5 < 0) {
    param_1[4] = 0;
  }
  else {
    param_1[4] = *(undefined4 *)(*(int *)(param_4 + 0x120) + param_5 * 4);
  }
  param_1[5] = param_3;
  return param_1;
}



/* @004c33e8 file=? name=FUN_004c33e8 */

void __cdecl FUN_004c33e8(int *param_1,byte param_2)

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



/* @004c3414 file=? name=FUN_004c3414 */

undefined4 FUN_004c3414(void)

{
  return 1;
}



/* @004c3428 file=? name=FUN_004c3428 */

void FUN_004c3428(void)

{
  return;
}



/* @004c3430 file=? name=FUN_004c3430 */

void __cdecl FUN_004c3430(int param_1)

{
  undefined4 uVar1;
  
  if (*(int *)(param_1 + 0x10) == 0) {
    **(undefined4 **)(param_1 + 0x14) = 100;
    return;
  }
  uVar1 = FUN_004dcd94();
  **(undefined4 **)(param_1 + 0x14) = uVar1;
  return;
}



/* @004c346c file=? name=FUN_004c346c */

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

{
  int iVar1;
  undefined4 *puVar2;
  
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00518e6c;
  iVar1 = 0;
  puVar2 = param_1 + 6;
  do {
    *puVar2 = *param_5;
    iVar1 = iVar1 + 1;
    puVar2 = puVar2 + 1;
    param_5 = param_5 + 1;
  } while (iVar1 < 8);
  param_1[4] = param_4;
  param_1[0xe] = param_3;
  return param_1;
}



/* @004c34b4 file=? name=FUN_004c34b4 */

void __cdecl FUN_004c34b4(int *param_1,byte param_2)

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



/* @004c34e0 file=? name=FUN_004c34e0 */

undefined4 FUN_004c34e0(void)

{
  return 1;
}



/* @004c34ec file=? name=FUN_004c34ec */

void FUN_004c34ec(void)

{
  return;
}



/* @004c34f4 file=? name=FUN_004c34f4 */

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

void __cdecl FUN_004c34f4(int param_1)

{
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  int *piVar4;
  int local_c;
  float local_8;
  
  iVar3 = 0;
  local_8 = 0.0;
  local_c = 0;
  piVar4 = (int *)(param_1 + 0x18);
  do {
    if (((-1 < *piVar4) &&
        (iVar1 = *(int *)(*(int *)(*(int *)(param_1 + 0x10) + 0x120) + *piVar4 * 4), iVar1 != 0)) &&
       (local_c = local_c + 1, local_8 < *(float *)(iVar1 + 0x158))) {
      local_8 = *(float *)(iVar1 + 0x158);
    }
    iVar3 = iVar3 + 1;
    piVar4 = piVar4 + 1;
  } while (iVar3 < 8);
  if (local_c == 0) {
    **(undefined4 **)(param_1 + 0x38) = 100;
  }
  else {
    uVar2 = FUN_004dcd94();
    **(undefined4 **)(param_1 + 0x38) = uVar2;
  }
  return;
}



/* @004c3598 file=? name=FUN_004c3598 */

undefined4 * __cdecl
FUN_004c3598(undefined4 *param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4)

{
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00518e60;
  param_1[4] = param_4;
  param_1[5] = param_3;
  return param_1;
}



/* @004c35c8 file=? name=FUN_004c35c8 */

void __cdecl FUN_004c35c8(int *param_1,byte param_2)

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



/* @004c35f4 file=? name=FUN_004c35f4 */

undefined4 FUN_004c35f4(void)

{
  return 1;
}



/* @004c3608 file=? name=FUN_004c3608 */

void FUN_004c3608(void)

{
  return;
}



/* @004c3610 file=? name=FUN_004c3610 */

void __cdecl FUN_004c3610(int param_1)

{
  undefined4 uVar1;
  
  if (*(int *)(param_1 + 0x10) == 0) {
    **(undefined4 **)(param_1 + 0x14) = 0;
    return;
  }
  if (*(int *)(*(int *)(param_1 + 0x10) + 0x40) == 1) {
    **(undefined4 **)(param_1 + 0x14) = 100;
    return;
  }
  uVar1 = FUN_004dcd94();
  **(undefined4 **)(param_1 + 0x14) = uVar1;
  return;
}



/* @004c3664 file=? name=FUN_004c3664 */

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

{
  int iVar1;
  
  FUN_00444124(param_1,param_2);
  *param_1 = &PTR_FUN_00518e54;
  if (param_4 != 0) {
    iVar1 = FUN_0041a1a4(**(int **)(param_4 + 0xc),0x50e3ec);
    if (iVar1 == 0) {
      iVar1 = FUN_0041a1a4(**(int **)(param_4 + 0xc),0x50e604);
      if (iVar1 == 0) {
        param_4 = 0;
      }
      else {
        param_1[5] = 0;
      }
    }
    else {
      param_1[5] = 1;
    }
  }
  param_1[4] = param_4;
  param_1[6] = param_3;
  return param_1;
}



/* @004c36d8 file=? name=FUN_004c36d8 */

void __cdecl FUN_004c36d8(int *param_1,byte param_2)

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



/* @004c3704 file=? name=FUN_004c3704 */

undefined4 FUN_004c3704(void)

{
  return 1;
}



/* @004c3718 file=? name=FUN_004c3718 */

void FUN_004c3718(void)

{
  return;
}



/* @004c3720 file=? name=FUN_004c3720 */

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

void __cdecl FUN_004c3720(int param_1)

{
  undefined4 uVar1;
  
  if (*(int *)(param_1 + 0x10) == 0) {
    **(undefined4 **)(param_1 + 0x18) = 100;
  }
  else if (*(int *)(*(int *)(param_1 + 0x10) + 0x40) == 1) {
    **(undefined4 **)(param_1 + 0x18) = 100;
  }
  else {
    if (*(int *)(param_1 + 0x14) == 0) {
      FUN_00417ab4(*(int *)(param_1 + 0x10) + 0x114);
    }
    uVar1 = FUN_004dcd94();
    **(undefined4 **)(param_1 + 0x18) = uVar1;
  }
  return;
}



/* @004c37dc file=? name=FUN_004c37dc */

undefined4 * __cdecl
FUN_004c37dc(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,
            undefined4 param_5,int param_6,undefined4 param_7,char *param_8,char *param_9,
            undefined4 param_10)

{
  undefined4 uVar1;
  char *pcVar2;
  int iVar3;
  int *piVar4;
  undefined4 *puVar5;
  int iVar6;
  
  FUN_00444308(param_1,param_2,param_3,param_4,param_5,param_10);
  *param_1 = &PTR_FUN_00518e10;
  uVar1 = FUN_004700ac(param_8);
  param_1[0x12] = uVar1;
  pcVar2 = (char *)FUN_004700ac(param_9);
  param_1[0x13] = pcVar2;
  iVar3 = FUN_004d4b58((char *)param_1[0x12],pcVar2);
  if (iVar3 == 0) {
    param_1[0x14] = 0;
  }
  else {
    param_1[0x14] = 1;
  }
  iVar3 = *(int *)(param_4 + 0x4c);
  iVar6 = 0;
  puVar5 = param_1 + 0x12;
  do {
    piVar4 = FUN_00442f6a(iVar3 + 0x3c,(char *)*puVar5,0);
    if (piVar4 == (int *)0x0) {
      pcVar2 = (char *)*puVar5;
      FUN_004dbb24(&DAT_00524e20,s_ColorMapper_cannot_find_palette_f_005185b6,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,pcVar2,(char *)0x0);
      FUN_004dbb24(&DAT_00524e20,&DAT_005185dd,(char *)0x0);
    }
    iVar6 = iVar6 + 1;
    puVar5 = puVar5 + 1;
  } while (iVar6 < 2);
  param_1[0x17] = param_7;
  param_1[0x18] = 0;
  uVar1 = FUN_00447f84(param_4,param_6);
  param_1[0x1a] = uVar1;
  return param_1;
}



/* @004c38dc file=? name=FUN_004c38dc */

void __cdecl FUN_004c38dc(int *param_1,byte param_2)

{
  int iVar1;
  int *piVar2;
  int iVar3;
  
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_00518e10;
    iVar3 = 0;
    piVar2 = param_1 + 0x12;
    iVar1 = *(int *)(param_1[7] + 0x4c);
    do {
      FUN_00443090(iVar1 + 0x3c,(char *)*piVar2);
      FUN_004022e8((int *)*piVar2);
      *piVar2 = 0;
      iVar3 = iVar3 + 1;
      piVar2 = piVar2 + 1;
    } while (iVar3 < 2);
    FUN_00444360(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004c3944 file=? name=FUN_004c3944 */

void FUN_004c3944(void)

{
  FUN_004443a4();
  return;
}



/* @004c3954 file=? name=FUN_004c3954 */

void FUN_004c3954(void)

{
  return;
}



/* @004c395c file=? name=FUN_004c395c */

void __cdecl FUN_004c395c(int param_1)

{
  *(undefined4 *)(param_1 + 0x54) = 0xffffffff;
  *(undefined4 *)(param_1 + 0x58) = 0xffffffff;
  *(undefined1 *)(param_1 + 100) = 0xff;
  *(undefined1 *)(param_1 + 0x65) = 0xff;
  *(undefined1 *)(param_1 + 0x66) = 0xff;
  return;
}



/* @004c3980 file=? name=FUN_004c3980 */

void __cdecl FUN_004c3980(int param_1)

{
  undefined2 uVar1;
  int iVar2;
  int iVar3;
  bool bVar4;
  int *piVar5;
  int *piVar6;
  undefined2 local_103;
  char local_101;
  int local_c [2];
  
  local_c[1] = 0xff;
  piVar6 = (int *)(param_1 + 0x54);
  if (0xfe < *piVar6) {
    piVar6 = local_c + 1;
  }
  piVar5 = (int *)(param_1 + 0x54);
  *(int *)(param_1 + 0x54) = *piVar6;
  local_c[0] = 0;
  if (*piVar5 < 1) {
    piVar5 = local_c;
  }
  *(int *)(param_1 + 0x54) = *piVar5;
  if (*(int *)(param_1 + 0x50) == 0) {
    if (*(int *)(param_1 + 0x54) == *(int *)(param_1 + 0x58)) {
      return;
    }
    *(int *)(param_1 + 0x58) = *(int *)(param_1 + 0x54);
  }
  else {
    *(int *)(param_1 + 0x60) = *(int *)(param_1 + 0x60) + 1;
    if (1 < *(int *)(param_1 + 0x60)) {
      *(undefined4 *)(param_1 + 0x60) = 0;
    }
  }
  iVar2 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
  piVar6 = FUN_00442f6a(iVar2 + 0x3c,*(char **)(param_1 + 0x48 + *(int *)(param_1 + 0x60) * 4),0);
  uVar1 = local_103;
  if (piVar6 != (int *)0x0) {
    iVar3 = *(int *)(param_1 + 0x54) * 3;
    uVar1 = *(undefined2 *)((int)piVar6 + iVar3 + 4);
    local_101 = *(char *)((int)piVar6 + iVar3 + 6);
    local_103._0_1_ = (char)uVar1;
    local_103._1_1_ = (char)((ushort)uVar1 >> 8);
    if (((*(char *)(param_1 + 100) == (char)local_103) &&
        (*(char *)(param_1 + 0x65) == local_103._1_1_)) && (*(char *)(param_1 + 0x66) == local_101))
    {
      bVar4 = false;
    }
    else {
      bVar4 = true;
    }
    if (bVar4) {
      *(char *)(param_1 + 100) = (char)local_103;
      *(char *)(param_1 + 0x65) = local_103._1_1_;
      *(char *)(param_1 + 0x66) = local_101;
      local_103 = uVar1;
      (**(code **)(**(int **)(param_1 + 0x68) + 0xc))
                (*(int **)(param_1 + 0x68),&local_103,*(undefined4 *)(param_1 + 0x5c));
      uVar1 = local_103;
    }
  }
  local_103 = uVar1;
  FUN_00443090(iVar2 + 0x3c,*(char **)(param_1 + 0x48 + *(int *)(param_1 + 0x60) * 4));
  return;
}



/* @004c3aa4 file=? name=FUN_004c3aa4 */

undefined4 __cdecl
FUN_004c3aa4(int param_1,undefined4 param_2,undefined4 param_3,int param_4,int param_5)

{
  uint *puVar1;
  int iVar2;
  int *piVar3;
  undefined4 uVar4;
  uint *local_8;
  
  puVar1 = (uint *)FUN_00402298(0x10);
  if (puVar1 == (uint *)0x0) {
    local_8 = (uint *)0x0;
  }
  else {
    local_8 = FUN_00402460(puVar1,&DAT_00514414);
  }
  local_8[3] = local_8[3] + 1;
  iVar2 = FUN_0042076c(param_4,(int *)&local_8);
  if (iVar2 < 0) {
    FUN_004dbb24(&DAT_00524e20,s_Warning__damage_zone___005185e9,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,(char *)local_8[2],(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___not_found__00518600,(char *)0x0);
  }
  piVar3 = (int *)FUN_00402298(0x70);
  if (piVar3 != (int *)0x0) {
    FUN_004c3b98(piVar3,DAT_005142c0,DAT_00514304,param_5,0,param_1,param_4,DAT_00514348,
                 &DAT_0051438c,&DAT_005143d0,iVar2,s_ColorMapperArmor_00518489);
  }
  uVar4 = 1;
  puVar1 = local_8 + 3;
  *puVar1 = *puVar1 - 1;
  if (*puVar1 == 0) {
    FUN_004024d8((int *)local_8,3);
  }
  return uVar4;
}



/* @004c3b98 file=? name=FUN_004c3b98 */

int * __cdecl
FUN_004c3b98(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,int param_7,undefined4 param_8,char *param_9,char *param_10,int param_11,
            undefined4 param_12)

{
  undefined4 *puVar1;
  
  FUN_004c37dc(param_1,param_2,param_3,param_4,param_5,param_6,param_8,param_9,param_10,param_12);
  *param_1 = (int)&PTR_FUN_00518dcc;
  param_1[0x1b] = 0;
  puVar1 = (undefined4 *)FUN_00402298(0x18);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004c33a4(puVar1,0,param_1 + 0x15,param_7,param_11);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar1);
  return param_1;
}



/* @004c3c14 file=? name=FUN_004c3c14 */

void FUN_004c3c14(void)

{
  return;
}



/* @004c3c1c file=? name=FUN_004c3c1c */

void __cdecl FUN_004c3c1c(int param_1)

{
  if (*(int *)(param_1 + 0x6c) != 0) {
    *(undefined4 *)(param_1 + 0x54) = 100;
  }
  FUN_004c3980(param_1);
  return;
}



/* @004c3c38 file=? name=FUN_004c3c38 */

void __cdecl FUN_004c3c38(int param_1,undefined4 param_2)

{
  *(undefined4 *)(param_1 + 0x6c) = param_2;
  return;
}



/* @004c3c48 file=? name=FUN_004c3c48 */

undefined4 __cdecl
FUN_004c3c48(int param_1,undefined4 param_2,undefined4 param_3,int param_4,int param_5)

{
  uint *puVar1;
  int iVar2;
  undefined4 uVar3;
  int *piVar4;
  int iVar5;
  int local_34 [8];
  char *local_14;
  uint *local_10;
  int local_c;
  undefined *local_8;
  
  iVar5 = 0;
  local_8 = &DAT_00514704;
  local_c = 1;
  piVar4 = local_34;
  do {
    local_14 = local_8 + iVar5 * 0x44 + 0x158;
    puVar1 = (uint *)FUN_00402298(0x10);
    if (puVar1 == (uint *)0x0) {
      local_10 = (uint *)0x0;
    }
    else {
      local_10 = FUN_00402460(puVar1,local_14);
    }
    local_10[3] = local_10[3] + 1;
    iVar2 = FUN_0042076c(param_4,(int *)&local_10);
    *piVar4 = iVar2;
    if (iVar2 != 0) {
      local_c = 0;
    }
    puVar1 = local_10 + 3;
    *puVar1 = *puVar1 - 1;
    if (*puVar1 == 0) {
      FUN_004024d8((int *)local_10,3);
    }
    iVar5 = iVar5 + 1;
    piVar4 = piVar4 + 1;
  } while (iVar5 < 8);
  if (local_c == 0) {
    piVar4 = (int *)FUN_00402298(0x6c);
    if (piVar4 != (int *)0x0) {
      FUN_004c3d60(piVar4,*(undefined4 *)(local_8 + 4),*(undefined4 *)(local_8 + 0x48),param_5,0,
                   param_1,param_4,*(undefined4 *)(local_8 + 0x8c),local_8 + 0xd0,local_8 + 0x114,
                   local_34,s_ColorMapperMultiArmor_0051849a);
    }
    uVar3 = 1;
  }
  else {
    FUN_004dbb24(&DAT_00524e20,s_No_Damage_zones_found__00518624,(char *)0x0);
    uVar3 = 0;
  }
  return uVar3;
}



/* @004c3d60 file=? name=FUN_004c3d60 */

int * __cdecl
FUN_004c3d60(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,char *param_9,char *param_10,
            undefined4 *param_11,undefined4 param_12)

{
  undefined4 *puVar1;
  
  FUN_004c37dc(param_1,param_2,param_3,param_4,param_5,param_6,param_8,param_9,param_10,param_12);
  *param_1 = (int)&PTR_FUN_00518d88;
  puVar1 = (undefined4 *)FUN_00402298(0x3c);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004c346c(puVar1,0,param_1 + 0x15,param_7,param_11);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar1);
  return param_1;
}



/* @004c3dd4 file=? name=FUN_004c3dd4 */

void FUN_004c3dd4(void)

{
  return;
}



/* @004c3ddc file=? name=FUN_004c3ddc */

undefined4 __cdecl
FUN_004c3ddc(int param_1,undefined4 param_2,undefined4 param_3,int param_4,int param_5)

{
  int *piVar1;
  
  piVar1 = (int *)FUN_00402298(0x6c);
  if (piVar1 != (int *)0x0) {
    FUN_004c3e40(piVar1,DAT_00514b50,DAT_00514b94,param_5,0,param_1,param_4,DAT_00514bd8,
                 &DAT_00514c1c,&DAT_00514c60,&DAT_00514ca4,s_ColorMapperCritical_005184b0);
  }
  return 1;
}



/* @004c3e40 file=? name=FUN_004c3e40 */

int * __cdecl
FUN_004c3e40(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,int param_7,undefined4 param_8,char *param_9,char *param_10,char *param_11,
            undefined4 param_12)

{
  int iVar1;
  undefined4 *puVar2;
  
  FUN_004c37dc(param_1,param_2,param_3,param_4,param_5,param_6,param_8,param_9,param_10,param_12);
  *param_1 = (int)&PTR_FUN_00518d44;
  iVar1 = FUN_0041f98c(param_7,param_11);
  if (iVar1 == 0) {
    FUN_004dbb24(&DAT_00524e20,s_ColorMapperCritical_warning__sub_00518643,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,param_11,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___does_not_exist_0051866c,(char *)0x0);
  }
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_004c3598(puVar2,0,param_1 + 0x15,iVar1);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  return param_1;
}



/* @004c3f00 file=? name=FUN_004c3f00 */

void FUN_004c3f00(void)

{
  return;
}



/* @004c3f08 file=? name=FUN_004c3f08 */

undefined4 __cdecl
FUN_004c3f08(int param_1,undefined4 param_2,undefined4 param_3,int param_4,int param_5)

{
  int *piVar1;
  
  piVar1 = (int *)FUN_00402298(0x6c);
  if (piVar1 != (int *)0x0) {
    FUN_004c3f6c(piVar1,DAT_00514f98,DAT_00514fdc,param_5,0,param_1,param_4,DAT_00515020,
                 &DAT_00515064,&DAT_005150a8,&DAT_005150ec,s_ColorMapperHeat_005184c4);
  }
  return 1;
}



/* @004c3f6c file=bt_l4/btl4gaug.cpp name=FUN_004c3f6c */

int * __cdecl
FUN_004c3f6c(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,int param_7,undefined4 param_8,char *param_9,char *param_10,char *param_11,
            undefined4 param_12)

{
  int iVar1;
  int iVar2;
  undefined4 *puVar3;
  
  FUN_004c37dc(param_1,param_2,param_3,param_4,param_5,param_6,param_8,param_9,param_10,param_12);
  *param_1 = (int)&PTR_FUN_00518d00;
  iVar1 = FUN_0041f98c(param_7,param_11);
  if (iVar1 == 0) {
    FUN_004dbb24(&DAT_00524e20,s_ColorMapperHeat_warning__subsyst_00518685,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,param_11,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,s___does_not_exist_005186aa,(char *)0x0);
  }
  else {
    iVar2 = FUN_0041a1a4(**(int **)(iVar1 + 0xc),0x50e3ec);
    if ((iVar2 == 0) && (iVar2 = FUN_0041a1a4(**(int **)(iVar1 + 0xc),0x50e604), iVar2 == 0)) {
      FUN_0040385c(s_Bad_subsystem_type_005186bc,s_d__tesla_bt_bt_l4_BTL4GAUG_CPP_005186cf,0x68a);
    }
  }
  puVar3 = (undefined4 *)FUN_00402298(0x1c);
  if (puVar3 == (undefined4 *)0x0) {
    puVar3 = (undefined4 *)0x0;
  }
  else {
    puVar3 = FUN_004c3664(puVar3,0,param_1 + 0x15,iVar1);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar3);
  return param_1;
}



/* @004c4074 file=? name=FUN_004c4074 */

void FUN_004c4074(void)

{
  return;
}



/* @004c407c file=? name=FUN_004c407c */

bool __cdecl FUN_004c407c(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  int *piVar2;
  undefined4 *puVar3;
  
  piVar2 = (int *)FUN_00402298(0xb8);
  if (piVar2 != (int *)0x0) {
    FUN_004c4170(piVar2,DAT_005153e0,DAT_00515424,param_5,0,param_1,param_2,param_3,
                 param_2 + DAT_00515468,param_3 + DAT_0051546c,&DAT_005154ac,DAT_005154f0,
                 DAT_00515534,DAT_00515578,DAT_005155bc,DAT_00515600,s_HorizTwoPartBar_005184d4);
  }
  iVar1 = *(int *)(param_5 + 0x4c);
  puVar3 = FUN_00442aec(iVar1 + 4,&DAT_005154ac,0);
  if (puVar3 != (undefined4 *)0x0) {
    FUN_00442c12(iVar1 + 4,&DAT_005154ac);
  }
  else {
    FUN_004dbb24(&DAT_00524e20,s_HorizTwoPartBar__Missing_image__005186f7,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_005154ac,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_00518717,(char *)0x0);
  }
  return puVar3 != (undefined4 *)0x0;
}



/* @004c4170 file=? name=FUN_004c4170 */

int * __cdecl
FUN_004c4170(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,int param_7,int param_8,int param_9,int param_10,char *param_11,int param_12
            ,int param_13,undefined4 param_14,undefined4 param_15,undefined4 param_16,
            undefined4 param_17)

{
  int iVar1;
  undefined4 *puVar2;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_17);
  *param_1 = (int)&PTR_FUN_00518cbc;
  iVar1 = FUN_004700ac(param_11);
  param_1[0x27] = iVar1;
  FUN_00442aec(*(int *)(param_4 + 0x4c) + 4,(char *)param_1[0x27],0);
  (**(code **)(param_1[0x12] + 8))(param_1 + 0x12,param_7,param_8,param_9,param_10);
  param_1[0x28] = param_12;
  param_1[0x29] = param_13;
  param_1[0x2a] = param_9 - param_7;
  param_1[0x2b] = (param_10 - param_8) + -1;
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0x24,param_14);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0x25,param_15);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0x26,param_16);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  return param_1;
}



/* @004c42b0 file=? name=FUN_004c42b0 */

void __cdecl FUN_004c42b0(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_00518cbc;
    FUN_00442c12(*(int *)(param_1[7] + 0x4c) + 4,(char *)param_1[0x27]);
    FUN_004022e8((int *)param_1[0x27]);
    param_1[0x27] = 0;
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004c430c file=? name=FUN_004c430c */

void FUN_004c430c(void)

{
  FUN_004448ac();
  return;
}



/* @004c431c file=? name=FUN_004c431c */

void FUN_004c431c(void)

{
  return;
}



/* @004c4324 file=? name=FUN_004c4324 */

void __cdecl FUN_004c4324(int param_1)

{
  *(undefined4 *)(param_1 + 0xb4) = 0;
  *(undefined4 *)(param_1 + 0xb0) = *(undefined4 *)(param_1 + 0xa8);
  return;
}



/* @004c4340 file=? name=FUN_004c4340 */

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

void __cdecl FUN_004c4340(int param_1)

{
  int iVar1;
  undefined4 *puVar2;
  int *piVar3;
  int *piVar4;
  int local_14 [3];
  int local_8;
  
  if (_DAT_004c452c <= *(float *)(param_1 + 0x90)) {
    if (*(float *)(param_1 + 0x98) < *(float *)(param_1 + 0x90)) {
      *(undefined4 *)(param_1 + 0x90) = *(undefined4 *)(param_1 + 0x98);
    }
  }
  else {
    *(undefined4 *)(param_1 + 0x90) = 0;
  }
  local_8 = FUN_004dcd94();
  local_14[2] = FUN_004dcd94();
  local_14[1] = 0;
  if (local_8 < 0) {
    piVar3 = local_14 + 1;
  }
  else {
    piVar3 = &local_8;
  }
  if (*(int *)(param_1 + 0xa8) <= *piVar3) {
    piVar3 = (int *)(param_1 + 0xa8);
  }
  local_8 = *piVar3;
  local_14[0] = 0;
  if (local_14[2] < 0) {
    piVar4 = local_14;
  }
  else {
    piVar4 = local_14 + 2;
  }
  if (*(int *)(param_1 + 0xa8) <= *piVar4) {
    piVar4 = (int *)(param_1 + 0xa8);
  }
  local_14[2] = *piVar4;
  if ((*piVar3 != *(int *)(param_1 + 0xb4)) || (local_14[2] != *(int *)(param_1 + 0xb0))) {
    piVar3 = (int *)(param_1 + 0x48);
    (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(piVar3,*(undefined4 *)(param_1 + 0xa0));
    iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
    puVar2 = FUN_00442aec(iVar1 + 4,*(char **)(param_1 + 0x9c),0);
    FUN_004c2ff8(piVar3,0,0,local_8 + -1,*(int *)(param_1 + 0xac),*(undefined4 *)(param_1 + 0xa4),
                 (int)puVar2);
    FUN_00442c12(iVar1 + 4,*(char **)(param_1 + 0x9c));
    if (local_8 < local_14[2]) {
      (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(piVar3,local_8,0);
      (**(code **)(*(int *)(param_1 + 0x48) + 0x48))
                (piVar3,local_14[2] + -1,*(undefined4 *)(param_1 + 0xac));
    }
    if (local_14[2] < *(int *)(param_1 + 0xa8)) {
      (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(piVar3,*(undefined4 *)(param_1 + 0xa4));
      (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(piVar3,local_14[2],0);
      (**(code **)(*(int *)(param_1 + 0x48) + 0x48))
                (piVar3,*(undefined4 *)(param_1 + 0xa8),*(undefined4 *)(param_1 + 0xac));
    }
    *(int *)(param_1 + 0xb4) = local_8;
    *(int *)(param_1 + 0xb0) = local_14[2];
  }
  return;
}



/* @004c462c file=? name=FUN_004c462c */

bool __cdecl FUN_004c462c(int param_1,int param_2,int param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  int *piVar2;
  undefined4 *puVar3;
  
  piVar2 = (int *)FUN_00402298(0xbc);
  if (piVar2 != (int *)0x0) {
    FUN_004c4724(piVar2,DAT_00515c70,DAT_00515cb4,param_5,0,param_1,param_2,param_3,
                 param_2 + DAT_00515cf8,param_3 + DAT_00515cfc,&DAT_00515d3c,DAT_00515d80,
                 DAT_00515dc4,DAT_00515e08,DAT_00515e4c,DAT_00515e90,&DAT_00514270,
                 s_VertTwoPartBar_005184e4);
  }
  iVar1 = *(int *)(param_5 + 0x4c);
  puVar3 = FUN_00442aec(iVar1 + 4,&DAT_00515d3c,0);
  if (puVar3 != (undefined4 *)0x0) {
    FUN_00442c12(iVar1 + 4,&DAT_00515d3c);
  }
  else {
    FUN_004dbb24(&DAT_00524e20,s_VertTwoPartBarNormalized__Missin_00518756,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_00515d3c,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_0051877f,(char *)0x0);
  }
  return puVar3 != (undefined4 *)0x0;
}



/* @004c4724 file=? name=FUN_004c4724 */

int * __cdecl
FUN_004c4724(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,int param_7,int param_8,int param_9,int param_10,char *param_11,int param_12
            ,int param_13,int param_14,undefined4 param_15,undefined4 param_16,undefined4 param_17,
            undefined4 param_18)

{
  int iVar1;
  undefined4 *puVar2;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_18);
  *param_1 = (int)&PTR_FUN_00518c78;
  iVar1 = FUN_004700ac(param_11);
  param_1[0x24] = iVar1;
  FUN_00442aec(*(int *)(param_4 + 0x4c) + 4,(char *)param_1[0x24],0);
  (**(code **)(param_1[0x12] + 8))(param_1 + 0x12,param_7,param_8,param_9,param_10);
  param_1[0x25] = param_12;
  param_1[0x26] = param_13;
  param_1[0x27] = param_14;
  param_1[0x28] = (param_9 - param_7) + -1;
  param_1[0x29] = param_10 - param_8;
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0x2c,param_15);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0x2d,param_16);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0x2e,param_17);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  return param_1;
}



/* @004c486c file=? name=FUN_004c486c */

void __cdecl FUN_004c486c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_00518c78;
    FUN_00442c12(*(int *)(param_1[7] + 0x4c) + 4,(char *)param_1[0x24]);
    FUN_004022e8((int *)param_1[0x24]);
    param_1[0x24] = 0;
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004c48c8 file=? name=FUN_004c48c8 */

void FUN_004c48c8(void)

{
  FUN_004448ac();
  return;
}



/* @004c48d8 file=? name=FUN_004c48d8 */

void FUN_004c48d8(void)

{
  return;
}



/* @004c48e0 file=? name=FUN_004c48e0 */

void __cdecl FUN_004c48e0(int param_1)

{
  *(undefined4 *)(param_1 + 0xac) = 0;
  *(undefined4 *)(param_1 + 0xa8) = *(undefined4 *)(param_1 + 0xa0);
  return;
}



/* @004c48fc file=? name=FUN_004c48fc */

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

void __cdecl FUN_004c48fc(int param_1)

{
  int iVar1;
  undefined4 *puVar2;
  int *piVar3;
  int *piVar4;
  int local_14 [3];
  int local_8;
  
  if (_DAT_004c4b00 <= *(float *)(param_1 + 0xb0)) {
    if (*(float *)(param_1 + 0xb8) < *(float *)(param_1 + 0xb0)) {
      *(undefined4 *)(param_1 + 0xb0) = *(undefined4 *)(param_1 + 0xb8);
    }
  }
  else {
    *(undefined4 *)(param_1 + 0xb0) = 0;
  }
  local_8 = FUN_004dcd94();
  local_14[2] = FUN_004dcd94();
  local_14[1] = 0;
  if (local_8 < 0) {
    piVar3 = local_14 + 1;
  }
  else {
    piVar3 = &local_8;
  }
  if (*(int *)(param_1 + 0xa4) <= *piVar3) {
    piVar3 = (int *)(param_1 + 0xa4);
  }
  local_8 = *piVar3;
  local_14[0] = 0;
  if (local_14[2] < 0) {
    piVar4 = local_14;
  }
  else {
    piVar4 = local_14 + 2;
  }
  if (*(int *)(param_1 + 0xa4) <= *piVar4) {
    piVar4 = (int *)(param_1 + 0xa4);
  }
  local_14[2] = *piVar4;
  if ((*piVar3 != *(int *)(param_1 + 0xac)) || (local_14[2] != *(int *)(param_1 + 0xa8))) {
    iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
    puVar2 = FUN_00442aec(iVar1 + 4,*(char **)(param_1 + 0x90),0);
    piVar3 = (int *)(param_1 + 0x48);
    (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(piVar3,*(undefined4 *)(param_1 + 0x94));
    FUN_004c2ff8(piVar3,0,0,*(int *)(param_1 + 0xa0),local_8 + -1,*(undefined4 *)(param_1 + 0x9c),
                 (int)puVar2);
    FUN_00442c12(iVar1 + 4,*(char **)(param_1 + 0x90));
    if (local_8 < local_14[2]) {
      (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(piVar3,*(undefined4 *)(param_1 + 0x98));
      (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(piVar3,0,local_8);
      (**(code **)(*(int *)(param_1 + 0x48) + 0x48))
                (piVar3,*(undefined4 *)(param_1 + 0xa0),local_14[2] + -1);
    }
    if (local_14[2] < *(int *)(param_1 + 0xa4)) {
      (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(piVar3,*(undefined4 *)(param_1 + 0x9c));
      (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(piVar3,0,local_14[2]);
      (**(code **)(*(int *)(param_1 + 0x48) + 0x48))
                (piVar3,*(undefined4 *)(param_1 + 0xa0),*(undefined4 *)(param_1 + 0xa4));
    }
    *(int *)(param_1 + 0xac) = local_8;
    *(int *)(param_1 + 0xa8) = local_14[2];
  }
  return;
}



/* @004c4b84 file=? name=FUN_004c4b84 */

int * __cdecl
FUN_004c4b84(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,int param_7,int param_8,int param_9,int param_10,int param_11,int param_12,
            int param_13,undefined4 param_14,undefined4 param_15)

{
  int *piVar1;
  undefined4 *puVar2;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_15);
  *param_1 = (int)&PTR_FUN_00518c34;
  piVar1 = param_1 + 0x12;
  (**(code **)(param_1[0x12] + 8))(piVar1,param_7,param_8,param_9,param_10);
  (**(code **)(param_1[0x12] + 0xc))(piVar1,3);
  (**(code **)(param_1[0x12] + 0x18))(piVar1,param_11);
  param_1[0x29] = param_11;
  param_1[0x2a] = param_12;
  param_1[0x27] = param_13;
  param_1[0x25] = (param_9 - param_7) + -1;
  param_1[0x26] = param_10 - param_8;
  param_1[0x28] = (param_10 - param_8) - param_1[0x27];
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0x2b,param_14);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  return param_1;
}



/* @004c4c68 file=? name=FUN_004c4c68 */

void __cdecl FUN_004c4c68(int *param_1,byte param_2)

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



/* @004c4c94 file=? name=FUN_004c4c94 */

void FUN_004c4c94(void)

{
  FUN_004448ac();
  return;
}



/* @004c4ca4 file=? name=FUN_004c4ca4 */

void FUN_004c4ca4(void)

{
  return;
}



/* @004c4cac file=? name=FUN_004c4cac */

void __cdecl FUN_004c4cac(int param_1)

{
  *(undefined4 *)(param_1 + 0x90) = 0xffffffff;
  return;
}



/* @004c4cc0 file=? name=FUN_004c4cc0 */

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

void __cdecl FUN_004c4cc0(int param_1)

{
  int iVar1;
  
  if (_DAT_004c4d3c <= *(float *)(param_1 + 0xac)) {
    if (_DAT_004c4d40 < *(float *)(param_1 + 0xac)) {
      *(undefined4 *)(param_1 + 0xac) = 0x3f800000;
    }
  }
  else {
    *(undefined4 *)(param_1 + 0xac) = 0;
  }
  iVar1 = FUN_004dcd94();
  if (iVar1 != *(int *)(param_1 + 0x90)) {
    FUN_004c4d48(param_1);
    *(int *)(param_1 + 0x90) = iVar1;
    FUN_004c4d48(param_1);
  }
  return;
}



/* @004c4d48 file=? name=FUN_004c4d48 */

void __cdecl FUN_004c4d48(int param_1)

{
  if (-1 < *(int *)(param_1 + 0x90)) {
    (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(param_1 + 0x48,0,*(int *)(param_1 + 0x90));
    (**(code **)(*(int *)(param_1 + 0x48) + 0x4c))
              (param_1 + 0x48,*(undefined4 *)(param_1 + 0x94),*(undefined4 *)(param_1 + 0x9c));
  }
  return;
}



/* @004c4d88 file=? name=FUN_004c4d88 */

undefined4 * __cdecl
FUN_004c4d88(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,
            undefined4 param_5,int param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9,
            char *param_10,undefined4 param_11,undefined4 param_12,int param_13,int param_14,
            undefined4 param_15)

{
  undefined4 uVar1;
  undefined4 *puVar2;
  int *piVar3;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_15);
  *param_1 = &PTR_FUN_00518bf0;
  param_1[0x26] = param_11;
  param_1[0x27] = param_12;
  param_1[0x28] = param_13;
  param_1[0x24] = param_9;
  uVar1 = FUN_004700ac(param_10);
  param_1[0x25] = uVar1;
  if (param_1[0x24] == 0) {
    piVar3 = FUN_00442d2b(*(int *)(param_4 + 0x4c) + 0x20,(char *)param_1[0x25],0);
    param_1[0x29] = *piVar3 / param_13;
    param_1[0x2a] = piVar3[1] / param_14;
  }
  else {
    puVar2 = FUN_00442aec(*(int *)(param_4 + 0x4c) + 4,(char *)param_1[0x25],0);
    param_1[0x29] = (int)puVar2[3] / param_13;
    param_1[0x2a] = (int)puVar2[4] / param_14;
  }
  (**(code **)(param_1[0x12] + 0x10))(param_1 + 0x12,param_7,param_8);
  return param_1;
}



/* @004c4e7c file=? name=FUN_004c4e7c */

void __cdecl FUN_004c4e7c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_00518bf0;
    if (param_1[0x24] == 0) {
      FUN_00442e51(*(int *)(param_1[7] + 0x4c) + 0x20,(char *)param_1[0x25]);
    }
    else {
      FUN_00442c12(*(int *)(param_1[7] + 0x4c) + 4,(char *)param_1[0x25]);
    }
    FUN_004022e8((int *)param_1[0x25]);
    param_1[0x25] = 0;
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004c4efc file=? name=FUN_004c4efc */

void FUN_004c4efc(void)

{
  FUN_004448ac();
  return;
}



/* @004c4f0c file=? name=FUN_004c4f0c */

void FUN_004c4f0c(void)

{
  return;
}



/* @004c4f14 file=? name=FUN_004c4f14 */

void __cdecl FUN_004c4f14(int param_1)

{
  *(undefined4 *)(param_1 + 0xb0) = 0xffffffff;
  return;
}



/* @004c4f28 file=? name=FUN_004c4f28 */

void __cdecl FUN_004c4f28(int param_1)

{
  int iVar1;
  undefined4 *puVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  int iVar7;
  
  if (*(int *)(param_1 + 0xac) != *(int *)(param_1 + 0xb0)) {
    *(int *)(param_1 + 0xb0) = *(int *)(param_1 + 0xac);
    iVar7 = *(int *)(param_1 + 0xa0);
    if (iVar7 == 1) {
      iVar6 = 0;
      iVar7 = *(int *)(param_1 + 0xac);
    }
    else {
      iVar6 = *(int *)(param_1 + 0xac) % iVar7;
      iVar7 = *(int *)(param_1 + 0xac) / iVar7;
    }
    iVar6 = iVar6 * *(int *)(param_1 + 0xa4);
    iVar4 = *(int *)(param_1 + 0xa4) + iVar6 + -1;
    iVar7 = iVar7 * *(int *)(param_1 + 0xa8);
    iVar5 = *(int *)(param_1 + 0xa8) + iVar7 + -1;
    if (*(int *)(param_1 + 0x90) == 0) {
      iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
      piVar3 = FUN_00442d2b(iVar1 + 0x20,*(char **)(param_1 + 0x94),0);
      (**(code **)(*(int *)(param_1 + 0x48) + 0x5c))
                (param_1 + 0x48,1,0,piVar3,iVar6,iVar7,iVar4,iVar5);
      FUN_00442e51(iVar1 + 0x20,*(char **)(param_1 + 0x94));
    }
    else {
      (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(param_1 + 0x48,*(undefined4 *)(param_1 + 0x98))
      ;
      iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
      puVar2 = FUN_00442aec(iVar1 + 4,*(char **)(param_1 + 0x94),0);
      (**(code **)(*(int *)(param_1 + 0x48) + 0x58))
                (param_1 + 0x48,*(undefined4 *)(param_1 + 0x9c),0,puVar2,iVar6,iVar7,iVar4,iVar5);
      FUN_00442c12(iVar1 + 4,*(char **)(param_1 + 0x94));
    }
  }
  return;
}



/* @004c5068 file=? name=FUN_004c5068 */

bool __cdecl
FUN_004c5068(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  int *piVar2;
  undefined4 *puVar3;
  
  piVar2 = (int *)FUN_00402298(0xb4);
  if (piVar2 != (int *)0x0) {
    FUN_004c5148(piVar2,DAT_00516500,DAT_00516544,param_5,0,param_1,param_2,param_3,&DAT_00516588,
                 DAT_005165cc,DAT_00516610,DAT_00516654,DAT_00516698,DAT_005166dc,
                 s_OneOfSeveralInt_00518511);
  }
  iVar1 = *(int *)(param_5 + 0x4c);
  puVar3 = FUN_00442aec(iVar1 + 4,&DAT_00516588,0);
  if (puVar3 != (undefined4 *)0x0) {
    FUN_00442c12(iVar1 + 4,&DAT_00516588);
  }
  else {
    FUN_004dbb24(&DAT_00524e20,s_OneOfSeveralInt__Missing_image__005187a3,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_00516588,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_005187c3,(char *)0x0);
  }
  return puVar3 != (undefined4 *)0x0;
}



/* @004c5148 file=? name=FUN_004c5148 */

int * __cdecl
FUN_004c5148(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,char *param_9,undefined4 param_10,
            undefined4 param_11,int param_12,int param_13,undefined4 param_14,undefined4 param_15)

{
  undefined4 *puVar1;
  
  FUN_004c4d88(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,1,param_9,param_10,
               param_11,param_12,param_13,param_15);
  *param_1 = (int)&PTR_FUN_00518bac;
  param_1[0x2b] = 0;
  puVar1 = (undefined4 *)FUN_00402298(0x18);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004749de(puVar1,0,param_1 + 0x2b,param_14);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar1);
  return param_1;
}



/* @004c51d8 file=? name=FUN_004c51d8 */

void __cdecl FUN_004c51d8(int *param_1,byte param_2)

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



/* @004c5204 file=? name=FUN_004c5204 */

bool __cdecl
FUN_004c5204(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  int *piVar2;
  
  piVar2 = (int *)FUN_00402298(0xb4);
  if (piVar2 != (int *)0x0) {
    FUN_004c52d8(piVar2,DAT_00516948,DAT_0051698c,param_5,0,param_1,param_2,param_3,&DAT_005169d0,
                 DAT_00516a14,DAT_00516a58,DAT_00516a9c,s_OneOfSeveralPixInt_00518521);
  }
  iVar1 = *(int *)(param_5 + 0x4c);
  piVar2 = FUN_00442d2b(iVar1 + 0x20,&DAT_005169d0,0);
  if (piVar2 != (int *)0x0) {
    FUN_00442e51(iVar1 + 0x20,&DAT_005169d0);
  }
  else {
    FUN_004dbb24(&DAT_00524e20,s_OneOfSeveralPixInt__Missing_imag_005187d9,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_005169d0,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_005187fc,(char *)0x0);
  }
  return piVar2 != (int *)0x0;
}



/* @004c52d8 file=? name=FUN_004c52d8 */

int * __cdecl
FUN_004c52d8(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,char *param_9,int param_10,
            int param_11,undefined4 param_12,undefined4 param_13)

{
  undefined4 *puVar1;
  
  FUN_004c4d88(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,0,param_9,0,0,
               param_10,param_11,param_13);
  *param_1 = (int)&PTR_FUN_00518b68;
  param_1[0x2b] = 0;
  puVar1 = (undefined4 *)FUN_00402298(0x18);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004749de(puVar1,0,param_1 + 0x2b,param_12);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar1);
  return param_1;
}



/* @004c5364 file=? name=FUN_004c5364 */

void __cdecl FUN_004c5364(int *param_1,byte param_2)

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



/* @004c5390 file=? name=FUN_004c5390 */

bool __cdecl
FUN_004c5390(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  int *piVar2;
  undefined4 *puVar3;
  
  piVar2 = (int *)FUN_00402298(0xb4);
  if (piVar2 != (int *)0x0) {
    FUN_004c5470(piVar2,DAT_00516d90,DAT_00516dd4,param_5,0,param_1,param_2,param_3,&DAT_00516e18,
                 DAT_00516e5c,DAT_00516ea0,DAT_00516ee4,DAT_00516f28,DAT_00516f6c,
                 s_OneOfSeveralStates_00518534);
  }
  iVar1 = *(int *)(param_5 + 0x4c);
  puVar3 = FUN_00442aec(iVar1 + 4,&DAT_00516e18,0);
  if (puVar3 != (undefined4 *)0x0) {
    FUN_00442c12(iVar1 + 4,&DAT_00516e18);
  }
  else {
    FUN_004dbb24(&DAT_00524e20,s_OneOfSeveralStates__Missing_imag_00518812,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_00516e18,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_00518835,(char *)0x0);
  }
  return puVar3 != (undefined4 *)0x0;
}



/* @004c5470 file=? name=FUN_004c5470 */

int * __cdecl
FUN_004c5470(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,char *param_9,undefined4 param_10,
            undefined4 param_11,int param_12,int param_13,undefined4 param_14,undefined4 param_15)

{
  undefined4 *puVar1;
  
  FUN_004c4d88(param_1,param_2,param_3,param_4,param_5,param_6,param_7,param_8,1,param_9,param_10,
               param_11,param_12,param_13,param_15);
  *param_1 = (int)&PTR_FUN_00518b24;
  param_1[0x2b] = 0;
  puVar1 = (undefined4 *)FUN_00402298(0x18);
  if (puVar1 == (undefined4 *)0x0) {
    puVar1 = (undefined4 *)0x0;
  }
  else {
    puVar1 = FUN_004c3324(puVar1,0,param_1 + 0x2b,param_14);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar1);
  return param_1;
}



/* @004c5500 file=? name=FUN_004c5500 */

void __cdecl FUN_004c5500(int *param_1,byte param_2)

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



/* @004c552c file=? name=FUN_004c552c */

void __cdecl FUN_004c552c(int param_1)

{
  if (*(int *)(param_1 + 0xac) < 0) {
    *(undefined4 *)(param_1 + 0xac) = 0;
  }
  FUN_004c4f28(param_1);
  return;
}



/* @004c554c file=? name=FUN_004c554c */

bool __cdecl
FUN_004c554c(int param_1,undefined4 param_2,undefined4 param_3,undefined4 param_4,int param_5)

{
  int iVar1;
  undefined4 *puVar2;
  
  puVar2 = (undefined4 *)FUN_00402298(0xc0);
  if (puVar2 != (undefined4 *)0x0) {
    FUN_004c562c(puVar2,DAT_005171d8,DAT_0051721c,param_5,0,param_1,param_2,param_3,DAT_00517260,
                 DAT_005172a4,DAT_005172e8,DAT_0051732c,DAT_00517370,&DAT_005173b4,
                 s_HeadingPointer_00518547);
  }
  iVar1 = *(int *)(param_5 + 0x4c);
  puVar2 = FUN_00442aec(iVar1 + 4,&DAT_005173b4,0);
  if (puVar2 != (undefined4 *)0x0) {
    FUN_00442c12(iVar1 + 4,&DAT_005173b4);
  }
  else {
    FUN_004dbb24(&DAT_00524e20,s_HeadingPointer__Missing_font__00518847,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_005173b4,(char *)0x0);
    FUN_004dbb24(&DAT_00524e20,&DAT_00518865,(char *)0x0);
  }
  return puVar2 != (undefined4 *)0x0;
}



/* @004c562c file=? name=FUN_004c562c */

undefined4 * __cdecl
FUN_004c562c(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,
            undefined4 param_5,int param_6,undefined4 param_7,undefined4 param_8,undefined4 param_9,
            int param_10,int param_11,undefined4 param_12,undefined4 param_13,char *param_14,
            undefined4 param_15)

{
  int iVar1;
  uint uVar2;
  undefined4 uVar3;
  undefined4 *puVar4;
  int iVar5;
  int *piVar6;
  int iVar7;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_15);
  *param_1 = &PTR_FUN_00518ae0;
  FUN_0044a5b4(param_1 + 0x29);
  (**(code **)(param_1[0x12] + 0x10))(param_1 + 0x12,param_7,param_8);
  param_1[0x24] = param_9;
  param_1[0x25] = param_11;
  param_1[0x26] = param_12;
  param_1[0x27] = param_13;
  uVar3 = FUN_004700ac(param_14);
  param_1[0x28] = uVar3;
  iVar1 = *(int *)(param_1[7] + 0x4c);
  puVar4 = FUN_00442aec(iVar1 + 4,param_14,0);
  uVar2 = ((int)puVar4[3] / 0xe) * 3;
  iVar5 = (int)uVar2 >> 1;
  if (iVar5 < 0) {
    iVar5 = iVar5 + (uint)((uVar2 & 1) != 0);
  }
  iVar7 = (int)puVar4[4] >> 1;
  if (iVar7 < 0) {
    iVar7 = iVar7 + (uint)((puVar4[4] & 1) != 0);
  }
  piVar6 = (int *)FUN_00402298(0x44);
  if (piVar6 == (int *)0x0) {
    piVar6 = (int *)0x0;
  }
  else {
    piVar6 = FUN_004700bc(piVar6,iVar1,-iVar5,-iVar7,param_14,3,0,param_11,param_10);
  }
  param_1[0x2f] = piVar6;
  return param_1;
}



/* @004c573c file=? name=FUN_004c573c */

void __cdecl FUN_004c573c(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_00518ae0;
    FUN_00442c12(*(int *)(param_1[7] + 0x4c) + 4,(char *)param_1[0x28]);
    FUN_004022e8((int *)param_1[0x28]);
    param_1[0x28] = 0;
    FUN_0047018c((int *)param_1[0x2f],3);
    param_1[0x2f] = 0;
    FUN_0044a5dc(param_1 + 0x29,2);
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004c57c0 file=? name=FUN_004c57c0 */

void FUN_004c57c0(void)

{
  FUN_004448ac();
  return;
}



/* @004c57d0 file=? name=FUN_004c57d0 */

void __cdecl FUN_004c57d0(int param_1,char *param_2)

{
  char cVar1;
  int *piVar2;
  uint uVar3;
  uint uVar4;
  char *pcVar5;
  char *pcVar6;
  char local_54 [80];
  
  FUN_004dbb24(&DAT_00524e20,param_2,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_HeadingPointer__00518868,(char *)0x0);
  uVar3 = 0xffffffff;
  do {
    pcVar5 = param_2;
    if (uVar3 == 0) break;
    uVar3 = uVar3 - 1;
    pcVar5 = param_2 + 1;
    cVar1 = *param_2;
    param_2 = pcVar5;
  } while (cVar1 != '\0');
  uVar3 = ~uVar3;
  pcVar5 = pcVar5 + -uVar3;
  pcVar6 = local_54;
  for (uVar4 = uVar3 >> 2; uVar4 != 0; uVar4 = uVar4 - 1) {
    *(undefined4 *)pcVar6 = *(undefined4 *)pcVar5;
    pcVar5 = pcVar5 + 4;
    pcVar6 = pcVar6 + 4;
  }
  for (uVar3 = uVar3 & 3; uVar3 != 0; uVar3 = uVar3 - 1) {
    *pcVar6 = *pcVar5;
    pcVar5 = pcVar5 + 1;
    pcVar6 = pcVar6 + 1;
  }
  FUN_004d49b8(local_54,&DAT_00518879);
  uVar3 = *(uint *)(param_1 + 0x94);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_bgColor__0051887d,(char *)0x0);
  piVar2 = FUN_004db78c(&DAT_00524e20,uVar3);
  FUN_004dbb24(piVar2,&DAT_00518886,(char *)0x0);
  uVar3 = *(uint *)(param_1 + 0x90);
  FUN_004dbb24(&DAT_00524e20,local_54,(char *)0x0);
  FUN_004dbb24(&DAT_00524e20,s_fgColor__00518888,(char *)0x0);
  piVar2 = FUN_004db78c(&DAT_00524e20,uVar3);
  FUN_004dbb24(piVar2,&DAT_00518891,(char *)0x0);
  FUN_004448bc(param_1,local_54);
  return;
}



/* @004c58e8 file=? name=FUN_004c58e8 */

void __cdecl FUN_004c58e8(int param_1)

{
  *(undefined4 *)(param_1 + 0xb4) = 0xfffffc19;
  *(undefined4 *)(param_1 + 0xb8) = 0xfffffc19;
  FUN_004703f4(*(int *)(param_1 + 0xbc));
  return;
}



/* @004c5914 file=? name=FUN_004c5914 */

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

void FUN_004c5914(int param_1)

{
  int *piVar1;
  int iVar2;
  float afStack_30 [3];
  int iStack_24;
  int iStack_20;
  undefined4 uStack_1c;
  undefined4 uStack_18;
  float fStack_14;
  float fStack_10;
  float afStack_c [2];
  
  iVar2 = FUN_00417ab4(*(int *)(param_1 + 0x1c) + 0x40);
  if (iVar2 != 0) {
    FUN_0040954c(afStack_30,(float *)(iVar2 + 0x10c));
    fStack_14 = -afStack_30[0];
    fStack_10 = fStack_14;
    FUN_00408328(afStack_c,&fStack_14);
    uStack_1c = FUN_004dcd94();
    uStack_18 = FUN_004dcd94();
    iStack_24 = FUN_004dcd94();
    iStack_20 = FUN_004dcd94();
    if ((iStack_24 != *(int *)(param_1 + 0xb4)) || (iStack_20 != *(int *)(param_1 + 0xb8))) {
      *(int *)(param_1 + 0xb4) = iStack_24;
      iVar2 = param_1 + 0x48;
      piVar1 = (int *)(param_1 + 0xa4);
      *(int *)(param_1 + 0xb8) = iStack_20;
      FUN_0044a650(piVar1,iVar2,*(uint *)(param_1 + 0x94));
      FUN_0044a630((int)piVar1);
      (**(code **)(*(int *)(param_1 + 0x48) + 100))(iVar2,piVar1);
      (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(iVar2,*(undefined4 *)(param_1 + 0x90));
      (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(iVar2,uStack_1c,uStack_18);
      (**(code **)(*(int *)(param_1 + 0x48) + 0x38))(iVar2,iStack_24,iStack_20);
      (**(code **)(*(int *)(param_1 + 0x48) + 0x68))(iVar2);
    }
    iVar2 = FUN_004dcd94();
    if ((float)iVar2 < _DAT_004c5acc) {
      FUN_004dcd94();
    }
    iVar2 = FUN_004dcd94();
    FUN_00470430(*(int **)(param_1 + 0xbc),(int *)(param_1 + 0x48),(float)iVar2);
  }
  return;
}



/* @004c591a file=? name=FUN_004c591a */

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

void FUN_004c591a(void)

{
  int *piVar1;
  int iVar2;
  int iVar3;
  undefined4 uVar4;
  int unaff_EBP;
  
  iVar2 = *(int *)(unaff_EBP + 8);
  iVar3 = FUN_00417ab4(*(int *)(iVar2 + 0x1c) + 0x40);
  if (iVar3 != 0) {
    FUN_0040954c((float *)(unaff_EBP + -0x2c),(float *)(iVar3 + 0x10c));
    *(float *)(unaff_EBP + -0xc) = -*(float *)(unaff_EBP + -0x2c);
    *(undefined4 *)(unaff_EBP + -0x10) = *(undefined4 *)(unaff_EBP + -0xc);
    FUN_00408328((float *)(unaff_EBP + -8),(float *)(unaff_EBP + -0x10));
    uVar4 = FUN_004dcd94();
    *(undefined4 *)(unaff_EBP + -0x18) = uVar4;
    uVar4 = FUN_004dcd94();
    *(undefined4 *)(unaff_EBP + -0x14) = uVar4;
    uVar4 = FUN_004dcd94();
    *(undefined4 *)(unaff_EBP + -0x20) = uVar4;
    uVar4 = FUN_004dcd94();
    *(undefined4 *)(unaff_EBP + -0x1c) = uVar4;
    if ((*(int *)(unaff_EBP + -0x20) != *(int *)(iVar2 + 0xb4)) ||
       (*(int *)(unaff_EBP + -0x1c) != *(int *)(iVar2 + 0xb8))) {
      *(int *)(iVar2 + 0xb4) = *(int *)(unaff_EBP + -0x20);
      iVar3 = iVar2 + 0x48;
      piVar1 = (int *)(iVar2 + 0xa4);
      *(undefined4 *)(iVar2 + 0xb8) = *(undefined4 *)(unaff_EBP + -0x1c);
      FUN_0044a650(piVar1,iVar3,*(uint *)(iVar2 + 0x94));
      FUN_0044a630((int)piVar1);
      (**(code **)(*(int *)(iVar2 + 0x48) + 100))(iVar3,piVar1);
      (**(code **)(*(int *)(iVar2 + 0x48) + 0x18))(iVar3,*(undefined4 *)(iVar2 + 0x90));
      (**(code **)(*(int *)(iVar2 + 0x48) + 0x24))
                (iVar3,*(undefined4 *)(unaff_EBP + -0x18),*(undefined4 *)(unaff_EBP + -0x14));
      (**(code **)(*(int *)(iVar2 + 0x48) + 0x38))
                (iVar3,*(undefined4 *)(unaff_EBP + -0x20),*(undefined4 *)(unaff_EBP + -0x1c));
      (**(code **)(*(int *)(iVar2 + 0x48) + 0x68))(iVar3);
    }
    uVar4 = FUN_004dcd94();
    *(undefined4 *)(unaff_EBP + -0x30) = uVar4;
    if ((float)*(int *)(unaff_EBP + -0x30) < _DAT_004c5acc) {
      *(undefined4 *)(unaff_EBP + -0x34) = uVar4;
      uVar4 = FUN_004dcd94();
    }
    *(undefined4 *)(unaff_EBP + -0x30) = uVar4;
    uVar4 = FUN_004dcd94();
    *(undefined4 *)(unaff_EBP + -0x34) = uVar4;
    FUN_00470430(*(int **)(iVar2 + 0xbc),(int *)(iVar2 + 0x48),(float)*(int *)(unaff_EBP + -0x34));
  }
  return;
}



/* @004c5b7c file=? name=FUN_004c5b7c */

int * __cdecl
FUN_004c5b7c(int *param_1,undefined4 param_2,undefined4 param_3,int param_4,undefined4 param_5,
            int param_6,undefined4 param_7,undefined4 param_8,char *param_9,int param_10,
            int param_11,int param_12,int param_13,undefined4 param_14,undefined4 param_15)

{
  int iVar1;
  undefined4 *puVar2;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_15);
  *param_1 = (int)&PTR_FUN_00518a9c;
  (**(code **)(param_1[0x12] + 0x10))(param_1 + 0x12,param_7,param_8);
  iVar1 = FUN_004700ac(param_9);
  param_1[0x24] = iVar1;
  param_1[0x25] = param_10;
  param_1[0x26] = param_11;
  param_1[0x28] = param_12;
  param_1[0x27] = param_12 * 2;
  param_1[0x2c] = param_13;
  puVar2 = FUN_00442aec(*(int *)(param_4 + 0x4c) + 4,(char *)param_1[0x24],0);
  if (puVar2 == (undefined4 *)0x0) {
    param_1[0x2a] = 0;
    param_1[0x29] = 0;
  }
  else {
    param_1[0x2a] = (int)puVar2[3] / 3;
    param_1[0x29] = puVar2[4];
  }
  puVar2 = (undefined4 *)FUN_00402298(0x18);
  if (puVar2 == (undefined4 *)0x0) {
    puVar2 = (undefined4 *)0x0;
  }
  else {
    puVar2 = FUN_00474855(puVar2,0,param_1 + 0x2d,param_14);
  }
  (**(code **)(*param_1 + 0x34))(param_1,puVar2);
  return param_1;
}



/* @004c5c80 file=? name=FUN_004c5c80 */

void __cdecl FUN_004c5c80(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_00518a9c;
    FUN_00442c12(*(int *)(param_1[7] + 0x4c) + 4,(char *)param_1[0x24]);
    FUN_004022e8((int *)param_1[0x24]);
    param_1[0x24] = 0;
    FUN_00444870(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004c5cdc file=? name=FUN_004c5cdc */

void FUN_004c5cdc(void)

{
  FUN_004448ac();
  return;
}



/* @004c5cec file=? name=FUN_004c5cec */

void FUN_004c5cec(void)

{
  return;
}



/* @004c5cf4 file=? name=FUN_004c5cf4 */

void __cdecl FUN_004c5cf4(int param_1)

{
  *(undefined4 *)(param_1 + 0xac) = 0xffffffff;
  return;
}



/* @004c5d08 file=? name=FUN_004c5d08 */

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

void __cdecl FUN_004c5d08(int param_1)

{
  int iVar1;
  int iVar2;
  int iVar3;
  undefined4 *puVar4;
  int iVar5;
  int iVar6;
  
  iVar1 = *(int *)(param_1 + 0x9c);
  iVar3 = FUN_004dcd94();
  if (iVar3 < 0) {
    iVar3 = 0;
  }
  if (iVar1 < iVar3) {
    iVar3 = iVar1;
  }
  if ((_DAT_0050e3d8 < *(float *)(param_1 + 0xb4)) && (iVar3 < 1)) {
    iVar3 = 1;
  }
  if (iVar3 != *(int *)(param_1 + 0xac)) {
    *(int *)(param_1 + 0xac) = iVar3;
    iVar1 = *(int *)(*(int *)(param_1 + 0x1c) + 0x4c);
    puVar4 = FUN_00442aec(iVar1 + 4,*(char **)(param_1 + 0x90),0);
    if (puVar4 != (undefined4 *)0x0) {
      iVar6 = -*(int *)(param_1 + 0xa4);
      for (iVar2 = *(int *)(param_1 + 0xa0); 0 < iVar2; iVar2 = iVar2 + -1) {
        iVar5 = param_1 + 0x48;
        (**(code **)(*(int *)(param_1 + 0x48) + 0x24))(iVar5,0,iVar6);
        if (iVar3 < 1) {
          (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(iVar5,*(undefined4 *)(param_1 + 0x94));
          iVar5 = 0;
        }
        else if (iVar3 == 1) {
          (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(iVar5,*(undefined4 *)(param_1 + 0x98));
          iVar5 = *(int *)(param_1 + 0xa8);
        }
        else {
          (**(code **)(*(int *)(param_1 + 0x48) + 0x18))(iVar5,*(undefined4 *)(param_1 + 0x98));
          iVar5 = *(int *)(param_1 + 0xa8) * 2;
        }
        (**(code **)(*(int *)(param_1 + 0x48) + 0x54))
                  (param_1 + 0x48,0,puVar4,iVar5,0,*(int *)(param_1 + 0xa8) + iVar5,
                   *(undefined4 *)(param_1 + 0xa4));
        iVar3 = iVar3 + -2;
        iVar6 = iVar6 - *(int *)(param_1 + 0xa4);
      }
    }
    FUN_00442c12(iVar1 + 4,*(char **)(param_1 + 0x90));
  }
  return;
}



/* @004c5e84 file=? name=FUN_004c5e84 */

undefined4 * __cdecl
FUN_004c5e84(undefined4 *param_1,undefined4 param_2,undefined4 param_3,int param_4,
            undefined4 param_5,int param_6,undefined4 param_7,undefined4 param_8,char *param_9,
            undefined4 param_10,undefined4 param_11,undefined4 param_12)

{
  undefined4 uVar1;
  undefined4 *puVar2;
  
  FUN_00444818(param_1,param_2,param_3,param_4,param_5,param_6,param_12);
  *param_1 = &PTR_FUN_00518a58;
  (**(code **)(param_1[0x12] + 0x10))(param_1 + 0x12,param_7,param_8);
  uVar1 = FUN_004700ac(param_9);
  param_1[0x24] = uVar1;
  param_1[0x25] = param_10;
  param_1[0x26] = param_11;
  puVar2 = FUN_00442aec(*(int *)(param_4 + 0x4c) + 4,(char *)param_1[0x24],0);
  if (puVar2 == (undefined4 *)0x0) {
    param_1[0x27] = 0;
    param_1[0x28] = 0;
  }
  else {
    param_1[0x27] = puVar2[3];
    param_1[0x28] = puVar2[4];
  }
  return param_1;
}



