#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 *, float);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float basic, gross;
  puts("Enter basic salary");
  scanf("%f", &basic);
  if (basic >= 1 && basic <= 4000)
    gross = basic * (1 + 0.15 + 0.5);
  else if (basic >= 4001 && basic <= 8000)
    gross = basic * (1 + 0.3 + 0.6);
  else if (basic >= 8001 && basic <= 12000)
    gross = basic * (1 + 0.45 + 0.70);
  else
    gross = basic * (1 + 0.5 + 0.85);
  printf("The gross salary is:%f", gross);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xef2(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
movss  0xe98(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11a6 <main+0x76>
movss  0xe8b(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     11a6 <main+0x76>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9c(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1264 <main+0x134>
movss  -0x8(%rbp),%xmm0
movss  0xe55(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11f1 <main+0xc1>
movss  0xe48(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     11f1 <main+0xc1>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe49(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    125f <main+0x12f>
movss  -0x8(%rbp),%xmm0
movss  0xe12(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     123c <main+0x10c>
movss  0xe05(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     123c <main+0x10c>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf6(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    125a <main+0x12a>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdcb(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    125f <main+0x12f>
jmp    1264 <main+0x134>
movss  -0xc(%rbp),%xmm0
lea    0xddb(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf00(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1b(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm1
ucomiss 0xea5(%rip),%xmm1
jb     117b <main+0x4b>
movss  0xe9f(%rip),%xmm0
ucomiss %xmm1,%xmm0
jb     117b <main+0x4b>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mulsd  0xeb7(%rip),%xmm0
jmp    11d1 <main+0xa1>
ucomiss 0xe86(%rip),%xmm1
jb     11a2 <main+0x72>
movss  0xe80(%rip),%xmm0
ucomiss %xmm1,%xmm0
jb     11a2 <main+0x72>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mulsd  0xe88(%rip),%xmm0
jmp    11d1 <main+0xa1>
ucomiss 0xe67(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
jb     11c9 <main+0x99>
movss  0xe5a(%rip),%xmm2
ucomiss %xmm1,%xmm2
jb     11c9 <main+0x99>
mulsd  0xe59(%rip),%xmm0
jmp    11d1 <main+0xa1>
mulsd  0xe47(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter basic salary\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [23 x i8] c"The gross salary is:%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = load float, float* %2
%7 = fcmp oge float %6, 1.000000e+00
br i1 %7, label %8, label %16
8: ; preds = %0
%9 = load float, float* %2
%10 = fcmp ole float %9, 4.000000e+03
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load float, float* %2
%13 = fpext float %12 to double
%14 = fmul double %13, 1.650000e+00
%15 = fptrunc double %14 to float
store float %15, float* %3
br label %45
16: ; preds = %8, %0
%17 = load float, float* %2
%18 = fcmp oge float %17, 4.001000e+03
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load float, float* %2
%21 = fcmp ole float %20, 8.000000e+03
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load float, float* %2
%24 = fpext float %23 to double
%25 = fmul double %24, 1.900000e+00
%26 = fptrunc double %25 to float
store float %26, float* %3
br label %44
27: ; preds = %19, %16
%28 = load float, float* %2
%29 = fcmp oge float %28, 8.001000e+03
br i1 %29, label %30, label %38
30: ; preds = %27
%31 = load float, float* %2
%32 = fcmp ole float %31, 1.200000e+04
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load float, float* %2
%35 = fpext float %34 to double
%36 = fmul double %35, 2.150000e+00
%37 = fptrunc double %36 to float
store float %37, float* %3
br label %43
38: ; preds = %30, %27
%39 = load float, float* %2
%40 = fpext float %39 to double
%41 = fmul double %40, 2.350000e+00
%42 = fptrunc double %41 to float
store float %42, float* %3
br label %43
43: ; preds = %38, %33
br label %44
44: ; preds = %43, %22
br label %45
45: ; preds = %44, %11
%46 = load float, float* %3
%47 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), float %46)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter basic salary\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [23 x i8] c"The gross salary is:%f\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fcmp oge float %5, 1.000000e+00
%7 = fcmp ole float %5, 4.000000e+03
%8 = and i1 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = fpext float %5 to double
%11 = fmul double %10, 1.650000e+00
br label %28
12: ; preds = %0
%13 = fcmp oge float %5, 4.001000e+03
%14 = fcmp ole float %5, 8.000000e+03
%15 = and i1 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = fpext float %5 to double
%18 = fmul double %17, 1.900000e+00
br label %28
19: ; preds = %12
%20 = fcmp oge float %5, 8.001000e+03
%21 = fcmp ole float %5, 1.200000e+04
%22 = and i1 %20, %21
%23 = fpext float %5 to double
br i1 %22, label %24, label %26
24: ; preds = %19
%25 = fmul double %23, 2.150000e+00
br label %28
26: ; preds = %19
%27 = fmul double %23, 2.350000e+00
br label %28
28: ; preds = %16, %26, %24, %9
%29 = phi double [ %11, %9 ], [ %18, %16 ], [ %25, %24 ], [ %27, %26 ]
%30 = fptrunc double %29 to float
%31 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), float %30)
ret i32 0
}