int ti_bop(int size, double const *const *inputs, double const *options,
           double *const *outputs) {
  const double *open = inputs[0];
  const double *high = inputs[1];
  const double *low = inputs[2];
  const double *close = inputs[3];
  (void)options;
  double *output = outputs[0];
  int i;
  for (i = 0; i < size; ++i) {
    double hl = high[i] - low[i];
    if (hl <= 0.0) {
      output[i] = 0;
    } else {
      output[i] = (close[i] - open[i]) / hl;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<ti_bop>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11e1 <ti_bop+0xe1>
mov    -0x30(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x4c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x58(%rbp),%xmm0
jb     11a2 <ti_bop+0xa2>
mov    -0x48(%rbp),%rax
movslq -0x4c(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    11ce <ti_bop+0xce>
mov    -0x40(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
divsd  -0x58(%rbp),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    11d3 <ti_bop+0xd3>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1154 <ti_bop+0x54>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ti_bop>:
test   %edi,%edi
jle    1154 <ti_bop+0x54>
mov    (%rsi),%r8
mov    0x8(%rsi),%rdx
mov    0x10(%rsi),%rax
mov    0x18(%rsi),%r9
mov    (%rcx),%rcx
mov    %edi,%edi
xor    %esi,%esi
jmp    112e <ti_bop+0x2e>
nopl   0x0(%rax)
movsd  %xmm1,(%rcx,%rsi,8)
add    $0x1,%rsi
cmp    %rsi,%rdi
je     1154 <ti_bop+0x54>
movsd  (%rdx,%rsi,8),%xmm0
subsd  (%rax,%rsi,8),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    1120 <ti_bop+0x20>
movsd  (%r9,%rsi,8),%xmm1
subsd  (%r8,%rsi,8),%xmm1
divsd  %xmm0,%xmm1
jmp    1120 <ti_bop+0x20>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @ti_bop(i32 %0, double** %1, double* %2, double** %3) {
%5 = alloca i32
%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 i32
%15 = alloca double
store i32 %0, i32* %5
store double** %1, double*** %6
store double* %2, double** %7
store double** %3, double*** %8
%16 = load double**, double*** %6
%17 = getelementptr inbounds double*, double** %16, i64 0
%18 = load double*, double** %17
store double* %18, double** %9
%19 = load double**, double*** %6
%20 = getelementptr inbounds double*, double** %19, i64 1
%21 = load double*, double** %20
store double* %21, double** %10
%22 = load double**, double*** %6
%23 = getelementptr inbounds double*, double** %22, i64 2
%24 = load double*, double** %23
store double* %24, double** %11
%25 = load double**, double*** %6
%26 = getelementptr inbounds double*, double** %25, i64 3
%27 = load double*, double** %26
store double* %27, double** %12
%28 = load double*, double** %7
%29 = load double**, double*** %8
%30 = getelementptr inbounds double*, double** %29, i64 0
%31 = load double*, double** %30
store double* %31, double** %13
store i32 0, i32* %14
br label %32
32: ; preds = %74, %4
%33 = load i32, i32* %14
%34 = load i32, i32* %5
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %77
36: ; preds = %32
%37 = load double*, double** %10
%38 = load i32, i32* %14
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %37, i64 %39
%41 = load double, double* %40
%42 = load double*, double** %11
%43 = load i32, i32* %14
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = fsub double %41, %46
store double %47, double* %15
%48 = load double, double* %15
%49 = fcmp ole double %48, 0.000000e+00
br i1 %49, label %50, label %55
50: ; preds = %36
%51 = load double*, double** %13
%52 = load i32, i32* %14
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %51, i64 %53
store double 0.000000e+00, double* %54
br label %73
55: ; preds = %36
%56 = load double*, double** %12
%57 = load i32, i32* %14
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %56, i64 %58
%60 = load double, double* %59
%61 = load double*, double** %9
%62 = load i32, i32* %14
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %61, i64 %63
%65 = load double, double* %64
%66 = fsub double %60, %65
%67 = load double, double* %15
%68 = fdiv double %66, %67
%69 = load double*, double** %13
%70 = load i32, i32* %14
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %69, i64 %71
store double %68, double* %72
br label %73
73: ; preds = %55, %50
br label %74
74: ; preds = %73
%75 = load i32, i32* %14
%76 = add nsw i32 %75, 1
store i32 %76, i32* %14
br label %32
77: ; preds = %32
ret i32 0
}

LLVM IR (-O2):
define i32 @ti_bop(i32 %0, double** nocapture %1, double* nocapture readnone %2, double** nocapture %3) {
%5 = load double*, double** %1
%6 = getelementptr inbounds double*, double** %1, i64 1
%7 = load double*, double** %6
%8 = getelementptr inbounds double*, double** %1, i64 2
%9 = load double*, double** %8
%10 = getelementptr inbounds double*, double** %1, i64 3
%11 = load double*, double** %10
%12 = load double*, double** %3
%13 = icmp sgt i32 %0, 0
br i1 %13, label %14, label %36
14: ; preds = %4
%15 = zext i32 %0 to i64
br label %16
16: ; preds = %14, %31
%17 = phi i64 [ 0, %14 ], [ %34, %31 ]
%18 = getelementptr inbounds double, double* %7, i64 %17
%19 = load double, double* %18
%20 = getelementptr inbounds double, double* %9, i64 %17
%21 = load double, double* %20
%22 = fsub double %19, %21
%23 = fcmp ugt double %22, 0.000000e+00
br i1 %23, label %24, label %31
24: ; preds = %16
%25 = getelementptr inbounds double, double* %11, i64 %17
%26 = load double, double* %25
%27 = getelementptr inbounds double, double* %5, i64 %17
%28 = load double, double* %27
%29 = fsub double %26, %28
%30 = fdiv double %29, %22
br label %31
31: ; preds = %16, %24
%32 = phi double [ %30, %24 ], [ 0.000000e+00, %16 ]
%33 = getelementptr inbounds double, double* %12, i64 %17
store double %32, double* %33
%34 = add nuw nsw i64 %17, 1
%35 = icmp eq i64 %34, %15
br i1 %35, label %36, label %16
36: ; preds = %31, %4
ret i32 0
}