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

/* ---- @ 004a5028 ---- */

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

float10 __cdecl FUN_004a5028(int param_1,float param_2)

{
  undefined4 uVar1;
  int iVar2;
  int iVar3;
  float fVar4;
  float10 fVar5;
  float local_8;
  
  iVar2 = **(int **)(param_1 + 0x128);
  iVar3 = *(int *)(param_1 + 0x40);
  if (*(int *)(param_1 + 0x650) == 0) {
    if (iVar3 == 5) {
      FUN_004a7fc4(param_1,0x1c);
      *(undefined4 *)(param_1 + 0x650) = 1;
    }
    else if (iVar3 == 6) {
      FUN_004a7fc4(param_1,0x1d);
      *(undefined4 *)(param_1 + 0x650) = 1;
    }
    else if (iVar3 == 7) {
      FUN_004a7fc4(param_1,0x1e);
      *(undefined4 *)(param_1 + 0x650) = 1;
    }
    else if (iVar3 == 8) {
      FUN_004a7fc4(param_1,0x1f);
      *(undefined4 *)(param_1 + 0x650) = 1;
    }
  }
  iVar3 = *(int *)(param_1 + 0x3b0);
  if ((*(float *)(param_1 + 0x348) <= _DAT_004a5674) &&
     ((((iVar3 == 6 || (iVar3 == 7)) || (iVar3 == 8)) || (iVar3 == 9)))) {
    FUN_0041bbd8(param_1 + 0x39c,0);
    *(undefined4 *)(param_1 + 0x654) = 1;
  }
  switch(*(undefined4 *)(param_1 + 0x3b0)) {
  case 0:
    if (*(float *)(param_1 + 0x530) < *(float *)(iVar2 + 0x128)) {
      FUN_004a7fc4(param_1,5);
    }
    else {
      local_8 = 0.0;
      if (_DAT_004a5674 <= *(float *)(iVar2 + 0x128)) break;
      FUN_004a7fc4(param_1,0x10);
    }
  case 2:
  case 3:
  case 5:
  case 8:
  case 9:
  case 10:
  case 0xb:
  case 0xe:
  case 0xf:
  case 0x10:
  case 0x11:
  case 0x14:
  case 0x15:
  case 0x1c:
  case 0x1d:
  case 0x1e:
  case 0x1f:
  case 0x20:
switchD_004a510d_caseD_2:
    if (*(int *)(param_1 + 0x3b0) == 0) {
      FUN_0040385c(s_Standing_Not_Supported_0050d7cd,s_d__tesla_bt_bt_MECH2_CPP_0050d7e4,0xd3);
    }
    fVar5 = FUN_0042790c(param_1 + 0x65c,
                         param_2 * *(float *)(param_1 + 0x5a8) * *(float *)(param_1 + 0x5ac),1);
    local_8 = (float)fVar5;
    *(float *)(param_1 + 0x348) = local_8 / param_2;
    break;
  case 1:
    local_8 = 0.0;
    break;
  case 4:
    if (*(float *)(param_1 + 0x530) < *(float *)(iVar2 + 0x128)) {
      FUN_0041bbd8(param_1 + 0x39c,0);
      FUN_004a4c54(param_1,8);
      break;
    }
    local_8 = 0.0;
    if (*(float *)(iVar2 + 0x128) < _DAT_004a5674) {
      FUN_0041bbd8(param_1 + 0x39c,0);
      FUN_004a4c54(param_1,8);
      break;
    }
    goto switchD_004a510d_caseD_2;
  case 6:
  case 7:
    if (*(float *)(iVar2 + 0x128) <= *(float *)(param_1 + 0x348)) {
      if (*(float *)(iVar2 + 0x128) < *(float *)(param_1 + 0x348)) {
        *(float *)(param_1 + 0x348) =
             *(float *)(param_1 + 0x348) - *(float *)(param_1 + 0x344) * param_2;
        if (*(float *)(iVar2 + 0x128) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(iVar2 + 0x128);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
        if (*(float *)(param_1 + 0x530) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x530);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x348) =
           *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x348);
      if (*(float *)(param_1 + 0x348) <= *(float *)(iVar2 + 0x128)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(iVar2 + 0x128);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
      if (*(float *)(param_1 + 0x348) <= *(float *)(param_1 + 0x534)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x534);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
    }
    fVar5 = FUN_0042790c(param_1 + 0x65c,
                         param_2 * (*(float *)(param_1 + 0x348) / *(float *)(param_1 + 0x534)) *
                         *(float *)(param_1 + 0x5a8),1);
    local_8 = (float)fVar5;
    break;
  case 0xc:
  case 0xd:
    if (*(float *)(iVar2 + 0x128) <= *(float *)(param_1 + 0x348)) {
      if (*(float *)(iVar2 + 0x128) < *(float *)(param_1 + 0x348)) {
        *(float *)(param_1 + 0x348) =
             *(float *)(param_1 + 0x348) - *(float *)(param_1 + 0x344) * param_2;
        if (*(float *)(iVar2 + 0x128) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(iVar2 + 0x128);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
        if (*(float *)(param_1 + 0x538) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x538);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x348) =
           *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x348);
      if (*(float *)(param_1 + 0x348) <= *(float *)(iVar2 + 0x128)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(iVar2 + 0x128);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
      if (*(float *)(param_1 + 0x348) <= *(float *)(param_1 + 0x7a0)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x7a0);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
    }
    fVar5 = FUN_0042790c(param_1 + 0x65c,
                         param_2 * (*(float *)(param_1 + 0x348) / *(float *)(param_1 + 0x34c)) *
                         *(float *)(param_1 + 0x5a8),1);
    local_8 = (float)fVar5;
    break;
  case 0x12:
  case 0x13:
    if (*(float *)(iVar2 + 0x128) <= *(float *)(param_1 + 0x348)) {
      if (*(float *)(iVar2 + 0x128) < *(float *)(param_1 + 0x348)) {
        *(float *)(param_1 + 0x348) =
             *(float *)(param_1 + 0x348) - *(float *)(param_1 + 0x5b0) * param_2;
        if (*(float *)(iVar2 + 0x128) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(iVar2 + 0x128);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
        if (*(float *)(param_1 + 0x350) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x350);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x348) =
           *(float *)(param_1 + 0x5b0) * param_2 + *(float *)(param_1 + 0x348);
      if (*(float *)(param_1 + 0x348) <= *(float *)(iVar2 + 0x128)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(iVar2 + 0x128);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
      if (*(float *)(param_1 + 0x348) <= *(float *)(param_1 + 0x52c)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x52c);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
    }
    fVar4 = *(float *)(param_1 + 0x348) / *(float *)(param_1 + 0x350);
    if (fVar4 <= _DAT_004a5674) {
      fVar4 = -fVar4;
    }
    fVar5 = FUN_0042790c(param_1 + 0x65c,fVar4 * param_2 * *(float *)(param_1 + 0x5a8),1);
    local_8 = (float)fVar5;
    break;
  case 0x16:
  case 0x17:
  case 0x18:
  case 0x19:
  case 0x1a:
  case 0x1b:
    FUN_00408440((undefined4 *)(param_1 + 0x598),&DAT_004e0f74);
    *(undefined4 *)(param_1 + 0x5a4) = 0;
    *(undefined4 *)(param_1 + 0x654) = 0;
    *(undefined4 *)(param_1 + 0x650) = 0;
    FUN_0041bbd8(param_1 + 0x39c,0);
    FUN_004283b8(param_1 + 0x65c,1);
    break;
  default:
    FUN_004dbb24(&DAT_00524e20,s_StandingAnimation_0050cfe8 + *(int *)(param_1 + 0x3b0) * 0x3c,
                 (char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    FUN_0040385c(s_Unsupported_mech_animation__0050d7fd,s_d__tesla_bt_bt_MECH2_CPP_0050d81a,0x13b);
  }
  return (float10)local_8;
}



/* ---- @ 004a5678 ---- */

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

float10 __cdecl FUN_004a5678(int param_1,float param_2,int param_3)

{
  undefined4 uVar1;
  int iVar2;
  float fVar3;
  float10 fVar4;
  float local_8;
  
  iVar2 = *(int *)(param_1 + 0x40);
  if (*(int *)(param_1 + 0x650) == 0) {
    if (iVar2 == 5) {
      FUN_004a800c(param_1,0x1c);
      *(undefined4 *)(param_1 + 0x650) = 1;
    }
    else if (iVar2 == 6) {
      FUN_004a800c(param_1,0x1d);
      *(undefined4 *)(param_1 + 0x650) = 1;
    }
    else if (iVar2 == 7) {
      FUN_004a800c(param_1,0x1e);
      *(undefined4 *)(param_1 + 0x650) = 1;
    }
    else if (iVar2 == 8) {
      FUN_004a800c(param_1,0x1f);
      *(undefined4 *)(param_1 + 0x650) = 1;
    }
  }
  switch(*(undefined4 *)(param_1 + 0x728)) {
  case 0:
    local_8 = 0.0;
    if (*(float *)(param_1 + 0x530) < *(float *)(param_1 + 0x6b4)) {
      FUN_004a800c(param_1,5);
    }
    else {
      if (_DAT_004a5bf4 <= *(float *)(param_1 + 0x6b4)) break;
      FUN_004a800c(param_1,0x10);
    }
  case 2:
  case 3:
  case 4:
  case 5:
  case 8:
  case 9:
  case 10:
  case 0xb:
  case 0xe:
  case 0xf:
  case 0x10:
  case 0x11:
  case 0x14:
  case 0x15:
  case 0x1c:
  case 0x1d:
  case 0x1e:
  case 0x1f:
  case 0x20:
    fVar4 = FUN_0042790c(param_1 + 0x6bc,
                         param_2 * *(float *)(param_1 + 0x5a8) * *(float *)(param_1 + 0x5ac),param_3
                        );
    local_8 = (float)fVar4;
    *(float *)(param_1 + 0x6b8) = local_8 / param_2;
    break;
  case 1:
    local_8 = 0.0;
    break;
  case 6:
  case 7:
    if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
      if (*(float *)(param_1 + 0x6b4) < *(float *)(param_1 + 0x6b8)) {
        *(float *)(param_1 + 0x6b8) =
             *(float *)(param_1 + 0x6b8) - *(float *)(param_1 + 0x344) * param_2;
        if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x6b4);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
        if (*(float *)(param_1 + 0x530) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x530);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x6b8) =
           *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x6b8);
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x6b4)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x6b4);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x534)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x534);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
    }
    fVar4 = FUN_0042790c(param_1 + 0x6bc,
                         param_2 * (*(float *)(param_1 + 0x6b8) / *(float *)(param_1 + 0x534)) *
                         *(float *)(param_1 + 0x5a8),param_3);
    local_8 = (float)fVar4;
    break;
  case 0xc:
  case 0xd:
    if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
      if (*(float *)(param_1 + 0x6b4) < *(float *)(param_1 + 0x6b8)) {
        *(float *)(param_1 + 0x6b8) =
             *(float *)(param_1 + 0x6b8) - *(float *)(param_1 + 0x344) * param_2;
        if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x6b4);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
        if (*(float *)(param_1 + 0x538) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x538);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x6b8) =
           *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x6b8);
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x6b4)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x6b4);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x7a0)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x7a0);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
    }
    fVar4 = FUN_0042790c(param_1 + 0x6bc,
                         param_2 * (*(float *)(param_1 + 0x6b8) / *(float *)(param_1 + 0x34c)) *
                         *(float *)(param_1 + 0x5a8),param_3);
    local_8 = (float)fVar4;
    break;
  case 0x12:
  case 0x13:
    if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
      if (*(float *)(param_1 + 0x6b4) < *(float *)(param_1 + 0x6b8)) {
        *(float *)(param_1 + 0x6b8) =
             *(float *)(param_1 + 0x6b8) - *(float *)(param_1 + 0x5b0) * param_2;
        if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x6b4);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
        if (*(float *)(param_1 + 0x350) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x350);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x6b8) =
           *(float *)(param_1 + 0x5b0) * param_2 + *(float *)(param_1 + 0x6b8);
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x6b4)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x6b4);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x52c)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x52c);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
    }
    fVar3 = *(float *)(param_1 + 0x6b8) / *(float *)(param_1 + 0x350);
    if (fVar3 <= _DAT_004a5bf4) {
      fVar3 = -fVar3;
    }
    fVar4 = FUN_0042790c(param_1 + 0x6bc,fVar3 * param_2 * *(float *)(param_1 + 0x5a8),param_3);
    local_8 = (float)fVar4;
    break;
  case 0x16:
  case 0x17:
  case 0x18:
  case 0x19:
  case 0x1a:
  case 0x1b:
    FUN_00408440((undefined4 *)(param_1 + 0x598),&DAT_004e0f74);
    *(undefined4 *)(param_1 + 0x5a4) = 0;
    *(undefined4 *)(param_1 + 0x658) = 0;
    *(undefined4 *)(param_1 + 0x650) = 0;
    FUN_0041bbd8(param_1 + 0x714,0);
    FUN_004283b8(param_1 + 0x6bc,param_3);
    break;
  default:
    FUN_004dbb24(&DAT_00524e20,s_StandingAnimation_0050cfe8 + *(int *)(param_1 + 0x728) * 0x3c,
                 (char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    FUN_0040385c(s_Unsupported_mech_animation__0050d833,s_d__tesla_bt_bt_MECH2_CPP_0050d850,0x206);
  }
  return (float10)local_8;
}



