#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 atof(char *);
int atoi(char *);
int /*<<< orphan*/ eigen_symm(double *, double **, double **, int);
int /*<<< orphan*/ matrix_mult(double **, double **, double **, int, int, int);
int /*<<< orphan*/ mult(double *, double *, int, int);
int /*<<< orphan*/ mvnrand_pcs(double *, double *, double *, double **, int);
double **new_matrix2(int, int);
int /*<<< orphan*/ printf(char *, ...);
double sqrt(int);
int /*<<< orphan*/ sub(double *, double *, double *, int);
int /*<<< orphan*/ transpose(double **, double **, int, int);
void test_mvnrand_pcs(int argc, char *argv[]) {
  if (argc < 7) {
    printf("usage: %s <n> <m1> <m2> <z1> <z2> <v11>\n", argv[0]);
    return;
  }
  int d = 2;
  int i, n = atoi(argv[1]);
  double m1 = atof(argv[2]);
  double m2 = atof(argv[3]);
  double z1 = atof(argv[4]);
  double z2 = atof(argv[5]);
  double v11 = atof(argv[6]);
  double mu[2] = {m1, m2};
  double z[2] = {z1, z2};
  double **V = new_matrix2(d, d);
  V[0][0] = v11;
  V[0][1] = sqrt(1 - v11 * v11);
  V[1][0] = V[0][1];
  V[1][1] = -V[0][0];
  double **X = new_matrix2(n, d);
  for (i = 0; i < n; i++) {
    mvnrand_pcs(X[i], mu, z, V, d);
  }
  double sample_mu[2] = {0, 0};
  for (i = 0; i < n; i++) {
    sample_mu[0] += X[i][0];
    sample_mu[1] += X[i][1];
  }
  sample_mu[0] /= (double)n;
  sample_mu[1] /= (double)n;
  for (i = 0; i < n; i++)
    sub(X[i], X[i], sample_mu, d);
  double **Xt = new_matrix2(d, n);
  transpose(Xt, X, n, d);
  double **S = new_matrix2(d, d);
  matrix_mult(S, Xt, X, d, n, d);
  mult(S[0], S[0], 1 / (double)n, d * d);
  eigen_symm(z, V, S, d);
  printf("sample mu = (%f, %f), z = (%f, %f), V = [%f %f; %f %f]\n",
         sample_mu[0], sample_mu[1], z[0], z[1], V[0][0], V[0][1], V[1][0],
         V[1][1]);
}


