#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 the trade: ");
  scanf("%f", &value);
  if (value < 2500.00f) {
    commission = 30.00f + 0.017f * value;
  } else if (value < 6250.00f) {
    commission = 56.00f + 0.0066f * value;
  } else if (value < 20000.00f) {
    commission = 76.00f + 0.0034f * value;
  } else if (value < 50000.00f) {
    commission = 100.00f + 0.0022f * value;
  } else if (value < 500000.00f) {
    commission = 155.00f + 0.0011f * value;
  } else {
    commission = 255.00f + 0.0009f * value;
  }
  if (commission < 39.00f) {
    commission = 39.00f;
  }
  printf("Commission: $%.2f\n", commission);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf1f(%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  0xed0(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xec8(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12a0 <main+0x180>
movss  0xe76(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11bf <main+0x9f>
movss  -0xc(%rbp),%xmm0
movss  0xe8f(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe87(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    129b <main+0x17b>
movss  0xe41(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11f8 <main+0xd8>
movss  -0xc(%rbp),%xmm0
movss  0xe4e(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe46(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1296 <main+0x176>
movss  0xe0c(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1231 <main+0x111>
movss  -0xc(%rbp),%xmm0
movss  0xe0d(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe05(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1291 <main+0x171>
movss  0xdd7(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    126a <main+0x14a>
movss  -0xc(%rbp),%xmm0
movss  0xdcc(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xdc4(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    128c <main+0x16c>
movss  -0xc(%rbp),%xmm0
movss  0xd9d(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xd95(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1291 <main+0x171>
jmp    1296 <main+0x176>
jmp    129b <main+0x17b>
jmp    12a0 <main+0x180>
movss  0xd9c(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    12bf <main+0x19f>
movss  0xd8a(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd97(%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    0xf20(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf2d(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  0xeb2(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1168 <main+0x48>
mulss  0xee1(%rip),%xmm0
addss  0xedd(%rip),%xmm0
jmp    11f4 <main+0xd4>
movss  0xe94(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1187 <main+0x67>
mulss  0xeb7(%rip),%xmm0
addss  0xeb3(%rip),%xmm0
jmp    11f4 <main+0xd4>
movss  0xe79(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11a6 <main+0x86>
mulss  0xe90(%rip),%xmm0
addss  0xe8c(%rip),%xmm0
jmp    11f4 <main+0xd4>
movss  0xe5e(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11c5 <main+0xa5>
mulss  0xe69(%rip),%xmm0
addss  0xe65(%rip),%xmm0
jmp    11f4 <main+0xd4>
movss  0xe43(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11e4 <main+0xc4>
mulss  0xe42(%rip),%xmm0
addss  0xe3e(%rip),%xmm0
jmp    11f4 <main+0xd4>
mulss  0xe28(%rip),%xmm0
addss  0xe24(%rip),%xmm0
movss  0xe48(%rip),%xmm1
maxss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe58(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Enter value of the trade: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [19 x i8] c"Commission: $%.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 ([27 x i8], [27 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 %42
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 %41
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 %40
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 %39
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 0x3F5205BC00000000, float %33, float 1.550000e+02)
store float %34, float* %2
br label %38
35: ; preds = %29
%36 = load float, float* %3
%37 = call float @llvm.fmuladd.f32(float 0x3F4D7DBF40000000, float %36, float 2.550000e+02)
store float %37, float* %2
br label %38
38: ; preds = %35, %32
br label %39
39: ; preds = %38, %26
br label %40
40: ; preds = %39, %20
br label %41
41: ; preds = %40, %14
br label %42
42: ; preds = %41, %8
%43 = load float, float* %2
%44 = fcmp olt float %43, 3.900000e+01
br i1 %44, label %45, label %46
45: ; preds = %42
store float 3.900000e+01, float* %2
br label %46
46: ; preds = %45, %42
%47 = load float, float* %2
%48 = fpext float %47 to double
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %48)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Enter value of the trade: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [19 x i8] c"Commission: $%.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 ([27 x i8], [27 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 %27
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 %27
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 %27
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 %27
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 0x3F5205BC00000000, float 1.550000e+02)
br label %27
25: ; preds = %21
%26 = call float @llvm.fmuladd.f32(float %5, float 0x3F4D7DBF40000000, float 2.550000e+02)
br label %27
27: ; preds = %11, %19, %25, %23, %15, %7
%28 = phi float [ %8, %7 ], [ %12, %11 ], [ %16, %15 ], [ %20, %19 ], [ %24, %23 ], [ %26, %25 ]
%29 = fcmp olt float %28, 3.900000e+01
%30 = select i1 %29, float 3.900000e+01, float %28
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), double %31)
ret i32 0
}