#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 Mfunc1D(double, double, double);
double Vfunc_beta(double, double, double);
int /*<<< orphan*/ compute_abc_nobc(double *, double *, double *, double *,
                                    double *, double, int, double *, double *,
                                    double *);
int /*<<< orphan*/ compute_delj(double *, double *, double *, int, double *,
                                int);
int /*<<< orphan*/ compute_dfactor(double *, int, double *);
int /*<<< orphan*/ compute_dx(double *, int, double *);
int /*<<< orphan*/ compute_xInt(double *, int, double *);
int /*<<< orphan*/ free(double *);
double *malloc(int);
int /*<<< orphan*/ tridiag(double *, double *, double *, double *, double *,
                           int);
void implicit_1Dx(double *phi, double *xx, double nu, double gamma, double h,
                  double beta, double dt, int L, int use_delj_trick) {
  int ii;
  double *dx = malloc((L - 1) * sizeof(*dx));
  double *dfactor = malloc(L * sizeof(*dfactor));
  double *xInt = malloc((L - 1) * sizeof(*xInt));
  double Mfirst, Mlast;
  double *MInt = malloc((L - 1) * sizeof(*MInt));
  double *V = malloc(L * sizeof(*V));
  double *VInt = malloc((L - 1) * sizeof(*VInt));
  double *delj = malloc((L - 1) * sizeof(*delj));
  double *a = malloc(L * sizeof(*a));
  double *b = malloc(L * sizeof(*b));
  double *c = malloc(L * sizeof(*c));
  double *r = malloc(L * sizeof(*r));
  compute_dx(xx, L, dx);
  compute_dfactor(dx, L, dfactor);
  compute_xInt(xx, L, xInt);
  Mfirst = Mfunc1D(xx[0], gamma, h);
  Mlast = Mfunc1D(xx[L - 1], gamma, h);
  for (ii = 0; ii < L; ii++)
    V[ii] = Vfunc_beta(xx[ii], nu, beta);
  for (ii = 0; ii < L - 1; ii++) {
    MInt[ii] = Mfunc1D(xInt[ii], gamma, h);
    VInt[ii] = Vfunc_beta(xInt[ii], nu, beta);
  }
  compute_delj(dx, MInt, VInt, L, delj, use_delj_trick);
  compute_abc_nobc(dx, dfactor, delj, MInt, V, dt, L, a, b, c);
  for (ii = 0; ii < L; ii++)
    r[ii] = phi[ii] / dt;
  if (Mfirst <= 0)
    b[0] += (0.5 / nu - Mfirst) * 2. / dx[0];
  if (Mlast >= 0)
    b[L - 1] += -(-0.5 / nu - Mlast) * 2. / dx[L - 2];
  tridiag(a, b, c, r, phi, L);
  free(dx);
  free(dfactor);
  free(xInt);
  free(MInt);
  free(V);
  free(VInt);
  free(delj);
  free(a);
  free(b);
  free(c);
  free(r);
}


