/* @004ae4d8 file=? name=FUN_004ae4d8 */

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

void __cdecl FUN_004ae4d8(int *param_1,undefined4 param_2)

{
  float fVar1;
  
  param_1[0x58] = (int)((_DAT_004ae530 - *(float *)(param_1[0x38] + 0x158)) * (float)param_1[0x76]);
  fVar1 = _DAT_004ae530;
  if (_DAT_004ae530 <= (float)param_1[0x58]) {
    fVar1 = (float)param_1[0x58];
  }
  param_1[0x58] = (int)fVar1;
  FUN_004ad748(param_1,param_2);
  return;
}



/* @004ae568 file=? name=FUN_004ae568 */

int * __cdecl FUN_004ae568(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_0050e4ec,0,0);
  *param_1 = (int)&PTR_FUN_0050ed88;
  FUN_0041b9ec(param_1 + 0x77,3);
  param_1[0x74] = 1;
  param_1[0x57] = 0;
  param_1[0x58] = *(int *)(param_4 + 0xfc);
  param_1[0x76] = param_1[0x58];
  param_1[10] = param_1[10] | 8;
  pcVar1 = (char *)param_1[0x35];
  iVar2 = FUN_004d4a78(pcVar1);
  iVar2 = FUN_004dd1e0(pcVar1 + iVar2 + -1);
  param_1[0x75] = iVar2;
  return param_1;
}



/* @004ae5fc file=? name=FUN_004ae5fc */

void __cdecl FUN_004ae5fc(int *param_1,byte param_2)

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



/* @004ae63c file=? name=FUN_004ae63c */

void __cdecl FUN_004ae63c(int param_1)

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



/* @004ae658 file=? name=FUN_004ae658 */

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

undefined4 __cdecl
FUN_004ae658(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_004ae150(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar1 == 0) {
    uVar2 = 0;
  }
  else {
    param_4[0x24] = '\0';
    param_4[0x25] = '\x01';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x43;
    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;
    }
    iVar1 = FUN_00404118(param_5,param_3,s_RefrigerationFactor_0050ea38,(float *)(param_4 + 0xfc));
    if ((iVar1 == 0) && (_DAT_004ae708 == *(float *)(param_4 + 0xfc))) {
      FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_missing_RefrigerationFactor__0050ea4c,(char *)0x0);
      uVar2 = 0;
    }
    else {
      uVar2 = 1;
    }
  }
  return uVar2;
}



/* @004ae724 file=? name=FUN_004ae724 */

void __cdecl FUN_004ae724(int *param_1,undefined4 param_2)

{
  FUN_004ad748(param_1,param_2);
  return;
}



/* @004ae73c file=? name=FUN_004ae73c */

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

void __cdecl FUN_004ae73c(int *param_1,float param_2)

{
  float fVar1;
  float fVar2;
  double dVar3;
  float fVar4;
  int iVar5;
  float10 fVar6;
  int *piVar7;
  
  iVar5 = FUN_004ad7d4((int)param_1);
  if (iVar5 != 0) {
    param_1[0x56] = (int)((float)param_1[0x72] + (float)param_1[0x56]);
    param_1[0x45] = (int)((float)param_1[0x56] / (float)param_1[0x55]);
    piVar7 = param_1;
    FUN_004ad7f0((int)param_1);
    param_1[0x72] = 0;
    fVar4 = _DAT_004ae89c - (_DAT_004ae89c - (float)param_1[0x75]) * _DAT_004ae8a0;
    fVar1 = (float)param_1[0x45];
    fVar2 = (float)param_1[0x58];
    dVar3 = (double)((-param_2 *
                     (float)param_1[0x50] *
                     (_DAT_004ae8a4 - *(float *)(param_1[0x38] + 0x158)) *
                     ((float)param_1[0x4b] / (float)param_1[0x4a]) * (float)param_1[0x57]) /
                    (float)param_1[0x55]);
    fVar6 = (float10)FUN_004dca38((short)piVar7,SUB84(dVar3,0),(uint)((ulonglong)dVar3 >> 0x20));
    param_1[0x72] =
         (int)(-(float)((float10)(fVar1 * fVar2 - fVar4) * (float10)(float)param_1[0x55] *
                       ((float10)_DAT_004ae8a4 - fVar6)) + (float)param_1[0x72]);
  }
  fVar1 = (float)param_1[0x4a] - (float)param_1[0x4b];
  if (_DAT_004ae8a8 < fVar1) {
    fVar6 = FUN_004dcd00((double)fVar1);
    if ((float10)_DAT_004ae8ac < fVar6) {
      fVar6 = (float10)(**(code **)(*param_1 + 0x38))(param_1,fVar1);
      param_1[0x4b] = (int)(float)(fVar6 + (float10)(float)param_1[0x4b]);
    }
  }
  return;
}



