#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double salary, rate, tax;
  printf("Enter the salary: ");
  scanf("%lf", &salary);
  if (salary <= 850)
    rate = 0;
  else if (salary <= 1350)
    rate = 0.05;
  else if (salary <= 2850)
    rate = 0.10;
  else if (salary <= 5850)
    rate = 0.15;
  else
    rate = 0.20;
  tax = rate * (salary - 850);
  printf("tax=%.02f", tax);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0f(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xeab(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     116d <main+0x4d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11f8 <main+0xd8>
movsd  0xe93(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1192 <main+0x72>
movsd  0xeb0(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11f3 <main+0xd3>
movsd  0xe76(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11b7 <main+0x97>
movsd  0xe83(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11ee <main+0xce>
movsd  0xe59(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11dc <main+0xbc>
movsd  0xe56(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11e9 <main+0xc9>
movsd  0xe3c(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11ee <main+0xce>
jmp    11f3 <main+0xd3>
jmp    11f8 <main+0xd8>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xdf6(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xe34(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf20(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf25(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
xorpd  %xmm1,%xmm1
movsd  0xeb1(%rip),%xmm2
ucomisd %xmm0,%xmm2
jae    11a2 <main+0x82>
movsd  0xeb3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1190 <main+0x70>
movsd  0xeb5(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    119a <main+0x7a>
movsd  0xeaf(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
setb   %al
lea    0xeaf(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm1
jmp    11a2 <main+0x82>
movsd  0xe70(%rip),%xmm1
jmp    11a2 <main+0x82>
movsd  0xe76(%rip),%xmm1
addsd  0xe86(%rip),%xmm0
mulsd  %xmm1,%xmm0
lea    0xeaa(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter the salary: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [10 x i8] c"tax=%.02f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%7 = load double, double* %2
%8 = fcmp ole double %7, 8.500000e+02
br i1 %8, label %9, label %10
9: ; preds = %0
store double 0.000000e+00, double* %3
br label %26
10: ; preds = %0
%11 = load double, double* %2
%12 = fcmp ole double %11, 1.350000e+03
br i1 %12, label %13, label %14
13: ; preds = %10
store double 5.000000e-02, double* %3
br label %25
14: ; preds = %10
%15 = load double, double* %2
%16 = fcmp ole double %15, 2.850000e+03
br i1 %16, label %17, label %18
17: ; preds = %14
store double 1.000000e-01, double* %3
br label %24
18: ; preds = %14
%19 = load double, double* %2
%20 = fcmp ole double %19, 5.850000e+03
br i1 %20, label %21, label %22
21: ; preds = %18
store double 1.500000e-01, double* %3
br label %23
22: ; preds = %18
store double 2.000000e-01, double* %3
br label %23
23: ; preds = %22, %21
br label %24
24: ; preds = %23, %17
br label %25
25: ; preds = %24, %13
br label %26
26: ; preds = %25, %9
%27 = load double, double* %3
%28 = load double, double* %2
%29 = fsub double %28, 8.500000e+02
%30 = fmul double %27, %29
store double %30, double* %4
%31 = load double, double* %4
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %31)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter the salary: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [10 x i8] c"tax=%.02f\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = load double, double* %1
%6 = fcmp ugt double %5, 8.500000e+02
br i1 %6, label %7, label %14
7: ; preds = %0
%8 = fcmp ugt double %5, 1.350000e+03
br i1 %8, label %9, label %14
9: ; preds = %7
%10 = fcmp ugt double %5, 2.850000e+03
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = fcmp ugt double %5, 5.850000e+03
%13 = select i1 %12, double 2.000000e-01, double 1.500000e-01
br label %14
14: ; preds = %11, %9, %7, %0
%15 = phi double [ 0.000000e+00, %0 ], [ 5.000000e-02, %7 ], [ 1.000000e-01, %9 ], [ %13, %11 ]
%16 = fadd double %5, -8.500000e+02
%17 = fmul double %16, %15
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), double %17)
ret i32 0
}