#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() {
  float commission, value;
  printf("Enter value of trade: ");
  scanf("%f", &value);
  while (value != 0.0f) {
    if (value == 0)
      break;
    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 = 155.00f + .0011f * value;
    else
      commission = 255.00f + .0009f * value;
    if (commission < 39.00f)
      commission = 39.00f;
    printf("Commission: $%.2f\n\n", commission);
    printf("Enter value of trade: ");
    scanf("%f", &value);
  }
  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    0xf1b(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1169 <main+0x49>
jp     1169 <main+0x49>
jmp    1331 <main+0x211>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1185 <main+0x65>
jp     1185 <main+0x65>
jmp    1331 <main+0x211>
movss  0xe73(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11be <main+0x9e>
movss  -0xc(%rbp),%xmm0
movss  0xe98(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe90(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12d8 <main+0x1b8>
movss  0xe3e(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11f7 <main+0xd7>
movss  -0xc(%rbp),%xmm0
movss  0xe57(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe4f(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12d3 <main+0x1b3>
movss  0xe09(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1230 <main+0x110>
movss  -0xc(%rbp),%xmm0
movss  0xe16(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe0e(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12ce <main+0x1ae>
movss  0xdd4(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1269 <main+0x149>
movss  -0xc(%rbp),%xmm0
movss  0xdd5(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xdcd(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12c9 <main+0x1a9>
movss  0xd9f(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    12a2 <main+0x182>
movss  -0xc(%rbp),%xmm0
movss  0xd94(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xd8c(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12c4 <main+0x1a4>
movss  -0xc(%rbp),%xmm0
movss  0xd65(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xd5d(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12c9 <main+0x1a9>
jmp    12ce <main+0x1ae>
jmp    12d3 <main+0x1b3>
jmp    12d8 <main+0x1b8>
movss  0xd64(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    12f7 <main+0x1d7>
movss  0xd52(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd5b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xd33(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd3c(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
jmp    114d <main+0x2d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xf1d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf26(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1165 <main+0x45>
jp     1165 <main+0x45>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xefa(%rip),%r14
lea    0xed9(%rip),%r15
lea    0xee9(%rip),%r12
lea    0x4(%rsp),%rbx
jmp    11e7 <main+0xc7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mulss  0xea4(%rip),%xmm0
addss  0xea0(%rip),%xmm0
movss  0xe9c(%rip),%xmm1
maxss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
ucomiss 0xe69(%rip),%xmm0
jne    11e7 <main+0xc7>
jnp    1157 <main+0x37>
movss  0xe11(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     1190 <main+0x70>
movss  0xe08(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1220 <main+0x100>
mulss  0xe2b(%rip),%xmm0
addss  0xe27(%rip),%xmm0
jmp    11a0 <main+0x80>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movss  0xde0(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1242 <main+0x122>
mulss  0xdf7(%rip),%xmm0
addss  0xdf3(%rip),%xmm0
jmp    11a0 <main+0x80>
movss  0xdc2(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1264 <main+0x144>
mulss  0xdcd(%rip),%xmm0
addss  0xdc9(%rip),%xmm0
jmp    11a0 <main+0x80>
movss  0xda4(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1286 <main+0x166>
mulss  0xda3(%rip),%xmm0
addss  0xd9f(%rip),%xmm0
jmp    11a0 <main+0x80>
mulss  0xd86(%rip),%xmm0
addss  0xd82(%rip),%xmm0
jmp    11a0 <main+0x80>

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

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