/* @004ae8d0 file=? name=FUN_004ae8d0 */

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

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

{
  FUN_004adda0(param_1,param_2,param_3,param_4,&DAT_0050e580,0,0);
  *param_1 = (int)&PTR_LAB_0050ed4c;
  param_1[0x74] = *(int *)(param_4 + 0xfc);
  param_1[0x75] = 0x43960000;
  FUN_004afa1a(param_1 + 0x76,0);
  param_1[0x50] =
       (int)(float)(_DAT_004ae974 * (float10)param_1[0x74] * (float10)(float)param_1[0x50]);
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_0050e5e8;
    param_1[8] = DAT_0050e5ec;
    param_1[9] = DAT_0050e5f0;
  }
  return param_1;
}



/* @004ae9c0 file=? name=FUN_004ae9c0 */

void __cdecl FUN_004ae9c0(int param_1)

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



/* @004ae9dc file=? name=FUN_004ae9dc */

undefined4 __cdecl
FUN_004ae9dc(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] = '\0';
    param_4[0x25] = '\x01';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x42;
    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;
    }
    bVar1 = FUN_004040d8(param_5,param_3,s_HeatSinkCount_0050ea95,(int *)(param_4 + 0xfc));
    if ((CONCAT31(extraout_var,bVar1) == 0) && (*(int *)(param_4 + 0xfc) == -1)) {
      FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_missing_HeatSinkCount__0050eaa3,(char *)0x0);
      uVar3 = 0;
    }
    else {
      uVar3 = 1;
    }
  }
  return uVar3;
}



/* @004aea84 file=? name=FUN_004aea84 */

void __cdecl FUN_004aea84(int *param_1,undefined4 param_2)

{
  FUN_004ac0bc(param_1,param_2);
  return;
}



/* @004aea9c file=? name=FUN_004aea9c */

void __cdecl FUN_004aea9c(int *param_1)

{
  FUN_004ac22c(param_1);
  FUN_0041bbd8((int)(param_1 + 0x4b),0);
  return;
}



/* @004aeac4 file=? name=FUN_004aeac4 */

void __cdecl FUN_004aeac4(int param_1)

{
  int iVar1;
  
  iVar1 = FUN_00417ab4(param_1 + 0x114);
  if (*(float *)(iVar1 + 0x114) <= *(float *)(param_1 + 0x124)) {
    if (*(float *)(iVar1 + 0x114) <= *(float *)(param_1 + 0x120)) {
      FUN_0041bbd8(param_1 + 300,0);
    }
    else {
      FUN_0041bbd8(param_1 + 300,1);
    }
  }
  else {
    FUN_0041bbd8(param_1 + 300,2);
  }
  return;
}



/* @004aeb40 file=? name=FUN_004aeb40 */

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

{
  FUN_004ac644(param_1,param_2,param_3,param_4,param_5,0,0);
  *param_1 = (int)&PTR_FUN_0050ed10;
  FUN_004af9cf(param_1 + 0x45,0);
  param_1[0x48] = *(int *)(param_4 + 0xe8);
  param_1[0x49] = *(int *)(param_4 + 0xec);
  param_1[0x4a] = *(int *)(param_4 + 0xe4);
  FUN_0041b9ec(param_1 + 0x4b,3);
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_0050e634;
    param_1[8] = DAT_0050e638;
    param_1[9] = DAT_0050e63c;
  }
  return param_1;
}



/* @004aebe8 file=? name=FUN_004aebe8 */

void __cdecl FUN_004aebe8(int *param_1,byte param_2)

{
  if (param_1 != (int *)0x0) {
    *param_1 = (int)&PTR_FUN_0050ed10;
    FUN_0041baa4(param_1 + 0x4b,2);
    FUN_004af9ee(param_1 + 0x45,2);
    FUN_004ac868(param_1,0);
    if ((param_2 & 1) != 0) {
      FUN_004022d0(param_1);
    }
  }
  return;
}



/* @004aec38 file=? name=FUN_004aec38 */

void __cdecl FUN_004aec38(int param_1)

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



/* @004aec54 file=? name=FUN_004aec54 */

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

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

