#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 *);
int main(void) {
  float commission, value;
  printf("Enter value of a trade: ");
  scanf("%f", &value);
  if (value < 2500.00f) {
    commission = 30.00f + .017f * value;
  } else if (value < 6250.00f) {
    commission = 56.00f + .0066f * value;
  } else if (value < 20000.00f) {
    commission = 76.00f + .0034f * value;
  } else if (value < 50000.00f) {
    commission = 100.00f + .0022f * value;
  } else if (value < 500000.00f) {
    commission = 255.00f + .0009f * value;
  }
  if (commission < 39.00f) {
    commission = 39.00f;
  }
  printf("Commission: $%1.2f\n", commission);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf15(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xeab(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1186 <main+0x66>
movss  -0xc(%rbp),%xmm0
movss  0xec8(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xec0(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1279 <main+0x159>
movss  0xe76(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11bf <main+0x9f>
movss  -0xc(%rbp),%xmm0
movss  0xe87(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe7f(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1274 <main+0x154>
movss  0xe41(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11f8 <main+0xd8>
movss  -0xc(%rbp),%xmm0
movss  0xe46(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe3e(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    126f <main+0x14f>
movss  0xe0c(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1231 <main+0x111>
movss  -0xc(%rbp),%xmm0
movss  0xe05(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xdfd(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    126a <main+0x14a>
movss  0xdd7(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1265 <main+0x145>
movss  -0xc(%rbp),%xmm0
movss  0xdc4(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xdbc(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    126a <main+0x14a>
jmp    126f <main+0x14f>
jmp    1274 <main+0x154>
jmp    1279 <main+0x159>
movss  0xdbb(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1298 <main+0x178>
movss  0xda9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdb4(%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
lea    0xf18(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf23(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  0xeb2(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1165 <main+0x45>
mulss  0xed9(%rip),%xmm0
addss  0xed5(%rip),%xmm0
jmp    11df <main+0xbf>
movss  0xe97(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1184 <main+0x64>
mulss  0xeb2(%rip),%xmm0
addss  0xeae(%rip),%xmm0
jmp    11df <main+0xbf>
movss  0xe7c(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11a3 <main+0x83>
mulss  0xe8b(%rip),%xmm0
addss  0xe87(%rip),%xmm0
jmp    11df <main+0xbf>
movss  0xe61(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11c2 <main+0xa2>
mulss  0xe64(%rip),%xmm0
addss  0xe60(%rip),%xmm0
jmp    11df <main+0xbf>
movss  0xe46(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11df <main+0xbf>
mulss  0xe3d(%rip),%xmm0
addss  0xe39(%rip),%xmm0
movss  0xe55(%rip),%xmm1
maxss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe63(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter value of a trade: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [20 x i8] c"Commission: $%1.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 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* %3)
%6 = load float, float* %3
%7 = fcmp olt float %6, 2.500000e+03
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load float, float* %3
%10 = call float @llvm.fmuladd.f32(float 0x3F916872C0000000, float %9, float 3.000000e+01)
store float %10, float* %2
br label %39
11: ; preds = %0
%12 = load float, float* %3
%13 = fcmp olt float %12, 6.250000e+03
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load float, float* %3
%16 = call float @llvm.fmuladd.f32(float 0x3F7B089A00000000, float %15, float 5.600000e+01)
store float %16, float* %2
br label %38
17: ; preds = %11
%18 = load float, float* %3
%19 = fcmp olt float %18, 2.000000e+04
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = load float, float* %3
%22 = call float @llvm.fmuladd.f32(float 0x3F6BDA5120000000, float %21, float 7.600000e+01)
store float %22, float* %2
br label %37
23: ; preds = %17
%24 = load float, float* %3
%25 = fcmp olt float %24, 5.000000e+04
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load float, float* %3
%28 = call float @llvm.fmuladd.f32(float 0x3F6205BC00000000, float %27, float 1.000000e+02)
store float %28, float* %2
br label %36
29: ; preds = %23
%30 = load float, float* %3
%31 = fcmp olt float %30, 5.000000e+05
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load float, float* %3
%34 = call float @llvm.fmuladd.f32(float 0x3F4D7DBF40000000, float %33, float 2.550000e+02)
store float %34, float* %2
br label %35
35: ; preds = %32, %29
br label %36
36: ; preds = %35, %26
br label %37
37: ; preds = %36, %20
br label %38
38: ; preds = %37, %14
br label %39
39: ; preds = %38, %8
%40 = load float, float* %2
%41 = fcmp olt float %40, 3.900000e+01
br i1 %41, label %42, label %43
42: ; preds = %39
store float 3.900000e+01, float* %2
br label %43
43: ; preds = %42, %39
%44 = load float, float* %2
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %45)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter value of a trade: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [20 x i8] c"Commission: $%1.2f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 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 olt float %5, 2.500000e+03
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call float @llvm.fmuladd.f32(float %5, float 0x3F916872C0000000, float 3.000000e+01)
br label %25
9: ; preds = %0
%10 = fcmp olt float %5, 6.250000e+03
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = call float @llvm.fmuladd.f32(float %5, float 0x3F7B089A00000000, float 5.600000e+01)
br label %25
13: ; preds = %9
%14 = fcmp olt float %5, 2.000000e+04
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = call float @llvm.fmuladd.f32(float %5, float 0x3F6BDA5120000000, float 7.600000e+01)
br label %25
17: ; preds = %13
%18 = fcmp olt float %5, 5.000000e+04
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = call float @llvm.fmuladd.f32(float %5, float 0x3F6205BC00000000, float 1.000000e+02)
br label %25
21: ; preds = %17
%22 = fcmp olt float %5, 5.000000e+05
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = call float @llvm.fmuladd.f32(float %5, float 0x3F4D7DBF40000000, float 2.550000e+02)
br label %25
25: ; preds = %11, %19, %23, %21, %15, %7
%26 = phi float [ %8, %7 ], [ %12, %11 ], [ %16, %15 ], [ %20, %19 ], [ %24, %23 ], [ undef, %21 ]
%27 = fcmp olt float %26, 3.900000e+01
%28 = select i1 %27, float 3.900000e+01, float %26
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), double %29)
ret i32 0
}