#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 scanf(char *, ...);
int main(void) {
  int option;
  double basic, income, tax;
  printf("*****************************************************************\n");
  printf("Enter the number corresponding to the desired category or action:\n");
  printf("1) Single                           2) Head of Household\n");
  printf("3) Married, Joint                   4) Married, Separate\n");
  printf("5) Quit\n");
  printf("*****************************************************************\n");
  while (scanf("%d", &option) == 1) {
    switch (option) {
    case 1:
      basic = 17850;
      break;
    case 2:
      basic = 23900;
      break;
    case 3:
      basic = 29750;
      break;
    case 4:
      basic = 14875;
      break;
    }
    if (option > 4 || option < 1)
      break;
    printf("Please enter your taxable income:\n$");
    scanf("%lf", &income);
    if (income <= basic)
      tax = income * 0.15;
    else
      tax = basic * 0.15 + (income - basic) * 0.28;
    printf("Your tax is: $%.2f\n\n\n", tax);
    printf(
        "*****************************************************************\n");
    printf(
        "Enter the number corresponding to the desired category or action:\n");
    printf("1) Single                           2) Head of Household\n");
    printf("3) Married, Joint                   4) Married, Separate\n");
    printf("5) Quit\n");
    printf(
        "*****************************************************************\n");
  }
  printf("Thank you!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfa0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xfb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    130a <main+0x1ea>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x3,%eax
ja     120a <main+0xea>
mov    -0x28(%rbp),%rax
lea    0xe72(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xe49(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    120a <main+0xea>
movsd  0xe2f(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    120a <main+0xea>
movsd  0xe15(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    120a <main+0xea>
movsd  0xdfb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     121e <main+0xfe>
cmpl   $0x1,-0x8(%rbp)
jge    1223 <main+0x103>
jmp    130a <main+0x1ea>
lea    0xf1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf32(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     126e <main+0x14e>
movsd  0xdc1(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    129e <main+0x17e>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xda3(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xd8f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xec4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1183 <main+0x63>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xfd3(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf6b(%rip),%rdi
call   1030 <puts@plt>
lea    0xf98(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    12a0 <main+0x170>
lea    0xf70(%rip),%rbx
lea    0xeef(%rip),%r14
lea    0xf21(%rip),%r15
lea    0xf53(%rip),%r12
lea    0xe4c(%rip),%r13
lea    0x4(%rsp),%rbp
jmp    123c <main+0x10c>
nopl   0x0(%rax,%rax,1)
subsd  %xmm1,%xmm0
mulsd  0xe2c(%rip),%xmm0
mulsd  0xe1c(%rip),%xmm1
addsd  %xmm1,%xmm0
lea    0xe4c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe57(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    12a0 <main+0x170>
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x3,%eax
ja     12a0 <main+0x170>
cltq
lea    0xf0f(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xdb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdc6(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm0
ucomisd %xmm0,%xmm1
jb     11d0 <main+0xa0>
mulsd  0xd65(%rip),%xmm0
jmp    11e8 <main+0xb8>
lea    0xdaa(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [67 x i8] c"*****************************************************************\0A\00"
@.str.1 = [67 x i8] c"Enter the number corresponding to the desired category or action:\0A\00"
@.str.2 = [58 x i8] c"1) Single 2) Head of Household\0A\00"
@.str.3 = [58 x i8] c"3) Married, Joint 4) Married, Separate\0A\00"
@.str.4 = [9 x i8] c"5) Quit\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [36 x i8] c"Please enter your taxable income:\0A$\00"
@.str.7 = [4 x i8] c"%lf\00"
@.str.8 = [22 x i8] c"Your tax is: $%.2f\0A\0A\0A\00"
@.str.9 = [12 x i8] c"Thank you!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %44, %0
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %53
15: ; preds = %12
%16 = load i32, i32* %2
switch i32 %16, label %21 [
i32 1, label %17
i32 2, label %18
i32 3, label %19
i32 4, label %20
]
17: ; preds = %15
store double 1.785000e+04, double* %3
br label %21
18: ; preds = %15
store double 2.390000e+04, double* %3
br label %21
19: ; preds = %15
store double 2.975000e+04, double* %3
br label %21
20: ; preds = %15
store double 1.487500e+04, double* %3
br label %21
21: ; preds = %15, %20, %19, %18, %17
%22 = load i32, i32* %2
%23 = icmp sgt i32 %22, 4
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = load i32, i32* %2
%26 = icmp slt i32 %25, 1
br i1 %26, label %27, label %28
27: ; preds = %24, %21
br label %53
28: ; preds = %24
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %4)
%31 = load double, double* %4
%32 = load double, double* %3
%33 = fcmp ole double %31, %32
br i1 %33, label %34, label %37
34: ; preds = %28
%35 = load double, double* %4
%36 = fmul double %35, 1.500000e-01
store double %36, double* %5
br label %44
37: ; preds = %28
%38 = load double, double* %3
%39 = load double, double* %4
%40 = load double, double* %3
%41 = fsub double %39, %40
%42 = fmul double %41, 2.800000e-01
%43 = call double @llvm.fmuladd.f64(double %38, double 1.500000e-01, double %42)
store double %43, double* %5
br label %44
44: ; preds = %37, %34
%45 = load double, double* %5
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), double %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0))
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
br label %12
53: ; preds = %27, %12
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [36 x i8] c"Please enter your taxable income:\0A$\00"
@.str.7 = [4 x i8] c"%lf\00"
@.str.8 = [22 x i8] c"Your tax is: $%.2f\0A\0A\0A\00"
@str.15 = [11 x i8] c"Thank you!\00"
@str.17 = [66 x i8] c"Enter the number corresponding to the desired category or action:\00"
@str.18 = [57 x i8] c"1) Single 2) Head of Household\00"
@str.19 = [57 x i8] c"3) Married, Joint 4) Married, Separate\00"
@str.20 = [8 x i8] c"5) Quit\00"
@str.21 = [66 x i8] c"*****************************************************************\00"
@switch.table.main = [4 x double] [double 1.785000e+04, double 2.390000e+04, double 2.975000e+04, double 1.487500e+04]
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.21, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.17, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.18, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.19, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.20, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.21, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %42
13: ; preds = %0, %31
%14 = load i32, i32* %1
%15 = add i32 %14, -1
%16 = icmp ult i32 %15, 4
br i1 %16, label %17, label %42
17: ; preds = %13
%18 = sext i32 %15 to i64
%19 = getelementptr inbounds [4 x double], [4 x double]* @switch.table.main, i64 0, i64 %18
%20 = load double, double* %19
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %2)
%23 = load double, double* %2
%24 = fcmp ugt double %23, %20
br i1 %24, label %27, label %25
25: ; preds = %17
%26 = fmul double %23, 1.500000e-01
br label %31
27: ; preds = %17
%28 = fsub double %23, %20
%29 = fmul double %28, 2.800000e-01
%30 = call double @llvm.fmuladd.f64(double %20, double 1.500000e-01, double %29)
br label %31
31: ; preds = %27, %25
%32 = phi double [ %26, %25 ], [ %30, %27 ]
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i64 0, i64 0), double %32)
%34 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.21, i64 0, i64 0))
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.17, i64 0, i64 0))
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.18, i64 0, i64 0))
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.19, i64 0, i64 0))
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.20, i64 0, i64 0))
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.21, i64 0, i64 0))
%40 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %1)
%41 = icmp eq i32 %40, 1
br i1 %41, label %13, label %42
42: ; preds = %31, %13, %0
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.15, i64 0, i64 0))
ret i32 0
}