#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 fabs(double);
double bidir(double *alpha, double *beta, int j, double ritz, double *s,
             double hurdle) {
  int i;
  int k;
  double sav_val;
  int iterate;
  double scale;
  double residual;
  double sign_normalize();
  s[2] = -(alpha[1] - ritz) / beta[2];
  i = 3;
  iterate = 1;
  while (i <= j && iterate) {
    s[i] =
        -((alpha[i - 1] - ritz) * s[i - 1] + beta[i - 1] * s[i - 2]) / beta[i];
    if (fabs(s[i - 1]) > hurdle && i > 2) {
      if (fabs(s[i]) < fabs(s[i - 1]) && fabs(s[i - 1]) > fabs(s[i - 2])) {
        iterate = 0;
        k = i - 1;
        sav_val = s[k];
      }
    }
    i++;
  }
  if (!iterate) {
    s[j] = 1.0;
    s[j - 1] = -(alpha[j] - ritz) / beta[j];
    for (i = j; i >= k + 2; i--) {
      s[i - 2] =
          -((alpha[i - 1] - ritz) * s[i - 1] + beta[i] * s[i]) / beta[i - 1];
    }
    scale = s[k] / sav_val;
    for (i = 1; i <= k - 1; i++) {
      s[i] = s[i] * scale;
    }
    residual =
        beta[k] * s[k - 1] + (alpha[k] - ritz) * s[k] + beta[k + 1] * s[k + 1];
  } else {
    residual = (alpha[j] - ritz) * s[j] + beta[j] * s[j - 1];
  }
  residual = fabs(residual) / sign_normalize(s, 1, j, j);
  return (residual);
}


