#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);
int /*<<< orphan*/ printf(char *, double);
double sqrt(double);
void tri_solve(double *alpha, double *beta, int j, double lambda, double *v,
               double b, double *d, double *e) {
  extern int DEBUG_EVECS;
  int i;
  double tol;
  double diff;
  double res;
  void bail();
  tol = 1.0e-15;
  d[1] = alpha[1] - lambda;
  if (fabs(d[1]) < tol) {
    bail("ERROR: Zero pivot in tri_solve().", 1);
  }
  if (j == 1) {
    v[1] = b / d[1];
    return;
  }
  for (i = 2; i <= j; i++) {
    e[i - 1] = beta[i - 1] / d[i - 1];
    d[i] = alpha[i] - lambda - d[i - 1] * e[i - 1] * e[i - 1];
    if (fabs(d[i]) < tol) {
      bail("ERROR: Zero pivot in tri_solve().", 1);
    }
  }
  v[1] = b;
  for (i = 2; i <= j; i++) {
    v[i] = -e[i - 1] * v[i - 1];
  }
  v[j] = v[j] / d[j];
  for (i = j - 1; i >= 1; i--) {
    v[i] = v[i] / d[i] - e[i] * v[i + 1];
  }
  if (DEBUG_EVECS > 1) {
    diff = b - ((alpha[1] - lambda) * v[1] + beta[1] * v[2]);
    res = diff * diff;
    for (i = 2; i <= j - 1; i++) {
      diff = beta[i - 1] * v[i - 1] + (alpha[i] - lambda) * v[i] +
             beta[i] * v[i + 1];
      res += diff * diff;
    }
    diff = beta[j - 1] * v[j - 1] + (alpha[j] - lambda) * v[j];
    res += diff * diff;
    res = sqrt(res);
    if (res > 1.0e-13) {
      printf("Tridiagonal solve residual %g\n", res);
    }
  }
}


