void setspeed() {
  extern int level;
  extern double enemy_row_delay, enemy_col_delay;
  extern double player_row_delay, player_col_delay;
  extern double row_to_col_delay_ratio, enemy_to_player_delay_ratio;
  const double PCD_K = 0.5, PCD_M = 1.5;
  const double ETPD_K = 0.125, ETPD_M = 1.125;
  player_col_delay = (9 + 1 - level) * PCD_K + PCD_M;
  enemy_to_player_delay_ratio = (9 + 1 - level) * ETPD_K + ETPD_M;
  player_row_delay = player_col_delay * row_to_col_delay_ratio;
  enemy_col_delay = player_col_delay * enemy_to_player_delay_ratio;
  enemy_row_delay = enemy_col_delay * row_to_col_delay_ratio;
}


x86 assembly (clang, -O0):
<setspeed>:
push   %rbp
mov    %rsp,%rbp
movsd  0xf04(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xeff(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeda(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xed5(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0xa,%eax
mov    0x2e9c(%rip),%rcx
sub    (%rcx),%eax
cvtsi2sd %eax,%xmm0
movsd  0xebe(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeba(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    0x2e87(%rip),%rax
movsd  %xmm0,(%rax)
mov    $0xa,%eax
mov    0x2e67(%rip),%rcx
sub    (%rcx),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe79(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe75(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    0x2e2a(%rip),%rax
movsd  %xmm0,(%rax)
mov    0x2e47(%rip),%rax
movsd  (%rax),%xmm0
mov    0x2e0c(%rip),%rax
mulsd  (%rax),%xmm0
mov    0x2df1(%rip),%rax
movsd  %xmm0,(%rax)
mov    0x2e26(%rip),%rax
movsd  (%rax),%xmm0
mov    0x2df3(%rip),%rax
mulsd  (%rax),%xmm0
mov    0x2df8(%rip),%rax
movsd  %xmm0,(%rax)
mov    0x2ded(%rip),%rax
movsd  (%rax),%xmm0
mov    0x2dca(%rip),%rax
mulsd  (%rax),%xmm0
mov    0x2dcf(%rip),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setspeed>:
mov    0x2ed9(%rip),%rax
mov    $0xa,%ecx
sub    (%rax),%ecx
cvtsi2sd %ecx,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xee2(%rip),%xmm1
mov    0x2ec3(%rip),%rax
mulsd  0xedb(%rip),%xmm0
movsd  %xmm1,(%rax)
addsd  0xed7(%rip),%xmm0
mov    0x2e80(%rip),%rax
movsd  %xmm0,(%rax)
mov    0x2e6d(%rip),%rax
movsd  (%rax),%xmm2
mulsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm1
mov    0x2e4a(%rip),%rax
movsd  %xmm1,(%rax)
mov    0x2e67(%rip),%rax
movsd  %xmm0,(%rax)
mulsd  %xmm2,%xmm0
mov    0x2e50(%rip),%rax
movsd  %xmm0,(%rax)
ret

LLVM IR (-O0):
@level = external global i32
@player_col_delay = external global double
@enemy_to_player_delay_ratio = external global double
@row_to_col_delay_ratio = external global double
@player_row_delay = external global double
@enemy_col_delay = external global double
@enemy_row_delay = external global double
define void @setspeed() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double 5.000000e-01, double* %1
store double 1.500000e+00, double* %2
store double 1.250000e-01, double* %3
store double 1.125000e+00, double* %4
%5 = load i32, i32* @level
%6 = sub nsw i32 10, %5
%7 = sitofp i32 %6 to double
%8 = call double @llvm.fmuladd.f64(double %7, double 5.000000e-01, double 1.500000e+00)
store double %8, double* @player_col_delay
%9 = load i32, i32* @level
%10 = sub nsw i32 10, %9
%11 = sitofp i32 %10 to double
%12 = call double @llvm.fmuladd.f64(double %11, double 1.250000e-01, double 1.125000e+00)
store double %12, double* @enemy_to_player_delay_ratio
%13 = load double, double* @player_col_delay
%14 = load double, double* @row_to_col_delay_ratio
%15 = fmul double %13, %14
store double %15, double* @player_row_delay
%16 = load double, double* @player_col_delay
%17 = load double, double* @enemy_to_player_delay_ratio
%18 = fmul double %16, %17
store double %18, double* @enemy_col_delay
%19 = load double, double* @enemy_col_delay
%20 = load double, double* @row_to_col_delay_ratio
%21 = fmul double %19, %20
store double %21, double* @enemy_row_delay
ret void
}

LLVM IR (-O2):
@level = external global i32
@player_col_delay = external global double
@enemy_to_player_delay_ratio = external global double
@row_to_col_delay_ratio = external global double
@player_row_delay = external global double
@enemy_col_delay = external global double
@enemy_row_delay = external global double
define void @setspeed() {
%1 = load i32, i32* @level
%2 = sub nsw i32 10, %1
%3 = sitofp i32 %2 to double
%4 = tail call double @llvm.fmuladd.f64(double %3, double 5.000000e-01, double 1.500000e+00)
store double %4, double* @player_col_delay
%5 = tail call double @llvm.fmuladd.f64(double %3, double 1.250000e-01, double 1.125000e+00)
store double %5, double* @enemy_to_player_delay_ratio
%6 = load double, double* @row_to_col_delay_ratio
%7 = fmul double %4, %6
store double %7, double* @player_row_delay
%8 = fmul double %4, %5
store double %8, double* @enemy_col_delay
%9 = fmul double %6, %8
store double %9, double* @enemy_row_delay
ret void
}