{
  char *pcVar1;
  int iVar2;
  undefined4 uVar3;
  char *pcVar4;
  char *pcVar5;
  bool bVar6;
  char *local_8;
  
  iVar2 = FUN_004ac9ec(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  if (iVar2 == 0) {
    uVar3 = 0;
  }
  else {
    param_4[0x24] = -0x10;
    param_4[0x25] = '\0';
    param_4[0x26] = '\0';
    param_4[0x27] = '\0';
    param_4[0x20] = -0x41;
    param_4[0x21] = '\v';
    param_4[0x22] = '\0';
    param_4[0x23] = '\0';
    if (param_7 == 1) {
      param_4[0xe4] = -1;
      param_4[0xe5] = -1;
      param_4[0xe6] = -1;
      param_4[0xe7] = -1;
    }
    iVar2 = FUN_00404118(param_5,param_3,s_DegradationTemperature_0050eac8,(float *)(param_4 + 0xe8)
                        );
    if ((iVar2 == 0) && (_DAT_004aee28 == *(float *)(param_4 + 0xe8))) {
      FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_missing_DegradationTemperature__0050eadf,(char *)0x0);
      uVar3 = 0;
    }
    else {
      iVar2 = FUN_00404118(param_5,param_3,s_FailureTemperature_0050eb01,(float *)(param_4 + 0xec));
      if ((iVar2 == 0) && (_DAT_004aee28 == *(float *)(param_4 + 0xec))) {
        FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_missing_FailureTemperature__0050eb14,(char *)0x0);
        uVar3 = 0;
      }
      else {
        local_8 = s_Unspecified_0050eb32;
        iVar2 = FUN_00404088(param_5,param_3,s_WatchedSubsystem_0050eb3e,&local_8);
        if ((iVar2 == 0) && (*(int *)(param_4 + 0xe4) == -1)) {
          FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
          FUN_004dbb24((int *)&DAT_00524e68,s_missing_WatchedSubsystem__0050eb4f,(char *)0x0);
          uVar3 = 0;
        }
        else {
          pcVar5 = s_Unspecified_0050eb6b;
          pcVar4 = local_8;
          do {
            bVar6 = *pcVar4 == *pcVar5;
            if (!bVar6) break;
            if (*pcVar4 == '\0') goto LAB_004aede2;
            pcVar1 = pcVar4 + 1;
            bVar6 = *pcVar1 == pcVar5[1];
            if (!bVar6) break;
            pcVar4 = pcVar4 + 2;
            pcVar5 = pcVar5 + 2;
            bVar6 = *pcVar1 == '\0';
          } while (!bVar6);
          if (!bVar6) {
            iVar2 = FUN_004215b0(param_5,local_8);
            *(int *)(param_4 + 0xe4) = iVar2;
          }
LAB_004aede2:
          if (*(int *)(param_4 + 0xe4) < 0) {
            FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
            FUN_004dbb24((int *)&DAT_00524e68,s_has_an_invalid_watched_subsystem_0050eb77,
                         (char *)0x0);
            uVar3 = 0;
          }
          else {
            *(int *)(param_4 + 0xe4) = *(int *)(param_4 + 0xe4) + 2;
            uVar3 = 1;
          }
        }
      }
    }
  }
  return uVar3;
}



/* @004aee70 file=? name=FUN_004aee70 */

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

void __cdecl FUN_004aee70(int param_1,int param_2)

{
  bool bVar1;
  undefined3 extraout_var;
  
  bVar1 = FUN_004ac9c8(param_1);
  if (CONCAT31(extraout_var,bVar1) == 0) {
    if (*(int *)(param_2 + 0xc) < 1) {
      FUN_0041bbd8(param_1 + 0x1d0,0);
    }
    else {
      if ((*(int *)(param_1 + 0x1e4) != 1) && (_DAT_004aeedc < *(float *)(param_1 + 300))) {
        FUN_0041bbd8(param_1 + 0x1d0,1);
      }
      *(undefined4 *)(param_1 + 0x228) = 0;
    }
    *(ushort *)(param_1 + 0x18) = *(ushort *)(param_1 + 0x18) | 1;
  }
  return;
}



/* @004aeef8 file=? name=FUN_004aeef8 */

void __cdecl FUN_004aeef8(int param_1,int param_2)

{
  FUN_0041bd34(param_1,param_2);
  if (*(int *)(param_2 + 0x10) == 0) {
    FUN_0041bbd8(param_1 + 0x1d0,0);
  }
  else {
    FUN_0041bbd8(param_1 + 0x1d0,1);
  }
  return;
}



/* @004aef40 file=? name=FUN_004aef40 */

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

