#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 *, int *);
int main() {
  int sales;
  double commission;
  printf("Please enter your total sales to the nearest dollar.\n");
  scanf("%d", &sales);
  if (sales <= 2000) {
    commission = sales * 0.1;
    printf("%g\n", commission);
  } else if (sales > 2000 && sales <= 5000) {
    commission = sales * 0.15;
    printf("%g\n", commission);
  } else {
    commission = sales * 0.2;
    printf("%g\n", commission);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0a(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x7d0,-0x8(%rbp)
jg     1188 <main+0x68>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xea9(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xed5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11fe <main+0xde>
cmpl   $0x7d0,-0x8(%rbp)
jle    11d0 <main+0xb0>
cmpl   $0x1388,-0x8(%rbp)
jg     11d0 <main+0xb0>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe59(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe8d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11f9 <main+0xd9>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe23(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xe5f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11fe <main+0xde>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xed4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x7d0,%eax
jg     1167 <main+0x37>
cvtsi2sd %eax,%xmm0
mulsd  0xeab(%rip),%xmm0
jmp    1184 <main+0x54>
cvtsi2sd %eax,%xmm0
cmp    $0x1388,%eax
ja     117c <main+0x4c>
mulsd  0xe8e(%rip),%xmm0
jmp    1184 <main+0x54>
mulsd  0xe7c(%rip),%xmm0
lea    0xe90(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [54 x i8] c"Please enter your total sales to the nearest dollar.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 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), i32* %2)
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 2000
br i1 %7, label %8, label %14
8: ; preds = %0
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = fmul double %10, 1.000000e-01
store double %11, double* %3
%12 = load double, double* %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %12)
br label %33
14: ; preds = %0
%15 = load i32, i32* %2
%16 = icmp sgt i32 %15, 2000
br i1 %16, label %17, label %26
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp sle i32 %18, 5000
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = load i32, i32* %2
%22 = sitofp i32 %21 to double
%23 = fmul double %22, 1.500000e-01
store double %23, double* %3
%24 = load double, double* %3
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %24)
br label %32
26: ; preds = %17, %14
%27 = load i32, i32* %2
%28 = sitofp i32 %27 to double
%29 = fmul double %28, 2.000000e-01
store double %29, double* %3
%30 = load double, double* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %30)
br label %32
32: ; preds = %26, %20
br label %33
33: ; preds = %32, %8
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%g\0A\00"
@str = [53 x i8] c"Please enter your total sales to the nearest dollar.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 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), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 2001
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = sitofp i32 %5 to double
%9 = fmul double %8, 1.000000e-01
br label %17
10: ; preds = %0
%11 = icmp ult i32 %5, 5001
%12 = sitofp i32 %5 to double
br i1 %11, label %13, label %15
13: ; preds = %10
%14 = fmul double %12, 1.500000e-01
br label %17
15: ; preds = %10
%16 = fmul double %12, 2.000000e-01
br label %17
17: ; preds = %13, %15, %7
%18 = phi double [ %14, %13 ], [ %16, %15 ], [ %9, %7 ]
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %18)
ret i32 0
}