#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*/ assert(int);
int ti_marketfi_start(double const *);
int ti_marketfi(int size, double const *const *inputs, double const *options,
                double *const *outputs) {
  const double *high = inputs[0];
  const double *low = inputs[1];
  const double *volume = inputs[2];
  (void)options;
  double *output = outputs[0];
  if (size <= ti_marketfi_start(options))
    return 0;
  int i;
  for (i = 0; i < size; ++i) {
    *output++ = (high[i] - low[i]) / volume[i];
  }
  assert(output - outputs[0] == size - ti_marketfi_start(options));
  return 0;
}


x86 assembly (clang, -O0):
<ti_marketfi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%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    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <ti_marketfi_start@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
cmp    %ecx,%eax
jg     118d <ti_marketfi+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    1232 <ti_marketfi+0x112>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e8 <ti_marketfi+0xc8>
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x44(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x40(%rbp)
movsd  %xmm0,(%rax)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1194 <ti_marketfi+0x74>
mov    -0x40(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%rcx
sub    %rcx,%rax
sar    $0x3,%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <ti_marketfi_start@plt>
mov    -0x54(%rbp),%ecx
mov    %eax,%edx
mov    -0x50(%rbp),%rax
sub    %edx,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ti_marketfi>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r12
mov    %rdx,%r15
mov    %edi,%r13d
mov    (%rsi),%rax
mov    %rax,0x10(%rsp)
mov    0x8(%rsi),%r14
mov    0x10(%rsi),%rbp
mov    (%rcx),%rbx
mov    %rdx,%rdi
call   1030 <ti_marketfi_start@plt>
cmp    %r13d,%eax
jge    1249 <ti_marketfi+0x129>
mov    %r13d,%ecx
mov    0x10(%rsp),%r9
mov    %r12,(%rsp)
test   %r13d,%r13d
mov    %r13d,0xc(%rsp)
jle    121c <ti_marketfi+0xfc>
mov    %rbp,%r13
mov    %ecx,%eax
cmp    $0x1,%ecx
jne    125a <ti_marketfi+0x13a>
xor    %r8d,%r8d
mov    (%rsp),%r12
mov    %r9,%r11
mov    %r8,%rdx
not    %rdx
test   $0x1,%al
je     11b6 <ti_marketfi+0x96>
movsd  (%r11,%r8,8),%xmm0
subsd  (%r14,%r8,8),%xmm0
divsd  0x0(%r13,%r8,8),%xmm0
movsd  %xmm0,(%rbx)
add    $0x8,%rbx
or     $0x1,%r8
add    %rax,%rdx
je     1220 <ti_marketfi+0x100>
sub    %r8,%rax
lea    0x8(,%r8,8),%rdx
add    %r13,%rdx
lea    (%r14,%r8,8),%rsi
add    $0x8,%rsi
lea    (%r11,%r8,8),%rbp
add    $0x8,%rbp
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movsd  -0x8(%rbp,%rcx,1),%xmm0
subsd  -0x8(%rsi,%rcx,1),%xmm0
divsd  -0x8(%rdx,%rcx,1),%xmm0
movsd  %xmm0,(%rbx,%rcx,1)
movsd  0x0(%rbp,%rcx,1),%xmm0
subsd  (%rsi,%rcx,1),%xmm0
divsd  (%rdx,%rcx,1),%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,1)
add    $0x10,%rcx
add    $0xfffffffffffffffe,%rax
jne    11e0 <ti_marketfi+0xc0>
add    %rcx,%rbx
jmp    1220 <ti_marketfi+0x100>
mov    (%rsp),%r12
sub    (%r12),%rbx
sar    $0x3,%rbx
mov    %r15,%rdi
call   1030 <ti_marketfi_start@plt>
mov    0xc(%rsp),%r13d
sub    %eax,%r13d
movslq %r13d,%rax
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    (%rbx,%rax,8),%rcx
mov    %r9,%rbp
lea    (%r9,%rax,8),%rdx
mov    %r14,%rdi
lea    (%r14,%rax,8),%rsi
mov    %r13,%r10
lea    0x0(,%rax,8),%r8
add    %r13,%r8
cmp    %rdx,%rbx
setb   %r12b
cmp    %rcx,%r9
setb   %r11b
cmp    %rsi,%rbx
setb   %dl
cmp    %rcx,%r14
setb   %bpl
cmp    %r8,%rbx
setb   %sil
cmp    %rcx,%r13
setb   %cl
xor    %r8d,%r8d
test   %r11b,%r12b
jne    1186 <ti_marketfi+0x66>
and    %bpl,%dl
jne    1186 <ti_marketfi+0x66>
and    %cl,%sil
mov    %r9,%r11
jne    1379 <ti_marketfi+0x259>
mov    %eax,%r8d
and    $0xfffffffe,%r8d
lea    -0x2(%r8),%rdx
mov    %rdx,%r9
shr    %r9
add    $0x1,%r9
test   %rdx,%rdx
je     1382 <ti_marketfi+0x262>
mov    %r9,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
movupd (%r11,%rdx,8),%xmm0
movupd (%r14,%rdx,8),%xmm1
subpd  %xmm1,%xmm0
movupd 0x0(%r13,%rdx,8),%xmm1
divpd  %xmm1,%xmm0
movupd %xmm0,(%rbx,%rdx,8)
movupd 0x10(%r11,%rdx,8),%xmm0
movupd 0x10(%r14,%rdx,8),%xmm1
subpd  %xmm1,%xmm0
movupd 0x10(%r13,%rdx,8),%xmm1
divpd  %xmm1,%xmm0
movupd %xmm0,0x10(%rbx,%rdx,8)
add    $0x4,%rdx
add    $0xfffffffffffffffe,%rsi
jne    12f0 <ti_marketfi+0x1d0>
test   $0x1,%r9b
je     1363 <ti_marketfi+0x243>
movupd (%r11,%rdx,8),%xmm0
movupd (%r14,%rdx,8),%xmm1
subpd  %xmm1,%xmm0
movupd 0x0(%r13,%rdx,8),%xmm1
divpd  %xmm1,%xmm0
movupd %xmm0,(%rbx,%rdx,8)
lea    (%rbx,%r8,8),%rbx
cmp    %rax,%r8
mov    (%rsp),%r12
jne    118d <ti_marketfi+0x6d>
jmp    1220 <ti_marketfi+0x100>
mov    (%rsp),%r12
jmp    118d <ti_marketfi+0x6d>
xor    %edx,%edx
test   $0x1,%r9b
jne    1343 <ti_marketfi+0x223>
jmp    1363 <ti_marketfi+0x243>

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

LLVM IR (-O2):
define i32 @ti_marketfi(i32 %0, double** nocapture %1, double* %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 = load double*, double** %3
%11 = tail call i32 @ti_marketfi_start(double* %2)
%12 = icmp slt i32 %11, %0
br i1 %12, label %13, label %156
13: ; preds = %4
%14 = icmp sgt i32 %0, 0
br i1 %14, label %15, label %143
15: ; preds = %13
%16 = zext i32 %0 to i64
%17 = icmp eq i32 %0, 1
br i1 %17, label %96, label %18
18: ; preds = %15
%19 = getelementptr double, double* %10, i64 %16
%20 = getelementptr double, double* %5, i64 %16
%21 = getelementptr double, double* %7, i64 %16
%22 = getelementptr double, double* %9, i64 %16
%23 = icmp ult double* %10, %20
%24 = icmp ult double* %5, %19
%25 = and i1 %23, %24
%26 = icmp ult double* %10, %21
%27 = icmp ult double* %7, %19
%28 = and i1 %26, %27
%29 = or i1 %25, %28
%30 = icmp ult double* %10, %22
%31 = icmp ult double* %9, %19
%32 = and i1 %30, %31
%33 = or i1 %29, %32
br i1 %33, label %96, label %34
34: ; preds = %18
%35 = and i64 %16, 4294967294
%36 = getelementptr double, double* %10, i64 %35
%37 = add nsw i64 %35, -2
%38 = lshr exact i64 %37, 1
%39 = add nuw i64 %38, 1
%40 = and i64 %39, 1
%41 = icmp eq i64 %37, 0
br i1 %41, label %77, label %42
42: ; preds = %34
%43 = and i64 %39, -2
br label %44
44: ; preds = %44, %42
%45 = phi i64 [ 0, %42 ], [ %74, %44 ]
%46 = phi i64 [ 0, %42 ], [ %75, %44 ]
%47 = getelementptr double, double* %10, i64 %45
%48 = getelementptr inbounds double, double* %5, i64 %45
%49 = bitcast double* %48 to <2 x double>*
%50 = load <2 x double>, <2 x double>* %49
%51 = getelementptr inbounds double, double* %7, i64 %45
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = fsub <2 x double> %50, %53
%55 = getelementptr inbounds double, double* %9, i64 %45
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = fdiv <2 x double> %54, %57
%59 = bitcast double* %47 to <2 x double>*
store <2 x double> %58, <2 x double>* %59
%60 = or i64 %45, 2
%61 = getelementptr double, double* %10, i64 %60
%62 = getelementptr inbounds double, double* %5, i64 %60
%63 = bitcast double* %62 to <2 x double>*
%64 = load <2 x double>, <2 x double>* %63
%65 = getelementptr inbounds double, double* %7, i64 %60
%66 = bitcast double* %65 to <2 x double>*
%67 = load <2 x double>, <2 x double>* %66
%68 = fsub <2 x double> %64, %67
%69 = getelementptr inbounds double, double* %9, i64 %60
%70 = bitcast double* %69 to <2 x double>*
%71 = load <2 x double>, <2 x double>* %70
%72 = fdiv <2 x double> %68, %71
%73 = bitcast double* %61 to <2 x double>*
store <2 x double> %72, <2 x double>* %73
%74 = add nuw i64 %45, 4
%75 = add nuw i64 %46, 2
%76 = icmp eq i64 %75, %43
br i1 %76, label %77, label %44
77: ; preds = %44, %34
%78 = phi i64 [ 0, %34 ], [ %74, %44 ]
%79 = icmp eq i64 %40, 0
br i1 %79, label %94, label %80
80: ; preds = %77
%81 = getelementptr double, double* %10, i64 %78
%82 = getelementptr inbounds double, double* %5, i64 %78
%83 = bitcast double* %82 to <2 x double>*
%84 = load <2 x double>, <2 x double>* %83
%85 = getelementptr inbounds double, double* %7, i64 %78
%86 = bitcast double* %85 to <2 x double>*
%87 = load <2 x double>, <2 x double>* %86
%88 = fsub <2 x double> %84, %87
%89 = getelementptr inbounds double, double* %9, i64 %78
%90 = bitcast double* %89 to <2 x double>*
%91 = load <2 x double>, <2 x double>* %90
%92 = fdiv <2 x double> %88, %91
%93 = bitcast double* %81 to <2 x double>*
store <2 x double> %92, <2 x double>* %93
br label %94
94: ; preds = %77, %80
%95 = icmp eq i64 %35, %16
br i1 %95, label %143, label %96
96: ; preds = %18, %15, %94
%97 = phi i64 [ 0, %18 ], [ 0, %15 ], [ %35, %94 ]
%98 = phi double* [ %10, %18 ], [ %10, %15 ], [ %36, %94 ]
%99 = xor i64 %97, -1
%100 = and i64 %16, 1
%101 = icmp eq i64 %100, 0
br i1 %101, label %113, label %102
102: ; preds = %96
%103 = getelementptr inbounds double, double* %5, i64 %97
%104 = load double, double* %103
%105 = getelementptr inbounds double, double* %7, i64 %97
%106 = load double, double* %105
%107 = fsub double %104, %106
%108 = getelementptr inbounds double, double* %9, i64 %97
%109 = load double, double* %108
%110 = fdiv double %107, %109
%111 = getelementptr inbounds double, double* %98, i64 1
store double %110, double* %98
%112 = or i64 %97, 1
br label %113
113: ; preds = %102, %96
%114 = phi double* [ undef, %96 ], [ %111, %102 ]
%115 = phi i64 [ %97, %96 ], [ %112, %102 ]
%116 = phi double* [ %98, %96 ], [ %111, %102 ]
%117 = sub nsw i64 0, %16
%118 = icmp eq i64 %99, %117
br i1 %118, label %143, label %119
119: ; preds = %113, %119
%120 = phi i64 [ %141, %119 ], [ %115, %113 ]
%121 = phi double* [ %140, %119 ], [ %116, %113 ]
%122 = getelementptr inbounds double, double* %5, i64 %120
%123 = load double, double* %122
%124 = getelementptr inbounds double, double* %7, i64 %120
%125 = load double, double* %124
%126 = fsub double %123, %125
%127 = getelementptr inbounds double, double* %9, i64 %120
%128 = load double, double* %127
%129 = fdiv double %126, %128
%130 = getelementptr inbounds double, double* %121, i64 1
store double %129, double* %121
%131 = add nuw nsw i64 %120, 1
%132 = getelementptr inbounds double, double* %5, i64 %131
%133 = load double, double* %132
%134 = getelementptr inbounds double, double* %7, i64 %131
%135 = load double, double* %134
%136 = fsub double %133, %135
%137 = getelementptr inbounds double, double* %9, i64 %131
%138 = load double, double* %137
%139 = fdiv double %136, %138
%140 = getelementptr inbounds double, double* %121, i64 2
store double %139, double* %130
%141 = add nuw nsw i64 %120, 2
%142 = icmp eq i64 %141, %16
br i1 %142, label %143, label %119
143: ; preds = %113, %119, %94, %13
%144 = phi double* [ %10, %13 ], [ %36, %94 ], [ %114, %113 ], [ %140, %119 ]
%145 = load double*, double** %3
%146 = ptrtoint double* %144 to i64
%147 = ptrtoint double* %145 to i64
%148 = sub i64 %146, %147
%149 = ashr exact i64 %148, 3
%150 = tail call i32 @ti_marketfi_start(double* %2)
%151 = sub nsw i32 %0, %150
%152 = sext i32 %151 to i64
%153 = icmp eq i64 %149, %152
%154 = zext i1 %153 to i32
%155 = tail call i32 @assert(i32 %154)
br label %156
156: ; preds = %4, %143
ret i32 0
}