#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 *, ...);
scalar_t__ scanf(char *, ...);
int main(void) {
  float income, tax;
  int mode, basic;
  printf("*************************************************************\n");
  printf("Enter the number corresponding to the desired type or action:\n");
  printf("1) Single\t\t2) Householder\n");
  printf("3) Married, shared\t4) Married, divorced\n");
  printf("5) quit\n");
  printf("*************************************************************\n");
  while (scanf("%d", &mode) && mode != 5) {
    switch (mode) {
    case 1:
      basic = 17850;
      break;
    case 2:
      basic = 23900;
      break;
    case 3:
      basic = 29750;
      break;
    case 4:
      basic = 14875;
      break;
    default:
      printf("No such option! Please enter an integer number within the range "
             "1 ~ 5.\n");
      continue;
    }
    printf("Now enter the taxable income\n");
    scanf("%f", &income);
    tax = 0.15 * (income > basic ? basic : income) +
          0.28 * (income > basic ? income - basic : 0);
    printf("Tax: %.2f\n", tax);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf61(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x15(%rbp)
je     11b1 <main+0x91>
cmpl   $0x5,-0x10(%rbp)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    11c1 <main+0xa1>
jmp    130e <main+0x1ee>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     121a <main+0xfa>
mov    -0x20(%rbp),%rax
lea    0xe2f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x45ba,-0x14(%rbp)
jmp    122d <main+0x10d>
movl   $0x5d5c,-0x14(%rbp)
jmp    122d <main+0x10d>
movl   $0x7436,-0x14(%rbp)
jmp    122d <main+0x10d>
movl   $0x3a1b,-0x14(%rbp)
jmp    122d <main+0x10d>
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1183 <main+0x63>
lea    0xf02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    126f <main+0x14f>
cvtsi2ssl -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    1279 <main+0x159>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    12b2 <main+0x192>
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    12bf <main+0x19f>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
jmp    12bf <main+0x19f>
movsd  -0x30(%rbp),%xmm0
movss  -0x34(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  0xd33(%rip),%xmm1
mulsd  %xmm2,%xmm1
movsd  0xd1f(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe55(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1183 <main+0x63>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xf64(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf29(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
test   %rax,%rax
je     1297 <main+0x167>
mov    0x8(%rsp),%eax
cmp    $0x5,%eax
je     1297 <main+0x167>
lea    0xe5e(%rip),%r15
lea    0xc(%rsp),%r12
lea    0xe55(%rip),%r13
lea    0xe48(%rip),%rbx
lea    0x8(%rsp),%rbp
lea    0xf30(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%eax
cmp    $0x4,%eax
jae    1270 <main+0x140>
cltq
lea    0xf57(%rip),%rcx
movss  (%rcx,%rax,4),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
movaps 0x10(%rsp),%xmm3
movaps %xmm3,%xmm1
minss  %xmm0,%xmm1
cvtss2sd %xmm1,%xmm1
movaps %xmm0,%xmm2
subss  %xmm3,%xmm2
cmpltss %xmm0,%xmm3
andps  %xmm2,%xmm3
xorps  %xmm0,%xmm0
cvtss2sd %xmm3,%xmm0
mulsd  0xdb4(%rip),%xmm0
mulsd  0xdb4(%rip),%xmm1
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
jmp    1278 <main+0x148>
nop
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
test   %rax,%rax
je     1297 <main+0x167>
mov    0x8(%rsp),%eax
cmp    $0x5,%eax
jne    11e0 <main+0xb0>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [63 x i8] c"*************************************************************\0A\00"
@.str.1 = [63 x i8] c"Enter the number corresponding to the desired type or action:\0A\00"
@.str.2 = [27 x i8] c"1) Single\09\092) Householder\0A\00"
@.str.3 = [41 x i8] c"3) Married, shared\094) Married, divorced\0A\00"
@.str.4 = [9 x i8] c"5) quit\0A\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [72 x i8] c"No such option! Please enter an integer number within the range 1 ~ 5.\0A\00"
@.str.7 = [30 x i8] c"Now enter the taxable income\0A\00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [11 x i8] c"Tax: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 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 ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %53, %26, %0
%13 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %4)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 5
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ false, %12 ], [ %17, %15 ]
br i1 %19, label %20, label %62
20: ; preds = %18
%21 = load i32, i32* %4
switch i32 %21, label %26 [
i32 1, label %22
i32 2, label %23
i32 3, label %24
i32 4, label %25
]
22: ; preds = %20
store i32 17850, i32* %5
br label %28
23: ; preds = %20
store i32 23900, i32* %5
br label %28
24: ; preds = %20
store i32 29750, i32* %5
br label %28
25: ; preds = %20
store i32 14875, i32* %5
br label %28
26: ; preds = %20
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.6, i64 0, i64 0))
br label %12
28: ; preds = %25, %24, %23, %22
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%30 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %2)
%31 = load float, float* %2
%32 = load i32, i32* %5
%33 = sitofp i32 %32 to float
%34 = fcmp ogt float %31, %33
br i1 %34, label %35, label %38
35: ; preds = %28
%36 = load i32, i32* %5
%37 = sitofp i32 %36 to float
br label %40
38: ; preds = %28
%39 = load float, float* %2
br label %40
40: ; preds = %38, %35
%41 = phi float [ %37, %35 ], [ %39, %38 ]
%42 = fpext float %41 to double
%43 = load float, float* %2
%44 = load i32, i32* %5
%45 = sitofp i32 %44 to float
%46 = fcmp ogt float %43, %45
br i1 %46, label %47, label %52
47: ; preds = %40
%48 = load float, float* %2
%49 = load i32, i32* %5
%50 = sitofp i32 %49 to float
%51 = fsub float %48, %50
br label %53
52: ; preds = %40
br label %53
53: ; preds = %52, %47
%54 = phi float [ %51, %47 ], [ 0.000000e+00, %52 ]
%55 = fpext float %54 to double
%56 = fmul double 2.800000e-01, %55
%57 = call double @llvm.fmuladd.f64(double 1.500000e-01, double %42, double %56)
%58 = fptrunc double %57 to float
store float %58, float* %3
%59 = load float, float* %3
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), double %60)
br label %12
62: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str.5 = [3 x i8] c"%d\00"
@.str.8 = [3 x i8] c"%f\00"
@.str.9 = [11 x i8] c"Tax: %.2f\0A\00"
@str.10 = [62 x i8] c"Enter the number corresponding to the desired type or action:\00"
@str.11 = [26 x i8] c"1) Single\09\092) Householder\00"
@str.12 = [40 x i8] c"3) Married, shared\094) Married, divorced\00"
@str.13 = [8 x i8] c"5) quit\00"
@str.14 = [62 x i8] c"*************************************************************\00"
@str.15 = [29 x i8] c"Now enter the taxable income\00"
@str.16 = [71 x i8] c"No such option! Please enter an integer number within the range 1 ~ 5.\00"
@switch.table.main = [4 x float] [float 1.785000e+04, float 2.390000e+04, float 2.975000e+04, float 1.487500e+04]
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = bitcast float* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.14, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.10, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.11, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.12, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.13, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.14, i64 0, i64 0))
%11 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%12 = icmp ne i64 %11, 0
%13 = load i32, i32* %2
%14 = icmp ne i32 %13, 5
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %16, label %46
16: ; preds = %0, %22
%17 = phi i32 [ %25, %22 ], [ %13, %0 ]
%18 = add i32 %17, -1
%19 = icmp ult i32 %18, 4
br i1 %19, label %28, label %20
20: ; preds = %16
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.16, i64 0, i64 0))
br label %22
22: ; preds = %20, %28
%23 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %2)
%24 = icmp ne i64 %23, 0
%25 = load i32, i32* %2
%26 = icmp ne i32 %25, 5
%27 = select i1 %24, i1 %26, i1 false
br i1 %27, label %16, label %46
28: ; preds = %16
%29 = sext i32 %18 to i64
%30 = getelementptr inbounds [4 x float], [4 x float]* @switch.table.main, i64 0, i64 %29
%31 = load float, float* %30
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.15, i64 0, i64 0))
%33 = call i64 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), float* %1)
%34 = load float, float* %1
%35 = fcmp ogt float %34, %31
%36 = select i1 %35, float %31, float %34
%37 = fpext float %36 to double
%38 = fsub float %34, %31
%39 = select i1 %35, float %38, float 0.000000e+00
%40 = fpext float %39 to double
%41 = fmul double %40, 2.800000e-01
%42 = call double @llvm.fmuladd.f64(double %37, double 1.500000e-01, double %41)
%43 = fptrunc double %42 to float
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i64 0, i64 0), double %44)
br label %22
46: ; preds = %22, %0
ret i32 0
}