#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ free(double *);
double *malloc(int);
int /*<<< orphan*/ tridiag_free();
int /*<<< orphan*/ tridiag_malloc(int);
int /*<<< orphan*/ tridiag_premalloc(double *, double *, double *, double *,
                                     double *, int);
void implicit_precalc_3Dx(double *phi, double *ax, double *bx, double *cx,
                          double dt, int L, int M, int N, int Mstart,
                          int Mend) {
  int ii, jj, kk;
  int index;
  double *a = malloc(L * sizeof(*a));
  double *b = malloc(L * sizeof(*b));
  double *c = malloc(L * sizeof(*c));
  double *r = malloc(L * sizeof(*r));
  double *new_row = malloc(L * sizeof(*new_row));
  tridiag_malloc(L);
  for (jj = Mstart; jj < Mend; jj++) {
    for (kk = 0; kk < N; kk++) {
      for (ii = 0; ii < L; ii++) {
        index = ii * M * N + jj * N + kk;
        a[ii] = ax[index];
        b[ii] = bx[index] + 1 / dt;
        c[ii] = cx[index];
        r[ii] = 1 / dt * phi[index];
      }
      tridiag_premalloc(a, b, c, r, new_row, L);
      for (ii = 0; ii < L; ii++)
        phi[ii * M * N + jj * N + kk] = new_row[ii];
    }
  }
  tridiag_free();
  free(a);
  free(b);
  free(c);
  free(r);
  free(new_row);
}


