float ChiHun_get_attackup(int level) {
  if (level >= 18)
    return (float)(1.17 + (float)level * 0.04);
  else if (level == 17)
    return (float)(1.86);
  else if (level >= 12)
    return (float)(1.18 + (float)level * 0.04);
  else if (level >= 1)
    return (float)(1.30 + (float)level * 0.03);
  return 1.00;
}


x86 assembly (clang, -O0):
<ChiHun_get_attackup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x12,-0x8(%rbp)
jl     1140 <ChiHun_get_attackup+0x40>
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xef6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xefa(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ea <ChiHun_get_attackup+0xea>
cmpl   $0x11,-0x8(%rbp)
jne    115c <ChiHun_get_attackup+0x5c>
movss  0xeb2(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ea <ChiHun_get_attackup+0xea>
cmpl   $0xc,-0x8(%rbp)
jl     1195 <ChiHun_get_attackup+0x95>
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ea <ChiHun_get_attackup+0xea>
cmpl   $0x1,-0x8(%rbp)
jl     11ce <ChiHun_get_attackup+0xce>
cvtsi2ssl -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe58(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe54(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ea <ChiHun_get_attackup+0xea>
jmp    11d3 <ChiHun_get_attackup+0xd3>
jmp    11d8 <ChiHun_get_attackup+0xd8>
jmp    11dd <ChiHun_get_attackup+0xdd>
movss  0xe1b(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ChiHun_get_attackup>:
cmp    $0x12,%edi
jl     1122 <ChiHun_get_attackup+0x22>
cvtsi2ss %edi,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xf03(%rip),%xmm0
addsd  0xf0b(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
cmp    $0x11,%edi
jne    1130 <ChiHun_get_attackup+0x30>
movss  0xed1(%rip),%xmm0
ret
cmp    $0xc,%edi
jl     1152 <ChiHun_get_attackup+0x52>
cvtsi2ss %edi,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xed3(%rip),%xmm0
addsd  0xed3(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
test   %edi,%edi
jle    1173 <ChiHun_get_attackup+0x73>
cvtsi2ss %edi,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xea2(%rip),%xmm0
addsd  0xea2(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
movss  0xe89(%rip),%xmm0
ret

LLVM IR (-O0):
define float @ChiHun_get_attackup(i32 %0) {
%2 = alloca float
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 18
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = sitofp i32 %7 to float
%9 = fpext float %8 to double
%10 = call double @llvm.fmuladd.f64(double %9, double 4.000000e-02, double 1.170000e+00)
%11 = fptrunc double %10 to float
store float %11, float* %2
br label %38
12: ; preds = %1
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 17
br i1 %14, label %15, label %16
15: ; preds = %12
store float 0x3FFDC28F60000000, float* %2
br label %38
16: ; preds = %12
%17 = load i32, i32* %3
%18 = icmp sge i32 %17, 12
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to float
%22 = fpext float %21 to double
%23 = call double @llvm.fmuladd.f64(double %22, double 4.000000e-02, double 1.180000e+00)
%24 = fptrunc double %23 to float
store float %24, float* %2
br label %38
25: ; preds = %16
%26 = load i32, i32* %3
%27 = icmp sge i32 %26, 1
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %3
%30 = sitofp i32 %29 to float
%31 = fpext float %30 to double
%32 = call double @llvm.fmuladd.f64(double %31, double 3.000000e-02, double 1.300000e+00)
%33 = fptrunc double %32 to float
store float %33, float* %2
br label %38
34: ; preds = %25
br label %35
35: ; preds = %34
br label %36
36: ; preds = %35
br label %37
37: ; preds = %36
store float 1.000000e+00, float* %2
br label %38
38: ; preds = %37, %28, %19, %15, %6
%39 = load float, float* %2
ret float %39
}

LLVM IR (-O2):
define float @ChiHun_get_attackup(i32 %0) {
%2 = icmp sgt i32 %0, 17
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = sitofp i32 %0 to float
%5 = fpext float %4 to double
%6 = tail call double @llvm.fmuladd.f64(double %5, double 4.000000e-02, double 1.170000e+00)
%7 = fptrunc double %6 to float
br label %24
8: ; preds = %1
%9 = icmp eq i32 %0, 17
br i1 %9, label %24, label %10
10: ; preds = %8
%11 = icmp sgt i32 %0, 11
br i1 %11, label %12, label %17
12: ; preds = %10
%13 = sitofp i32 %0 to float
%14 = fpext float %13 to double
%15 = tail call double @llvm.fmuladd.f64(double %14, double 4.000000e-02, double 1.180000e+00)
%16 = fptrunc double %15 to float
br label %24
17: ; preds = %10
%18 = icmp sgt i32 %0, 0
br i1 %18, label %19, label %24
19: ; preds = %17
%20 = sitofp i32 %0 to float
%21 = fpext float %20 to double
%22 = tail call double @llvm.fmuladd.f64(double %21, double 3.000000e-02, double 1.300000e+00)
%23 = fptrunc double %22 to float
br label %24
24: ; preds = %17, %8, %19, %12, %3
%25 = phi float [ %7, %3 ], [ %16, %12 ], [ %23, %19 ], [ 0x3FFDC28F60000000, %8 ], [ 1.000000e+00, %17 ]
ret float %25
}