{
  FUN_0041c500(param_1,param_2,param_3);
  *param_2 = 0x14;
  param_2[4] = (uint)(*(int *)(param_1 + 0x1e4) == 1);
  return;
}



/* @004aef78 file=? name=FUN_004aef78 */

void __cdecl FUN_004aef78(int param_1,float param_2)

{
  if (*(int *)(param_1 + 0x1e4) == 1) {
    *(float *)(param_1 + 0x228) = param_2 + *(float *)(param_1 + 0x228);
    FUN_004aefa4(param_1,param_2);
  }
  return;
}



/* @004aefa4 file=? name=FUN_004aefa4 */

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

void __cdecl FUN_004aefa4(int param_1,float param_2)

{
  float fVar1;
  int iVar2;
  int iVar3;
  float10 fVar4;
  int local_6c [3];
  int local_60 [3];
  int local_54 [3];
  int local_48 [3];
  int local_3c [4];
  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_8 = *(float *)(param_1 + 300);
  fVar4 = FUN_004dcd00((double)local_8);
  if ((float10)_DAT_004af3a0 < fVar4) {
    iVar3 = *(int *)(param_1 + 0xd0);
    FUN_004afa65(local_3c,0);
    FUN_004a4f15(local_48,iVar3 + 0x7cc);
    while (iVar2 = (**(code **)(local_48[0] + 0x28))(), iVar2 != 0) {
      (**(code **)(local_3c[0] + 4))(local_3c);
    }
    FUN_004afab0(local_54,iVar3 + 0x7bc);
    while (iVar2 = (**(code **)(local_54[0] + 0x28))(), iVar2 != 0) {
      (**(code **)(local_3c[0] + 4))(local_3c);
    }
    FUN_004a4f9e(local_60,iVar3 + 0x7ac);
    while (iVar3 = (**(code **)(local_60[0] + 0x28))(), iVar3 != 0) {
      (**(code **)(local_3c[0] + 4))(local_3c);
    }
    FUN_00417ab4(param_1 + 0x164);
    (**(code **)(local_3c[0] + 4))(local_3c);
    FUN_004afb58(local_6c,(int)local_3c);
    while (iVar3 = (**(code **)(local_6c[0] + 0x28))(), iVar3 != 0) {
      local_c = *(float *)(param_1 + 300);
      fVar4 = FUN_004dcd00((double)local_c);
      if (fVar4 <= (float10)_DAT_004af3a0) {
        FUN_004afb96(local_6c,2);
        FUN_004a4ffb(local_60,2);
        FUN_004afb0d(local_54,2);
        FUN_004a4f72(local_48,2);
        FUN_004afa84(local_3c,2);
        return;
      }
      if (*(float *)(iVar3 + 0x15c) != _DAT_004af3a4) {
        fVar1 = -*(float *)(param_1 + 0x224) * *(float *)(iVar3 + 0x15c) * param_2;
        local_14 = -*(float *)(param_1 + 300);
        local_10 = local_14;
        if ((local_14 <= fVar1) && (local_10 = fVar1, _DAT_004af3a4 < fVar1)) {
          local_10 = _DAT_004af3a4;
        }
        local_24 = *(float *)(iVar3 + 300);
        fVar4 = FUN_004dcd00((double)local_24);
        if ((float10)_DAT_004af3a0 < fVar4) {
          local_20 = local_10;
          if (local_10 <= _DAT_004af3a4) {
            local_20 = -local_10;
          }
          local_20 = local_20 / *(float *)(iVar3 + 300);
          local_1c = local_10;
          if (local_10 <= _DAT_004af3a4) {
            local_1c = -local_10;
          }
          local_1c = local_1c / *(float *)(param_1 + 300);
          local_18 = *(float *)(iVar3 + 0x158) * local_20 - *(float *)(param_1 + 0x158) * local_1c;
        }
        else {
          local_20 = local_10;
          if (local_10 <= _DAT_004af3a4) {
            local_20 = -local_10;
          }
          local_20 = local_20 / *(float *)(iVar3 + 0x128);
          local_1c = local_10;
          if (local_10 <= _DAT_004af3a4) {
            local_1c = -local_10;
          }
          local_1c = local_1c / *(float *)(param_1 + 300);
          local_18 = *(float *)(iVar3 + 0x158) * local_20 - *(float *)(param_1 + 0x158) * local_1c;
        }
        *(float *)(param_1 + 300) = local_10 + *(float *)(param_1 + 300);
        *(float *)(iVar3 + 300) = *(float *)(iVar3 + 300) - local_10;
        if (_DAT_004af3a4 <= *(float *)(iVar3 + 300)) {
          if (*(float *)(iVar3 + 300) <= *(float *)(iVar3 + 0x128)) {
            fVar1 = *(float *)(iVar3 + 300);
          }
          else {
            fVar1 = *(float *)(iVar3 + 0x128);
          }
        }
        else {
          fVar1 = (float)_DAT_004af3a8;
        }
        *(float *)(iVar3 + 300) = fVar1;
        if (*(float *)(iVar3 + 0x154) * *(float *)(param_1 + 0x13c) < local_18) {
          local_18 = *(float *)(iVar3 + 0x154) * *(float *)(param_1 + 0x13c);
        }
        local_2c = -local_18;
        if (_DAT_004af3a4 < local_2c) {
          local_2c = _DAT_004af3a4;
        }
        *(float *)(iVar3 + 0x1c8) = local_2c + *(float *)(iVar3 + 0x1c8);
        local_28 = local_2c;
      }
    }
    FUN_004afb96(local_6c,2);
    FUN_004a4ffb(local_60,2);
    FUN_004afb0d(local_54,2);
    FUN_004a4f72(local_48,2);
    FUN_004afa84(local_3c,2);
  }
  return;
}



