#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);
double const sqrt(double);
int ti_volatility_start(double const *);
int ti_volatility(int size, double const *const *inputs, double const *options,
                  double *const *outputs) {
  const double *input = inputs[0];
  double *output = outputs[0];
  const int period = (int)options[0];
  const double scale = 1.0 / period;
  const double annual = sqrt(252);
  if (period < 1)
    return 1;
  if (size <= ti_volatility_start(options))
    return 0;
  double sum = 0;
  double sum2 = 0;
  int i;
  for (i = 1; i <= period; ++i) {
    const double c = (input[i] / input[i - 1] - 1.0);
    sum += c;
    sum2 += c * c;
  }
  *output++ = sqrt(sum2 * scale - (sum * scale) * (sum * scale)) * annual;
  for (i = period + 1; i < size; ++i) {
    const double c = (input[i] / input[i - 1] - 1.0);
    sum += c;
    sum2 += c * c;
    const double cp = (input[i - period] / input[i - period - 1] - 1.0);
    sum -= cp;
    sum2 -= cp * cp;
    *output++ = sqrt(sum2 * scale - (sum * scale) * (sum * scale)) * annual;
  }
  assert(output - outputs[0] == size - ti_volatility_start(options));
  return 0;
}


x86 assembly (clang, -O0):
<ti_volatility>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%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    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
cvttsd2si (%rax),%eax
mov    %eax,-0x34(%rbp)
cvtsi2sdl -0x34(%rbp),%xmm1
movsd  0xe90(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe77(%rip),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
cmpl   $0x1,-0x34(%rbp)
jge    11a9 <ti_volatility+0x79>
movl   $0x1,-0x4(%rbp)
jmp    146b <ti_volatility+0x33b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x7c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <ti_volatility_start@plt>
mov    %eax,%ecx
mov    -0x7c(%rbp),%eax
cmp    %ecx,%eax
jg     11d1 <ti_volatility+0xa1>
movl   $0x0,-0x4(%rbp)
jmp    146b <ti_volatility+0x33b>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jg     125d <ti_volatility+0x12d>
mov    -0x28(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm0
movsd  0xded(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    11e8 <ti_volatility+0xb8>
movsd  -0x58(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm3
mulsd  -0x40(%rbp),%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mulsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x30(%rbp)
movsd  %xmm0,(%rax)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1415 <ti_volatility+0x2e5>
mov    -0x28(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm0
movsd  0xd11(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x5c(%rbp),%ecx
sub    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm0
movsd  0xcae(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm3
mulsd  -0x40(%rbp),%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mulsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x30(%rbp)
movsd  %xmm0,(%rax)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    12c4 <ti_volatility+0x194>
mov    -0x30(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%rcx
sub    %rcx,%rax
sar    $0x3,%rax
mov    %rax,-0x88(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <ti_volatility_start@plt>
mov    -0x8c(%rbp),%ecx
mov    %eax,%edx
mov    -0x88(%rbp),%rax
sub    %edx,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ti_volatility>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movsd  (%rdx),%xmm0
cvttsd2si %xmm0,%r15d
test   %r15d,%r15d
jle    11b4 <ti_volatility+0x84>
mov    %rcx,%rbx
mov    %rdx,%r12
mov    %edi,%r14d
movapd %xmm0,0x20(%rsp)
mov    (%rsi),%rbp
mov    (%rcx),%r13
mov    %rdx,%rdi
call   1040 <ti_volatility_start@plt>
xor    %ecx,%ecx
cmp    %r14d,%eax
jge    144d <ti_volatility+0x31d>
mov    %rbx,0x48(%rsp)
mov    %r13,0x8(%rsp)
cvttpd2dq 0x20(%rsp),%xmm0
cvtdq2pd %xmm0,%xmm0
movsd  0xe6f(%rip),%xmm8
lea    0x1(%r15),%edi
movsd  0x0(%rbp),%xmm1
mov    %r15d,%r13d
cmp    $0x2,%edi
jne    11be <ti_volatility+0x8e>
xorpd  %xmm7,%xmm7
mov    $0x1,%eax
xorpd  %xmm6,%xmm6
jmp    1232 <ti_volatility+0x102>
mov    $0x1,%ecx
jmp    144d <ti_volatility+0x31d>
mov    %r13d,%ecx
and    $0xfffffffe,%ecx
neg    %rcx
xorpd  %xmm7,%xmm7
mov    $0x1,%eax
movsd  0xe30(%rip),%xmm2
movapd %xmm1,%xmm3
xorpd  %xmm6,%xmm6
movsd  0x0(%rbp,%rax,8),%xmm4
movsd  0x8(%rbp,%rax,8),%xmm1
movapd %xmm4,%xmm5
divsd  %xmm3,%xmm5
addsd  %xmm2,%xmm5
addsd  %xmm5,%xmm6
mulsd  %xmm5,%xmm5
addsd  %xmm7,%xmm5
movapd %xmm1,%xmm7
divsd  %xmm4,%xmm7
addsd  %xmm2,%xmm7
addsd  %xmm7,%xmm6
mulsd  %xmm7,%xmm7
addsd  %xmm5,%xmm7
lea    (%rcx,%rax,1),%rdx
add    $0x2,%rdx
add    $0x2,%rax
movapd %xmm1,%xmm3
cmp    $0x1,%rdx
jne    11e0 <ti_volatility+0xb0>
divsd  %xmm0,%xmm8
test   $0x1,%r13b
je     125b <ti_volatility+0x12b>
movsd  0x0(%rbp,%rax,8),%xmm0
divsd  %xmm1,%xmm0
addsd  0xdb9(%rip),%xmm0
addsd  %xmm0,%xmm6
mulsd  %xmm0,%xmm0
addsd  %xmm0,%xmm7
movapd %xmm8,%xmm1
mulsd  %xmm6,%xmm1
mulsd  %xmm1,%xmm1
movapd %xmm7,%xmm0
mulsd  %xmm8,%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
movsd  %xmm8,0x38(%rsp)
jb     128c <ti_volatility+0x15c>
sqrtsd %xmm0,%xmm0
jmp    12bc <ti_volatility+0x18c>
mov    %r13,%rbx
movsd  %xmm7,0x20(%rsp)
movsd  %xmm6,0x10(%rsp)
mov    %edi,%r13d
call   1050 <sqrt@plt>
mov    %r13d,%edi
movsd  0x10(%rsp),%xmm6
movsd  0x20(%rsp),%xmm7
mov    %rbx,%r13
movsd  0x38(%rsp),%xmm8
mov    0x8(%rsp),%rdx
mulsd  0xd47(%rip),%xmm0
movsd  %xmm0,(%rdx)
add    $0x8,%rdx
cmp    %r14d,%edi
jge    1420 <ti_volatility+0x2f0>
mov    %r12,0x40(%rsp)
movslq %edi,%rax
movslq %r15d,%rcx
lea    0x0(,%rax,8),%rdi
add    %rbp,%rdi
sub    %rcx,%rax
lea    0x0(,%rax,8),%rbx
add    %rbp,%rbx
mov    $0x1,%esi
mov    %r14d,0x1c(%rsp)
sub    %r14d,%esi
add    %r13,%rsi
xor    %r14d,%r14d
movsd  0xcef(%rip),%xmm2
xorpd  %xmm3,%xmm3
movsd  0xceb(%rip),%xmm4
xor    %r12d,%r12d
mov    %rbp,0x50(%rsp)
mov    %rsi,0x8(%rsp)
jmp    13a7 <ti_volatility+0x277>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rdx,%r15
movsd  %xmm7,0x20(%rsp)
movsd  %xmm6,0x10(%rsp)
mov    %rdi,%rbp
call   1050 <sqrt@plt>
movsd  0xcb1(%rip),%xmm4
xorpd  %xmm3,%xmm3
movsd  0xc9d(%rip),%xmm2
mov    0x8(%rsp),%rsi
mov    %rbp,%rdi
mov    0x50(%rsp),%rbp
movsd  0x10(%rsp),%xmm6
movsd  0x20(%rsp),%xmm7
movsd  0x38(%rsp),%xmm8
mov    %r15,%rdx
mulsd  %xmm4,%xmm0
movsd  %xmm0,(%rdx,%r12,8)
add    $0x1,%r12
add    $0xfffffffffffffff8,%r14
mov    %esi,%eax
add    %r12d,%eax
je     1413 <ti_volatility+0x2e3>
lea    (%r12,%r13,1),%eax
movsd  (%rdi,%r12,8),%xmm0
cltq
divsd  0x0(%rbp,%rax,8),%xmm0
addsd  %xmm2,%xmm0
addsd  %xmm0,%xmm6
mulsd  %xmm0,%xmm0
addsd  %xmm0,%xmm7
movsd  (%rbx,%r12,8),%xmm0
divsd  -0x8(%rbx,%r12,8),%xmm0
addsd  %xmm2,%xmm0
subsd  %xmm0,%xmm6
mulsd  %xmm0,%xmm0
subsd  %xmm0,%xmm7
movapd %xmm8,%xmm1
mulsd  %xmm6,%xmm1
mulsd  %xmm1,%xmm1
movapd %xmm7,%xmm0
mulsd  %xmm8,%xmm0
subsd  %xmm1,%xmm0
ucomisd %xmm3,%xmm0
jb     1340 <ti_volatility+0x210>
sqrtsd %xmm0,%xmm0
jmp    138e <ti_volatility+0x25e>
sub    %r14,%rdx
mov    0x1c(%rsp),%r14d
mov    0x40(%rsp),%r12
mov    0x48(%rsp),%rax
sub    (%rax),%rdx
sar    $0x3,%rdx
mov    %r12,%rdi
mov    %rdx,%rbx
call   1040 <ti_volatility_start@plt>
sub    %eax,%r14d
movslq %r14d,%rax
xor    %edi,%edi
cmp    %rax,%rbx
sete   %dil
call   1030 <assert@plt>
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ti_volatility(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 i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca i32
%18 = alloca double
%19 = alloca double
%20 = alloca double
store i32 %0, i32* %6
store double** %1, double*** %7
store double* %2, double** %8
store double** %3, double*** %9
%21 = load double**, double*** %7
%22 = getelementptr inbounds double*, double** %21, i64 0
%23 = load double*, double** %22
store double* %23, double** %10
%24 = load double**, double*** %9
%25 = getelementptr inbounds double*, double** %24, i64 0
%26 = load double*, double** %25
store double* %26, double** %11
%27 = load double*, double** %8
%28 = getelementptr inbounds double, double* %27, i64 0
%29 = load double, double* %28
%30 = fptosi double %29 to i32
store i32 %30, i32* %12
%31 = load i32, i32* %12
%32 = sitofp i32 %31 to double
%33 = fdiv double 1.000000e+00, %32
store double %33, double* %13
%34 = call double @sqrt(double 2.520000e+02)
store double %34, double* %14
%35 = load i32, i32* %12
%36 = icmp slt i32 %35, 1
br i1 %36, label %37, label %38
37: ; preds = %4
store i32 1, i32* %5
br label %178
38: ; preds = %4
%39 = load i32, i32* %6
%40 = load double*, double** %8
%41 = call i32 @ti_volatility_start(double* %40)
%42 = icmp sle i32 %39, %41
br i1 %42, label %43, label %44
43: ; preds = %38
store i32 0, i32* %5
br label %178
44: ; preds = %38
store double 0.000000e+00, double* %15
store double 0.000000e+00, double* %16
store i32 1, i32* %17
br label %45
45: ; preds = %70, %44
%46 = load i32, i32* %17
%47 = load i32, i32* %12
%48 = icmp sle i32 %46, %47
br i1 %48, label %49, label %73
49: ; preds = %45
%50 = load double*, double** %10
%51 = load i32, i32* %17
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %50, i64 %52
%54 = load double, double* %53
%55 = load double*, double** %10
%56 = load i32, i32* %17
%57 = sub nsw i32 %56, 1
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds double, double* %55, i64 %58
%60 = load double, double* %59
%61 = fdiv double %54, %60
%62 = fsub double %61, 1.000000e+00
store double %62, double* %18
%63 = load double, double* %18
%64 = load double, double* %15
%65 = fadd double %64, %63
store double %65, double* %15
%66 = load double, double* %18
%67 = load double, double* %18
%68 = load double, double* %16
%69 = call double @llvm.fmuladd.f64(double %66, double %67, double %68)
store double %69, double* %16
br label %70
70: ; preds = %49
%71 = load i32, i32* %17
%72 = add nsw i32 %71, 1
store i32 %72, i32* %17
br label %45
73: ; preds = %45
%74 = load double, double* %16
%75 = load double, double* %13
%76 = load double, double* %15
%77 = load double, double* %13
%78 = fmul double %76, %77
%79 = load double, double* %15
%80 = load double, double* %13
%81 = fmul double %79, %80
%82 = fmul double %78, %81
%83 = fneg double %82
%84 = call double @llvm.fmuladd.f64(double %74, double %75, double %83)
%85 = call double @sqrt(double %84)
%86 = load double, double* %14
%87 = fmul double %85, %86
%88 = load double*, double** %11
%89 = getelementptr inbounds double, double* %88, i32 1
store double* %89, double** %11
store double %87, double* %88
%90 = load i32, i32* %12
%91 = add nsw i32 %90, 1
store i32 %91, i32* %17
br label %92
92: ; preds = %158, %73
%93 = load i32, i32* %17
%94 = load i32, i32* %6
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %161
96: ; preds = %92
%97 = load double*, double** %10
%98 = load i32, i32* %17
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds double, double* %97, i64 %99
%101 = load double, double* %100
%102 = load double*, double** %10
%103 = load i32, i32* %17
%104 = sub nsw i32 %103, 1
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %102, i64 %105
%107 = load double, double* %106
%108 = fdiv double %101, %107
%109 = fsub double %108, 1.000000e+00
store double %109, double* %19
%110 = load double, double* %19
%111 = load double, double* %15
%112 = fadd double %111, %110
store double %112, double* %15
%113 = load double, double* %19
%114 = load double, double* %19
%115 = load double, double* %16
%116 = call double @llvm.fmuladd.f64(double %113, double %114, double %115)
store double %116, double* %16
%117 = load double*, double** %10
%118 = load i32, i32* %17
%119 = load i32, i32* %12
%120 = sub nsw i32 %118, %119
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %117, i64 %121
%123 = load double, double* %122
%124 = load double*, double** %10
%125 = load i32, i32* %17
%126 = load i32, i32* %12
%127 = sub nsw i32 %125, %126
%128 = sub nsw i32 %127, 1
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds double, double* %124, i64 %129
%131 = load double, double* %130
%132 = fdiv double %123, %131
%133 = fsub double %132, 1.000000e+00
store double %133, double* %20
%134 = load double, double* %20
%135 = load double, double* %15
%136 = fsub double %135, %134
store double %136, double* %15
%137 = load double, double* %20
%138 = load double, double* %20
%139 = load double, double* %16
%140 = fneg double %137
%141 = call double @llvm.fmuladd.f64(double %140, double %138, double %139)
store double %141, double* %16
%142 = load double, double* %16
%143 = load double, double* %13
%144 = load double, double* %15
%145 = load double, double* %13
%146 = fmul double %144, %145
%147 = load double, double* %15
%148 = load double, double* %13
%149 = fmul double %147, %148
%150 = fmul double %146, %149
%151 = fneg double %150
%152 = call double @llvm.fmuladd.f64(double %142, double %143, double %151)
%153 = call double @sqrt(double %152)
%154 = load double, double* %14
%155 = fmul double %153, %154
%156 = load double*, double** %11
%157 = getelementptr inbounds double, double* %156, i32 1
store double* %157, double** %11
store double %155, double* %156
br label %158
158: ; preds = %96
%159 = load i32, i32* %17
%160 = add nsw i32 %159, 1
store i32 %160, i32* %17
br label %92
161: ; preds = %92
%162 = load double*, double** %11
%163 = load double**, double*** %9
%164 = getelementptr inbounds double*, double** %163, i64 0
%165 = load double*, double** %164
%166 = ptrtoint double* %162 to i64
%167 = ptrtoint double* %165 to i64
%168 = sub i64 %166, %167
%169 = sdiv exact i64 %168, 8
%170 = load i32, i32* %6
%171 = load double*, double** %8
%172 = call i32 @ti_volatility_start(double* %171)
%173 = sub nsw i32 %170, %172
%174 = sext i32 %173 to i64
%175 = icmp eq i64 %169, %174
%176 = zext i1 %175 to i32
%177 = call i32 @assert(i32 %176)
store i32 0, i32* %5
br label %178
178: ; preds = %161, %43, %37
%179 = load i32, i32* %5
ret i32 %179
}

LLVM IR (-O2):
define i32 @ti_volatility(i32 %0, double** nocapture %1, double* %2, double** nocapture %3) {
%5 = load double*, double** %1
%6 = load double*, double** %3
%7 = load double, double* %2
%8 = fptosi double %7 to i32
%9 = sitofp i32 %8 to double
%10 = fdiv double 1.000000e+00, %9
%11 = icmp slt i32 %8, 1
br i1 %11, label %124, label %12
12: ; preds = %4
%13 = tail call i32 @ti_volatility_start(double* %2)
%14 = icmp slt i32 %13, %0
br i1 %14, label %15, label %124
15: ; preds = %12
%16 = add nuw i32 %8, 1
%17 = load double, double* %5
%18 = zext i32 %8 to i64
%19 = and i64 %18, 1
%20 = icmp eq i32 %16, 2
br i1 %20, label %45, label %21
21: ; preds = %15
%22 = and i64 %18, 4294967294
br label %23
23: ; preds = %23, %21
%24 = phi double [ %17, %21 ], [ %37, %23 ]
%25 = phi i64 [ 1, %21 ], [ %42, %23 ]
%26 = phi double [ 0.000000e+00, %21 ], [ %41, %23 ]
%27 = phi double [ 0.000000e+00, %21 ], [ %40, %23 ]
%28 = phi i64 [ 0, %21 ], [ %43, %23 ]
%29 = getelementptr inbounds double, double* %5, i64 %25
%30 = load double, double* %29
%31 = fdiv double %30, %24
%32 = fadd double %31, -1.000000e+00
%33 = fadd double %27, %32
%34 = tail call double @llvm.fmuladd.f64(double %32, double %32, double %26)
%35 = add nuw nsw i64 %25, 1
%36 = getelementptr inbounds double, double* %5, i64 %35
%37 = load double, double* %36
%38 = fdiv double %37, %30
%39 = fadd double %38, -1.000000e+00
%40 = fadd double %33, %39
%41 = tail call double @llvm.fmuladd.f64(double %39, double %39, double %34)
%42 = add nuw nsw i64 %25, 2
%43 = add i64 %28, 2
%44 = icmp eq i64 %43, %22
br i1 %44, label %45, label %23
45: ; preds = %23, %15
%46 = phi double [ undef, %15 ], [ %40, %23 ]
%47 = phi double [ undef, %15 ], [ %41, %23 ]
%48 = phi double [ %17, %15 ], [ %37, %23 ]
%49 = phi i64 [ 1, %15 ], [ %42, %23 ]
%50 = phi double [ 0.000000e+00, %15 ], [ %41, %23 ]
%51 = phi double [ 0.000000e+00, %15 ], [ %40, %23 ]
%52 = icmp eq i64 %19, 0
br i1 %52, label %60, label %53
53: ; preds = %45
%54 = getelementptr inbounds double, double* %5, i64 %49
%55 = load double, double* %54
%56 = fdiv double %55, %48
%57 = fadd double %56, -1.000000e+00
%58 = fadd double %51, %57
%59 = tail call double @llvm.fmuladd.f64(double %57, double %57, double %50)
br label %60
60: ; preds = %45, %53
%61 = phi double [ %46, %45 ], [ %58, %53 ]
%62 = phi double [ %47, %45 ], [ %59, %53 ]
%63 = fmul double %10, %61
%64 = fneg double %63
%65 = fmul double %63, %64
%66 = tail call double @llvm.fmuladd.f64(double %62, double %10, double %65)
%67 = tail call double @sqrt(double %66)
%68 = fmul double %67, 0x402FBFBF7EBC755F
store double %68, double* %6
%69 = getelementptr inbounds double, double* %6, i64 1
%70 = icmp slt i32 %16, %0
br i1 %70, label %71, label %111
71: ; preds = %60
%72 = sext i32 %16 to i64
%73 = sext i32 %8 to i64
br label %74
74: ; preds = %71, %74
%75 = phi i64 [ %72, %71 ], [ %107, %74 ]
%76 = phi double* [ %69, %71 ], [ %106, %74 ]
%77 = phi i32 [ %8, %71 ], [ %108, %74 ]
%78 = phi double [ %62, %71 ], [ %99, %74 ]
%79 = phi double [ %61, %71 ], [ %97, %74 ]
%80 = getelementptr inbounds double, double* %5, i64 %75
%81 = load double, double* %80
%82 = sext i32 %77 to i64
%83 = getelementptr inbounds double, double* %5, i64 %82
%84 = load double, double* %83
%85 = fdiv double %81, %84
%86 = fadd double %85, -1.000000e+00
%87 = fadd double %79, %86
%88 = tail call double @llvm.fmuladd.f64(double %86, double %86, double %78)
%89 = sub nsw i64 %75, %73
%90 = getelementptr inbounds double, double* %5, i64 %89
%91 = load double, double* %90
%92 = add nsw i64 %89, -1
%93 = getelementptr inbounds double, double* %5, i64 %92
%94 = load double, double* %93
%95 = fdiv double %91, %94
%96 = fadd double %95, -1.000000e+00
%97 = fsub double %87, %96
%98 = fneg double %96
%99 = tail call double @llvm.fmuladd.f64(double %98, double %96, double %88)
%100 = fmul double %10, %97
%101 = fneg double %100
%102 = fmul double %100, %101
%103 = tail call double @llvm.fmuladd.f64(double %99, double %10, double %102)
%104 = tail call double @sqrt(double %103)
%105 = fmul double %104, 0x402FBFBF7EBC755F
store double %105, double* %76
%106 = getelementptr inbounds double, double* %76, i64 1
%107 = add nsw i64 %75, 1
%108 = trunc i64 %75 to i32
%109 = trunc i64 %107 to i32
%110 = icmp eq i32 %109, %0
br i1 %110, label %111, label %74
111: ; preds = %74, %60
%112 = phi double* [ %69, %60 ], [ %106, %74 ]
%113 = load double*, double** %3
%114 = ptrtoint double* %112 to i64
%115 = ptrtoint double* %113 to i64
%116 = sub i64 %114, %115
%117 = ashr exact i64 %116, 3
%118 = tail call i32 @ti_volatility_start(double* %2)
%119 = sub nsw i32 %0, %118
%120 = sext i32 %119 to i64
%121 = icmp eq i64 %117, %120
%122 = zext i1 %121 to i32
%123 = tail call i32 @assert(i32 %122)
br label %124
124: ; preds = %12, %4, %111
%125 = phi i32 [ 0, %111 ], [ 1, %4 ], [ 0, %12 ]
ret i32 %125
}