/* ---- @ 004a5bf8 ---- */

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

float10 __cdecl FUN_004a5bf8(int param_1,float param_2,int param_3)

{
  undefined4 uVar1;
  int iVar2;
  float fVar3;
  float10 fVar4;
  float local_c;
  float local_8;
  
  iVar2 = *(int *)(param_1 + 0x728);
  if (((iVar2 - 6U < 2) || (iVar2 - 0xcU < 2)) || (iVar2 - 0x12U < 2)) {
    if (*(int *)(param_1 + 0x40) == 3) {
      if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x53c)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b4);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x53c);
      }
      *(undefined4 *)(param_1 + 0x6b4) = uVar1;
    }
    else {
      if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x540)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b4);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x540);
      }
      *(undefined4 *)(param_1 + 0x6b4) = uVar1;
    }
    fVar3 = _DAT_004a6340;
    if (_DAT_004a6340 <= *(float *)(param_1 + 0x6b4)) {
      fVar3 = *(float *)(param_1 + 0x6b4);
    }
    *(float *)(param_1 + 0x6b4) = fVar3;
  }
  switch(*(undefined4 *)(param_1 + 0x728)) {
  case 0:
    if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x530)) {
      local_8 = 0.0;
      break;
    }
    FUN_004a800c(param_1,5);
  case 2:
  case 3:
  case 4:
  case 5:
  case 8:
  case 9:
  case 10:
  case 0xb:
  case 0xe:
  case 0xf:
  case 0x10:
  case 0x11:
  case 0x14:
  case 0x15:
  case 0x16:
  case 0x17:
  case 0x1a:
  case 0x1b:
  case 0x20:
    fVar4 = FUN_0042790c(param_1 + 0x6bc,
                         param_2 * *(float *)(param_1 + 0x5a8) * *(float *)(param_1 + 0x5ac),param_3
                        );
    local_8 = (float)fVar4;
    *(float *)(param_1 + 0x6b8) = local_8 / param_2;
    break;
  case 1:
    local_8 = 0.0;
    break;
  case 6:
  case 7:
    if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
      if (*(float *)(param_1 + 0x6b4) < *(float *)(param_1 + 0x6b8)) {
        *(float *)(param_1 + 0x6b8) =
             *(float *)(param_1 + 0x6b8) - *(float *)(param_1 + 0x344) * param_2;
        if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x6b4);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
        if (*(float *)(param_1 + 0x530) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x530);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x6b8) =
           *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x6b8);
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x6b4)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x6b4);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x534)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x534);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
    }
    fVar4 = FUN_0042790c(param_1 + 0x6bc,
                         param_2 * (*(float *)(param_1 + 0x6b8) / *(float *)(param_1 + 0x534)) *
                         *(float *)(param_1 + 0x5a8),param_3);
    local_8 = (float)fVar4;
    break;
  case 0xc:
  case 0xd:
    if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
      if (*(float *)(param_1 + 0x6b4) < *(float *)(param_1 + 0x6b8)) {
        *(float *)(param_1 + 0x6b8) =
             *(float *)(param_1 + 0x6b8) - *(float *)(param_1 + 0x344) * param_2;
        if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x6b4);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
        if (*(float *)(param_1 + 0x538) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x538);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x6b8) =
           *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x6b8);
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x6b4)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x6b4);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x7a0)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x7a0);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
    }
    fVar4 = FUN_0042790c(param_1 + 0x6bc,
                         param_2 * (*(float *)(param_1 + 0x6b8) / *(float *)(param_1 + 0x34c)) *
                         *(float *)(param_1 + 0x5a8),param_3);
    local_8 = (float)fVar4;
    break;
  case 0x12:
  case 0x13:
    if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
      if (*(float *)(param_1 + 0x6b4) < *(float *)(param_1 + 0x6b8)) {
        *(float *)(param_1 + 0x6b8) =
             *(float *)(param_1 + 0x6b8) - *(float *)(param_1 + 0x5b0) * param_2;
        if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x6b4);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
        if (*(float *)(param_1 + 0x350) <= *(float *)(param_1 + 0x6b8)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x350);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x6b8) =
           *(float *)(param_1 + 0x5b0) * param_2 + *(float *)(param_1 + 0x6b8);
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x6b4)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x6b4);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x52c)) {
        uVar1 = *(undefined4 *)(param_1 + 0x6b8);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x52c);
      }
      *(undefined4 *)(param_1 + 0x6b8) = uVar1;
    }
    fVar3 = *(float *)(param_1 + 0x6b8) / *(float *)(param_1 + 0x350);
    if (fVar3 <= _DAT_004a6340) {
      fVar3 = -fVar3;
    }
    fVar4 = FUN_0042790c(param_1 + 0x6bc,fVar3 * param_2 * *(float *)(param_1 + 0x5a8),param_3);
    local_8 = (float)fVar4;
    break;
  case 0x18:
  case 0x19:
    if (*(int *)(param_1 + 0x40) == 3) {
      if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
        if (*(float *)(param_1 + 0x6b4) < *(float *)(param_1 + 0x6b8)) {
          *(float *)(param_1 + 0x6b8) =
               *(float *)(param_1 + 0x6b8) - *(float *)(param_1 + 0x344) * param_2;
          if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
            uVar1 = *(undefined4 *)(param_1 + 0x6b8);
          }
          else {
            uVar1 = *(undefined4 *)(param_1 + 0x6b4);
          }
          *(undefined4 *)(param_1 + 0x6b8) = uVar1;
          if (*(float *)(param_1 + 0x53c) <= *(float *)(param_1 + 0x6b8)) {
            uVar1 = *(undefined4 *)(param_1 + 0x6b8);
          }
          else {
            uVar1 = *(undefined4 *)(param_1 + 0x53c);
          }
          *(undefined4 *)(param_1 + 0x6b8) = uVar1;
        }
      }
      else {
        *(float *)(param_1 + 0x6b8) =
             *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x6b8);
        if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x6b4)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x6b4);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
        if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x544)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x544);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      }
      local_c = *(float *)(param_1 + 0x6b8) / *(float *)(param_1 + 0x544);
    }
    else {
      if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
        if (*(float *)(param_1 + 0x6b4) < *(float *)(param_1 + 0x6b8)) {
          *(float *)(param_1 + 0x6b8) =
               *(float *)(param_1 + 0x6b8) - *(float *)(param_1 + 0x344) * param_2;
          if (*(float *)(param_1 + 0x6b4) <= *(float *)(param_1 + 0x6b8)) {
            uVar1 = *(undefined4 *)(param_1 + 0x6b8);
          }
          else {
            uVar1 = *(undefined4 *)(param_1 + 0x6b4);
          }
          *(undefined4 *)(param_1 + 0x6b8) = uVar1;
          if (*(float *)(param_1 + 0x540) <= *(float *)(param_1 + 0x6b8)) {
            uVar1 = *(undefined4 *)(param_1 + 0x6b8);
          }
          else {
            uVar1 = *(undefined4 *)(param_1 + 0x540);
          }
          *(undefined4 *)(param_1 + 0x6b8) = uVar1;
        }
      }
      else {
        *(float *)(param_1 + 0x6b8) =
             *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x6b8);
        if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x6b4)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x6b4);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
        if (*(float *)(param_1 + 0x6b8) <= *(float *)(param_1 + 0x548)) {
          uVar1 = *(undefined4 *)(param_1 + 0x6b8);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x548);
        }
        *(undefined4 *)(param_1 + 0x6b8) = uVar1;
      }
      local_c = *(float *)(param_1 + 0x6b8) / *(float *)(param_1 + 0x548);
    }
    fVar4 = FUN_0042790c(param_1 + 0x6bc,param_2 * local_c * *(float *)(param_1 + 0x5a8),param_3);
    local_8 = (float)fVar4;
    break;
  default:
    FUN_004dbb24(&DAT_00524e20,s_StandingAnimation_0050cfe8 + *(int *)(param_1 + 0x728) * 0x3c,
                 (char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    FUN_0040385c(s_Unsupported_mech_animation__0050d869,s_d__tesla_bt_bt_MECH2_CPP_0050d886,0x2e8);
  }
  return (float10)local_8;
}



