#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 */
char get_choice();
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main(void) {
  char mode;
  float BASIC, wt, salary, tax, net;
  printf("*****************************************************************\n");
  printf("Enter the number corresponding to the desired pay rate or action:\n");
  printf("a) $8.75/hr\t\tb) $9.33/hr\n");
  printf("c) $10.00/hr\t\td) $11.20/hr\n");
  printf("q) quit\n");
  printf("*****************************************************************\n");
  while ((mode = get_choice()) && mode != 'q') {
    switch (mode) {
    case 'a':
      BASIC = 8.75;
      break;
    case 'b':
      BASIC = 9.33;
      break;
    case 'c':
      BASIC = 10.00;
      break;
    case 'd':
      BASIC = 11.20;
      break;
    default:
      printf("No such option! Please enter a English letter within the range a "
             "~ d & q.\n");
      continue;
    }
    printf("Now enter the working hours\n");
    scanf("%f", &wt);
    while (getchar() != '\n')
      continue;
    salary =
        BASIC * (wt > 40 ? 40 : wt) + 1.5 * BASIC * (wt > 40 ? wt - 40 : 0);
    if (salary <= 300)
      tax = salary * 0.15;
    else if (salary <= 450)
      tax = 300 * 0.15 + (salary - 300) * 0.2;
    else
      tax = 300 * 0.15 + 150 * 0.2 + (salary - 450) * 0.25;
    net = salary - tax;
    printf("Total salary: %.2f\nTax: %.2f\nNet salary: %.2f\n", salary, tax,
           net);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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    0xf80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <get_choice@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1d(%rbp)
je     11cb <main+0x8b>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    11db <main+0x9b>
jmp    145f <main+0x31f>
movsbl -0x5(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x3,%eax
ja     124d <main+0x10d>
mov    -0x28(%rbp),%rax
lea    0xe54(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movss  0xdff(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1260 <main+0x120>
movss  0xde9(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1260 <main+0x120>
movss  0xdd3(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1260 <main+0x120>
movss  0xdbd(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1260 <main+0x120>
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a3 <main+0x63>
lea    0xf09(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1296 <main+0x156>
jmp    127e <main+0x13e>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xd63(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    12c8 <main+0x188>
movss  0xd52(%rip),%xmm0
movss  %xmm0,-0x30(%rbp)
jmp    12d2 <main+0x192>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x2c(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd26(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xd00(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1334 <main+0x1f4>
movss  -0x10(%rbp),%xmm0
movss  0xcea(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
jmp    1341 <main+0x201>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
jmp    1341 <main+0x201>
movsd  -0x40(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movss  -0x44(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xca7(%rip),%xmm0
ucomiss -0x14(%rbp),%xmm0
jb     139a <main+0x25a>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xcc0(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1422 <main+0x2e2>
movss  0xc76(%rip),%xmm0
ucomiss -0x14(%rbp),%xmm0
jb     13e7 <main+0x2a7>
movss  -0x14(%rbp),%xmm0
movss  0xc5b(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc6f(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc6b(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    141d <main+0x2dd>
movss  -0x14(%rbp),%xmm0
movss  0xc24(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xc24(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc20(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1422 <main+0x2e2>
movss  -0x14(%rbp),%xmm0
subss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x18(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x1c(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xd3d(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
jmp    11a3 <main+0x63>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xf96(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf09(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3f(%rip),%rdi
call   1030 <puts@plt>
lea    0xf4c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5b(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xff7(%rip),%rbp
lea    0xf8a(%rip),%r14
lea    0xe91(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xe88(%rip),%r13
lea    0xf8c(%rip),%rbx
jmp    11d8 <main+0x88>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <get_choice@plt>
test   %al,%al
je     1319 <main+0x1c9>
cmp    $0x71,%al
je     1319 <main+0x1c9>
movsbl %al,%eax
add    $0xffffff9f,%eax
cmp    $0x4,%eax
jae    11d0 <main+0x80>
cltq
movss  0x0(%rbp,%rax,4),%xmm0
movss  %xmm0,(%rsp)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
jne    1220 <main+0xd0>
movss  0x4(%rsp),%xmm0
movss  0xdc7(%rip),%xmm3
movaps %xmm3,%xmm1
minss  %xmm0,%xmm1
movss  (%rsp),%xmm2
mulss  %xmm2,%xmm1
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
mulsd  0xdbf(%rip),%xmm2
cmpltss %xmm0,%xmm3
addss  0xd9e(%rip),%xmm0
andps  %xmm3,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm2,%xmm2
cvtsd2ss %xmm0,%xmm2
movss  0xd84(%rip),%xmm0
ucomiss %xmm2,%xmm0
jae    12c0 <main+0x170>
movss  0xd7b(%rip),%xmm0
ucomiss %xmm2,%xmm0
jae    12d1 <main+0x181>
movaps %xmm2,%xmm0
addss  0xd73(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xd8b(%rip),%xmm0
addsd  0xd8b(%rip),%xmm0
jmp    12f0 <main+0x1a0>
nopw   0x0(%rax,%rax,1)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mulsd  0xd51(%rip),%xmm0
jmp    12f0 <main+0x1a0>
movaps %xmm2,%xmm0
addss  0xd34(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xd40(%rip),%xmm0
addsd  0xd40(%rip),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
subss  %xmm1,%xmm2
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
mov    %r13,%rdi
mov    $0x3,%al
call   1040 <printf@plt>
jmp    11d8 <main+0x88>
xor    %eax,%eax
add    $0x8,%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 pay rate or action:\0A\00"
@.str.2 = [26 x i8] c"a) $8.75/hr\09\09b) $9.33/hr\0A\00"
@.str.3 = [28 x i8] c"c) $10.00/hr\09\09d) $11.20/hr\0A\00"
@.str.4 = [9 x i8] c"q) quit\0A\00"
@.str.5 = [75 x i8] c"No such option! Please enter a English letter within the range a ~ d & q.\0A\00"
@.str.6 = [29 x i8] c"Now enter the working hours\0A\00"
@.str.7 = [3 x i8] c"%f\00"
@.str.8 = [47 x i8] c"Total salary: %.2f\0ATax: %.2f\0ANet salary: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %89, %31, %0
%15 = call signext i8 (...) @get_choice()
store i8 %15, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 113
br label %22
22: ; preds = %18, %14
%23 = phi i1 [ false, %14 ], [ %21, %18 ]
br i1 %23, label %24, label %100
24: ; preds = %22
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
switch i32 %26, label %31 [
i32 97, label %27
i32 98, label %28
i32 99, label %29
i32 100, label %30
]
27: ; preds = %24
store float 8.750000e+00, float* %3
br label %33
28: ; preds = %24
store float 0x4022A8F5C0000000, float* %3
br label %33
29: ; preds = %24
store float 1.000000e+01, float* %3
br label %33
30: ; preds = %24
store float 0x4026666660000000, float* %3
br label %33
31: ; preds = %24
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.5, i64 0, i64 0))
br label %14
33: ; preds = %30, %29, %28, %27
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %4)
br label %36
36: ; preds = %40, %33
%37 = call signext i8 (...) @getchar()
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 10
br i1 %39, label %40, label %41
40: ; preds = %36
br label %36
41: ; preds = %36
%42 = load float, float* %3
%43 = load float, float* %4
%44 = fcmp ogt float %43, 4.000000e+01
br i1 %44, label %45, label %46
45: ; preds = %41
br label %48
46: ; preds = %41
%47 = load float, float* %4
br label %48
48: ; preds = %46, %45
%49 = phi float [ 4.000000e+01, %45 ], [ %47, %46 ]
%50 = fmul float %42, %49
%51 = fpext float %50 to double
%52 = load float, float* %3
%53 = fpext float %52 to double
%54 = fmul double 1.500000e+00, %53
%55 = load float, float* %4
%56 = fcmp ogt float %55, 4.000000e+01
br i1 %56, label %57, label %60
57: ; preds = %48
%58 = load float, float* %4
%59 = fsub float %58, 4.000000e+01
br label %61
60: ; preds = %48
br label %61
61: ; preds = %60, %57
%62 = phi float [ %59, %57 ], [ 0.000000e+00, %60 ]
%63 = fpext float %62 to double
%64 = call double @llvm.fmuladd.f64(double %54, double %63, double %51)
%65 = fptrunc double %64 to float
store float %65, float* %5
%66 = load float, float* %5
%67 = fcmp ole float %66, 3.000000e+02
br i1 %67, label %68, label %73
68: ; preds = %61
%69 = load float, float* %5
%70 = fpext float %69 to double
%71 = fmul double %70, 1.500000e-01
%72 = fptrunc double %71 to float
store float %72, float* %6
br label %89
73: ; preds = %61
%74 = load float, float* %5
%75 = fcmp ole float %74, 4.500000e+02
br i1 %75, label %76, label %82
76: ; preds = %73
%77 = load float, float* %5
%78 = fsub float %77, 3.000000e+02
%79 = fpext float %78 to double
%80 = call double @llvm.fmuladd.f64(double %79, double 2.000000e-01, double 4.500000e+01)
%81 = fptrunc double %80 to float
store float %81, float* %6
br label %88
82: ; preds = %73
%83 = load float, float* %5
%84 = fsub float %83, 4.500000e+02
%85 = fpext float %84 to double
%86 = call double @llvm.fmuladd.f64(double %85, double 2.500000e-01, double 7.500000e+01)
%87 = fptrunc double %86 to float
store float %87, float* %6
br label %88
88: ; preds = %82, %76
br label %89
89: ; preds = %88, %68
%90 = load float, float* %5
%91 = load float, float* %6
%92 = fsub float %90, %91
store float %92, float* %7
%93 = load float, float* %5
%94 = fpext float %93 to double
%95 = load float, float* %6
%96 = fpext float %95 to double
%97 = load float, float* %7
%98 = fpext float %97 to double
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), double %94, double %96, double %98)
br label %14
100: ; preds = %22
ret i32 0
}

LLVM IR (-O2):
@.str.7 = [3 x i8] c"%f\00"
@.str.8 = [47 x i8] c"Total salary: %.2f\0ATax: %.2f\0ANet salary: %.2f\0A\00"
@str.9 = [66 x i8] c"Enter the number corresponding to the desired pay rate or action:\00"
@str.10 = [25 x i8] c"a) $8.75/hr\09\09b) $9.33/hr\00"
@str.11 = [27 x i8] c"c) $10.00/hr\09\09d) $11.20/hr\00"
@str.12 = [8 x i8] c"q) quit\00"
@str.13 = [66 x i8] c"*****************************************************************\00"
@str.14 = [28 x i8] c"Now enter the working hours\00"
@str.15 = [74 x i8] c"No such option! Please enter a English letter within the range a ~ d & q.\00"
@switch.table.main = [4 x float] [float 8.750000e+00, float 0x4022A8F5C0000000, float 1.000000e+01, float 0x4026666660000000]
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.13, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.9, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.10, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.11, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.12, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.13, i64 0, i64 0))
br label %9
9: ; preds = %17, %0
%10 = call signext i8 (...) @get_choice()
switch i8 %10, label %11 [
i8 113, label %62
i8 0, label %62
]
11: ; preds = %9
%12 = sext i8 %10 to i32
%13 = add nsw i32 %12, -97
%14 = icmp ult i32 %13, 4
br i1 %14, label %18, label %15
15: ; preds = %11
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([74 x i8], [74 x i8]* @str.15, i64 0, i64 0))
br label %17
17: ; preds = %15, %54
br label %9
18: ; preds = %11
%19 = sext i32 %13 to i64
%20 = getelementptr inbounds [4 x float], [4 x float]* @switch.table.main, i64 0, i64 %19
%21 = load float, float* %20
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.14, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), float* %1)
br label %24
24: ; preds = %24, %18
%25 = call signext i8 (...) @getchar()
%26 = icmp eq i8 %25, 10
br i1 %26, label %27, label %24
27: ; preds = %24
%28 = load float, float* %1
%29 = fcmp ogt float %28, 4.000000e+01
%30 = select i1 %29, float 4.000000e+01, float %28
%31 = fmul float %21, %30
%32 = fpext float %31 to double
%33 = fpext float %21 to double
%34 = fmul double %33, 1.500000e+00
%35 = fadd float %28, -4.000000e+01
%36 = select i1 %29, float %35, float 0.000000e+00
%37 = fpext float %36 to double
%38 = call double @llvm.fmuladd.f64(double %34, double %37, double %32)
%39 = fptrunc double %38 to float
%40 = fcmp ugt float %39, 3.000000e+02
br i1 %40, label %44, label %41
41: ; preds = %27
%42 = fpext float %39 to double
%43 = fmul double %42, 1.500000e-01
br label %54
44: ; preds = %27
%45 = fcmp ugt float %39, 4.500000e+02
br i1 %45, label %50, label %46
46: ; preds = %44
%47 = fadd float %39, -3.000000e+02
%48 = fpext float %47 to double
%49 = call double @llvm.fmuladd.f64(double %48, double 2.000000e-01, double 4.500000e+01)
br label %54
50: ; preds = %44
%51 = fadd float %39, -4.500000e+02
%52 = fpext float %51 to double
%53 = call double @llvm.fmuladd.f64(double %52, double 2.500000e-01, double 7.500000e+01)
br label %54
54: ; preds = %46, %50, %41
%55 = phi double [ %43, %41 ], [ %49, %46 ], [ %53, %50 ]
%56 = fptrunc double %55 to float
%57 = fsub float %39, %56
%58 = fpext float %39 to double
%59 = fpext float %56 to double
%60 = fpext float %57 to double
%61 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.8, i64 0, i64 0), double %58, double %59, double %60)
br label %17
62: ; preds = %9, %9
ret i32 0
}