#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 *zeros(int);
double *backSubstitution(int n, double *matrix, double b[]) {
  int i, j, k;
  double aux, temp;
  double *x = zeros(n);
  for (i = 0; i < (n - 1); i++) {
    for (j = (i + 1); j < n; j++) {
      aux = *(matrix + n * j + i) / *(matrix + n * i + i);
      for (k = i; k < n; k++) {
        *(matrix + n * j + k) -= (aux * (*(matrix + n * i + k)));
      }
      b[j] -= (aux * b[i]);
    }
  }
  x[n - 1] = b[n - 1] / *(matrix + n * (n - 1) + n - 1);
  for (i = (n - 2); i >= 0; i--) {
    temp = b[i];
    for (j = (i + 1); j < n; j++) {
      temp -= (*(matrix + n * i + j) * x[j]);
    }
    x[i] = temp / *(matrix + n * i + i);
  }
  return x;
}


x86 assembly (clang, -O0):
<backSubstitution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <zeros@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1286 <backSubstitution+0x176>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1273 <backSubstitution+0x163>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x20(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1222 <backSubstitution+0x112>
movsd  -0x30(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x20(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a3 <backSubstitution+0x93>
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movq   %xmm0,%rdx
movabs $0x8000000000000000,%rsi
xor    %rsi,%rdx
movq   %rdx,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1150 <backSubstitution+0x40>
jmp    1278 <backSubstitution+0x168>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1136 <backSubstitution+0x26>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
imul   %edx,%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x4(%rbp),%rcx
divsd  -0x8(%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     13a8 <backSubstitution+0x298>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    136a <backSubstitution+0x25a>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x38(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    12fc <backSubstitution+0x1ec>
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
imul   -0x1c(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
movslq -0x1c(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x40(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    12d7 <backSubstitution+0x1c7>
mov    -0x40(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<backSubstitution>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    %rdx,%r12
mov    %rsi,%r14
mov    %edi,%ebx
call   1030 <zeros@plt>
lea    -0x1(%rbx),%edx
cmp    $0x1,%ebx
jle    1573 <backSubstitution+0x463>
mov    %rax,0x58(%rsp)
mov    %rbx,0x60(%rsp)
mov    %ebx,%ecx
mov    %edx,0x14(%rsp)
mov    %edx,%eax
mov    %rax,0x78(%rsp)
lea    0x1(%rcx),%rax
mov    %rax,0xb8(%rsp)
lea    0x0(,%rcx,8),%rax
mov    %rax,0x50(%rsp)
lea    0x8(,%rcx,8),%rax
mov    %rax,0x38(%rsp)
lea    (%rcx,%rcx,1),%rax
mov    %rax,0x70(%rsp)
lea    0x8(%r14),%r9
mov    %rcx,%rax
neg    %rax
mov    %rax,0xe0(%rsp)
lea    (%r14,%rcx,8),%rax
add    $0x38,%rax
mov    %rax,0x30(%rsp)
lea    0x38(%r14),%rbp
lea    -0x5(%rcx),%rax
mov    %rax,0x28(%rsp)
lea    (%r14,%rcx,8),%rax
mov    %rax,0x20(%rsp)
mov    $0x1,%eax
mov    %rax,0x18(%rsp)
xor    %r8d,%r8d
movapd 0xe36(%rip),%xmm0
mov    %r9,0x68(%rsp)
mov    %r12,0x90(%rsp)
mov    %r14,0x40(%rsp)
jmp    1219 <backSubstitution+0x109>
xchg   %ax,%ax
addq   $0x1,0x18(%rsp)
mov    0x38(%rsp),%rax
add    %rax,0x30(%rsp)
add    %rax,%rbp
addq   $0xffffffffffffffff,0x28(%rsp)
mov    0x50(%rsp),%rax
add    %rax,0x20(%rsp)
add    %rax,%r9
mov    0x88(%rsp),%r8
cmp    0x78(%rsp),%r8
je     1578 <backSubstitution+0x468>
lea    0x1(%r8),%rax
mov    %rax,0x88(%rsp)
cmp    %rcx,%rax
jae    11e0 <backSubstitution+0xd0>
mov    0x28(%rsp),%rax
shr    $0x2,%rax
add    $0x1,%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,0x80(%rsp)
mov    %r8,%rdi
not    %rdi
lea    (%rdi,%rcx,1),%rax
add    $0xfffffffffffffffc,%rax
mov    %rax,0xb0(%rsp)
shr    $0x2,%rax
add    $0x1,%rax
mov    %rax,0xa8(%rsp)
add    %rcx,%rdi
mov    0x38(%rsp),%rsi
imul   %r8,%rsi
mov    %r8,%rdx
imul   %rcx,%rdx
mov    0x70(%rsp),%rax
add    %rdx,%rax
mov    %rax,0xd0(%rsp)
mov    0x68(%rsp),%rax
mov    %rsi,0xd8(%rsp)
lea    (%rax,%rsi,1),%rax
mov    %rax,0xc8(%rsp)
lea    (%rdx,%rcx,1),%rsi
lea    (%r14,%rsi,8),%rax
mov    %rax,0xc0(%rsp)
lea    (%r14,%rdx,8),%rax
mov    %rax,0x8(%rsp)
lea    0x1(%r8),%rax
mov    %rax,(%rsp)
mov    %rdi,0x48(%rsp)
and    $0xfffffffffffffffc,%rdi
mov    %rdi,0xa0(%rsp)
lea    (%r8,%rdi,1),%rax
add    $0x1,%rax
mov    %rax,0x98(%rsp)
mov    0x20(%rsp),%r10
mov    0x30(%rsp),%r11
xor    %esi,%esi
mov    0x18(%rsp),%r13
jmp    132e <backSubstitution+0x21e>
nopw   0x0(%rax,%rax,1)
mulsd  (%r12,%r8,8),%xmm1
addsd  (%r12,%r13,8),%xmm1
movsd  %xmm1,(%r12,%r13,8)
add    $0x1,%r13
add    $0x1,%rsi
mov    0x50(%rsp),%rax
add    %rax,%r11
add    %rax,%r10
cmp    %rcx,%r13
je     11e0 <backSubstitution+0xd0>
mov    %r13,%rdx
imul   %rcx,%rdx
lea    (%r14,%rdx,8),%r15
movsd  (%r15,%r8,8),%xmm2
mov    0x8(%rsp),%rax
movsd  (%rax,%r8,8),%xmm3
movapd %xmm2,%xmm1
xorpd  %xmm0,%xmm1
divsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,(%r15,%r8,8)
cmp    %rcx,(%rsp)
je     1300 <backSubstitution+0x1f0>
mov    (%rsp),%rdx
cmpq   $0x4,0x48(%rsp)
jae    13f0 <backSubstitution+0x2e0>
mov    %ecx,%eax
sub    %edx,%eax
mov    %rdx,%rdi
test   $0x1,%al
je     139f <backSubstitution+0x28f>
mov    0x8(%rsp),%rax
movsd  (%rax,%rdx,8),%xmm2
mulsd  %xmm1,%xmm2
addsd  (%r15,%rdx,8),%xmm2
movsd  %xmm2,(%r15,%rdx,8)
lea    0x1(%rdx),%rdi
not    %rdx
cmp    0xe0(%rsp),%rdx
je     1300 <backSubstitution+0x1f0>
movsd  -0x8(%r9,%rdi,8),%xmm2
mulsd  %xmm1,%xmm2
addsd  (%r10,%rdi,8),%xmm2
movsd  %xmm2,(%r10,%rdi,8)
movsd  (%r9,%rdi,8),%xmm2
mulsd  %xmm1,%xmm2
addsd  0x8(%r10,%rdi,8),%xmm2
movsd  %xmm2,0x8(%r10,%rdi,8)
add    $0x2,%rdi
cmp    %rdi,%rcx
jne    13b0 <backSubstitution+0x2a0>
jmp    1300 <backSubstitution+0x1f0>
nopl   (%rax)
mov    %rsi,%rdx
imul   %rcx,%rdx
mov    0xb8(%rsp),%rax
lea    (%rax,%rdx,1),%rdi
lea    (%r14,%rdi,8),%rdi
add    0xd8(%rsp),%rdi
add    0xd0(%rsp),%rdx
lea    (%r14,%rdx,8),%rbx
cmp    0xc0(%rsp),%rdi
setb   %r14b
cmp    %rbx,0xc8(%rsp)
setb   %al
mov    (%rsp),%rdx
test   %al,%r14b
mov    0x40(%rsp),%r14
jne    1376 <backSubstitution+0x266>
mov    (%rsp),%rdx
cmp    %rbx,%rdi
jb     1376 <backSubstitution+0x266>
movapd %xmm1,%xmm2
unpcklpd %xmm1,%xmm2
cmpq   $0x4,0xb0(%rsp)
jae    146c <backSubstitution+0x35c>
xor    %r12d,%r12d
jmp    14fc <backSubstitution+0x3ec>
mov    0x80(%rsp),%r14
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
movupd -0x30(%rbp,%r12,8),%xmm3
movupd -0x20(%rbp,%r12,8),%xmm4
mulpd  %xmm2,%xmm3
movupd -0x30(%r11,%r12,8),%xmm5
addpd  %xmm3,%xmm5
movupd -0x20(%r11,%r12,8),%xmm3
movupd -0x10(%r11,%r12,8),%xmm6
movupd (%r11,%r12,8),%xmm7
mulpd  %xmm2,%xmm4
addpd  %xmm3,%xmm4
movupd %xmm5,-0x30(%r11,%r12,8)
movupd %xmm4,-0x20(%r11,%r12,8)
movupd -0x10(%rbp,%r12,8),%xmm3
movupd 0x0(%rbp,%r12,8),%xmm4
mulpd  %xmm2,%xmm3
addpd  %xmm6,%xmm3
mulpd  %xmm2,%xmm4
addpd  %xmm7,%xmm4
movupd %xmm3,-0x10(%r11,%r12,8)
movupd %xmm4,(%r11,%r12,8)
add    $0x8,%r12
add    $0xfffffffffffffffe,%r14
jne    1480 <backSubstitution+0x370>
testb  $0x1,0xa8(%rsp)
01
mov    0x40(%rsp),%r14
je     154b <backSubstitution+0x43b>
add    (%rsp),%r12
mov    0x8(%rsp),%rax
movupd (%rax,%r12,8),%xmm3
movupd 0x10(%rax,%r12,8),%xmm4
movupd (%r15,%r12,8),%xmm5
movupd 0x10(%r15,%r12,8),%xmm6
mulpd  %xmm2,%xmm3
addpd  %xmm5,%xmm3
mulpd  %xmm2,%xmm4
addpd  %xmm6,%xmm4
movupd %xmm3,(%r15,%r12,8)
movupd %xmm4,0x10(%r15,%r12,8)
mov    0x98(%rsp),%rdx
mov    0xa0(%rsp),%rax
cmp    %rax,0x48(%rsp)
mov    0x90(%rsp),%r12
je     1300 <backSubstitution+0x1f0>
jmp    1376 <backSubstitution+0x266>
movslq %ebx,%rcx
jmp    1586 <backSubstitution+0x476>
mov    0x60(%rsp),%rbx
mov    0x58(%rsp),%rax
mov    0x14(%rsp),%edx
movslq %edx,%rsi
imul   %ebx,%edx
movsd  (%r12,%rsi,8),%xmm0
movslq %edx,%rdx
lea    (%r14,%rdx,8),%rdx
divsd  -0x8(%rdx,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rsi,8)
cmp    $0x2,%ebx
jl     1649 <backSubstitution+0x539>
lea    -0x2(%rbx),%edx
lea    0x8(,%rdx,8),%rbp
imul   %rcx,%rbp
add    %r14,%rbp
lea    0x0(,%rcx,8),%r8
xor    $0xfffffffffffffff8,%r8
lea    (%rax,%rcx,8),%rdi
sub    %ecx,%ebx
jmp    1605 <backSubstitution+0x4f5>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    (%r14,%r9,8),%rsi
divsd  (%rsi,%rdx,8),%xmm0
movsd  %xmm0,(%rax,%rdx,8)
lea    -0x1(%rdx),%rsi
add    %r8,%rbp
add    $0xfffffffffffffff8,%rdi
add    $0x1,%rbx
test   %rdx,%rdx
mov    %rsi,%rdx
jle    1649 <backSubstitution+0x539>
movsd  (%r12,%rdx,8),%xmm0
lea    0x1(%rdx),%rsi
mov    %rdx,%r9
imul   %rcx,%r9
cmp    %rcx,%rsi
jge    15e0 <backSubstitution+0x4d0>
mov    $0xffffffffffffffff,%rsi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0x0(%rbp,%rsi,8),%xmm1
mulsd  (%rdi,%rsi,8),%xmm1
subsd  %xmm1,%xmm0
add    $0x1,%rsi
cmp    %esi,%ebx
jne    1630 <backSubstitution+0x520>
jmp    15e0 <backSubstitution+0x4d0>
add    $0xe8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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