x86 assembly (clang, -O0):
<bidir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
divsd  0x10(%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x10(%rax)
movl   $0x3,-0x34(%rbp)
movl   $0x1,-0x44(%rbp)
mov    -0x34(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x59(%rbp)
jg     1191 <bidir+0x81>
cmpl   $0x0,-0x44(%rbp)
setne  %al
mov    %al,-0x59(%rbp)
mov    -0x59(%rbp),%al
test   $0x1,%al
jne    11a1 <bidir+0x91>
jmp    1311 <bidir+0x201>
mov    -0x8(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xdd0(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    1303 <bidir+0x1f3>
cmpl   $0x2,-0x34(%rbp)
jle    1303 <bidir+0x1f3>
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xda3(%rip),%xmm0
pand   %xmm0,%xmm1
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xd86(%rip),%xmm2
pand   %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    12fe <bidir+0x1ee>
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xd5f(%rip),%xmm1
pand   %xmm1,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xd42(%rip),%xmm2
pand   %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    12fe <bidir+0x1ee>
movl   $0x0,-0x44(%rbp)
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1303 <bidir+0x1f3>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1176 <bidir+0x66>
cmpl   $0x0,-0x44(%rbp)
jne    14fb <bidir+0x3eb>
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  0xcd5(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x38(%rbp),%ecx
add    $0x2,%ecx
cmp    %ecx,%eax
jl     1423 <bidir+0x313>
mov    -0x8(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x34(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    137e <bidir+0x26e>
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     147f <bidir+0x36f>
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x50(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1441 <bidir+0x331>
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x38(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x38(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    1546 <bidir+0x436>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movaps 0xabe(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <sign_normalize@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bidir>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  0x8(%rdi),%xmm2
subsd  %xmm0,%xmm2
xorpd  0xed8(%rip),%xmm2
divsd  0x10(%rsi),%xmm2
movsd  %xmm2,0x10(%rcx)
cmp    $0x3,%edx
jl     1332 <bidir+0x222>
mov    %edx,%r9d
movsd  0x8(%rcx),%xmm7
mov    $0x1,%eax
xor    %r8d,%r8d
movapd 0xead(%rip),%xmm3
movapd 0xeb5(%rip),%xmm5
movapd 0xeac(%rip),%xmm8
movabs $0xffffffff00000000,%r10
ff ff ff
jmp    118b <bidir+0x7b>
lea    0x1(%rax),%rbx
add    %r10,%r8
add    $0x2,%rax
movapd %xmm6,%xmm7
cmp    %r9,%rax
mov    %rbx,%rax
jae    1332 <bidir+0x222>
movapd %xmm2,%xmm6
movsd  0x8(%rdi,%rax,8),%xmm2
subsd  %xmm0,%xmm2
mulsd  0x8(%rsi,%rax,8),%xmm7
mulsd  %xmm6,%xmm2
addsd  %xmm7,%xmm2
xorpd  %xmm3,%xmm2
divsd  0x10(%rsi,%rax,8),%xmm2
movsd  %xmm2,0x10(%rcx,%rax,8)
movapd %xmm6,%xmm7
andpd  %xmm5,%xmm7
ucomisd %xmm1,%xmm7
jbe    1170 <bidir+0x60>
movapd %xmm2,%xmm4
andpd  %xmm5,%xmm4
ucomisd %xmm4,%xmm7
jbe    1170 <bidir+0x60>
movsd  (%rcx,%rax,8),%xmm4
andpd  %xmm8,%xmm4
ucomisd %xmm4,%xmm7
jbe    1170 <bidir+0x60>
movslq %edx,%r9
movabs $0x3ff0000000000000,%rbx
mov    %rbx,(%rcx,%r9,8)
movsd  (%rdi,%r9,8),%xmm1
subsd  %xmm0,%xmm1
xorpd  0xdfa(%rip),%xmm1
divsd  (%rsi,%r9,8),%xmm1
lea    0x1(%rax),%r10
movsd  %xmm1,-0x8(%rcx,%r9,8)
lea    0x3(%rax),%rbx
cmp    %edx,%ebx
jg     1270 <bidir+0x160>
movslq %ebx,%rbx
add    $0x1,%r9
movsd  0xdf2(%rip),%xmm1
xchg   %ax,%ax
movsd  -0x10(%rdi,%r9,8),%xmm2
subsd  %xmm0,%xmm2
movsd  -0x10(%rcx,%r9,8),%xmm4
mulsd  -0x8(%rsi,%r9,8),%xmm1
mulsd  %xmm4,%xmm2
addsd  %xmm1,%xmm2
xorpd  %xmm3,%xmm2
divsd  -0x10(%rsi,%r9,8),%xmm2
movsd  %xmm2,-0x18(%rcx,%r9,8)
add    $0xffffffffffffffff,%r9
movapd %xmm4,%xmm1
cmp    %rbx,%r9
jg     1230 <bidir+0x120>
movabs $0x200000000,%rbx
sub    %r8,%rbx
mov    %rbx,%r9
sar    $0x20,%r9
sar    $0x1d,%rbx
movsd  (%rcx,%rbx,1),%xmm1
cmp    $0x2,%r10d
jl     13ef <bidir+0x2df>
divsd  %xmm6,%xmm1
mov    $0x1,%r10d
cmp    $0x4,%rax
jb     13bc <bidir+0x2ac>
mov    %rax,%r10
and    $0xfffffffffffffffc,%r10
movapd %xmm1,%xmm2
unpcklpd %xmm1,%xmm2
lea    -0x4(%r10),%rbx
mov    %rbx,%r14
shr    $0x2,%r14
add    $0x1,%r14
test   %rbx,%rbx
je     1385 <bidir+0x275>
mov    %r14,%rbx
and    $0xfffffffffffffffe,%rbx
mov    $0x1,%r11d
nop
movupd (%rcx,%r11,8),%xmm3
movupd 0x10(%rcx,%r11,8),%xmm4
movupd 0x20(%rcx,%r11,8),%xmm5
movupd 0x30(%rcx,%r11,8),%xmm6
mulpd  %xmm2,%xmm3
mulpd  %xmm2,%xmm4
movupd %xmm3,(%rcx,%r11,8)
movupd %xmm4,0x10(%rcx,%r11,8)
mulpd  %xmm2,%xmm5
mulpd  %xmm2,%xmm6
movupd %xmm5,0x20(%rcx,%r11,8)
movupd %xmm6,0x30(%rcx,%r11,8)
add    $0x8,%r11
add    $0xfffffffffffffffe,%rbx
jne    12e0 <bidir+0x1d0>
jmp    138b <bidir+0x27b>
movslq %edx,%rax
movsd  (%rdi,%rax,8),%xmm3
movsd  (%rsi,%rax,8),%xmm1
mulsd  -0x8(%rcx,%rax,8),%xmm1
subsd  %xmm0,%xmm3
mulsd  (%rcx,%rax,8),%xmm3
addsd  %xmm1,%xmm3
andpd  0xcb6(%rip),%xmm3
movapd %xmm3,(%rsp)
mov    %rcx,%rdi
mov    $0x1,%esi
mov    %edx,%ecx
xor    %eax,%eax
call   1030 <sign_normalize@plt>
movapd (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x1,%r11d
test   $0x1,%r14b
je     13b3 <bidir+0x2a3>
movupd (%rcx,%r11,8),%xmm3
movupd 0x10(%rcx,%r11,8),%xmm4
mulpd  %xmm2,%xmm3
mulpd  %xmm2,%xmm4
movupd %xmm3,(%rcx,%r11,8)
movupd %xmm4,0x10(%rcx,%r11,8)
cmp    %r10,%rax
je     13e9 <bidir+0x2d9>
or     $0x1,%r10
lea    (%rcx,%r10,8),%r11
sub    %r10,%rax
add    $0x1,%rax
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  (%r11,%rbx,8),%xmm2
mulsd  %xmm1,%xmm2
movsd  %xmm2,(%r11,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rax
jne    13d0 <bidir+0x2c0>
movsd  (%rcx,%r9,8),%xmm1
movsd  (%rsi,%r9,8),%xmm2
movabs $0x100000000,%rax
sub    %r8,%rax
sar    $0x1d,%rax
movsd  (%rdi,%r9,8),%xmm3
subsd  %xmm0,%xmm3
mulsd  %xmm1,%xmm3
mulsd  (%rcx,%rax,1),%xmm2
addsd  %xmm3,%xmm2
movabs $0x300000000,%rax
sub    %r8,%rax
sar    $0x1d,%rax
movsd  (%rsi,%rax,1),%xmm3
mulsd  (%rcx,%rax,1),%xmm3
addsd  %xmm2,%xmm3
jmp    1352 <bidir+0x242>

LLVM IR (-O0):
define double @bidir(double* %0, double* %1, i32 %2, double %3, double* %4, double %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double*
%12 = alloca double
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca i32
%17 = alloca double
%18 = alloca double
store double* %0, double** %7
store double* %1, double** %8
store i32 %2, i32* %9
store double %3, double* %10
store double* %4, double** %11
store double %5, double* %12
%19 = load double*, double** %7
%20 = getelementptr inbounds double, double* %19, i64 1
%21 = load double, double* %20
%22 = load double, double* %10
%23 = fsub double %21, %22
%24 = fneg double %23
%25 = load double*, double** %8
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
%28 = fdiv double %24, %27
%29 = load double*, double** %11
%30 = getelementptr inbounds double, double* %29, i64 2
store double %28, double* %30
store i32 3, i32* %13
store i32 1, i32* %16
br label %31
31: ; preds = %132, %6
%32 = load i32, i32* %13
%33 = load i32, i32* %9
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* %16
%37 = icmp ne i32 %36, 0
br label %38
38: ; preds = %35, %31
%39 = phi i1 [ false, %31 ], [ %37, %35 ]
br i1 %39, label %40, label %135
40: ; preds = %38
%41 = load double*, double** %7
%42 = load i32, i32* %13
%43 = sub nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %41, i64 %44
%46 = load double, double* %45
%47 = load double, double* %10
%48 = fsub double %46, %47
%49 = load double*, double** %11
%50 = load i32, i32* %13
%51 = sub nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %49, i64 %52
%54 = load double, double* %53
%55 = load double*, double** %8
%56 = load i32, i32* %13
%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 = load double*, double** %11
%62 = load i32, i32* %13
%63 = sub nsw i32 %62, 2
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %61, i64 %64
%66 = load double, double* %65
%67 = fmul double %60, %66
%68 = call double @llvm.fmuladd.f64(double %48, double %54, double %67)
%69 = fneg double %68
%70 = load double*, double** %8
%71 = load i32, i32* %13
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds double, double* %70, i64 %72
%74 = load double, double* %73
%75 = fdiv double %69, %74
%76 = load double*, double** %11
%77 = load i32, i32* %13
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %76, i64 %78
store double %75, double* %79
%80 = load double*, double** %11
%81 = load i32, i32* %13
%82 = sub nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds double, double* %80, i64 %83
%85 = load double, double* %84
%86 = call double @llvm.fabs.f64(double %85)
%87 = load double, double* %12
%88 = fcmp ogt double %86, %87
br i1 %88, label %89, label %132
89: ; preds = %40
%90 = load i32, i32* %13
%91 = icmp sgt i32 %90, 2
br i1 %91, label %92, label %132
92: ; preds = %89
%93 = load double*, double** %11
%94 = load i32, i32* %13
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %93, i64 %95
%97 = load double, double* %96
%98 = call double @llvm.fabs.f64(double %97)
%99 = load double*, double** %11
%100 = load i32, i32* %13
%101 = sub nsw i32 %100, 1
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds double, double* %99, i64 %102
%104 = load double, double* %103
%105 = call double @llvm.fabs.f64(double %104)
%106 = fcmp olt double %98, %105
br i1 %106, label %107, label %131
107: ; preds = %92
%108 = load double*, double** %11
%109 = load i32, i32* %13
%110 = sub nsw i32 %109, 1
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds double, double* %108, i64 %111
%113 = load double, double* %112
%114 = call double @llvm.fabs.f64(double %113)
%115 = load double*, double** %11
%116 = load i32, i32* %13
%117 = sub nsw i32 %116, 2
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds double, double* %115, i64 %118
%120 = load double, double* %119
%121 = call double @llvm.fabs.f64(double %120)
%122 = fcmp ogt double %114, %121
br i1 %122, label %123, label %131
123: ; preds = %107
store i32 0, i32* %16
%124 = load i32, i32* %13
%125 = sub nsw i32 %124, 1
store i32 %125, i32* %14
%126 = load double*, double** %11
%127 = load i32, i32* %14
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds double, double* %126, i64 %128
%130 = load double, double* %129
store double %130, double* %15
br label %131
131: ; preds = %123, %107, %92
br label %132
132: ; preds = %131, %89, %40
%133 = load i32, i32* %13
%134 = add nsw i32 %133, 1
store i32 %134, i32* %13
br label %31
135: ; preds = %38
%136 = load i32, i32* %16
%137 = icmp ne i32 %136, 0
br i1 %137, label %278, label %138
138: ; preds = %135
%139 = load double*, double** %11
%140 = load i32, i32* %9
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds double, double* %139, i64 %141
store double 1.000000e+00, double* %142
%143 = load double*, double** %7
%144 = load i32, i32* %9
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds double, double* %143, i64 %145
%147 = load double, double* %146
%148 = load double, double* %10
%149 = fsub double %147, %148
%150 = fneg double %149
%151 = load double*, double** %8
%152 = load i32, i32* %9
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds double, double* %151, i64 %153
%155 = load double, double* %154
%156 = fdiv double %150, %155
%157 = load double*, double** %11
%158 = load i32, i32* %9
%159 = sub nsw i32 %158, 1
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds double, double* %157, i64 %160
store double %156, double* %161
%162 = load i32, i32* %9
store i32 %162, i32* %13
br label %163
163: ; preds = %208, %138
%164 = load i32, i32* %13
%165 = load i32, i32* %14
%166 = add nsw i32 %165, 2
%167 = icmp sge i32 %164, %166
br i1 %167, label %168, label %211
168: ; preds = %163
%169 = load double*, double** %7
%170 = load i32, i32* %13
%171 = sub nsw i32 %170, 1
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds double, double* %169, i64 %172
%174 = load double, double* %173
%175 = load double, double* %10
%176 = fsub double %174, %175
%177 = load double*, double** %11
%178 = load i32, i32* %13
%179 = sub nsw i32 %178, 1
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds double, double* %177, i64 %180
%182 = load double, double* %181
%183 = load double*, double** %8
%184 = load i32, i32* %13
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds double, double* %183, i64 %185
%187 = load double, double* %186
%188 = load double*, double** %11
%189 = load i32, i32* %13
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds double, double* %188, i64 %190
%192 = load double, double* %191
%193 = fmul double %187, %192
%194 = call double @llvm.fmuladd.f64(double %176, double %182, double %193)
%195 = fneg double %194
%196 = load double*, double** %8
%197 = load i32, i32* %13
%198 = sub nsw i32 %197, 1
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds double, double* %196, i64 %199
%201 = load double, double* %200
%202 = fdiv double %195, %201
%203 = load double*, double** %11
%204 = load i32, i32* %13
%205 = sub nsw i32 %204, 2
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds double, double* %203, i64 %206
store double %202, double* %207
br label %208
208: ; preds = %168
%209 = load i32, i32* %13
%210 = add nsw i32 %209, -1
store i32 %210, i32* %13
br label %163
211: ; preds = %163
%212 = load double*, double** %11
%213 = load i32, i32* %14
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds double, double* %212, i64 %214
%216 = load double, double* %215
%217 = load double, double* %15
%218 = fdiv double %216, %217
store double %218, double* %17
store i32 1, i32* %13
br label %219
219: ; preds = %236, %211
%220 = load i32, i32* %13
%221 = load i32, i32* %14
%222 = sub nsw i32 %221, 1
%223 = icmp sle i32 %220, %222
br i1 %223, label %224, label %239
224: ; preds = %219
%225 = load double*, double** %11
%226 = load i32, i32* %13
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds double, double* %225, i64 %227
%229 = load double, double* %228
%230 = load double, double* %17
%231 = fmul double %229, %230
%232 = load double*, double** %11
%233 = load i32, i32* %13
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds double, double* %232, i64 %234
store double %231, double* %235
br label %236
236: ; preds = %224
%237 = load i32, i32* %13
%238 = add nsw i32 %237, 1
store i32 %238, i32* %13
br label %219
239: ; preds = %219
%240 = load double*, double** %8
%241 = load i32, i32* %14
%242 = sext i32 %241 to i64
%243 = getelementptr inbounds double, double* %240, i64 %242
%244 = load double, double* %243
%245 = load double*, double** %11
%246 = load i32, i32* %14
%247 = sub nsw i32 %246, 1
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds double, double* %245, i64 %248
%250 = load double, double* %249
%251 = load double*, double** %7
%252 = load i32, i32* %14
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds double, double* %251, i64 %253
%255 = load double, double* %254
%256 = load double, double* %10
%257 = fsub double %255, %256
%258 = load double*, double** %11
%259 = load i32, i32* %14
%260 = sext i32 %259 to i64
%261 = getelementptr inbounds double, double* %258, i64 %260
%262 = load double, double* %261
%263 = fmul double %257, %262
%264 = call double @llvm.fmuladd.f64(double %244, double %250, double %263)
%265 = load double*, double** %8
%266 = load i32, i32* %14
%267 = add nsw i32 %266, 1
%268 = sext i32 %267 to i64
%269 = getelementptr inbounds double, double* %265, i64 %268
%270 = load double, double* %269
%271 = load double*, double** %11
%272 = load i32, i32* %14
%273 = add nsw i32 %272, 1
%274 = sext i32 %273 to i64
%275 = getelementptr inbounds double, double* %271, i64 %274
%276 = load double, double* %275
%277 = call double @llvm.fmuladd.f64(double %270, double %276, double %264)
store double %277, double* %18
br label %304
278: ; preds = %135
%279 = load double*, double** %7
%280 = load i32, i32* %9
%281 = sext i32 %280 to i64
%282 = getelementptr inbounds double, double* %279, i64 %281
%283 = load double, double* %282
%284 = load double, double* %10
%285 = fsub double %283, %284
%286 = load double*, double** %11
%287 = load i32, i32* %9
%288 = sext i32 %287 to i64
%289 = getelementptr inbounds double, double* %286, i64 %288
%290 = load double, double* %289
%291 = load double*, double** %8
%292 = load i32, i32* %9
%293 = sext i32 %292 to i64
%294 = getelementptr inbounds double, double* %291, i64 %293
%295 = load double, double* %294
%296 = load double*, double** %11
%297 = load i32, i32* %9
%298 = sub nsw i32 %297, 1
%299 = sext i32 %298 to i64
%300 = getelementptr inbounds double, double* %296, i64 %299
%301 = load double, double* %300
%302 = fmul double %295, %301
%303 = call double @llvm.fmuladd.f64(double %285, double %290, double %302)
store double %303, double* %18
br label %304
304: ; preds = %278, %239
%305 = load double, double* %18
%306 = call double @llvm.fabs.f64(double %305)
%307 = load double*, double** %11
%308 = load i32, i32* %9
%309 = load i32, i32* %9
%310 = call double (double*, i32, i32, i32, ...) bitcast (double (...)* @sign_normalize to double (double*, i32, i32, i32, ...)*)(double* %307, i32 1, i32 %308, i32 %309)
%311 = fdiv double %306, %310
store double %311, double* %18
%312 = load double, double* %18
ret double %312
}

LLVM IR (-O2):
define double @bidir(double* nocapture %0, double* nocapture %1, i32 %2, double %3, double* %4, double %5) {
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = fsub double %8, %3
%10 = fneg double %9
%11 = getelementptr inbounds double, double* %1, i64 2
%12 = load double, double* %11
%13 = fdiv double %10, %12
%14 = getelementptr inbounds double, double* %4, i64 2
store double %13, double* %14
%15 = icmp sgt i32 %2, 2
br i1 %15, label %16, label %192
16: ; preds = %6
%17 = zext i32 %2 to i64
%18 = getelementptr inbounds double, double* %4, i64 1
%19 = load double, double* %18
br label %20
20: ; preds = %16, %48
%21 = phi double [ %19, %16 ], [ %22, %48 ]
%22 = phi double [ %13, %16 ], [ %35, %48 ]
%23 = phi i64 [ 3, %16 ], [ %49, %48 ]
%24 = add nsw i64 %23, -1
%25 = getelementptr inbounds double, double* %0, i64 %24
%26 = load double, double* %25
%27 = fsub double %26, %3
%28 = getelementptr inbounds double, double* %1, i64 %24
%29 = load double, double* %28
%30 = fmul double %29, %21
%31 = tail call double @llvm.fmuladd.f64(double %27, double %22, double %30)
%32 = fneg double %31
%33 = getelementptr inbounds double, double* %1, i64 %23
%34 = load double, double* %33
%35 = fdiv double %32, %34
%36 = getelementptr inbounds double, double* %4, i64 %23
store double %35, double* %36
%37 = tail call double @llvm.fabs.f64(double %22)
%38 = fcmp ogt double %37, %5
%39 = tail call double @llvm.fabs.f64(double %35)
%40 = fcmp olt double %39, %37
%41 = select i1 %38, i1 %40, i1 false
br i1 %41, label %42, label %48
42: ; preds = %20
%43 = add nsw i64 %23, -2
%44 = getelementptr inbounds double, double* %4, i64 %43
%45 = load double, double* %44
%46 = tail call double @llvm.fabs.f64(double %45)
%47 = fcmp ogt double %37, %46
br i1 %47, label %51, label %48
48: ; preds = %42, %20
%49 = add nuw nsw i64 %23, 1
%50 = icmp ult i64 %23, %17
br i1 %50, label %20, label %192
51: ; preds = %42
%52 = trunc i64 %24 to i32
%53 = sext i32 %2 to i64
%54 = getelementptr inbounds double, double* %4, i64 %53
store double 1.000000e+00, double* %54
%55 = getelementptr inbounds double, double* %0, i64 %53
%56 = load double, double* %55
%57 = fsub double %56, %3
%58 = fneg double %57
%59 = getelementptr inbounds double, double* %1, i64 %53
%60 = load double, double* %59
%61 = fdiv double %58, %60
%62 = add nsw i32 %2, -1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %4, i64 %63
store double %61, double* %64
%65 = add nsw i32 %52, 2
%66 = icmp sgt i32 %65, %2
br i1 %66, label %89, label %67
67: ; preds = %51
%68 = sext i32 %65 to i64
br label %69
69: ; preds = %67, %69
%70 = phi double [ 1.000000e+00, %67 ], [ %77, %69 ]
%71 = phi i64 [ %53, %67 ], [ %72, %69 ]
%72 = add nsw i64 %71, -1
%73 = getelementptr inbounds double, double* %0, i64 %72
%74 = load double, double* %73
%75 = fsub double %74, %3
%76 = getelementptr inbounds double, double* %4, i64 %72
%77 = load double, double* %76
%78 = getelementptr inbounds double, double* %1, i64 %71
%79 = load double, double* %78
%80 = fmul double %79, %70
%81 = tail call double @llvm.fmuladd.f64(double %75, double %77, double %80)
%82 = fneg double %81
%83 = getelementptr inbounds double, double* %1, i64 %72
%84 = load double, double* %83
%85 = fdiv double %82, %84
%86 = add nsw i64 %71, -2
%87 = getelementptr inbounds double, double* %4, i64 %86
store double %85, double* %87
%88 = icmp sgt i64 %71, %68
br i1 %88, label %69, label %89
89: ; preds = %69, %51
%90 = shl i64 %24, 32
%91 = ashr exact i64 %90, 32
%92 = getelementptr inbounds double, double* %4, i64 %91
%93 = load double, double* %92
%94 = fdiv double %93, %22
%95 = icmp sgt i32 %52, 1
br i1 %95, label %96, label %171
96: ; preds = %89
%97 = and i64 %24, 4294967295
%98 = add nsw i64 %23, -2
%99 = icmp ult i64 %98, 4
br i1 %99, label %160, label %100
100: ; preds = %96
%101 = and i64 %98, -4
%102 = or i64 %101, 1
%103 = insertelement <2 x double> poison, double %94, i64 0
%104 = shufflevector <2 x double> %103, <2 x double> poison, <2 x i32> zeroinitializer
%105 = insertelement <2 x double> poison, double %94, i64 0
%106 = shufflevector <2 x double> %105, <2 x double> poison, <2 x i32> zeroinitializer
%107 = add nsw i64 %101, -4
%108 = lshr exact i64 %107, 2
%109 = add nuw nsw i64 %108, 1
%110 = and i64 %109, 1
%111 = icmp eq i64 %107, 0
br i1 %111, label %144, label %112
112: ; preds = %100
%113 = and i64 %109, 9223372036854775806
br label %114
114: ; preds = %114, %112
%115 = phi i64 [ 0, %112 ], [ %139, %114 ]
%116 = phi i64 [ 0, %112 ], [ %140, %114 ]
%117 = or i64 %115, 1
%118 = getelementptr inbounds double, double* %4, i64 %117
%119 = bitcast double* %118 to <2 x double>*
%120 = load <2 x double>, <2 x double>* %119
%121 = getelementptr inbounds double, double* %118, i64 2
%122 = bitcast double* %121 to <2 x double>*
%123 = load <2 x double>, <2 x double>* %122
%124 = fmul <2 x double> %104, %120
%125 = fmul <2 x double> %106, %123
%126 = bitcast double* %118 to <2 x double>*
store <2 x double> %124, <2 x double>* %126
%127 = bitcast double* %121 to <2 x double>*
store <2 x double> %125, <2 x double>* %127
%128 = or i64 %115, 5
%129 = getelementptr inbounds double, double* %4, i64 %128
%130 = bitcast double* %129 to <2 x double>*
%131 = load <2 x double>, <2 x double>* %130
%132 = getelementptr inbounds double, double* %129, i64 2
%133 = bitcast double* %132 to <2 x double>*
%134 = load <2 x double>, <2 x double>* %133
%135 = fmul <2 x double> %104, %131
%136 = fmul <2 x double> %106, %134
%137 = bitcast double* %129 to <2 x double>*
store <2 x double> %135, <2 x double>* %137
%138 = bitcast double* %132 to <2 x double>*
store <2 x double> %136, <2 x double>* %138
%139 = add nuw i64 %115, 8
%140 = add i64 %116, 2
%141 = icmp eq i64 %140, %113
br i1 %141, label %142, label %114
142: ; preds = %114
%143 = or i64 %139, 1
br label %144
144: ; preds = %142, %100
%145 = phi i64 [ 1, %100 ], [ %143, %142 ]
%146 = icmp eq i64 %110, 0
br i1 %146, label %158, label %147
147: ; preds = %144
%148 = getelementptr inbounds double, double* %4, i64 %145
%149 = bitcast double* %148 to <2 x double>*
%150 = load <2 x double>, <2 x double>* %149
%151 = getelementptr inbounds double, double* %148, i64 2
%152 = bitcast double* %151 to <2 x double>*
%153 = load <2 x double>, <2 x double>* %152
%154 = fmul <2 x double> %104, %150
%155 = fmul <2 x double> %106, %153
%156 = bitcast double* %148 to <2 x double>*
store <2 x double> %154, <2 x double>* %156
%157 = bitcast double* %151 to <2 x double>*
store <2 x double> %155, <2 x double>* %157
br label %158
158: ; preds = %144, %147
%159 = icmp eq i64 %98, %101
br i1 %159, label %169, label %160
160: ; preds = %96, %158
%161 = phi i64 [ 1, %96 ], [ %102, %158 ]
br label %162
162: ; preds = %160, %162
%163 = phi i64 [ %167, %162 ], [ %161, %160 ]
%164 = getelementptr inbounds double, double* %4, i64 %163
%165 = load double, double* %164
%166 = fmul double %94, %165
store double %166, double* %164
%167 = add nuw nsw i64 %163, 1
%168 = icmp eq i64 %167, %97
br i1 %168, label %169, label %162
169: ; preds = %162, %158
%170 = load double, double* %92
br label %171
171: ; preds = %169, %89
%172 = phi double [ %170, %169 ], [ %93, %89 ]
%173 = getelementptr inbounds double, double* %1, i64 %91
%174 = load double, double* %173
%175 = shl i64 %23, 32
%176 = add i64 %175, -8589934592
%177 = ashr exact i64 %176, 32
%178 = getelementptr inbounds double, double* %4, i64 %177
%179 = load double, double* %178
%180 = getelementptr inbounds double, double* %0, i64 %91
%181 = load double, double* %180
%182 = fsub double %181, %3
%183 = fmul double %182, %172
%184 = tail call double @llvm.fmuladd.f64(double %174, double %179, double %183)
%185 = shl i64 %23, 32
%186 = ashr exact i64 %185, 32
%187 = getelementptr inbounds double, double* %1, i64 %186
%188 = load double, double* %187
%189 = getelementptr inbounds double, double* %4, i64 %186
%190 = load double, double* %189
%191 = tail call double @llvm.fmuladd.f64(double %188, double %190, double %184)
br label %207
192: ; preds = %48, %6
%193 = sext i32 %2 to i64
%194 = getelementptr inbounds double, double* %0, i64 %193
%195 = load double, double* %194
%196 = fsub double %195, %3
%197 = getelementptr inbounds double, double* %4, i64 %193
%198 = load double, double* %197
%199 = getelementptr inbounds double, double* %1, i64 %193
%200 = load double, double* %199
%201 = add nsw i32 %2, -1
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double, double* %4, i64 %202
%204 = load double, double* %203
%205 = fmul double %200, %204
%206 = tail call double @llvm.fmuladd.f64(double %196, double %198, double %205)
br label %207
207: ; preds = %192, %171
%208 = phi double [ %206, %192 ], [ %191, %171 ]
%209 = tail call double @llvm.fabs.f64(double %208)
%210 = tail call double (double*, i32, i32, i32, ...) bitcast (double (...)* @sign_normalize to double (double*, i32, i32, i32, ...)*)(double* %4, i32 1, i32 %2, i32 %2)
%211 = fdiv double %209, %210
ret double %211
}