#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 *, float *);
main() {
  float sale = 0.0, com = 0.0;
  printf("Enter the sales amount");
  scanf("%f", &sale);
  if (sale < 10000.0) {
    com = (sale * (10.0 / 100.0));
  } else if ((sale >= 10000.0) && (sale < 50000.0)) {
    com = (sale * (30.0 / 100.0));
  } else {
    com = (sale * (50.0 / 100.0));
  }
  printf("The commission is %f", com);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe92(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    119b <main+0x7b>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe97(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1217 <main+0xf7>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe54(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11f4 <main+0xd4>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe41(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11f4 <main+0xd4>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe36(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1212 <main+0xf2>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe0b(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1217 <main+0xf7>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe18(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xef0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf0b(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  0xea6(%rip),%xmm2
ucomiss %xmm0,%xmm2
jbe    1170 <main+0x50>
mulsd  0xeb1(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
jmp    119f <main+0x7f>
ucomiss 0xe89(%rip),%xmm0
jb     1197 <main+0x77>
movss  0xe83(%rip),%xmm2
ucomiss %xmm0,%xmm2
jbe    1197 <main+0x77>
mulsd  0xe82(%rip),%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
jmp    119f <main+0x7f>
mulss  0xe69(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter the sales amount\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [21 x i8] c"The commission is %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 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 = fpext float %6 to double
%8 = fcmp olt double %7, 1.000000e+04
br i1 %8, label %9, label %14
9: ; preds = %0
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = fmul double %11, 1.000000e-01
%13 = fptrunc double %12 to float
store float %13, float* %3
br label %33
14: ; preds = %0
%15 = load float, float* %2
%16 = fpext float %15 to double
%17 = fcmp oge double %16, 1.000000e+04
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load float, float* %2
%20 = fpext float %19 to double
%21 = fcmp olt double %20, 5.000000e+04
br i1 %21, label %22, label %27
22: ; preds = %18
%23 = load float, float* %2
%24 = fpext float %23 to double
%25 = fmul double %24, 3.000000e-01
%26 = fptrunc double %25 to float
store float %26, float* %3
br label %32
27: ; preds = %18, %14
%28 = load float, float* %2
%29 = fpext float %28 to double
%30 = fmul double %29, 5.000000e-01
%31 = fptrunc double %30 to float
store float %31, float* %3
br label %32
32: ; preds = %27, %22
br label %33
33: ; preds = %32, %9
%34 = load float, float* %3
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter the sales amount\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [21 x i8] c"The commission is %f\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 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 = fpext float %5 to double
%7 = fcmp olt float %5, 1.000000e+04
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = fmul double %6, 1.000000e-01
%10 = fptrunc double %9 to float
br label %20
11: ; preds = %0
%12 = fcmp oge float %5, 1.000000e+04
%13 = fcmp olt float %5, 5.000000e+04
%14 = and i1 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = fmul double %6, 3.000000e-01
%17 = fptrunc double %16 to float
br label %20
18: ; preds = %11
%19 = fmul float %5, 5.000000e-01
br label %20
20: ; preds = %15, %18, %8
%21 = phi float [ %10, %8 ], [ %17, %15 ], [ %19, %18 ]
%22 = fpext float %21 to double
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), double %22)
ret i32 0
}