/* @004af3b0 file=? name=FUN_004af3b0 */

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

float10 __cdecl FUN_004af3b0(int param_1,float param_2)

{
  float fVar1;
  
  fVar1 = _DAT_004af404;
  if ((_DAT_004af404 <= param_2) && (fVar1 = param_2, *(float *)(param_1 + 300) < param_2)) {
    fVar1 = *(float *)(param_1 + 300);
  }
  *(float *)(param_1 + 300) = *(float *)(param_1 + 300) - fVar1;
  return (float10)fVar1;
}



/* @004af408 file=? name=FUN_004af408 */

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

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

{
  int iVar1;
  
  FUN_004adda0(param_1,param_2,param_3,param_4,param_5,0,0);
  *param_1 = (int)&PTR_LAB_0050ecd4;
  FUN_0041b9ec(param_1 + 0x74,2);
  param_1[0x8b] = 0x3f000000;
  param_1[0x4a] = *(int *)(param_4 + 0xfc);
  param_1[0x89] = *(int *)(param_4 + 0x100);
  param_1[0x4b] = param_1[0x4a];
  param_1[0x57] = 0;
  FUN_0041bbd8((int)(param_1 + 0x74),0);
  param_1[0x8a] = 0;
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_0050e6b4;
    param_1[8] = DAT_0050e6b8;
    param_1[9] = DAT_0050e6bc;
    iVar1 = FUN_00417ab4((int)(param_1 + 0x59));
    (**(code **)(*(int *)(iVar1 + 0x1d8) + 4))(iVar1 + 0x1d8,param_1);
    param_1[0x4a] =
         (int)(float)(_DAT_004af518 * (float10)*(int *)(iVar1 + 0x1d0) *
                     (float10)(float)param_1[0x4a]);
    param_1[0x4b] = param_1[0x4a];
  }
  else {
    param_1[10] = param_1[10] | 2;
  }
  return param_1;
}



/* @004af564 file=? name=FUN_004af564 */

void __cdecl FUN_004af564(int param_1)

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



/* @004af580 file=? name=FUN_004af580 */

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

undefined4 __cdecl
FUN_004af580(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_004ae150(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] = -0x40;
    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[0x100] = '\0';
      param_4[0x101] = '\0';
      param_4[0x102] = -0x80;
      param_4[0x103] = -0x41;
    }
    iVar1 = FUN_00404118(param_5,param_3,s_CoolantCapacity_0050ebc2,(float *)(param_4 + 0xfc));
    if ((iVar1 == 0) && (_DAT_004af694 == *(float *)(param_4 + 0xfc))) {
      FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
      FUN_004dbb24((int *)&DAT_00524e68,s_missing_CoolantCapacity__0050ebd2,(char *)0x0);
      uVar2 = 0;
    }
    else {
      iVar1 = FUN_00404118(param_5,param_3,s_CoolantSquirtMass_0050ebed,(float *)(param_4 + 0x100));
      if ((iVar1 == 0) && (_DAT_004af694 == *(float *)(param_4 + 0x100))) {
        FUN_004dbb24((int *)&DAT_00524e68,param_3,(char *)0x0);
        FUN_004dbb24((int *)&DAT_00524e68,s_missing_CoolantSquirtMass__0050ebff,(char *)0x0);
        uVar2 = 0;
      }
      else {
        uVar2 = 1;
      }
    }
  }
  return uVar2;
}



/* @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;
}



