#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 *);
int /*<<< orphan*/ getQR(double *, int, int, double *, double *, double *);
int /*<<< orphan*/ itranspose(double *, int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ mmult(double *, double *, double *, int, int, int);
int /*<<< orphan*/ mtranspose(double *, int, int, double *);
int /*<<< orphan*/ qrdecomp(double *, int, int, double *);
int lls_qr_undetermined(double *Ai, double *bi, int M, int N, double *xo) {
  int retval, i, c1, l, j;
  double *A, *bvec, *Q, *R, *z, *b;
  double sum;
  retval = 0;
  A = (double *)malloc(sizeof(double) * N * M);
  bvec = (double *)malloc(sizeof(double) * M);
  Q = (double *)malloc(sizeof(double) * N * M);
  R = (double *)malloc(sizeof(double) * M * M);
  z = (double *)malloc(sizeof(double) * M);
  b = (double *)malloc(sizeof(double) * M);
  for (j = 0; j < M; ++j) {
    b[j] = bi[j];
  }
  mtranspose(Ai, M, N, A);
  qrdecomp(A, N, M, bvec);
  getQR(A, N, M, bvec, Q, R);
  itranspose(R, M, M);
  z[0] = b[0] / R[0];
  for (i = 1; i < M; i++) {
    sum = 0.;
    c1 = i * M;
    l = i * M + i;
    for (j = 0; j < i; j++) {
      sum += R[c1 + j] * z[j];
    }
    z[i] = (b[i] - sum) / R[l];
  }
  mmult(Q, z, xo, N, M, 1);
  free(A);
  free(bvec);
  free(Q);
  free(R);
  free(z);
  free(b);
  return retval;
}


x86 assembly (clang, -O0):
<lls_qr_undetermined>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x48(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x50(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x60(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1256 <lls_qr_undetermined+0xe6>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x68(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1222 <lls_qr_undetermined+0xb2>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x40(%rbp),%rcx
call   1060 <mtranspose@plt>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x48(%rbp),%rcx
call   1070 <qrdecomp@plt>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0x58(%rbp),%r9
call   1090 <getQR@plt>
mov    -0x58(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <itranspose@plt>
mov    -0x68(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x58(%rbp),%rax
divsd  (%rax),%xmm0
mov    -0x60(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    137c <lls_qr_undetermined+0x20c>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x28(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
imul   -0x14(%rbp),%eax
add    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1342 <lls_qr_undetermined+0x1d2>
mov    -0x58(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    -0x34(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x70(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12f7 <lls_qr_undetermined+0x187>
mov    -0x68(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
subsd  -0x70(%rbp),%xmm0
mov    -0x58(%rbp),%rax
movslq -0x30(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x60(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12c5 <lls_qr_undetermined+0x155>
mov    -0x50(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    $0x1,%r9d
call   1040 <mmult@plt>
mov    -0x40(%rbp),%rdi
call   1030 <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>
mov    -0x24(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lls_qr_undetermined>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r8,0x30(%rsp)
mov    %ecx,%ebp
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,0x20(%rsp)
mov    %ecx,0xc(%rsp)
imul   %edx,%ebp
shl    $0x3,%ebp
mov    %ebp,%edi
call   1080 <malloc@plt>
mov    %rax,0x18(%rsp)
lea    0x0(,%r14,8),%ebx
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %rax,0x10(%rsp)
mov    %ebp,%edi
call   1080 <malloc@plt>
mov    %rax,0x28(%rsp)
mov    %ebx,%edi
imul   %r14d,%edi
call   1080 <malloc@plt>
mov    %rax,(%rsp)
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %r14,%rbx
mov    %rax,%r13
mov    %ebx,%r14d
test   %ebx,%ebx
jle    1397 <lls_qr_undetermined+0x227>
cmp    $0x4,%ebx
jb     121d <lls_qr_undetermined+0xad>
lea    (%r15,%r14,8),%rax
cmp    %rax,%r13
jae    12b5 <lls_qr_undetermined+0x145>
lea    0x0(,%r14,8),%rax
add    %r13,%rax
cmp    %r15,%rax
jbe    12b5 <lls_qr_undetermined+0x145>
xor    %eax,%eax
mov    %rax,%rcx
not    %rcx
add    %r14,%rcx
mov    %r14,%rdx
and    $0x3,%rdx
je     1257 <lls_qr_undetermined+0xe7>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%rax,8),%xmm0
movsd  %xmm0,0x0(%r13,%rax,8)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    1240 <lls_qr_undetermined+0xd0>
cmp    $0x3,%rcx
jb     1397 <lls_qr_undetermined+0x227>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%r15,%rax,8),%xmm0
movsd  %xmm0,0x0(%r13,%rax,8)
movsd  0x8(%r15,%rax,8),%xmm0
movsd  %xmm0,0x8(%r13,%rax,8)
movsd  0x10(%r15,%rax,8),%xmm0
movsd  %xmm0,0x10(%r13,%rax,8)
movsd  0x18(%r15,%rax,8),%xmm0
movsd  %xmm0,0x18(%r13,%rax,8)
add    $0x4,%rax
cmp    %rax,%r14
jne    1270 <lls_qr_undetermined+0x100>
jmp    1397 <lls_qr_undetermined+0x227>
mov    %r14d,%eax
and    $0xfffffffc,%eax
lea    -0x4(%rax),%rdi
mov    %rdi,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
mov    %edx,%ecx
and    $0x3,%ecx
cmp    $0xc,%rdi
jae    12d9 <lls_qr_undetermined+0x169>
xor    %edi,%edi
jmp    134b <lls_qr_undetermined+0x1db>
and    $0xfffffffffffffffc,%rdx
xor    %edi,%edi
nop
movups (%r15,%rdi,8),%xmm0
movups 0x10(%r15,%rdi,8),%xmm1
movups %xmm0,0x0(%r13,%rdi,8)
movups %xmm1,0x10(%r13,%rdi,8)
movups 0x20(%r15,%rdi,8),%xmm0
movups 0x30(%r15,%rdi,8),%xmm1
movups %xmm0,0x20(%r13,%rdi,8)
movups %xmm1,0x30(%r13,%rdi,8)
movups 0x40(%r15,%rdi,8),%xmm0
movups 0x50(%r15,%rdi,8),%xmm1
movups %xmm0,0x40(%r13,%rdi,8)
movups %xmm1,0x50(%r13,%rdi,8)
movups 0x60(%r15,%rdi,8),%xmm0
movupd 0x70(%r15,%rdi,8),%xmm1
movups %xmm0,0x60(%r13,%rdi,8)
movupd %xmm1,0x70(%r13,%rdi,8)
add    $0x10,%rdi
add    $0xfffffffffffffffc,%rdx
jne    12e0 <lls_qr_undetermined+0x170>
test   %rcx,%rcx
je     138e <lls_qr_undetermined+0x21e>
lea    0x10(,%rdi,8),%rdx
add    %r13,%rdx
lea    (%r15,%rdi,8),%rbp
add    $0x10,%rbp
shl    $0x5,%rcx
xor    %edi,%edi
nopl   0x0(%rax)
movups -0x10(%rbp,%rdi,1),%xmm0
movupd 0x0(%rbp,%rdi,1),%xmm1
movups %xmm0,-0x10(%rdx,%rdi,1)
movupd %xmm1,(%rdx,%rdi,1)
add    $0x20,%rdi
cmp    %rdi,%rcx
jne    1370 <lls_qr_undetermined+0x200>
cmp    %r14,%rax
jne    121f <lls_qr_undetermined+0xaf>
mov    0x20(%rsp),%rdi
mov    %ebx,%esi
mov    0xc(%rsp),%r15d
mov    %r15d,%edx
mov    0x18(%rsp),%rbp
mov    %rbp,%rcx
call   1060 <mtranspose@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %ebx,%edx
mov    0x10(%rsp),%rcx
call   1070 <qrdecomp@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %ebx,%edx
mov    0x10(%rsp),%rcx
mov    0x28(%rsp),%r15
mov    %r15,%r8
mov    (%rsp),%rbp
mov    %rbp,%r9
call   1090 <getQR@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1050 <itranspose@plt>
mov    %rbx,%r8
movsd  0x0(%r13),%xmm0
divsd  0x0(%rbp),%xmm0
movsd  %xmm0,(%r12)
cmp    $0x2,%r8d
jl     152d <lls_qr_undetermined+0x3bd>
mov    (%rsp),%rax
lea    (%rax,%r14,8),%rax
add    $0x18,%rax
lea    0x0(,%r14,8),%r11
mov    $0x1,%ebx
xor    %r10d,%r10d
mov    %r14,%r9
jmp    1477 <lls_qr_undetermined+0x307>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movslq %edx,%rcx
add    %rbx,%rcx
movsd  0x0(%r13,%rbx,8),%xmm1
subsd  %xmm0,%xmm1
mov    (%rsp),%rdx
divsd  (%rdx,%rcx,8),%xmm1
movsd  %xmm1,(%r12,%rbx,8)
add    $0x1,%rbx
add    $0x1,%r10
add    %r11,%rax
add    %r14,%r9
cmp    %r14,%rbx
je     152d <lls_qr_undetermined+0x3bd>
cmp    $0x3,%r10
jae    1490 <lls_qr_undetermined+0x320>
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
jmp    14eb <lls_qr_undetermined+0x37b>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdx
and    $0xfffffffffffffffc,%rdx
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
nopl   (%rax)
movsd  -0x18(%rax,%rbp,8),%xmm1
movsd  -0x10(%rax,%rbp,8),%xmm2
mulsd  (%r12,%rbp,8),%xmm1
mulsd  0x8(%r12,%rbp,8),%xmm2
addsd  %xmm0,%xmm1
movsd  -0x8(%rax,%rbp,8),%xmm3
mulsd  0x10(%r12,%rbp,8),%xmm3
addsd  %xmm1,%xmm2
movsd  (%rax,%rbp,8),%xmm0
mulsd  0x18(%r12,%rbp,8),%xmm0
addsd  %xmm2,%xmm3
addsd  %xmm3,%xmm0
add    $0x4,%rbp
cmp    %rbp,%rdx
jne    14a0 <lls_qr_undetermined+0x330>
mov    %ebx,%edx
imul   %r8d,%edx
test   $0x3,%bl
je     1440 <lls_qr_undetermined+0x2d0>
mov    %ebx,%ecx
and    $0x3,%ecx
lea    (%r12,%rbp,8),%rdi
add    %r9,%rbp
mov    (%rsp),%rsi
lea    (%rsi,%rbp,8),%rbp
xor    %esi,%esi
movsd  0x0(%rbp,%rsi,8),%xmm1
mulsd  (%rdi,%rsi,8),%xmm1
addsd  %xmm1,%xmm0
add    $0x1,%rsi
cmp    %rsi,%rcx
jne    1510 <lls_qr_undetermined+0x3a0>
jmp    1440 <lls_qr_undetermined+0x2d0>
mov    %r15,%rdi
mov    %r12,%rsi
mov    0x30(%rsp),%rdx
mov    0xc(%rsp),%ecx
mov    $0x1,%r9d
call   1040 <mmult@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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