#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 */
double atof(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  double tradefee = 0.2;
  double buy_amount_btc = atof(argv[1]);
  double buyrate = atof(argv[2]);
  double sellrate = atof(argv[3]);
  double stupid_shit = sellrate;
  printf("trading fee: ");
  double buy_fee = (tradefee * buy_amount_btc / 100);
  printf("%f\n", buy_fee * 2);
  printf("rate: ");
  printf("%f", tradefee);
  printf("%f\n");
  double buy_amount_with_fee_btc = buy_amount_btc - buy_fee;
  printf("total btc minus fee: ");
  printf("%f\n", buy_amount_with_fee_btc);
  double buy_amount_usd = buy_amount_with_fee_btc * buyrate;
  printf("total usd amount minus fee: ");
  printf("%f\n", buy_amount_usd);
  double sell_fee = (tradefee * buy_amount_with_fee_btc / 100);
  double sell_amount_btc = buy_amount_with_fee_btc - sell_fee;
  printf("Selling amount in btc: ");
  printf("%f\n", sell_amount_btc);
  double sell_amount_usd = sell_amount_btc * sellrate;
  printf("Selling amount in usd: ");
  printf("%f\n", sell_amount_usd);
  double profit_usd = sell_amount_usd - buy_amount_usd;
  double profit_btc = profit_usd / buyrate;
  printf("btc profit: ");
  printf("%f\n", profit_btc);
  printf("usd profit: ");
  printf("%f\n", profit_usd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xecf(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  0xe5a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe51(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
lea    0xe63(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
lea    0xe4d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x20(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x48(%rbp),%xmm0
lea    0xe04(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x48(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x50(%rbp),%xmm0
lea    0xdd4(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x18(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  0xd95(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x60(%rbp),%xmm0
lea    0xd89(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x60(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x68(%rbp),%xmm0
lea    0xd59(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  -0x68(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x78(%rbp),%xmm0
lea    0xd1a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsd  -0x70(%rbp),%xmm0
lea    0xcf9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1030 <atof@plt>
movsd  %xmm0,(%rsp)
mov    0x10(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x10(%rsp)
mov    0x18(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x18(%rsp)
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
mulsd  0xe91(%rip),%xmm0
divsd  0xe91(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
addsd  %xmm0,%xmm0
lea    0xe96(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe89(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe82(%rip),%rdi
movsd  0xe51(%rip),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
lea    0xe55(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xe3d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
movsd  0xdd7(%rip),%xmm1
mulsd  %xmm0,%xmm1
divsd  0xdd3(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
lea    0xe1a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
movsd  %xmm0,(%rsp)
lea    0xe05(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%rsp)
divsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xde4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xdd3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
movsd  (%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"trading fee: \00"
@.str.1 = [4 x i8] c"%f\0A\00"
@.str.2 = [7 x i8] c"rate: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [22 x i8] c"total btc minus fee: \00"
@.str.5 = [29 x i8] c"total usd amount minus fee: \00"
@.str.6 = [24 x i8] c"Selling amount in btc: \00"
@.str.7 = [24 x i8] c"Selling amount in usd: \00"
@.str.8 = [13 x i8] c"btc profit: \00"
@.str.9 = [13 x i8] c"usd profit: \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 2.000000e-01, double* %6
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call double @atof(i8* %21)
store double %22, double* %7
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call double @atof(i8* %25)
store double %26, double* %8
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 3
%29 = load i8*, i8** %28
%30 = call double @atof(i8* %29)
store double %30, double* %9
%31 = load double, double* %9
store double %31, double* %10
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%33 = load double, double* %6
%34 = load double, double* %7
%35 = fmul double %33, %34
%36 = fdiv double %35, 1.000000e+02
store double %36, double* %11
%37 = load double, double* %11
%38 = fmul double %37, 2.000000e+00
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %38)
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%41 = load double, double* %6
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), double %41)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%44 = load double, double* %7
%45 = load double, double* %11
%46 = fsub double %44, %45
store double %46, double* %12
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%48 = load double, double* %12
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %48)
%50 = load double, double* %12
%51 = load double, double* %8
%52 = fmul double %50, %51
store double %52, double* %13
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%54 = load double, double* %13
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %54)
%56 = load double, double* %6
%57 = load double, double* %12
%58 = fmul double %56, %57
%59 = fdiv double %58, 1.000000e+02
store double %59, double* %14
%60 = load double, double* %12
%61 = load double, double* %14
%62 = fsub double %60, %61
store double %62, double* %15
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%64 = load double, double* %15
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %64)
%66 = load double, double* %15
%67 = load double, double* %9
%68 = fmul double %66, %67
store double %68, double* %16
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%70 = load double, double* %16
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %70)
%72 = load double, double* %16
%73 = load double, double* %13
%74 = fsub double %72, %73
store double %74, double* %17
%75 = load double, double* %17
%76 = load double, double* %8
%77 = fdiv double %75, %76
store double %77, double* %18
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%79 = load double, double* %18
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %79)
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
%82 = load double, double* %17
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %82)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"trading fee: \00"
@.str.1 = [4 x i8] c"%f\0A\00"
@.str.2 = [7 x i8] c"rate: \00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [22 x i8] c"total btc minus fee: \00"
@.str.5 = [29 x i8] c"total usd amount minus fee: \00"
@.str.6 = [24 x i8] c"Selling amount in btc: \00"
@.str.7 = [24 x i8] c"Selling amount in usd: \00"
@.str.8 = [13 x i8] c"btc profit: \00"
@.str.9 = [13 x i8] c"usd profit: \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call double @atof(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call double @atof(i8* %7)
%9 = getelementptr inbounds i8*, i8** %1, i64 3
%10 = load i8*, i8** %9
%11 = tail call double @atof(i8* %10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%13 = fmul double %5, 2.000000e-01
%14 = fdiv double %13, 1.000000e+02
%15 = fmul double %14, 2.000000e+00
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %15)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), double 2.000000e-01)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%20 = fsub double %5, %14
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %20)
%23 = fmul double %8, %20
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %23)
%26 = fmul double %20, 2.000000e-01
%27 = fdiv double %26, 1.000000e+02
%28 = fsub double %20, %27
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %28)
%31 = fmul double %11, %28
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %31)
%34 = fsub double %31, %23
%35 = fdiv double %34, %8
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %35)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0))
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %34)
ret i32 0
}