x86 assembly (clang, -O0):
<implicit_1Dx>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
mov    %edx,-0x3c(%rbp)
mov    %ecx,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x78(%rbp)
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x80(%rbp)
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    -0x3c(%rbp),%eax
sub    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x90(%rbp)
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x98(%rbp)
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0xa0(%rbp)
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0xa8(%rbp)
movslq -0x3c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0xb0(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x50(%rbp),%rdx
call   10a0 <compute_dx@plt>
mov    -0x50(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x58(%rbp),%rdx
call   1080 <compute_dfactor@plt>
mov    -0x10(%rbp),%rdi
mov    -0x3c(%rbp),%esi
mov    -0x60(%rbp),%rdx
call   10b0 <compute_xInt@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1060 <Mfunc1D@plt>
movsd  %xmm0,-0x68(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1060 <Mfunc1D@plt>
movsd  %xmm0,-0x70(%rbp)
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1385 <implicit_1Dx+0x1e5>
mov    -0x10(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
call   1040 <Vfunc_beta@plt>
mov    -0x80(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1342 <implicit_1Dx+0x1a2>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1400 <implicit_1Dx+0x260>
mov    -0x60(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1060 <Mfunc1D@plt>
mov    -0x78(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x60(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
call   1040 <Vfunc_beta@plt>
mov    -0x88(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    138c <implicit_1Dx+0x1ec>
mov    -0x50(%rbp),%rdi
mov    -0x78(%rbp),%rsi
mov    -0x88(%rbp),%rdx
mov    -0x3c(%rbp),%ecx
mov    -0x90(%rbp),%r8
mov    -0x40(%rbp),%r9d
call   10c0 <compute_delj@plt>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rsi
mov    -0x90(%rbp),%rdx
mov    -0x78(%rbp),%rcx
mov    -0x80(%rbp),%r8
movsd  -0x38(%rbp),%xmm0
mov    -0x3c(%rbp),%r9d
mov    -0x98(%rbp),%r11
mov    -0xa0(%rbp),%r10
mov    -0xa8(%rbp),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <compute_abc_nobc@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    14ad <implicit_1Dx+0x30d>
mov    -0x8(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x38(%rbp),%xmm0
mov    -0xb0(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1471 <implicit_1Dx+0x2d1>
xorps  %xmm0,%xmm0
ucomisd -0x68(%rbp),%xmm0
jb     14f0 <implicit_1Dx+0x350>
movsd  0xb45(%rip),%xmm0
divsd  -0x18(%rbp),%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  0xb2b(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
divsd  (%rax),%xmm0
mov    -0xa0(%rbp),%rax
addsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1563 <implicit_1Dx+0x3c3>
movsd  0xb06(%rip),%xmm0
divsd  -0x18(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xacd(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0xa0(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x98(%rbp),%rdi
mov    -0xa0(%rbp),%rsi
mov    -0xa8(%rbp),%rdx
mov    -0xb0(%rbp),%rcx
mov    -0x8(%rbp),%r8
mov    -0x3c(%rbp),%r9d
call   1070 <tridiag@plt>
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xa8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xb0(%rbp),%rdi
call   1030 <free@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<implicit_1Dx>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %ecx,0x1c(%rsp)
movaps %xmm4,0xa0(%rsp)
movsd  %xmm3,0x98(%rsp)
movsd  %xmm2,0x60(%rsp)
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,0x30(%rsp)
mov    %rsi,%r12
mov    %rdi,0x90(%rsp)
mov    %edx,0xc(%rsp)
movslq %edx,%r13
lea    -0x1(%r13),%rax
mov    %rax,0x68(%rsp)
lea    -0x8(,%r13,8),%ebp
ff
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,0x10(%rsp)
lea    0x0(,%r13,8),%ebx
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,0x20(%rsp)
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,0x58(%rsp)
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,%r14
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,0x50(%rsp)
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,0x48(%rsp)
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,0x40(%rsp)
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,0x38(%rsp)
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,0x88(%rsp)
mov    %ebx,%edi
mov    0x10(%rsp),%rbx
call   1090 <malloc@plt>
mov    %rax,0x80(%rsp)
mov    %r12,%rdi
mov    %r13d,%esi
mov    %rbx,%rdx
call   10a0 <compute_dx@plt>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    0x20(%rsp),%rdx
call   1080 <compute_dfactor@plt>
mov    %r12,%rdi
mov    %r13d,%esi
mov    %r15,%rdx
call   10b0 <compute_xInt@plt>
movsd  (%r12),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x60(%rsp),%xmm2
call   1060 <Mfunc1D@plt>
movsd  %xmm0,0x70(%rsp)
movsd  -0x8(%r12,%r13,8),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x60(%rsp),%xmm2
call   1060 <Mfunc1D@plt>
mov    %r13,0xb8(%rsp)
test   %r13d,%r13d
mov    %r15,0xc0(%rsp)
movsd  %xmm0,0x78(%rsp)
jle    1468 <implicit_1Dx+0x2c8>
mov    0xc(%rsp),%ebp
mov    %ebp,%r13d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  (%r12,%rbx,8),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0x98(%rsp),%xmm2
call   1040 <Vfunc_beta@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1320 <implicit_1Dx+0x180>
mov    %r14,0xb0(%rsp)
cmp    $0x2,%ebp
mov    0x58(%rsp),%r12
mov    0x50(%rsp),%r14
movsd  0x28(%rsp),%xmm1
jl     13b6 <implicit_1Dx+0x216>
mov    0x68(%rsp),%ebp
xor    %ebx,%ebx
nopl   0x0(%rax)
movsd  (%r15,%rbx,8),%xmm0
movsd  0x60(%rsp),%xmm2
call   1060 <Mfunc1D@plt>
movsd  %xmm0,(%r12,%rbx,8)
movsd  (%r15,%rbx,8),%xmm0
movsd  0x30(%rsp),%xmm1
movsd  0x98(%rsp),%xmm2
call   1040 <Vfunc_beta@plt>
movsd  0x28(%rsp),%xmm1
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1370 <implicit_1Dx+0x1d0>
mov    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    0xc(%rsp),%ecx
mov    0x48(%rsp),%rbx
mov    %rbx,%r8
mov    0x1c(%rsp),%r9d
call   10c0 <compute_delj@plt>
sub    $0x8,%rsp
mov    %rbp,%rdi
mov    0x28(%rsp),%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    0xb8(%rsp),%r14
mov    %r14,%r8
movapd 0xa8(%rsp),%xmm0
mov    0x14(%rsp),%ebp
mov    %ebp,%r9d
mov    0x90(%rsp),%rbx
push   %rbx
push   0x48(%rsp)
push   0x58(%rsp)
call   1050 <compute_abc_nobc@plt>
mov    %ebp,%r9d
movapd 0xc0(%rsp),%xmm3
add    $0x20,%rsp
test   %ebp,%ebp
mov    0x90(%rsp),%r8
movsd  0x30(%rsp),%xmm2
mov    0x80(%rsp),%r12
movsd  0x78(%rsp),%xmm4
movsd  0x70(%rsp),%xmm5
jle    1599 <implicit_1Dx+0x3f9>
cmp    $0x1,%r9d
jne    14fa <implicit_1Dx+0x35a>
xor    %eax,%eax
jmp    1580 <implicit_1Dx+0x3e0>
mov    %rbx,%rdi
mov    0x58(%rsp),%r15
mov    %r15,%rsi
mov    0x50(%rsp),%rdx
mov    0xc(%rsp),%r12d
mov    %r12d,%ecx
mov    0x48(%rsp),%rbp
mov    %rbp,%r8
mov    0x1c(%rsp),%r9d
call   10c0 <compute_delj@plt>
sub    $0x8,%rsp
mov    %rbx,%rdi
mov    0x28(%rsp),%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r14,%r8
movapd 0xa8(%rsp),%xmm0
mov    %r12d,%r9d
mov    0x90(%rsp),%rbx
push   %rbx
push   0x48(%rsp)
push   0x58(%rsp)
call   1050 <compute_abc_nobc@plt>
movsd  0x98(%rsp),%xmm4
add    $0x20,%rsp
mov    %r12d,%r9d
mov    0x90(%rsp),%r8
movsd  0x30(%rsp),%xmm2
mov    0x80(%rsp),%r12
movsd  0x70(%rsp),%xmm5
jmp    1599 <implicit_1Dx+0x3f9>
mov    %r13d,%eax
and    $0xfffffffe,%eax
movapd %xmm3,%xmm0
unpcklpd %xmm3,%xmm0
lea    -0x2(%rax),%rdx
mov    %rdx,%rdi
shr    %rdi
add    $0x1,%rdi
test   %rdx,%rdx
je     16a1 <implicit_1Dx+0x501>
mov    %rdi,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movupd (%r8,%rdx,8),%xmm1
divpd  %xmm0,%xmm1
movupd %xmm1,(%r12,%rdx,8)
movupd 0x10(%r8,%rdx,8),%xmm1
divpd  %xmm0,%xmm1
movupd %xmm1,0x10(%r12,%rdx,8)
add    $0x4,%rdx
add    $0xfffffffffffffffe,%rsi
jne    1530 <implicit_1Dx+0x390>
test   $0x1,%dil
je     1572 <implicit_1Dx+0x3d2>
movupd (%r8,%rdx,8),%xmm1
divpd  %xmm0,%xmm1
movupd %xmm1,(%r12,%rdx,8)
cmp    %r13,%rax
je     1599 <implicit_1Dx+0x3f9>
nopw   0x0(%rax,%rax,1)
movsd  (%r8,%rax,8),%xmm0
divsd  %xmm3,%xmm0
movsd  %xmm0,(%r12,%rax,8)
add    $0x1,%rax
cmp    %rax,%r13
jne    1580 <implicit_1Dx+0x3e0>
mov    %rbx,%r15
xorpd  %xmm0,%xmm0
ucomisd %xmm5,%xmm0
mov    0x38(%rsp),%rbx
jb     15d0 <implicit_1Dx+0x430>
movsd  0xa4d(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm5,%xmm1
addsd  %xmm1,%xmm1
mov    0x10(%rsp),%rax
divsd  (%rax),%xmm1
addsd  (%rbx),%xmm1
movsd  %xmm1,(%rbx)
ucomisd %xmm0,%xmm4
mov    0x58(%rsp),%r13
mov    0x40(%rsp),%rbp
jb     161a <implicit_1Dx+0x47a>
movsd  0xa20(%rip),%xmm0
divsd  %xmm2,%xmm0
subsd  %xmm4,%xmm0
addsd  %xmm0,%xmm0
mov    0xb8(%rsp),%rax
mov    0x10(%rsp),%rdx
divsd  -0x10(%rdx,%rax,8),%xmm0
mov    0x68(%rsp),%rax
movsd  (%rbx,%rax,8),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rax,8)
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
call   1070 <tridiag@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0xc0(%rsp),%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x50(%rsp),%rdi
call   1030 <free@plt>
mov    0x48(%rsp),%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>
xor    %edx,%edx
test   $0x1,%dil
jne    1562 <implicit_1Dx+0x3c2>
jmp    1572 <implicit_1Dx+0x3d2>

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

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