x86 assembly (clang, -O0):
<implicit_precalc_3Dx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9d,-0x30(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x48(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x50(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x60(%rbp)
movslq -0x2c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x2c(%rbp),%edi
call   1070 <tridiag_malloc@plt>
mov    0x18(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    0x20(%rbp),%eax
jge    135f <implicit_precalc_3Dx+0x20f>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    134c <implicit_precalc_3Dx+0x1fc>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    12cb <implicit_precalc_3Dx+0x17b>
mov    -0x34(%rbp),%eax
imul   -0x30(%rbp),%eax
imul   0x10(%rbp),%eax
mov    -0x38(%rbp),%ecx
imul   0x10(%rbp),%ecx
add    %ecx,%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x48(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xd9a(%rip),%xmm1
divsd  -0x28(%rbp),%xmm1
addsd  %xmm1,%xmm0
mov    -0x50(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  0xd62(%rip),%xmm0
divsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x40(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1211 <implicit_precalc_3Dx+0xc1>
mov    -0x48(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    -0x68(%rbp),%r8
mov    -0x2c(%rbp),%r9d
call   1040 <tridiag_premalloc@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1339 <implicit_precalc_3Dx+0x1e9>
mov    -0x68(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x34(%rbp),%ecx
imul   -0x30(%rbp),%ecx
imul   0x10(%rbp),%ecx
mov    -0x38(%rbp),%edx
imul   0x10(%rbp),%edx
add    %edx,%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12ef <implicit_precalc_3Dx+0x19f>
jmp    133e <implicit_precalc_3Dx+0x1ee>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    11fe <implicit_precalc_3Dx+0xae>
jmp    1351 <implicit_precalc_3Dx+0x201>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11eb <implicit_precalc_3Dx+0x9b>
mov    $0x0,%al
call   1050 <tridiag_free@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@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    -0x68(%rbp),%rdi
call   1030 <free@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<implicit_precalc_3Dx>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9,0x60(%rsp)
mov    %r8d,%r14d
movsd  %xmm0,0x8(%rsp)
mov    %rcx,0x80(%rsp)
mov    %rdx,0x78(%rsp)
mov    %rsi,0x48(%rsp)
mov    %rdi,%rbp
mov    0xd0(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0xc8(%rsp),%r15d
mov    0xc0(%rsp),%eax
mov    %eax,0x4(%rsp)
lea    0x0(,%r14,8),%ebx
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,0x40(%rsp)
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,0x38(%rsp)
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,%r13
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,0x30(%rsp)
mov    %r14d,%edi
call   1070 <tridiag_malloc@plt>
mov    0x4(%rsp),%r8d
mov    0x40(%rsp),%rdi
mov    0x48(%rsp),%r9
mov    %r15,0x28(%rsp)
cmp    0x14(%rsp),%r15d
jge    142c <implicit_precalc_3Dx+0x2dc>
mov    %r14,%r10
mov    %r10d,%r15d
movsd  0xde9(%rip),%xmm1
divsd  0x8(%rsp),%xmm1
mov    %r15d,%eax
and    $0xfffffffe,%eax
mov    %rax,0x70(%rsp)
mov    0x28(%rsp),%rcx
mov    %ecx,%eax
imul   %r8d,%eax
mov    %eax,0x1c(%rsp)
mov    %r8d,%r14d
mov    0x60(%rsp),%rax
imul   %eax,%r14d
add    %ecx,%eax
imul   %r8d,%eax
mov    %eax,0x18(%rsp)
lea    (%r14,%r14,1),%eax
mov    %eax,0x5c(%rsp)
mov    %r10,0x50(%rsp)
movsd  %xmm1,0x68(%rsp)
jmp    1291 <implicit_precalc_3Dx+0x141>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x28(%rsp),%rax
add    $0x1,%eax
add    %r8d,0x1c(%rsp)
add    %r8d,0x18(%rsp)
mov    %rax,0x28(%rsp)
cmp    0x14(%rsp),%eax
je     142c <implicit_precalc_3Dx+0x2dc>
test   %r8d,%r8d
jle    1270 <implicit_precalc_3Dx+0x120>
movl   $0x0,0x8(%rsp)
mov    0x18(%rsp),%eax
mov    %eax,0x20(%rsp)
mov    0x1c(%rsp),%ecx
jmp    12ff <implicit_precalc_3Dx+0x1af>
nopl   0x0(%rax)
mov    0x38(%rsp),%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    0x50(%rsp),%r9
call   1040 <tridiag_premalloc@plt>
movsd  0x68(%rsp),%xmm1
mov    0x4(%rsp),%r8d
mov    0x40(%rsp),%rdi
mov    0x48(%rsp),%r9
mov    0x50(%rsp),%r10
mov    0x8(%rsp),%eax
add    $0x1,%eax
mov    0x24(%rsp),%ecx
add    $0x1,%ecx
addl   $0x1,0x20(%rsp)
mov    %eax,0x8(%rsp)
cmp    %r8d,%eax
je     1270 <implicit_precalc_3Dx+0x120>
test   %r10d,%r10d
mov    0x30(%rsp),%r8
mov    %ecx,0x24(%rsp)
jle    12b0 <implicit_precalc_3Dx+0x160>
mov    %ecx,%eax
xor    %ecx,%ecx
mov    0x80(%rsp),%rdx
mov    0x78(%rsp),%rbx
mov    0x38(%rsp),%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cltq
movsd  (%r9,%rax,8),%xmm0
movsd  %xmm0,(%rdi,%rcx,8)
movsd  (%rbx,%rax,8),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsi,%rcx,8)
movsd  (%rdx,%rax,8),%xmm0
movsd  %xmm0,(%r12,%rcx,8)
movsd  0x0(%rbp,%rax,8),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x0(%r13,%rcx,8)
add    $0x1,%rcx
add    %r14d,%eax
cmp    %rcx,%r15
jne    1330 <implicit_precalc_3Dx+0x1e0>
mov    %r12,%rdx
mov    %r13,%rcx
mov    %r15d,%r9d
call   1040 <tridiag_premalloc@plt>
movsd  0x68(%rsp),%xmm1
mov    0x40(%rsp),%rdi
mov    0x48(%rsp),%r9
mov    0x50(%rsp),%r10
test   %r10d,%r10d
mov    0x4(%rsp),%r8d
mov    0x70(%rsp),%r11
mov    0x5c(%rsp),%ebx
jle    12df <implicit_precalc_3Dx+0x18f>
cmp    $0x1,%r10d
jne    13b7 <implicit_precalc_3Dx+0x267>
xor    %eax,%eax
jmp    13fa <implicit_precalc_3Dx+0x2aa>
mov    0x24(%rsp),%eax
mov    %eax,%ecx
mov    0x20(%rsp),%eax
mov    %eax,%edx
xor    %eax,%eax
mov    0x30(%rsp),%rsi
nopw   0x0(%rax,%rax,1)
movsd  (%rsi,%rax,8),%xmm0
movslq %ecx,%rcx
movsd  %xmm0,0x0(%rbp,%rcx,8)
movsd  0x8(%rsi,%rax,8),%xmm0
movslq %edx,%rdx
movsd  %xmm0,0x0(%rbp,%rdx,8)
add    $0x2,%rax
add    %ebx,%edx
add    %ebx,%ecx
cmp    %rax,%r11
jne    13d0 <implicit_precalc_3Dx+0x280>
test   $0x1,%r15b
je     12df <implicit_precalc_3Dx+0x18f>
mov    0x30(%rsp),%rcx
movsd  (%rcx,%rax,8),%xmm0
imul   0x60(%rsp),%eax
add    0x28(%rsp),%eax
imul   %r8d,%eax
add    0x8(%rsp),%eax
cltq
movsd  %xmm0,0x0(%rbp,%rax,8)
jmp    12df <implicit_precalc_3Dx+0x18f>
xor    %eax,%eax
mov    %rdi,%rbx
call   1050 <tridiag_free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%rdi
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @implicit_precalc_3Dx(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9) {
%11 = shl i32 %5, 3
%12 = tail call double* @malloc(i32 %11)
%13 = tail call double* @malloc(i32 %11)
%14 = tail call double* @malloc(i32 %11)
%15 = tail call double* @malloc(i32 %11)
%16 = tail call double* @malloc(i32 %11)
%17 = tail call i32 @tridiag_malloc(i32 %5)
%18 = icmp slt i32 %8, %9
br i1 %18, label %19, label %104
19: ; preds = %10
%20 = icmp sgt i32 %7, 0
%21 = icmp sgt i32 %5, 0
%22 = fdiv double 1.000000e+00, %4
%23 = zext i32 %5 to i64
%24 = and i64 %23, 1
%25 = icmp eq i32 %5, 1
%26 = and i64 %23, 4294967294
%27 = icmp eq i64 %24, 0
br label %28
28: ; preds = %19, %101
%29 = phi i32 [ %8, %19 ], [ %102, %101 ]
br i1 %20, label %30, label %101
30: ; preds = %28, %98
%31 = phi i32 [ %99, %98 ], [ 0, %28 ]
br i1 %21, label %34, label %32
32: ; preds = %30
%33 = tail call i32 @tridiag_premalloc(double* %12, double* %13, double* %14, double* %15, double* %16, i32 %5)
br label %98
34: ; preds = %30, %34
%35 = phi i64 [ %56, %34 ], [ 0, %30 ]
%36 = trunc i64 %35 to i32
%37 = mul i32 %36, %6
%38 = add i32 %37, %29
%39 = mul i32 %38, %7
%40 = add nsw i32 %39, %31
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %1, i64 %41
%43 = load double, double* %42
%44 = getelementptr inbounds double, double* %12, i64 %35
store double %43, double* %44
%45 = getelementptr inbounds double, double* %2, i64 %41
%46 = load double, double* %45
%47 = fadd double %22, %46
%48 = getelementptr inbounds double, double* %13, i64 %35
store double %47, double* %48
%49 = getelementptr inbounds double, double* %3, i64 %41
%50 = load double, double* %49
%51 = getelementptr inbounds double, double* %14, i64 %35
store double %50, double* %51
%52 = getelementptr inbounds double, double* %0, i64 %41
%53 = load double, double* %52
%54 = fmul double %22, %53
%55 = getelementptr inbounds double, double* %15, i64 %35
store double %54, double* %55
%56 = add nuw nsw i64 %35, 1
%57 = icmp eq i64 %56, %23
br i1 %57, label %58, label %34
58: ; preds = %34
%59 = tail call i32 @tridiag_premalloc(double* %12, double* %13, double* %14, double* %15, double* %16, i32 %5)
br i1 %21, label %60, label %98
60: ; preds = %58
br i1 %25, label %86, label %61
61: ; preds = %60, %61
%62 = phi i64 [ %83, %61 ], [ 0, %60 ]
%63 = phi i64 [ %84, %61 ], [ 0, %60 ]
%64 = getelementptr inbounds double, double* %16, i64 %62
%65 = load double, double* %64
%66 = trunc i64 %62 to i32
%67 = mul i32 %66, %6
%68 = add i32 %67, %29
%69 = mul i32 %68, %7
%70 = add nsw i32 %69, %31
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds double, double* %0, i64 %71
store double %65, double* %72
%73 = or i64 %62, 1
%74 = getelementptr inbounds double, double* %16, i64 %73
%75 = load double, double* %74
%76 = trunc i64 %73 to i32
%77 = mul i32 %76, %6
%78 = add i32 %77, %29
%79 = mul i32 %78, %7
%80 = add nsw i32 %79, %31
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %0, i64 %81
store double %75, double* %82
%83 = add nuw nsw i64 %62, 2
%84 = add i64 %63, 2
%85 = icmp eq i64 %84, %26
br i1 %85, label %86, label %61
86: ; preds = %61, %60
%87 = phi i64 [ 0, %60 ], [ %83, %61 ]
br i1 %27, label %98, label %88
88: ; preds = %86
%89 = getelementptr inbounds double, double* %16, i64 %87
%90 = load double, double* %89
%91 = trunc i64 %87 to i32
%92 = mul i32 %91, %6
%93 = add i32 %92, %29
%94 = mul i32 %93, %7
%95 = add nsw i32 %94, %31
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %0, i64 %96
store double %90, double* %97
br label %98
98: ; preds = %88, %86, %32, %58
%99 = add nuw nsw i32 %31, 1
%100 = icmp eq i32 %99, %7
br i1 %100, label %101, label %30
101: ; preds = %98, %28
%102 = add i32 %29, 1
%103 = icmp eq i32 %102, %9
br i1 %103, label %104, label %28
104: ; preds = %101, %10
%105 = tail call i32 (...) @tridiag_free()
%106 = tail call i32 @free(double* %12)
%107 = tail call i32 @free(double* %13)
%108 = tail call i32 @free(double* %14)
%109 = tail call i32 @free(double* %15)
%110 = tail call i32 @free(double* %16)
ret void
}