#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 rank(double *, int, int);
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);
  retval = rank(R, M, M);
  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   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x48(%rbp)
movslq -0x18(%rbp),%rax
shl    $0x3,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
movslq -0x14(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x58(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x60(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1266 <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    1232 <lls_qr_undetermined+0xb2>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x40(%rbp),%rcx
call   1070 <mtranspose@plt>
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x48(%rbp),%rcx
call   1080 <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   10a0 <getQR@plt>
mov    -0x58(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <rank@plt>
mov    %eax,-0x24(%rbp)
mov    -0x58(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1060 <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    139e <lls_qr_undetermined+0x21e>
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    1364 <lls_qr_undetermined+0x1e4>
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    1319 <lls_qr_undetermined+0x199>
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    12e7 <lls_qr_undetermined+0x167>
mov    -0x50(%rbp),%rdi
mov    -0x60(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    $0x1,%r9d
call   1050 <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,0x28(%rsp)
mov    %ecx,0xc(%rsp)
imul   %edx,%ebp
shl    $0x3,%ebp
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,0x20(%rsp)
lea    0x0(,%r14,8),%ebx
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,0x10(%rsp)
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    %ebx,%edi
imul   %r14d,%edi
call   1090 <malloc@plt>
mov    %rax,(%rsp)
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %r14,%rsi
mov    %rax,%r13
mov    %esi,%r14d
test   %esi,%esi
jle    13a7 <lls_qr_undetermined+0x227>
cmp    $0x4,%esi
jb     122d <lls_qr_undetermined+0xad>
lea    (%r15,%r14,8),%rax
cmp    %rax,%r13
jae    12c5 <lls_qr_undetermined+0x145>
lea    0x0(,%r14,8),%rax
add    %r13,%rax
cmp    %r15,%rax
jbe    12c5 <lls_qr_undetermined+0x145>
xor    %eax,%eax
mov    %rax,%rcx
not    %rcx
add    %r14,%rcx
mov    %r14,%rdx
and    $0x3,%rdx
je     1267 <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    1250 <lls_qr_undetermined+0xd0>
cmp    $0x3,%rcx
jb     13a7 <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    1280 <lls_qr_undetermined+0x100>
jmp    13a7 <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    12e9 <lls_qr_undetermined+0x169>
xor    %edi,%edi
jmp    135b <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    12f0 <lls_qr_undetermined+0x170>
test   %rcx,%rcx
je     139e <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    1380 <lls_qr_undetermined+0x200>
cmp    %r14,%rax
jne    122f <lls_qr_undetermined+0xaf>
mov    0x28(%rsp),%rdi
mov    0xc(%rsp),%r15d
mov    %r15d,%edx
mov    0x20(%rsp),%rbx
mov    %rbx,%rcx
mov    %rsi,%rbp
call   1070 <mtranspose@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    0x10(%rsp),%rcx
call   1080 <qrdecomp@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
mov    0x10(%rsp),%rcx
mov    0x18(%rsp),%r8
mov    (%rsp),%rbx
mov    %rbx,%r9
call   10a0 <getQR@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
call   1040 <rank@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
call   1060 <itranspose@plt>
mov    %rbp,%r8
movsd  0x0(%r13),%xmm0
divsd  (%rbx),%xmm0
movsd  %xmm0,(%r12)
cmp    $0x2,%r8d
jl     153d <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    1487 <lls_qr_undetermined+0x307>
nopl   (%rax)
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     153d <lls_qr_undetermined+0x3bd>
cmp    $0x3,%r10
jae    14a0 <lls_qr_undetermined+0x320>
xorpd  %xmm0,%xmm0
xor    %ebp,%ebp
jmp    14fb <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    14b0 <lls_qr_undetermined+0x330>
mov    %ebx,%edx
imul   %r8d,%edx
test   $0x3,%bl
je     1450 <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    1520 <lls_qr_undetermined+0x3a0>
jmp    1450 <lls_qr_undetermined+0x2d0>
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    0x30(%rsp),%rdx
mov    0xc(%rsp),%ecx
mov    $0x1,%r9d
call   1050 <mmult@plt>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%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>
mov    %r15d,%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 @rank(double* %103, i32 %104, i32 %105)
store i32 %106, i32* %11
%107 = load double*, double** %19
%108 = load i32, i32* %8
%109 = load i32, i32* %8
%110 = call i32 @itranspose(double* %107, i32 %108, i32 %109)
%111 = load double*, double** %21
%112 = getelementptr inbounds double, double* %111, i64 0
%113 = load double, double* %112
%114 = load double*, double** %19
%115 = getelementptr inbounds double, double* %114, i64 0
%116 = load double, double* %115
%117 = fdiv double %113, %116
%118 = load double*, double** %20
%119 = getelementptr inbounds double, double* %118, i64 0
store double %117, double* %119
store i32 1, i32* %12
br label %120
120: ; preds = %173, %85
%121 = load i32, i32* %12
%122 = load i32, i32* %8
%123 = icmp slt i32 %121, %122
br i1 %123, label %124, label %176
124: ; preds = %120
store double 0.000000e+00, double* %22
%125 = load i32, i32* %12
%126 = load i32, i32* %8
%127 = mul nsw i32 %125, %126
store i32 %127, i32* %13
%128 = load i32, i32* %12
%129 = load i32, i32* %8
%130 = mul nsw i32 %128, %129
%131 = load i32, i32* %12
%132 = add nsw i32 %130, %131
store i32 %132, i32* %14
store i32 0, i32* %15
br label %133
133: ; preds = %152, %124
%134 = load i32, i32* %15
%135 = load i32, i32* %12
%136 = icmp slt i32 %134, %135
br i1 %136, label %137, label %155
137: ; preds = %133
%138 = load double*, double** %19
%139 = load i32, i32* %13
%140 = load i32, i32* %15
%141 = add nsw i32 %139, %140
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %138, i64 %142
%144 = load double, double* %143
%145 = load double*, double** %20
%146 = load i32, i32* %15
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds double, double* %145, i64 %147
%149 = load double, double* %148
%150 = load double, double* %22
%151 = call double @llvm.fmuladd.f64(double %144, double %149, double %150)
store double %151, double* %22
br label %152
152: ; preds = %137
%153 = load i32, i32* %15
%154 = add nsw i32 %153, 1
store i32 %154, i32* %15
br label %133
155: ; preds = %133
%156 = load double*, double** %21
%157 = load i32, i32* %12
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds double, double* %156, i64 %158
%160 = load double, double* %159
%161 = load double, double* %22
%162 = fsub double %160, %161
%163 = load double*, double** %19
%164 = load i32, i32* %14
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds double, double* %163, i64 %165
%167 = load double, double* %166
%168 = fdiv double %162, %167
%169 = load double*, double** %20
%170 = load i32, i32* %12
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds double, double* %169, i64 %171
store double %168, double* %172
br label %173
173: ; preds = %155
%174 = load i32, i32* %12
%175 = add nsw i32 %174, 1
store i32 %175, i32* %12
br label %120
176: ; preds = %120
%177 = load double*, double** %18
%178 = load double*, double** %20
%179 = load double*, double** %10
%180 = load i32, i32* %9
%181 = load i32, i32* %8
%182 = call i32 @mmult(double* %177, double* %178, double* %179, i32 %180, i32 %181, i32 1)
%183 = load double*, double** %16
%184 = call i32 @free(double* %183)
%185 = load double*, double** %17
%186 = call i32 @free(double* %185)
%187 = load double*, double** %18
%188 = call i32 @free(double* %187)
%189 = load double*, double** %19
%190 = call i32 @free(double* %189)
%191 = load double*, double** %20
%192 = call i32 @free(double* %191)
%193 = load double*, double** %21
%194 = call i32 @free(double* %193)
%195 = load i32, i32* %11
ret i32 %195
}

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 @rank(double* %17, i32 %2, i32 %2)
%155 = tail call i32 @itranspose(double* %17, i32 %2, i32 %2)
%156 = load double, double* %21
%157 = load double, double* %17
%158 = fdiv double %156, %157
store double %158, double* %19
%159 = icmp sgt i32 %2, 1
br i1 %159, label %160, label %239
160: ; preds = %150
%161 = zext i32 %2 to i64
%162 = zext i32 %2 to i64
br label %163
163: ; preds = %160, %225
%164 = phi i64 [ 0, %160 ], [ %238, %225 ]
%165 = phi i64 [ 1, %160 ], [ %236, %225 ]
%166 = trunc i64 %165 to i32
%167 = mul nsw i64 %165, %161
%168 = mul nsw i32 %166, %2
%169 = and i64 %165, 3
%170 = icmp ult i64 %164, 3
br i1 %170, label %207, label %171
171: ; preds = %163
%172 = and i64 %165, 9223372036854775804
br label %173
173: ; preds = %173, %171
%174 = phi i64 [ 0, %171 ], [ %204, %173 ]
%175 = phi double [ 0.000000e+00, %171 ], [ %203, %173 ]
%176 = phi i64 [ 0, %171 ], [ %205, %173 ]
%177 = add nuw nsw i64 %174, %167
%178 = getelementptr inbounds double, double* %17, i64 %177
%179 = load double, double* %178
%180 = getelementptr inbounds double, double* %19, i64 %174
%181 = load double, double* %180
%182 = tail call double @llvm.fmuladd.f64(double %179, double %181, double %175)
%183 = or i64 %174, 1
%184 = add nuw nsw i64 %183, %167
%185 = getelementptr inbounds double, double* %17, i64 %184
%186 = load double, double* %185
%187 = getelementptr inbounds double, double* %19, i64 %183
%188 = load double, double* %187
%189 = tail call double @llvm.fmuladd.f64(double %186, double %188, double %182)
%190 = or i64 %174, 2
%191 = add nuw nsw i64 %190, %167
%192 = getelementptr inbounds double, double* %17, i64 %191
%193 = load double, double* %192
%194 = getelementptr inbounds double, double* %19, i64 %190
%195 = load double, double* %194
%196 = tail call double @llvm.fmuladd.f64(double %193, double %195, double %189)
%197 = or i64 %174, 3
%198 = add nuw nsw i64 %197, %167
%199 = getelementptr inbounds double, double* %17, i64 %198
%200 = load double, double* %199
%201 = getelementptr inbounds double, double* %19, i64 %197
%202 = load double, double* %201
%203 = tail call double @llvm.fmuladd.f64(double %200, double %202, double %196)
%204 = add nuw nsw i64 %174, 4
%205 = add i64 %176, 4
%206 = icmp eq i64 %205, %172
br i1 %206, label %207, label %173
207: ; preds = %173, %163
%208 = phi double [ undef, %163 ], [ %203, %173 ]
%209 = phi i64 [ 0, %163 ], [ %204, %173 ]
%210 = phi double [ 0.000000e+00, %163 ], [ %203, %173 ]
%211 = icmp eq i64 %169, 0
br i1 %211, label %225, label %212
212: ; preds = %207, %212
%213 = phi i64 [ %222, %212 ], [ %209, %207 ]
%214 = phi double [ %221, %212 ], [ %210, %207 ]
%215 = phi i64 [ %223, %212 ], [ 0, %207 ]
%216 = add nuw nsw i64 %213, %167
%217 = getelementptr inbounds double, double* %17, i64 %216
%218 = load double, double* %217
%219 = getelementptr inbounds double, double* %19, i64 %213
%220 = load double, double* %219
%221 = tail call double @llvm.fmuladd.f64(double %218, double %220, double %214)
%222 = add nuw nsw i64 %213, 1
%223 = add i64 %215, 1
%224 = icmp eq i64 %223, %169
br i1 %224, label %225, label %212
225: ; preds = %212, %207
%226 = phi double [ %208, %207 ], [ %221, %212 ]
%227 = sext i32 %168 to i64
%228 = add nsw i64 %165, %227
%229 = getelementptr inbounds double, double* %21, i64 %165
%230 = load double, double* %229
%231 = fsub double %230, %226
%232 = getelementptr inbounds double, double* %17, i64 %228
%233 = load double, double* %232
%234 = fdiv double %231, %233
%235 = getelementptr inbounds double, double* %19, i64 %165
store double %234, double* %235
%236 = add nuw nsw i64 %165, 1
%237 = icmp eq i64 %236, %162
%238 = add i64 %164, 1
br i1 %237, label %239, label %163
239: ; preds = %225, %150
%240 = tail call i32 @mmult(double* %14, double* %19, double* %4, i32 %3, i32 %2, i32 1)
%241 = tail call i32 @free(double* %9)
%242 = tail call i32 @free(double* %12)
%243 = tail call i32 @free(double* %14)
%244 = tail call i32 @free(double* %17)
%245 = tail call i32 @free(double* %19)
%246 = tail call i32 @free(double* %21)
ret i32 %154
}