#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 *);
double mvnpdf_pcs(double *, double *, double *, double **, int);
double **new_matrix2(int, int);
int /*<<< orphan*/ printf(char *, ...);
double sqrt(int);
void test_mvnpdf_pcs(int argc, char *argv[]) {
  if (argc < 8) {
    printf("usage: %s <x1> <x2> <m1> <m2> <z1> <z2> <v11>\n", argv[0]);
    return;
  }
  int d = 2;
  double x[2];
  double mu[2];
  double z[2];
  double **V = new_matrix2(2, 2);
  x[0] = atof(argv[1]);
  x[1] = atof(argv[2]);
  mu[0] = atof(argv[3]);
  mu[1] = atof(argv[4]);
  z[0] = atof(argv[5]);
  z[1] = atof(argv[6]);
  V[0][0] = atof(argv[7]);
  V[0][1] = sqrt(1 - V[0][0] * V[0][0]);
  V[1][0] = V[0][1];
  V[1][1] = -V[0][0];
  printf("pdf = %f\n", mvnpdf_pcs(x, mu, z, V, d));
}


x86 assembly (clang, -O0):
<test_mvnpdf_pcs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    1183 <test_mvnpdf_pcs+0x33>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12de <test_mvnpdf_pcs+0x18e>
movl   $0x2,-0x14(%rbp)
mov    $0x2,%esi
mov    %esi,%edi
call   1050 <new_matrix2@plt>
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x30(%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,-0x40(%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,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
call   1030 <atof@plt>
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
movsd  %xmm0,(%rax)
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm0
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xda9(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1070 <sqrt@plt>
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
movsd  0x8(%rax),%xmm0
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rax
movsd  %xmm0,(%rax)
mov    -0x58(%rbp),%rax
mov    (%rax),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x58(%rbp),%rax
mov    0x8(%rax),%rax
movsd  %xmm0,0x8(%rax)
lea    -0x30(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x50(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    -0x14(%rbp),%r8d
call   1060 <mvnpdf_pcs@plt>
lea    0xd60(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mvnpdf_pcs>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
cmp    $0x7,%edi
jg     1177 <test_mvnpdf_pcs+0x27>
mov    (%rbx),%rsi
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1050 <new_matrix2@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x20(%rsp)
mov    0x10(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x28(%rsp)
mov    0x18(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x10(%rsp)
mov    0x20(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x18(%rsp)
mov    0x28(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,(%rsp)
mov    0x30(%rbx),%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x8(%rsp)
mov    0x38(%rbx),%rdi
call   1030 <atof@plt>
mov    (%r14),%rax
movsd  %xmm0,(%rax)
mulsd  %xmm0,%xmm0
movsd  0xe02(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1070 <sqrt@plt>
mov    (%r14),%rax
movsd  %xmm0,0x8(%rax)
mov    0x8(%r14),%rcx
movsd  %xmm0,(%rcx)
movsd  (%rax),%xmm0
xorps  0xdea(%rip),%xmm0
movlps %xmm0,0x8(%rcx)
lea    0x20(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %rsp,%rdx
mov    %r14,%rcx
mov    $0x2,%r8d
call   1060 <mvnpdf_pcs@plt>
lea    0xe03(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [47 x i8] c"usage: %s <x1> <x2> <m1> <m2> <z1> <z2> <v11>\0A\00"
@.str.1 = [10 x i8] c"pdf = %f\0A\00"
define void @test_mvnpdf_pcs(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca [2 x double]
%7 = alloca [2 x double]
%8 = alloca [2 x double]
%9 = alloca double**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 8
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %101
17: ; preds = %2
store i32 2, i32* %5
%18 = call double** @new_matrix2(i32 2, i32 2)
store double** %18, double*** %9
%19 = load i8**, i8*** %4
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call double @atof(i8* %21)
%23 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
store double %22, double* %23
%24 = load i8**, i8*** %4
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call double @atof(i8* %26)
%28 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 1
store double %27, double* %28
%29 = load i8**, i8*** %4
%30 = getelementptr inbounds i8*, i8** %29, i64 3
%31 = load i8*, i8** %30
%32 = call double @atof(i8* %31)
%33 = getelementptr inbounds [2 x double], [2 x double]* %7, i64 0, i64 0
store double %32, double* %33
%34 = load i8**, i8*** %4
%35 = getelementptr inbounds i8*, i8** %34, i64 4
%36 = load i8*, i8** %35
%37 = call double @atof(i8* %36)
%38 = getelementptr inbounds [2 x double], [2 x double]* %7, i64 0, i64 1
store double %37, double* %38
%39 = load i8**, i8*** %4
%40 = getelementptr inbounds i8*, i8** %39, i64 5
%41 = load i8*, i8** %40
%42 = call double @atof(i8* %41)
%43 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 0
store double %42, double* %43
%44 = load i8**, i8*** %4
%45 = getelementptr inbounds i8*, i8** %44, i64 6
%46 = load i8*, i8** %45
%47 = call double @atof(i8* %46)
%48 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 1
store double %47, double* %48
%49 = load i8**, i8*** %4
%50 = getelementptr inbounds i8*, i8** %49, i64 7
%51 = load i8*, i8** %50
%52 = call double @atof(i8* %51)
%53 = load double**, double*** %9
%54 = getelementptr inbounds double*, double** %53, i64 0
%55 = load double*, double** %54
%56 = getelementptr inbounds double, double* %55, i64 0
store double %52, double* %56
%57 = load double**, double*** %9
%58 = getelementptr inbounds double*, double** %57, i64 0
%59 = load double*, double** %58
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
%62 = load double**, double*** %9
%63 = getelementptr inbounds double*, double** %62, i64 0
%64 = load double*, double** %63
%65 = getelementptr inbounds double, double* %64, i64 0
%66 = load double, double* %65
%67 = fneg double %61
%68 = call double @llvm.fmuladd.f64(double %67, double %66, double 1.000000e+00)
%69 = fptosi double %68 to i32
%70 = call double @sqrt(i32 %69)
%71 = load double**, double*** %9
%72 = getelementptr inbounds double*, double** %71, i64 0
%73 = load double*, double** %72
%74 = getelementptr inbounds double, double* %73, i64 1
store double %70, double* %74
%75 = load double**, double*** %9
%76 = getelementptr inbounds double*, double** %75, i64 0
%77 = load double*, double** %76
%78 = getelementptr inbounds double, double* %77, i64 1
%79 = load double, double* %78
%80 = load double**, double*** %9
%81 = getelementptr inbounds double*, double** %80, i64 1
%82 = load double*, double** %81
%83 = getelementptr inbounds double, double* %82, i64 0
store double %79, double* %83
%84 = load double**, double*** %9
%85 = getelementptr inbounds double*, double** %84, i64 0
%86 = load double*, double** %85
%87 = getelementptr inbounds double, double* %86, i64 0
%88 = load double, double* %87
%89 = fneg double %88
%90 = load double**, double*** %9
%91 = getelementptr inbounds double*, double** %90, i64 1
%92 = load double*, double** %91
%93 = getelementptr inbounds double, double* %92, i64 1
store double %89, double* %93
%94 = getelementptr inbounds [2 x double], [2 x double]* %6, i64 0, i64 0
%95 = getelementptr inbounds [2 x double], [2 x double]* %7, i64 0, i64 0
%96 = getelementptr inbounds [2 x double], [2 x double]* %8, i64 0, i64 0
%97 = load double**, double*** %9
%98 = load i32, i32* %5
%99 = call double @mvnpdf_pcs(double* %94, double* %95, double* %96, double** %97, i32 %98)
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %99)
br label %101
101: ; preds = %17, %12
ret void
}

LLVM IR (-O2):
@.str = [47 x i8] c"usage: %s <x1> <x2> <m1> <m2> <z1> <z2> <v11>\0A\00"
@.str.1 = [10 x i8] c"pdf = %f\0A\00"
define void @test_mvnpdf_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, 8
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 ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %56
10: ; preds = %2
%11 = bitcast [2 x double]* %3 to i8*
%12 = bitcast [2 x double]* %4 to i8*
%13 = bitcast [2 x double]* %5 to i8*
%14 = tail call double** @new_matrix2(i32 2, i32 2)
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call double @atof(i8* %16)
%18 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
store double %17, double* %18
%19 = getelementptr inbounds i8*, i8** %1, i64 2
%20 = load i8*, i8** %19
%21 = tail call double @atof(i8* %20)
%22 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
store double %21, double* %22
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = tail call double @atof(i8* %24)
%26 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
store double %25, double* %26
%27 = getelementptr inbounds i8*, i8** %1, i64 4
%28 = load i8*, i8** %27
%29 = tail call double @atof(i8* %28)
%30 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 1
store double %29, double* %30
%31 = getelementptr inbounds i8*, i8** %1, i64 5
%32 = load i8*, i8** %31
%33 = tail call double @atof(i8* %32)
%34 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
store double %33, double* %34
%35 = getelementptr inbounds i8*, i8** %1, i64 6
%36 = load i8*, i8** %35
%37 = tail call double @atof(i8* %36)
%38 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 1
store double %37, double* %38
%39 = getelementptr inbounds i8*, i8** %1, i64 7
%40 = load i8*, i8** %39
%41 = tail call double @atof(i8* %40)
%42 = load double*, double** %14
store double %41, double* %42
%43 = fneg double %41
%44 = tail call double @llvm.fmuladd.f64(double %43, double %41, double 1.000000e+00)
%45 = fptosi double %44 to i32
%46 = tail call double @sqrt(i32 %45)
%47 = load double*, double** %14
%48 = getelementptr inbounds double, double* %47, i64 1
store double %46, double* %48
%49 = getelementptr inbounds double*, double** %14, i64 1
%50 = load double*, double** %49
store double %46, double* %50
%51 = load double, double* %47
%52 = fneg double %51
%53 = getelementptr inbounds double, double* %50, i64 1
store double %52, double* %53
%54 = call double @mvnpdf_pcs(double* %18, double* %26, double* %34, double** %14, i32 2)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %54)
br label %56
56: ; preds = %10, %7
ret void
}