x86 assembly (clang, -O0):
<test_mvnrand_pcs>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x7,-0x4(%rbp)
jge    11f6 <test_mvnrand_pcs+0x36>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe1e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    157b <test_mvnrand_pcs+0x3bb>
movl   $0x2,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10a0 <new_matrix2@plt>
mov    %rax,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x78(%rbp),%rax
mov    (%rax),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd25(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   10c0 <sqrt@plt>
mov    -0x78(%rbp),%rax
mov    (%rax),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x78(%rbp),%rax
mov    (%rax),%rax
movsd  0x8(%rax),%xmm0
mov    -0x78(%rbp),%rax
mov    0x8(%rax),%rax
movsd  %xmm0,(%rax)
mov    -0x78(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x78(%rbp),%rax
mov    0x8(%rax),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x1c(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10a0 <new_matrix2@plt>
mov    %rax,-0x80(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    138c <test_mvnrand_pcs+0x1cc>
mov    -0x80(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x70(%rbp),%rdx
mov    -0x78(%rbp),%rcx
mov    -0x14(%rbp),%r8d
call   10d0 <mvnrand_pcs@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1351 <test_mvnrand_pcs+0x191>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1401 <test_mvnrand_pcs+0x241>
mov    -0x80(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  (%rax),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x80(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsd  0x8(%rax),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    13a6 <test_mvnrand_pcs+0x1e6>
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  -0x90(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  -0x88(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    147b <test_mvnrand_pcs+0x2bb>
mov    -0x80(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x80(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    -0x90(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   10e0 <sub@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    143a <test_mvnrand_pcs+0x27a>
mov    -0x14(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   10a0 <new_matrix2@plt>
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
mov    -0x80(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x14(%rbp),%ecx
call   1070 <transpose@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
call   10a0 <new_matrix2@plt>
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rdi
mov    -0x98(%rbp),%rsi
mov    -0x80(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x14(%rbp),%r9d
call   1080 <matrix_mult@plt>
mov    -0xa0(%rbp),%rax
mov    (%rax),%rdi
mov    -0xa0(%rbp),%rax
mov    (%rax),%rsi
cvtsi2sdl -0x1c(%rbp),%xmm1
movsd  0xb08(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
mov    -0x14(%rbp),%ecx
imul   -0x14(%rbp),%ecx
call   1090 <mult@plt>
lea    -0x70(%rbp),%rdi
mov    -0x78(%rbp),%rsi
mov    -0xa0(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1050 <eigen_symm@plt>
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm3
mov    -0x78(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm4
mov    -0x78(%rbp),%rax
mov    (%rax),%rax
movsd  0x8(%rax),%xmm5
mov    -0x78(%rbp),%rax
mov    0x8(%rax),%rax
movsd  (%rax),%xmm6
mov    -0x78(%rbp),%rax
mov    0x8(%rax),%rax
movsd  0x8(%rax),%xmm7
lea    0xabd(%rip),%rdi
mov    $0x8,%al
call   1040 <printf@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mvnrand_pcs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbx
cmp    $0x6,%edi
jg     11e5 <test_mvnrand_pcs+0x35>
mov    (%rbx),%rsi
lea    0xe50(%rip),%rdi
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>
mov    0x8(%rbx),%rdi
call   10a0 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x30(%rsp)
mov    0x18(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x20(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x58(%rsp)
mov    0x28(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x48(%rsp)
mov    0x30(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x50(%rsp)
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,0x60(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x68(%rsp)
movsd  0x58(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x48(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
mov    $0x2,%edi
mov    $0x2,%esi
call   1090 <new_matrix2@plt>
mov    %rax,%r15
mov    (%rax),%rax
movsd  0x50(%rsp),%xmm0
movsd  %xmm0,(%rax)
mulsd  %xmm0,%xmm0
movapd %xmm0,%xmm1
movsd  0xd65(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   10b0 <sqrt@plt>
mov    (%r15),%rax
movsd  %xmm0,0x8(%rax)
mov    0x8(%r15),%rcx
movsd  %xmm0,(%rcx)
movsd  (%rax),%xmm0
xorpd  0xd4c(%rip),%xmm0
movlpd %xmm0,0x8(%rcx)
mov    %r14d,%edi
mov    $0x2,%esi
call   1090 <new_matrix2@plt>
mov    %rax,%rbp
test   %r14d,%r14d
jle    134a <test_mvnrand_pcs+0x19a>
mov    %r14d,0x8(%rsp)
mov    %r14d,%r13d
xor    %r14d,%r14d
lea    0x60(%rsp),%r12
lea    0x20(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp,%r14,8),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    $0x2,%r8d
call   10c0 <mvnrand_pcs@plt>
add    $0x1,%r14
cmp    %r14,%r13
jne    1300 <test_mvnrand_pcs+0x150>
xorpd  %xmm0,%xmm0
movapd %xmm0,0x10(%rsp)
mov    0x8(%rsp),%r14d
test   %r14d,%r14d
jle    134a <test_mvnrand_pcs+0x19a>
lea    -0x1(%r13),%rcx
mov    %r13d,%eax
and    $0x3,%eax
cmp    $0x3,%rcx
jae    136f <test_mvnrand_pcs+0x1bf>
xor    %ecx,%ecx
jmp    13bd <test_mvnrand_pcs+0x20d>
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
xorpd  %xmm0,%xmm0
movapd %xmm1,0x30(%rsp)
divsd  %xmm1,%xmm0
unpcklpd %xmm0,%xmm0
movapd %xmm0,0x10(%rsp)
jmp    1433 <test_mvnrand_pcs+0x283>
mov    %r13d,%edx
and    $0xfffffffc,%edx
xorpd  %xmm0,%xmm0
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%rcx,8),%rsi
mov    0x8(%rbp,%rcx,8),%rdi
movupd (%rsi),%xmm1
addpd  %xmm0,%xmm1
movupd (%rdi),%xmm0
addpd  %xmm1,%xmm0
mov    0x10(%rbp,%rcx,8),%rsi
movupd (%rsi),%xmm1
addpd  %xmm0,%xmm1
mov    0x18(%rbp,%rcx,8),%rsi
movupd (%rsi),%xmm0
addpd  %xmm1,%xmm0
add    $0x4,%rcx
cmp    %rcx,%rdx
jne    1380 <test_mvnrand_pcs+0x1d0>
test   %rax,%rax
je     13e5 <test_mvnrand_pcs+0x235>
lea    0x0(,%rcx,8),%rcx
add    %rbp,%rcx
xor    %edx,%edx
nop
mov    (%rcx,%rdx,8),%rsi
movupd (%rsi),%xmm1
addpd  %xmm1,%xmm0
add    $0x1,%rdx
cmp    %rdx,%rax
jne    13d0 <test_mvnrand_pcs+0x220>
xorps  %xmm1,%xmm1
cvtsi2sd %r14d,%xmm1
movapd %xmm1,0x30(%rsp)
unpcklpd %xmm1,%xmm1
divpd  %xmm1,%xmm0
movapd %xmm0,0x10(%rsp)
test   %r14d,%r14d
jle    1433 <test_mvnrand_pcs+0x283>
xor    %ebx,%ebx
lea    0x10(%rsp),%r14
nopl   (%rax)
mov    0x0(%rbp,%rbx,8),%rdi
mov    %rdi,%rsi
mov    %r14,%rdx
mov    $0x2,%ecx
call   10d0 <sub@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1410 <test_mvnrand_pcs+0x260>
mov    0x8(%rsp),%r14d
mov    $0x2,%edi
mov    %r14d,%esi
call   1090 <new_matrix2@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    %rbp,%rsi
mov    %r14d,%edx
mov    $0x2,%ecx
call   1060 <transpose@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1090 <new_matrix2@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    $0x2,%ecx
mov    %r14d,%r8d
mov    $0x2,%r9d
call   1070 <matrix_mult@plt>
mov    (%rbx),%rdi
movsd  0xb71(%rip),%xmm0
divsd  0x30(%rsp),%xmm0
cvttsd2si %xmm0,%edx
mov    %rdi,%rsi
mov    $0x4,%ecx
call   1080 <mult@plt>
lea    0x20(%rsp),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    $0x2,%ecx
call   1050 <eigen_symm@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x20(%rsp),%xmm2
movsd  0x28(%rsp),%xmm3
mov    (%r15),%rax
mov    0x8(%r15),%rcx
movsd  (%rax),%xmm4
movsd  0x8(%rax),%xmm5
movsd  (%rcx),%xmm6
movsd  0x8(%rcx),%xmm7
lea    0xb56(%rip),%rdi
mov    $0x8,%al
call   1040 <printf@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [41 x i8] c"usage: %s <n> <m1> <m2> <z1> <z2> <v11>\0A\00"
@.str.1 = [56 x i8] c"sample mu = (%f, %f), z = (%f, %f), V = [%f %f; %f %f]\0A\00"
define void @test_mvnrand_pcs(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x double]
%4 = alloca [2 x double]
%5 = alloca <2 x double>
%6 = icmp slt i32 %0, 7
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %166
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call double @atof(i8* %15)
%17 = getelementptr inbounds i8*, i8** %1, i64 3
%18 = load i8*, i8** %17
%19 = tail call double @atof(i8* %18)
%20 = getelementptr inbounds i8*, i8** %1, i64 4
%21 = load i8*, i8** %20
%22 = tail call double @atof(i8* %21)
%23 = getelementptr inbounds i8*, i8** %1, i64 5
%24 = load i8*, i8** %23
%25 = tail call double @atof(i8* %24)
%26 = getelementptr inbounds i8*, i8** %1, i64 6
%27 = load i8*, i8** %26
%28 = tail call double @atof(i8* %27)
%29 = bitcast [2 x double]* %3 to i8*
%30 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
store double %16, double* %30
%31 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
store double %19, double* %31
%32 = bitcast [2 x double]* %4 to i8*
%33 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
store double %22, double* %33
%34 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 1
store double %25, double* %34
%35 = tail call double** @new_matrix2(i32 2, i32 2)
%36 = load double*, double** %35
store double %28, double* %36
%37 = fneg double %28
%38 = tail call double @llvm.fmuladd.f64(double %37, double %28, double 1.000000e+00)
%39 = fptosi double %38 to i32
%40 = tail call double @sqrt(i32 %39)
%41 = load double*, double** %35
%42 = getelementptr inbounds double, double* %41, i64 1
store double %40, double* %42
%43 = getelementptr inbounds double*, double** %35, i64 1
%44 = load double*, double** %43
store double %40, double* %44
%45 = load double, double* %41
%46 = fneg double %45
%47 = getelementptr inbounds double, double* %44, i64 1
store double %46, double* %47
%48 = tail call double** @new_matrix2(i32 %13, i32 2)
%49 = icmp sgt i32 %13, 0
br i1 %49, label %52, label %50
50: ; preds = %10
%51 = bitcast <2 x double>* %5 to i8*
br label %99
52: ; preds = %10
%53 = zext i32 %13 to i64
br label %54
54: ; preds = %52, %54
%55 = phi i64 [ 0, %52 ], [ %59, %54 ]
%56 = getelementptr inbounds double*, double** %48, i64 %55
%57 = load double*, double** %56
%58 = call i32 @mvnrand_pcs(double* %57, double* %30, double* %33, double** %35, i32 2)
%59 = add nuw nsw i64 %55, 1
%60 = icmp eq i64 %59, %53
br i1 %60, label %61, label %54
61: ; preds = %54
%62 = bitcast <2 x double>* %5 to i8*
br i1 %49, label %63, label %99
63: ; preds = %61
%64 = add nsw i64 %53, -1
%65 = and i64 %53, 3
%66 = icmp ult i64 %64, 3
br i1 %66, label %105, label %67
67: ; preds = %63
%68 = and i64 %53, 4294967292
br label %69
69: ; preds = %69, %67
%70 = phi i64 [ 0, %67 ], [ %96, %69 ]
%71 = phi <2 x double> [ zeroinitializer, %67 ], [ %95, %69 ]
%72 = phi i64 [ 0, %67 ], [ %97, %69 ]
%73 = getelementptr inbounds double*, double** %48, i64 %70
%74 = bitcast double** %73 to <2 x double>**
%75 = load <2 x double>*, <2 x double>** %74
%76 = load <2 x double>, <2 x double>* %75
%77 = fadd <2 x double> %76, %71
%78 = or i64 %70, 1
%79 = getelementptr inbounds double*, double** %48, i64 %78
%80 = bitcast double** %79 to <2 x double>**
%81 = load <2 x double>*, <2 x double>** %80
%82 = load <2 x double>, <2 x double>* %81
%83 = fadd <2 x double> %82, %77
%84 = or i64 %70, 2
%85 = getelementptr inbounds double*, double** %48, i64 %84
%86 = bitcast double** %85 to <2 x double>**
%87 = load <2 x double>*, <2 x double>** %86
%88 = load <2 x double>, <2 x double>* %87
%89 = fadd <2 x double> %88, %83
%90 = or i64 %70, 3
%91 = getelementptr inbounds double*, double** %48, i64 %90
%92 = bitcast double** %91 to <2 x double>**
%93 = load <2 x double>*, <2 x double>** %92
%94 = load <2 x double>, <2 x double>* %93
%95 = fadd <2 x double> %94, %89
%96 = add nuw nsw i64 %70, 4
%97 = add i64 %72, 4
%98 = icmp eq i64 %97, %68
br i1 %98, label %105, label %69
99: ; preds = %50, %61
%100 = sitofp i32 %13 to double
%101 = getelementptr inbounds <2 x double>, <2 x double>* %5, i64 0, i64 1
%102 = insertelement <2 x double> poison, double %100, i64 0
%103 = fdiv <2 x double> <double 0.000000e+00, double poison>, %102
%104 = shufflevector <2 x double> %103, <2 x double> poison, <2 x i32> zeroinitializer
store <2 x double> %104, <2 x double>* %5
br label %139
105: ; preds = %69, %63
%106 = phi <2 x double> [ undef, %63 ], [ %95, %69 ]
%107 = phi i64 [ 0, %63 ], [ %96, %69 ]
%108 = phi <2 x double> [ zeroinitializer, %63 ], [ %95, %69 ]
%109 = icmp eq i64 %65, 0
br i1 %109, label %122, label %110
110: ; preds = %105, %110
%111 = phi i64 [ %119, %110 ], [ %107, %105 ]
%112 = phi <2 x double> [ %118, %110 ], [ %108, %105 ]
%113 = phi i64 [ %120, %110 ], [ 0, %105 ]
%114 = getelementptr inbounds double*, double** %48, i64 %111
%115 = bitcast double** %114 to <2 x double>**
%116 = load <2 x double>*, <2 x double>** %115
%117 = load <2 x double>, <2 x double>* %116
%118 = fadd <2 x double> %117, %112
%119 = add nuw nsw i64 %111, 1
%120 = add i64 %113, 1
%121 = icmp eq i64 %120, %65
br i1 %121, label %122, label %110
122: ; preds = %110, %105
%123 = phi <2 x double> [ %106, %105 ], [ %118, %110 ]
%124 = sitofp i32 %13 to double
%125 = getelementptr inbounds <2 x double>, <2 x double>* %5, i64 0, i64 0
%126 = getelementptr inbounds <2 x double>, <2 x double>* %5, i64 0, i64 1
%127 = insertelement <2 x double> poison, double %124, i64 0
%128 = shufflevector <2 x double> %127, <2 x double> poison, <2 x i32> zeroinitializer
%129 = fdiv <2 x double> %123, %128
store <2 x double> %129, <2 x double>* %5
br i1 %49, label %130, label %139
130: ; preds = %122
%131 = zext i32 %13 to i64
br label %132
132: ; preds = %130, %132
%133 = phi i64 [ 0, %130 ], [ %137, %132 ]
%134 = getelementptr inbounds double*, double** %48, i64 %133
%135 = load double*, double** %134
%136 = call i32 @sub(double* %135, double* %135, double* %125, i32 2)
%137 = add nuw nsw i64 %133, 1
%138 = icmp eq i64 %137, %131
br i1 %138, label %139, label %132
139: ; preds = %132, %99, %122
%140 = phi double* [ %101, %99 ], [ %126, %122 ], [ %126, %132 ]
%141 = phi double [ %100, %99 ], [ %124, %122 ], [ %124, %132 ]
%142 = bitcast <2 x double>* %5 to i8*
%143 = getelementptr inbounds <2 x double>, <2 x double>* %5, i64 0, i64 0
%144 = call double** @new_matrix2(i32 2, i32 %13)
%145 = call i32 @transpose(double** %144, double** %48, i32 %13, i32 2)
%146 = call double** @new_matrix2(i32 2, i32 2)
%147 = call i32 @matrix_mult(double** %146, double** %144, double** %48, i32 2, i32 %13, i32 2)
%148 = load double*, double** %146
%149 = fdiv double 1.000000e+00, %141
%150 = fptosi double %149 to i32
%151 = call i32 @mult(double* %148, double* %148, i32 %150, i32 4)
%152 = call i32 @eigen_symm(double* %33, double** %35, double** %146, i32 2)
%153 = load double, double* %143
%154 = load double, double* %140
%155 = load double, double* %33
%156 = load double, double* %34
%157 = load double*, double** %35
%158 = load double, double* %157
%159 = getelementptr inbounds double, double* %157, i64 1
%160 = load double, double* %159
%161 = load double*, double** %43
%162 = load double, double* %161
%163 = getelementptr inbounds double, double* %161, i64 1
%164 = load double, double* %163
%165 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), double %153, double %154, double %155, double %156, double %158, double %160, double %162, double %164)
br label %166
166: ; preds = %139, %7
ret void
}