x86 assembly (clang, -O0):
<tri_solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%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    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movsd  0xeaf(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x38(%rbp),%rax
movsd  0x8(%rax),%xmm1
movaps 0xe73(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11b3 <tri_solve+0x83>
lea    0xe79(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <bail@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11d9 <tri_solve+0xa9>
movsd  -0x30(%rbp),%xmm0
mov    -0x38(%rbp),%rax
divsd  0x8(%rax),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
jmp    15c6 <tri_solve+0x496>
movl   $0x2,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     12e3 <tri_solve+0x1b3>
mov    -0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
subsd  -0x20(%rbp),%xmm1
mov    -0x38(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xd56(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12d0 <tri_solve+0x1a0>
lea    0xd5c(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <bail@plt>
jmp    12d5 <tri_solve+0x1a5>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11e0 <tri_solve+0xb0>
movsd  -0x30(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movl   $0x2,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     135a <tri_solve+0x22a>
mov    -0x40(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x28(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12f8 <tri_solve+0x1c8>
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x14(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x44(%rbp)
cmpl   $0x1,-0x44(%rbp)
jl     1407 <tri_solve+0x2d7>
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x38(%rbp),%rax
movslq -0x44(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm1
mov    -0x40(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    138a <tri_solve+0x25a>
mov    0x2bda(%rip),%rax
cmpl   $0x1,(%rax)
jle    15c6 <tri_solve+0x496>
movsd  -0x30(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
subsd  -0x20(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm3
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm2
mov    -0x28(%rbp),%rax
mulsd  0x10(%rax),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x2,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jg     151e <tri_solve+0x3ee>
mov    -0x10(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
mov    -0x44(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x44(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x44(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    146c <tri_solve+0x33c>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
subsd  -0x20(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xa72(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    15c1 <tri_solve+0x491>
movsd  -0x60(%rbp),%xmm0
lea    0xa86(%rip),%rdi
call   1030 <printf@plt>
jmp    15c6 <tri_solve+0x496>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tri_solve>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%rbx
movapd %xmm0,%xmm8
movsd  0x8(%rdi),%xmm0
subsd  %xmm8,%xmm0
movsd  %xmm0,0x8(%r8)
andpd  0xea2(%rip),%xmm0
mov    %r9,%rbp
mov    %rcx,%r13
mov    %edx,%r15d
movsd  0xeb1(%rip),%xmm3
ucomisd %xmm0,%xmm3
movsd  %xmm8,0x10(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rdi,%r14
jbe    11b8 <tri_solve+0x88>
lea    0xea5(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
movsd  %xmm1,(%rsp)
call   1040 <bail@plt>
movsd  0xe7c(%rip),%xmm3
mov    %r14,%rdi
mov    0x8(%rsp),%rsi
movsd  (%rsp),%xmm1
movsd  0x10(%rsp),%xmm8
cmp    $0x1,%r15d
jne    11ce <tri_solve+0x9e>
divsd  0x8(%rbx),%xmm1
movsd  %xmm1,0x8(%r13)
jmp    151a <tri_solve+0x3ea>
jg     11db <tri_solve+0xab>
movsd  %xmm1,0x8(%r13)
jmp    133a <tri_solve+0x20a>
movsd  %xmm1,(%rsp)
mov    %r15,0x20(%rsp)
mov    %r15d,%r12d
lea    0x1(%r12),%rax
mov    %rax,0x18(%rsp)
add    $0xffffffffffffffff,%r12
movapd 0xe02(%rip),%xmm4
xor    %r15d,%r15d
jmp    1219 <tri_solve+0xe9>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%r15
cmp    %r15,%r12
je     1295 <tri_solve+0x165>
movsd  0x8(%rsi,%r15,8),%xmm0
divsd  0x8(%rbx,%r15,8),%xmm0
movsd  %xmm0,0x8(%rbp,%r15,8)
movsd  0x10(%rdi,%r15,8),%xmm1
subsd  %xmm8,%xmm1
movsd  0x8(%rbx,%r15,8),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rbx,%r15,8)
andpd  %xmm4,%xmm1
ucomisd %xmm1,%xmm3
jbe    1210 <tri_solve+0xe0>
lea    0xdcb(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <bail@plt>
movapd 0xd87(%rip),%xmm4
movsd  0xd9f(%rip),%xmm3
mov    %r14,%rdi
mov    0x8(%rsp),%rsi
movsd  0x10(%rsp),%xmm8
jmp    1210 <tri_solve+0xe0>
movsd  (%rsp),%xmm1
movsd  %xmm1,0x8(%r13)
mov    0x20(%rsp),%r15
cmp    $0x2,%r15d
jl     133a <tri_solve+0x20a>
mov    $0x2,%eax
movapd %xmm1,%xmm0
mov    0x18(%rsp),%rdx
cmp    $0x3,%edx
je     131c <tri_solve+0x1ec>
lea    -0x2(%rdx),%rcx
and    $0xfffffffffffffffe,%rcx
xor    %eax,%eax
movapd 0xd3c(%rip),%xmm3
movapd %xmm1,%xmm0
nopl   0x0(%rax,%rax,1)
movsd  0x8(%rbp,%rax,8),%xmm2
xorpd  %xmm3,%xmm2
mulsd  %xmm0,%xmm2
movsd  %xmm2,0x10(%r13,%rax,8)
movsd  0x10(%rbp,%rax,8),%xmm0
xorpd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%r13,%rax,8)
add    $0x2,%rax
cmp    %rax,%rcx
jne    12e0 <tri_solve+0x1b0>
add    $0x2,%rax
movsd  (%rsp),%xmm1
test   $0x1,%dl
je     133a <tri_solve+0x20a>
movsd  -0x8(%rbp,%rax,8),%xmm2
xorpd  0xce1(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x0(%r13,%rax,8)
movslq %r15d,%rax
movsd  0x0(%r13,%rax,8),%xmm0
divsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,0x0(%r13,%rax,8)
lea    -0x1(%r15),%ecx
cmp    $0x2,%r15d
jl     138f <tri_solve+0x25f>
mov    %ecx,%edx
add    $0x1,%rdx
movsd  -0x8(%r13,%rdx,8),%xmm0
divsd  -0x8(%rbx,%rdx,8),%xmm0
movsd  -0x8(%rbp,%rdx,8),%xmm2
mulsd  0x0(%r13,%rdx,8),%xmm2
subsd  %xmm2,%xmm0
movsd  %xmm0,-0x8(%r13,%rdx,8)
add    $0xffffffffffffffff,%rdx
cmp    $0x1,%rdx
ja     1360 <tri_solve+0x230>
mov    0x2c52(%rip),%rdx
cmpl   $0x2,(%rdx)
jl     151a <tri_solve+0x3ea>
movsd  0x8(%rdi),%xmm3
subsd  %xmm8,%xmm3
movsd  0x8(%r13),%xmm0
movsd  0x10(%r13),%xmm2
movsd  0x8(%rsi),%xmm9
movapd %xmm9,%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm0,%xmm3
addsd  %xmm4,%xmm3
subsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm1
movapd %xmm1,%xmm4
cmp    $0x3,%r15d
jl     14d6 <tri_solve+0x3a6>
mov    %r15d,%r8d
jne    13f5 <tri_solve+0x2c5>
mov    $0x2,%edx
movapd %xmm4,%xmm1
jmp    149b <tri_solve+0x36b>
lea    -0x2(%r8),%rbx
and    $0xfffffffffffffffe,%rbx
neg    %rbx
mov    $0x2,%edx
movapd %xmm2,%xmm3
movapd %xmm4,%xmm1
nopl   (%rax)
mulsd  %xmm9,%xmm0
movsd  (%rdi,%rdx,8),%xmm4
movsd  0x8(%rdi,%rdx,8),%xmm5
subsd  %xmm8,%xmm4
mulsd  %xmm3,%xmm4
addsd  %xmm0,%xmm4
movsd  0x8(%r13,%rdx,8),%xmm0
movsd  0x10(%r13,%rdx,8),%xmm2
movsd  (%rsi,%rdx,8),%xmm6
movsd  0x8(%rsi,%rdx,8),%xmm9
movapd %xmm6,%xmm7
mulsd  %xmm0,%xmm7
addsd  %xmm4,%xmm7
mulsd  %xmm7,%xmm7
addsd  %xmm1,%xmm7
subsd  %xmm8,%xmm5
mulsd  %xmm0,%xmm5
mulsd  %xmm3,%xmm6
addsd  %xmm5,%xmm6
movapd %xmm9,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm6,%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm7,%xmm1
lea    (%rbx,%rdx,1),%rbp
add    $0x2,%rbp
add    $0x2,%rdx
movapd %xmm2,%xmm3
cmp    $0x2,%rbp
jne    1410 <tri_solve+0x2e0>
movapd %xmm1,%xmm4
test   $0x1,%r8b
je     14d6 <tri_solve+0x3a6>
movsd  (%rdi,%rdx,8),%xmm3
subsd  %xmm8,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm9
movsd  (%rsi,%rdx,8),%xmm0
mulsd  0x8(%r13,%rdx,8),%xmm0
addsd  %xmm3,%xmm9
addsd  %xmm9,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm0,%xmm4
movslq %ecx,%rcx
movsd  (%rsi,%rcx,8),%xmm0
movsd  (%rdi,%rax,8),%xmm1
subsd  %xmm8,%xmm1
mulsd  0x0(%r13,%rax,8),%xmm1
mulsd  0x0(%r13,%rcx,8),%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm4,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1529 <tri_solve+0x3f9>
sqrtsd %xmm0,%xmm0
ucomisd 0xb10(%rip),%xmm0
ja     1538 <tri_solve+0x408>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
call   1050 <sqrt@plt>
ucomisd 0xaf2(%rip),%xmm0
jbe    151a <tri_solve+0x3ea>
lea    0xb13(%rip),%rdi
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

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

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