#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 priceClose(int);
double priceHigh(int);
scalar_t__ priceLow(int);
scalar_t__ priceOpen(int);
int candle_marubozu_black(int idx) {
  double threshold = 0.1 * (priceHigh(idx) - priceLow(idx));
  if ((priceOpen(idx) > priceClose(idx)) &&
      (priceClose(idx) > (priceHigh(idx) - threshold) &&
       priceOpen(idx) < (priceLow(idx) + threshold)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<candle_marubozu_black>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <priceHigh@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <priceLow@plt>
movsd  -0x20(%rbp),%xmm1
cvtsi2sd %rax,%xmm0
subsd  %xmm0,%xmm1
movsd  0xe8a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <priceOpen@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <priceClose@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1216 <candle_marubozu_black+0xd6>
mov    -0x8(%rbp),%edi
call   1030 <priceClose@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <priceHigh@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    1216 <candle_marubozu_black+0xd6>
mov    -0x8(%rbp),%edi
call   1060 <priceOpen@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <priceLow@plt>
movsd  -0x30(%rbp),%xmm1
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1216 <candle_marubozu_black+0xd6>
movl   $0x1,-0x4(%rbp)
jmp    121d <candle_marubozu_black+0xdd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<candle_marubozu_black>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
call   1040 <priceHigh@plt>
movsd  %xmm0,0x10(%rsp)
mov    %ebx,%edi
call   1050 <priceLow@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1060 <priceOpen@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1030 <priceClose@plt>
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    120b <candle_marubozu_black+0xcb>
xorps  %xmm0,%xmm0
cvtsi2sd %r14,%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe5c(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
mov    %ebx,%edi
call   1030 <priceClose@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1040 <priceHigh@plt>
subsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jbe    120b <candle_marubozu_black+0xcb>
mov    %ebx,%edi
call   1060 <priceOpen@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %ebx,%edi
call   1050 <priceLow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
mov    $0x1,%eax
ucomisd 0x8(%rsp),%xmm1
ja     120d <candle_marubozu_black+0xcd>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @candle_marubozu_black(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call double @priceHigh(i32 %5)
%7 = load i32, i32* %3
%8 = call i64 @priceLow(i32 %7)
%9 = sitofp i64 %8 to double
%10 = fsub double %6, %9
%11 = fmul double 1.000000e-01, %10
store double %11, double* %4
%12 = load i32, i32* %3
%13 = call i64 @priceOpen(i32 %12)
%14 = sitofp i64 %13 to double
%15 = load i32, i32* %3
%16 = call double @priceClose(i32 %15)
%17 = fcmp ogt double %14, %16
br i1 %17, label %18, label %37
18: ; preds = %1
%19 = load i32, i32* %3
%20 = call double @priceClose(i32 %19)
%21 = load i32, i32* %3
%22 = call double @priceHigh(i32 %21)
%23 = load double, double* %4
%24 = fsub double %22, %23
%25 = fcmp ogt double %20, %24
br i1 %25, label %26, label %37
26: ; preds = %18
%27 = load i32, i32* %3
%28 = call i64 @priceOpen(i32 %27)
%29 = sitofp i64 %28 to double
%30 = load i32, i32* %3
%31 = call i64 @priceLow(i32 %30)
%32 = sitofp i64 %31 to double
%33 = load double, double* %4
%34 = fadd double %32, %33
%35 = fcmp olt double %29, %34
br i1 %35, label %36, label %37
36: ; preds = %26
store i32 1, i32* %2
br label %38
37: ; preds = %26, %18, %1
store i32 0, i32* %2
br label %38
38: ; preds = %37, %36
%39 = load i32, i32* %2
ret i32 %39
}

LLVM IR (-O2):
define i32 @candle_marubozu_black(i32 %0) {
%2 = tail call double @priceHigh(i32 %0)
%3 = tail call i64 @priceLow(i32 %0)
%4 = sitofp i64 %3 to double
%5 = fsub double %2, %4
%6 = fmul double %5, 1.000000e-01
%7 = tail call i64 @priceOpen(i32 %0)
%8 = sitofp i64 %7 to double
%9 = tail call double @priceClose(i32 %0)
%10 = fcmp olt double %9, %8
br i1 %10, label %11, label %23
11: ; preds = %1
%12 = tail call double @priceClose(i32 %0)
%13 = tail call double @priceHigh(i32 %0)
%14 = fsub double %13, %6
%15 = fcmp ogt double %12, %14
br i1 %15, label %16, label %23
16: ; preds = %11
%17 = tail call i64 @priceOpen(i32 %0)
%18 = sitofp i64 %17 to double
%19 = tail call i64 @priceLow(i32 %0)
%20 = sitofp i64 %19 to double
%21 = fadd double %6, %20
%22 = fcmp ogt double %21, %18
br i1 %22, label %24, label %23
23: ; preds = %16, %11, %1
br label %24
24: ; preds = %16, %23
%25 = phi i32 [ 0, %23 ], [ 1, %16 ]
ret i32 %25
}