// Recovered decompilation of functions attributed to bt/heat.cpp
// (from BTL4OPT.EXE via embedded assert paths). Pseudocode — reconstruct against the header.

/* ---- @ 004adda0 ---- */

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

{
  int iVar1;
  int local_8;
  
  FUN_004ac644(param_1,param_2,param_3,param_4,param_5,param_6,param_7);
  *param_1 = (int)&PTR_FUN_0050edc4;
  param_1[0x45] = *(int *)(param_4 + 0xe4);
  param_1[0x46] = *(int *)(param_4 + 0xe8);
  param_1[0x47] = *(int *)(param_4 + 0xec);
  param_1[0x48] = 0;
  param_1[0x49] = 0x3f000000;
  param_1[0x4a] = 0x3f800000;
  param_1[0x4b] = param_1[0x4a];
  param_1[0x4c] = 0;
  param_1[0x4d] = 1;
  param_1[0x4e] = 0;
  param_1[0x4f] = param_1[0x45];
  param_1[0x50] = *(int *)(param_4 + 0xf0);
  FUN_0043ad4f((uint *)(param_1 + 0x51),0xf,0);
  param_1[0x54] = 0x3ecccccd;
  param_1[0x55] = *(int *)(param_4 + 0xf4);
  param_1[0x56] = (int)((float)param_1[0x55] * (float)param_1[0x4f]);
  param_1[0x57] = 0x3f800000;
  param_1[0x58] = 0x3f800000;
  FUN_004af9cf(param_1 + 0x59,0);
  FUN_0041b9ec(param_1 + 0x5c,3);
  param_1[0x72] = 0;
  if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
    param_1[7] = (int)PTR_FUN_0050e4e0;
    param_1[8] = DAT_0050e4e4;
    param_1[9] = DAT_0050e4e8;
  }
  param_1[0x71] = (int)param_4;
  local_8 = 0;
  iVar1 = FUN_0041a1a4(*(int *)param_1[3],0x50e590);
  if (iVar1 == 0) {
    if (*(int *)(param_4 + 0xf8) < *(int *)(param_2 + 0x124)) {
      local_8 = *(int *)(*(int *)(param_2 + 0x128) + *(int *)(param_4 + 0xf8) * 4);
    }
    else {
      FUN_0040385c(s_Bad_subsystem_resource_>heatSink_0050e7c9,s_d__tesla_bt_bt_HEAT_CPP_0050e804,
                   0x25f);
    }
    if (((*(uint *)(param_2 + 0x28) & 0xc) == 0) && ((*(uint *)(param_2 + 0x28) & 0x100) != 0)) {
      if (local_8 == 0) {
        FUN_0040385c(s_Master_heatable_subystem_is_miss_0050e81c,s_d__tesla_bt_bt_HEAT_CPP_0050e859,
                     0x26b);
      }
      else {
        (**(code **)(param_1[0x59] + 4))(param_1 + 0x59,local_8);
      }
    }
    else if (((*(uint *)(param_2 + 0x28) & 0xc) == 4) && (local_8 != 0)) {
      (**(code **)(param_1[0x59] + 4))(param_1 + 0x59,local_8);
    }
  }
  FUN_004ad7f0((int)param_1);
  return param_1;
}



