#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 *, float *);
int main(void) {
  float comission = 0, comission_of_competor = 0, price = 0;
  int amount = 0;
  printf("enter the amount and price of trade: (xxx * xxx)\n");
  scanf("%d * %f", &amount, &price);
  float value = amount * price;
  if (value < 2500.00f) {
    comission = 30.00f + .017f * value;
  } else if (value < 6250.00f) {
    comission = 76.00f + .0066f * value;
  } else if (value < 20000.00f) {
    comission = 100.00f + .0034 * value;
  } else if (value < 50000.00f) {
    comission = 155.00f + .0022 * value;
  } else {
    comission = 255.00f + .0009 * value;
  }
  if (comission < 39.00f)
    comission = 39.00f;
  if (amount < 2000) {
    comission_of_competor = amount * .03 + 33;
  } else {
    comission_of_competor = amount * .02 + 33;
  }
  printf("comission: $%.2f\n", comission);
  printf("comission_of_competor: $%.2f\n", comission_of_competor);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xf1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3f(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
cvtsi2ssl -0x14(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xe79(%rip),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    11b8 <main+0x98>
movss  -0x18(%rbp),%xmm0
movss  0xe7a(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe72(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12ac <main+0x18c>
movss  0xe44(%rip),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    11f1 <main+0xd1>
movss  -0x18(%rbp),%xmm0
movss  0xe39(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xe31(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12a7 <main+0x187>
movss  0xe0f(%rip),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    1232 <main+0x112>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe34(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe30(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12a2 <main+0x182>
movss  0xdd2(%rip),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    1273 <main+0x153>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xde3(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xddf(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    129d <main+0x17d>
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xda0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    12a2 <main+0x182>
jmp    12a7 <main+0x187>
jmp    12ac <main+0x18c>
movss  0xd6c(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    12cb <main+0x1ab>
movss  0xd5a(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
cmpl   $0x7d0,-0x14(%rbp)
jge    1303 <main+0x1e3>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xd83(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd6f(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1329 <main+0x209>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xd48(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd44(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd71(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd6c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xf5d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf19(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cvtsi2ss %eax,%xmm0
mulss  0x10(%rsp),%xmm0
movss  0xe84(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    1193 <main+0x63>
mulss  0xe8f(%rip),%xmm0
addss  0xe8b(%rip),%xmm0
jmp    120c <main+0xdc>
movss  0xe69(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11b2 <main+0x82>
mulss  0xe68(%rip),%xmm0
addss  0xe64(%rip),%xmm0
jmp    120c <main+0xdc>
movss  0xe4e(%rip),%xmm1
ucomiss %xmm0,%xmm1
jbe    11d5 <main+0xa5>
cvtss2sd %xmm0,%xmm0
mulsd  0xe7d(%rip),%xmm0
addsd  0xe7d(%rip),%xmm0
jmp    1208 <main+0xd8>
movss  0xe2f(%rip),%xmm1
ucomiss %xmm0,%xmm1
cvtss2sd %xmm0,%xmm0
jbe    11f8 <main+0xc8>
mulsd  0xe4a(%rip),%xmm0
addsd  0xe4a(%rip),%xmm0
jmp    1208 <main+0xd8>
mulsd  0xe28(%rip),%xmm0
addsd  0xe28(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
xor    %ecx,%ecx
cmp    $0x7d0,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
setl   %cl
lea    0xe3c(%rip),%rax
mulsd  (%rax,%rcx,8),%xmm1
addsd  0xe27(%rip),%xmm1
movss  0xde7(%rip),%xmm2
maxss  %xmm0,%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x14(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
lea    0xe20(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"enter the amount and price of trade: (xxx * xxx)\0A\00"
@.str.1 = [8 x i8] c"%d * %f\00"
@.str.2 = [18 x i8] c"comission: $%.2f\0A\00"
@.str.3 = [30 x i8] c"comission_of_competor: $%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store i32 0, i32* %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %5, float* %4)
%9 = load i32, i32* %5
%10 = sitofp i32 %9 to float
%11 = load float, float* %4
%12 = fmul float %10, %11
store float %12, float* %6
%13 = load float, float* %6
%14 = fcmp olt float %13, 2.500000e+03
br i1 %14, label %15, label %18
15: ; preds = %0
%16 = load float, float* %6
%17 = call float @llvm.fmuladd.f32(float 0x3F916872C0000000, float %16, float 3.000000e+01)
store float %17, float* %2
br label %48
18: ; preds = %0
%19 = load float, float* %6
%20 = fcmp olt float %19, 6.250000e+03
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load float, float* %6
%23 = call float @llvm.fmuladd.f32(float 0x3F7B089A00000000, float %22, float 7.600000e+01)
store float %23, float* %2
br label %47
24: ; preds = %18
%25 = load float, float* %6
%26 = fcmp olt float %25, 2.000000e+04
br i1 %26, label %27, label %32
27: ; preds = %24
%28 = load float, float* %6
%29 = fpext float %28 to double
%30 = call double @llvm.fmuladd.f64(double 3.400000e-03, double %29, double 1.000000e+02)
%31 = fptrunc double %30 to float
store float %31, float* %2
br label %46
32: ; preds = %24
%33 = load float, float* %6
%34 = fcmp olt float %33, 5.000000e+04
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = load float, float* %6
%37 = fpext float %36 to double
%38 = call double @llvm.fmuladd.f64(double 2.200000e-03, double %37, double 1.550000e+02)
%39 = fptrunc double %38 to float
store float %39, float* %2
br label %45
40: ; preds = %32
%41 = load float, float* %6
%42 = fpext float %41 to double
%43 = call double @llvm.fmuladd.f64(double 9.000000e-04, double %42, double 2.550000e+02)
%44 = fptrunc double %43 to float
store float %44, float* %2
br label %45
45: ; preds = %40, %35
br label %46
46: ; preds = %45, %27
br label %47
47: ; preds = %46, %21
br label %48
48: ; preds = %47, %15
%49 = load float, float* %2
%50 = fcmp olt float %49, 3.900000e+01
br i1 %50, label %51, label %52
51: ; preds = %48
store float 3.900000e+01, float* %2
br label %52
52: ; preds = %51, %48
%53 = load i32, i32* %5
%54 = icmp slt i32 %53, 2000
br i1 %54, label %55, label %60
55: ; preds = %52
%56 = load i32, i32* %5
%57 = sitofp i32 %56 to double
%58 = call double @llvm.fmuladd.f64(double %57, double 3.000000e-02, double 3.300000e+01)
%59 = fptrunc double %58 to float
store float %59, float* %3
br label %65
60: ; preds = %52
%61 = load i32, i32* %5
%62 = sitofp i32 %61 to double
%63 = call double @llvm.fmuladd.f64(double %62, double 2.000000e-02, double 3.300000e+01)
%64 = fptrunc double %63 to float
store float %64, float* %3
br label %65
65: ; preds = %60, %55
%66 = load float, float* %2
%67 = fpext float %66 to double
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %67)
%69 = load float, float* %3
%70 = fpext float %69 to double
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), double %70)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"%d * %f\00"
@.str.2 = [18 x i8] c"comission: $%.2f\0A\00"
@.str.3 = [30 x i8] c"comission_of_competor: $%.2f\0A\00"
@str = [49 x i8] c"enter the amount and price of trade: (xxx * xxx)\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i32
%3 = bitcast float* %1 to i8*
store float 0.000000e+00, float* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %2, float* %1)
%7 = load i32, i32* %2
%8 = sitofp i32 %7 to float
%9 = load float, float* %1
%10 = fmul float %9, %8
%11 = fcmp olt float %10, 2.500000e+03
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call float @llvm.fmuladd.f32(float %10, float 0x3F916872C0000000, float 3.000000e+01)
br label %33
14: ; preds = %0
%15 = fcmp olt float %10, 6.250000e+03
br i1 %15, label %16, label %18
16: ; preds = %14
%17 = call float @llvm.fmuladd.f32(float %10, float 0x3F7B089A00000000, float 7.600000e+01)
br label %33
18: ; preds = %14
%19 = fcmp olt float %10, 2.000000e+04
br i1 %19, label %20, label %24
20: ; preds = %18
%21 = fpext float %10 to double
%22 = call double @llvm.fmuladd.f64(double %21, double 3.400000e-03, double 1.000000e+02)
%23 = fptrunc double %22 to float
br label %33
24: ; preds = %18
%25 = fcmp olt float %10, 5.000000e+04
%26 = fpext float %10 to double
br i1 %25, label %27, label %30
27: ; preds = %24
%28 = call double @llvm.fmuladd.f64(double %26, double 2.200000e-03, double 1.550000e+02)
%29 = fptrunc double %28 to float
br label %33
30: ; preds = %24
%31 = call double @llvm.fmuladd.f64(double %26, double 9.000000e-04, double 2.550000e+02)
%32 = fptrunc double %31 to float
br label %33
33: ; preds = %16, %27, %30, %20, %12
%34 = phi float [ %13, %12 ], [ %17, %16 ], [ %23, %20 ], [ %29, %27 ], [ %32, %30 ]
%35 = icmp slt i32 %7, 2000
%36 = sitofp i32 %7 to double
%37 = call double @llvm.fmuladd.f64(double %36, double 3.000000e-02, double 3.300000e+01)
%38 = call double @llvm.fmuladd.f64(double %36, double 2.000000e-02, double 3.300000e+01)
%39 = select i1 %35, double %37, double %38
%40 = fcmp olt float %34, 3.900000e+01
%41 = select i1 %40, float 3.900000e+01, float %34
%42 = fptrunc double %39 to float
%43 = fpext float %41 to double
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %43)
%45 = fpext float %42 to double
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), double %45)
ret i32 0
}