/* ---- @ 004a71f4 ---- */

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

float10 __cdecl FUN_004a71f4(int param_1,float param_2)

{
  undefined4 uVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  float fVar5;
  float10 fVar6;
  float local_c;
  float local_8;
  
  iVar2 = *(int *)(param_1 + 0x40);
  iVar3 = **(int **)(param_1 + 0x128);
  iVar4 = *(int *)(param_1 + 0x3b0);
  if (((iVar4 - 6U < 2) || (iVar4 - 0xcU < 2)) || (iVar4 - 0x12U < 2)) {
    if (iVar2 == 3) {
      if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x53c)) {
        uVar1 = *(undefined4 *)(iVar3 + 0x128);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x53c);
      }
      *(undefined4 *)(iVar3 + 0x128) = uVar1;
    }
    else {
      if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x540)) {
        uVar1 = *(undefined4 *)(iVar3 + 0x128);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x540);
      }
      *(undefined4 *)(iVar3 + 0x128) = uVar1;
    }
    fVar5 = _DAT_004a796c;
    if (_DAT_004a796c <= *(float *)(iVar3 + 0x128)) {
      fVar5 = *(float *)(iVar3 + 0x128);
    }
    *(float *)(iVar3 + 0x128) = fVar5;
  }
  switch(*(undefined4 *)(param_1 + 0x3b0)) {
  case 0:
    if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x530)) {
      local_8 = 0.0;
      break;
    }
    FUN_004a7fc4(param_1,5);
  case 2:
  case 3:
  case 5:
  case 8:
  case 9:
  case 10:
  case 0xb:
  case 0xe:
  case 0xf:
  case 0x10:
  case 0x11:
  case 0x14:
  case 0x15:
  case 0x16:
  case 0x17:
  case 0x1a:
  case 0x1b:
  case 0x20:
switchD_004a72b4_caseD_2:
    fVar6 = FUN_0042790c(param_1 + 0x65c,
                         param_2 * *(float *)(param_1 + 0x5a8) * *(float *)(param_1 + 0x5ac),1);
    local_8 = (float)fVar6;
    *(float *)(param_1 + 0x348) = local_8 / param_2;
    break;
  case 1:
    local_8 = 0.0;
    break;
  case 4:
    if (*(float *)(param_1 + 0x530) < *(float *)(iVar3 + 0x128)) {
      FUN_0041bbd8(param_1 + 0x39c,0);
      FUN_004a4c54(param_1,8);
      break;
    }
    goto switchD_004a72b4_caseD_2;
  case 6:
  case 7:
    if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x348)) {
      if (*(float *)(iVar3 + 0x128) < *(float *)(param_1 + 0x348)) {
        *(float *)(param_1 + 0x348) =
             *(float *)(param_1 + 0x348) - *(float *)(param_1 + 0x344) * param_2;
        if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(iVar3 + 0x128);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
        if (*(float *)(param_1 + 0x530) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x530);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x348) =
           *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x348);
      if (*(float *)(param_1 + 0x348) <= *(float *)(iVar3 + 0x128)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(iVar3 + 0x128);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
      if (*(float *)(param_1 + 0x348) <= *(float *)(param_1 + 0x534)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x534);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
    }
    fVar6 = FUN_0042790c(param_1 + 0x65c,
                         param_2 * (*(float *)(param_1 + 0x348) / *(float *)(param_1 + 0x534)) *
                         *(float *)(param_1 + 0x5a8),1);
    local_8 = (float)fVar6;
    break;
  case 0xc:
  case 0xd:
    if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x348)) {
      if (*(float *)(iVar3 + 0x128) < *(float *)(param_1 + 0x348)) {
        *(float *)(param_1 + 0x348) =
             *(float *)(param_1 + 0x348) - *(float *)(param_1 + 0x344) * param_2;
        if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(iVar3 + 0x128);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
        if (*(float *)(param_1 + 0x538) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x538);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x348) =
           *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x348);
      if (*(float *)(param_1 + 0x348) <= *(float *)(iVar3 + 0x128)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(iVar3 + 0x128);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
      if (*(float *)(param_1 + 0x348) <= *(float *)(param_1 + 0x7a0)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x7a0);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
    }
    fVar6 = FUN_0042790c(param_1 + 0x65c,
                         param_2 * (*(float *)(param_1 + 0x348) / *(float *)(param_1 + 0x34c)) *
                         *(float *)(param_1 + 0x5a8),1);
    local_8 = (float)fVar6;
    break;
  case 0x12:
  case 0x13:
    if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x348)) {
      if (*(float *)(iVar3 + 0x128) < *(float *)(param_1 + 0x348)) {
        *(float *)(param_1 + 0x348) =
             *(float *)(param_1 + 0x348) - *(float *)(param_1 + 0x5b0) * param_2;
        if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(iVar3 + 0x128);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
        if (*(float *)(param_1 + 0x350) <= *(float *)(param_1 + 0x348)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x350);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
      }
    }
    else {
      *(float *)(param_1 + 0x348) =
           *(float *)(param_1 + 0x5b0) * param_2 + *(float *)(param_1 + 0x348);
      if (*(float *)(param_1 + 0x348) <= *(float *)(iVar3 + 0x128)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(iVar3 + 0x128);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
      if (*(float *)(param_1 + 0x348) <= *(float *)(param_1 + 0x52c)) {
        uVar1 = *(undefined4 *)(param_1 + 0x348);
      }
      else {
        uVar1 = *(undefined4 *)(param_1 + 0x52c);
      }
      *(undefined4 *)(param_1 + 0x348) = uVar1;
    }
    fVar5 = *(float *)(param_1 + 0x348) / *(float *)(param_1 + 0x350);
    if (fVar5 <= _DAT_004a796c) {
      fVar5 = -fVar5;
    }
    fVar6 = FUN_0042790c(param_1 + 0x65c,fVar5 * param_2 * *(float *)(param_1 + 0x5a8),1);
    local_8 = (float)fVar6;
    break;
  case 0x18:
  case 0x19:
    if (iVar2 == 3) {
      if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x348)) {
        if (*(float *)(iVar3 + 0x128) < *(float *)(param_1 + 0x348)) {
          *(float *)(param_1 + 0x348) =
               *(float *)(param_1 + 0x348) - *(float *)(param_1 + 0x344) * param_2;
          if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x348)) {
            uVar1 = *(undefined4 *)(param_1 + 0x348);
          }
          else {
            uVar1 = *(undefined4 *)(iVar3 + 0x128);
          }
          *(undefined4 *)(param_1 + 0x348) = uVar1;
          if (*(float *)(param_1 + 0x53c) <= *(float *)(param_1 + 0x348)) {
            uVar1 = *(undefined4 *)(param_1 + 0x348);
          }
          else {
            uVar1 = *(undefined4 *)(param_1 + 0x53c);
          }
          *(undefined4 *)(param_1 + 0x348) = uVar1;
        }
      }
      else {
        *(float *)(param_1 + 0x348) =
             *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x348);
        if (*(float *)(param_1 + 0x348) <= *(float *)(iVar3 + 0x128)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(iVar3 + 0x128);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
        if (*(float *)(param_1 + 0x348) <= *(float *)(param_1 + 0x544)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x544);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
      }
      local_c = *(float *)(param_1 + 0x348) / *(float *)(param_1 + 0x544);
    }
    else {
      if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x348)) {
        if (*(float *)(iVar3 + 0x128) < *(float *)(param_1 + 0x348)) {
          *(float *)(param_1 + 0x348) =
               *(float *)(param_1 + 0x348) - *(float *)(param_1 + 0x344) * param_2;
          if (*(float *)(iVar3 + 0x128) <= *(float *)(param_1 + 0x348)) {
            uVar1 = *(undefined4 *)(param_1 + 0x348);
          }
          else {
            uVar1 = *(undefined4 *)(iVar3 + 0x128);
          }
          *(undefined4 *)(param_1 + 0x348) = uVar1;
          if (*(float *)(param_1 + 0x540) <= *(float *)(param_1 + 0x348)) {
            uVar1 = *(undefined4 *)(param_1 + 0x348);
          }
          else {
            uVar1 = *(undefined4 *)(param_1 + 0x540);
          }
          *(undefined4 *)(param_1 + 0x348) = uVar1;
        }
      }
      else {
        *(float *)(param_1 + 0x348) =
             *(float *)(param_1 + 0x344) * param_2 + *(float *)(param_1 + 0x348);
        if (*(float *)(param_1 + 0x348) <= *(float *)(iVar3 + 0x128)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(iVar3 + 0x128);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
        if (*(float *)(param_1 + 0x348) <= *(float *)(param_1 + 0x548)) {
          uVar1 = *(undefined4 *)(param_1 + 0x348);
        }
        else {
          uVar1 = *(undefined4 *)(param_1 + 0x548);
        }
        *(undefined4 *)(param_1 + 0x348) = uVar1;
      }
      local_c = *(float *)(param_1 + 0x348) / *(float *)(param_1 + 0x548);
    }
    fVar6 = FUN_0042790c(param_1 + 0x65c,param_2 * local_c * *(float *)(param_1 + 0x5a8),1);
    local_8 = (float)fVar6;
    break;
  default:
    FUN_004dbb24(&DAT_00524e20,s_StandingAnimation_0050cfe8 + *(int *)(param_1 + 0x3b0) * 0x3c,
                 (char *)0x0);
    FUN_004d9c38(&DAT_00524e20);
    FUN_0040385c(s_Unsupported_mech_animation__0050d89f,s_d__tesla_bt_bt_MECH2_CPP_0050d8bc,0x672);
  }
  return (float10)local_8;
}



