float tax(int salary) {
  float tax = 0.0f;
  if (salary > 7000.00f) {
    tax = 230.00f + (salary - 7000.00f) * .06;
  } else if (salary > 5250.00f) {
    tax = 142.50f + (salary - 5250.00f) * .05;
  } else if (salary > 3750.00f) {
    tax = 82.50f + (salary - 3750.00f) * .04;
  } else if (salary > 2250.00f) {
    tax = 37.50f + (salary - 2250.0f) * .03;
  } else if (salary > 750) {
    tax = 7.50f + (salary - 750.00f) * .02;
  } else {
    tax = salary * .01;
  }
  return tax;
}


x86 assembly (clang, -O0):
<tax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xee4(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1160 <tax+0x60>
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xece(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xf1e(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xf1a(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12c9 <tax+0x1c9>
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xe97(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11b1 <tax+0xb1>
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xe81(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xebd(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb9(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12c4 <tax+0x1c4>
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xe4a(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1202 <tax+0x102>
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xe34(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe5c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe58(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12bf <tax+0x1bf>
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xdfd(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1253 <tax+0x153>
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xde7(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdfb(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdf7(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12ba <tax+0x1ba>
cmpl   $0x2ee,-0x4(%rbp)
jle    129b <tax+0x19b>
cvtsi2ssl -0x4(%rbp),%xmm0
movss  0xda3(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd9f(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12b5 <tax+0x1b5>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xd70(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12ba <tax+0x1ba>
jmp    12bf <tax+0x1bf>
jmp    12c4 <tax+0x1c4>
jmp    12c9 <tax+0x1c9>
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tax>:
cvtsi2ss %edi,%xmm0
cmp    $0x1b59,%edi
jl     112d <tax+0x2d>
addss  0xf54(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xf28(%rip),%xmm0
addsd  0xf28(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
cmp    $0x1483,%edi
jl     1156 <tax+0x56>
addss  0xf27(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xeef(%rip),%xmm0
addsd  0xeef(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
cmp    $0xea7,%edi
jl     117f <tax+0x7f>
addss  0xefa(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xeb6(%rip),%xmm0
addsd  0xeb6(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
cmp    $0x8cb,%edi
jl     11a8 <tax+0xa8>
addss  0xecd(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe7d(%rip),%xmm0
addsd  0xe7d(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
cmp    $0x2ef,%edi
jl     11d1 <tax+0xd1>
addss  0xea0(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe44(%rip),%xmm0
addsd  0xe44(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
mulsd  0xe20(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @tax(i32 %0) {
%2 = alloca i32
%3 = alloca float
store i32 %0, i32* %2
store float 0.000000e+00, float* %3
%4 = load i32, i32* %2
%5 = sitofp i32 %4 to float
%6 = fcmp ogt float %5, 7.000000e+03
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sitofp i32 %8 to float
%10 = fsub float %9, 7.000000e+03
%11 = fpext float %10 to double
%12 = call double @llvm.fmuladd.f64(double %11, double 6.000000e-02, double 2.300000e+02)
%13 = fptrunc double %12 to float
store float %13, float* %3
br label %66
14: ; preds = %1
%15 = load i32, i32* %2
%16 = sitofp i32 %15 to float
%17 = fcmp ogt float %16, 5.250000e+03
br i1 %17, label %18, label %25
18: ; preds = %14
%19 = load i32, i32* %2
%20 = sitofp i32 %19 to float
%21 = fsub float %20, 5.250000e+03
%22 = fpext float %21 to double
%23 = call double @llvm.fmuladd.f64(double %22, double 5.000000e-02, double 1.425000e+02)
%24 = fptrunc double %23 to float
store float %24, float* %3
br label %65
25: ; preds = %14
%26 = load i32, i32* %2
%27 = sitofp i32 %26 to float
%28 = fcmp ogt float %27, 3.750000e+03
br i1 %28, label %29, label %36
29: ; preds = %25
%30 = load i32, i32* %2
%31 = sitofp i32 %30 to float
%32 = fsub float %31, 3.750000e+03
%33 = fpext float %32 to double
%34 = call double @llvm.fmuladd.f64(double %33, double 4.000000e-02, double 8.250000e+01)
%35 = fptrunc double %34 to float
store float %35, float* %3
br label %64
36: ; preds = %25
%37 = load i32, i32* %2
%38 = sitofp i32 %37 to float
%39 = fcmp ogt float %38, 2.250000e+03
br i1 %39, label %40, label %47
40: ; preds = %36
%41 = load i32, i32* %2
%42 = sitofp i32 %41 to float
%43 = fsub float %42, 2.250000e+03
%44 = fpext float %43 to double
%45 = call double @llvm.fmuladd.f64(double %44, double 3.000000e-02, double 3.750000e+01)
%46 = fptrunc double %45 to float
store float %46, float* %3
br label %63
47: ; preds = %36
%48 = load i32, i32* %2
%49 = icmp sgt i32 %48, 750
br i1 %49, label %50, label %57
50: ; preds = %47
%51 = load i32, i32* %2
%52 = sitofp i32 %51 to float
%53 = fsub float %52, 7.500000e+02
%54 = fpext float %53 to double
%55 = call double @llvm.fmuladd.f64(double %54, double 2.000000e-02, double 7.500000e+00)
%56 = fptrunc double %55 to float
store float %56, float* %3
br label %62
57: ; preds = %47
%58 = load i32, i32* %2
%59 = sitofp i32 %58 to double
%60 = fmul double %59, 1.000000e-02
%61 = fptrunc double %60 to float
store float %61, float* %3
br label %62
62: ; preds = %57, %50
br label %63
63: ; preds = %62, %40
br label %64
64: ; preds = %63, %29
br label %65
65: ; preds = %64, %18
br label %66
66: ; preds = %65, %7
%67 = load float, float* %3
ret float %67
}

LLVM IR (-O2):
define float @tax(i32 %0) {
%2 = sitofp i32 %0 to float
%3 = icmp sgt i32 %0, 7000
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = fadd float %2, -7.000000e+03
%6 = fpext float %5 to double
%7 = tail call double @llvm.fmuladd.f64(double %6, double 6.000000e-02, double 2.300000e+02)
br label %35
8: ; preds = %1
%9 = icmp sgt i32 %0, 5250
br i1 %9, label %10, label %14
10: ; preds = %8
%11 = fadd float %2, -5.250000e+03
%12 = fpext float %11 to double
%13 = tail call double @llvm.fmuladd.f64(double %12, double 5.000000e-02, double 1.425000e+02)
br label %35
14: ; preds = %8
%15 = icmp sgt i32 %0, 3750
br i1 %15, label %16, label %20
16: ; preds = %14
%17 = fadd float %2, -3.750000e+03
%18 = fpext float %17 to double
%19 = tail call double @llvm.fmuladd.f64(double %18, double 4.000000e-02, double 8.250000e+01)
br label %35
20: ; preds = %14
%21 = icmp sgt i32 %0, 2250
br i1 %21, label %22, label %26
22: ; preds = %20
%23 = fadd float %2, -2.250000e+03
%24 = fpext float %23 to double
%25 = tail call double @llvm.fmuladd.f64(double %24, double 3.000000e-02, double 3.750000e+01)
br label %35
26: ; preds = %20
%27 = icmp sgt i32 %0, 750
br i1 %27, label %28, label %32
28: ; preds = %26
%29 = fadd float %2, -7.500000e+02
%30 = fpext float %29 to double
%31 = tail call double @llvm.fmuladd.f64(double %30, double 2.000000e-02, double 7.500000e+00)
br label %35
32: ; preds = %26
%33 = sitofp i32 %0 to double
%34 = fmul double %33, 1.000000e-02
br label %35
35: ; preds = %10, %22, %32, %28, %16, %4
%36 = phi double [ %7, %4 ], [ %13, %10 ], [ %19, %16 ], [ %25, %22 ], [ %31, %28 ], [ %34, %32 ]
%37 = fptrunc double %36 to float
ret float %37
}