#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 exp(double);
int sqrt(int);
double bivarcond(double x, double y, double mu1, double mu2, double *cv) {
  double rho, s1, s1sq, s2, s2sq, m, e;
  s1sq = cv[(0) * (2) + (0)];
  s2sq = cv[(1) * (2) + (1)];
  s1 = sqrt(s1sq);
  s2 = sqrt(s2sq);
  rho = cv[(0) * (2) + (1)] / sqrt(s1sq * s2sq);
  m = 1 / sqrt((2 * 3.14 * s2sq * (1 - (rho * rho))));
  e = (y - mu2 - rho * (s2 / s1) * (x - mu1));
  e *= e;
  e /= s2sq * (1 - (rho * rho));
  return (m * exp(-0.5 * e));
}


x86 assembly (clang, -O0):
<bivarcond>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
cvttsd2si -0x40(%rbp),%edi
call   1040 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvttsd2si -0x50(%rbp),%edi
call   1040 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movsd  -0x70(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe54(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe1a(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
divsd  -0x38(%rbp),%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x8(%rbp),%xmm2
subsd  -0x18(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x50(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
movsd  0xd6a(%rip),%xmm2
addsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xd3a(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bivarcond>:
push   %rbx
sub    $0x50,%rsp
mov    %rdi,%rbx
movsd  %xmm3,0x40(%rsp)
movsd  %xmm2,0x48(%rsp)
movsd  %xmm1,0x30(%rsp)
movsd  %xmm0,0x38(%rsp)
movsd  (%rdi),%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x18(%rdi),%xmm0
movsd  %xmm0,0x10(%rsp)
cvttsd2si %xmm1,%edi
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
cvttsd2si 0x10(%rsp),%edi
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
divsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rbx),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x18(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xe38(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm1
movsd  0xe2e(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  %xmm2,0x18(%rsp)
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x3,%ecx
cmovb  %eax,%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x20(%rsp)
movsd  0x30(%rsp),%xmm0
subsd  0x40(%rsp),%xmm0
movsd  0x38(%rsp),%xmm1
subsd  0x48(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  0x28(%rsp),%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
divsd  %xmm1,%xmm0
mulsd  0xdbf(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0x20(%rsp),%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @bivarcond(double %0, double %1, double %2, double %3, double* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double*
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double* %4, double** %10
%18 = load double*, double** %10
%19 = getelementptr inbounds double, double* %18, i64 0
%20 = load double, double* %19
store double %20, double* %13
%21 = load double*, double** %10
%22 = getelementptr inbounds double, double* %21, i64 3
%23 = load double, double* %22
store double %23, double* %15
%24 = load double, double* %13
%25 = fptosi double %24 to i32
%26 = call i32 @sqrt(i32 %25)
%27 = sitofp i32 %26 to double
store double %27, double* %12
%28 = load double, double* %15
%29 = fptosi double %28 to i32
%30 = call i32 @sqrt(i32 %29)
%31 = sitofp i32 %30 to double
store double %31, double* %14
%32 = load double*, double** %10
%33 = getelementptr inbounds double, double* %32, i64 1
%34 = load double, double* %33
%35 = load double, double* %13
%36 = load double, double* %15
%37 = fmul double %35, %36
%38 = fptosi double %37 to i32
%39 = call i32 @sqrt(i32 %38)
%40 = sitofp i32 %39 to double
%41 = fdiv double %34, %40
store double %41, double* %11
%42 = load double, double* %15
%43 = fmul double 6.280000e+00, %42
%44 = load double, double* %11
%45 = load double, double* %11
%46 = fneg double %44
%47 = call double @llvm.fmuladd.f64(double %46, double %45, double 1.000000e+00)
%48 = fmul double %43, %47
%49 = fptosi double %48 to i32
%50 = call i32 @sqrt(i32 %49)
%51 = sdiv i32 1, %50
%52 = sitofp i32 %51 to double
store double %52, double* %16
%53 = load double, double* %7
%54 = load double, double* %9
%55 = fsub double %53, %54
%56 = load double, double* %11
%57 = load double, double* %14
%58 = load double, double* %12
%59 = fdiv double %57, %58
%60 = fmul double %56, %59
%61 = load double, double* %6
%62 = load double, double* %8
%63 = fsub double %61, %62
%64 = fneg double %60
%65 = call double @llvm.fmuladd.f64(double %64, double %63, double %55)
store double %65, double* %17
%66 = load double, double* %17
%67 = load double, double* %17
%68 = fmul double %67, %66
store double %68, double* %17
%69 = load double, double* %15
%70 = load double, double* %11
%71 = load double, double* %11
%72 = fneg double %70
%73 = call double @llvm.fmuladd.f64(double %72, double %71, double 1.000000e+00)
%74 = fmul double %69, %73
%75 = load double, double* %17
%76 = fdiv double %75, %74
store double %76, double* %17
%77 = load double, double* %16
%78 = load double, double* %17
%79 = fmul double -5.000000e-01, %78
%80 = call double @exp(double %79)
%81 = fmul double %77, %80
ret double %81
}

LLVM IR (-O2):
define double @bivarcond(double %0, double %1, double %2, double %3, double* nocapture %4) {
%6 = load double, double* %4
%7 = getelementptr inbounds double, double* %4, i64 3
%8 = load double, double* %7
%9 = fptosi double %6 to i32
%10 = tail call i32 @sqrt(i32 %9)
%11 = sitofp i32 %10 to double
%12 = fptosi double %8 to i32
%13 = tail call i32 @sqrt(i32 %12)
%14 = sitofp i32 %13 to double
%15 = getelementptr inbounds double, double* %4, i64 1
%16 = load double, double* %15
%17 = fmul double %6, %8
%18 = fptosi double %17 to i32
%19 = tail call i32 @sqrt(i32 %18)
%20 = sitofp i32 %19 to double
%21 = fdiv double %16, %20
%22 = fmul double %8, 6.280000e+00
%23 = fneg double %21
%24 = tail call double @llvm.fmuladd.f64(double %23, double %21, double 1.000000e+00)
%25 = fmul double %22, %24
%26 = fptosi double %25 to i32
%27 = tail call i32 @sqrt(i32 %26)
%28 = add i32 %27, 1
%29 = icmp ult i32 %28, 3
%30 = select i1 %29, i32 %27, i32 0
%31 = sitofp i32 %30 to double
%32 = fsub double %1, %3
%33 = fdiv double %14, %11
%34 = fsub double %0, %2
%35 = fmul double %33, %23
%36 = tail call double @llvm.fmuladd.f64(double %35, double %34, double %32)
%37 = fmul double %36, %36
%38 = fmul double %8, %24
%39 = fdiv double %37, %38
%40 = fmul double %39, -5.000000e-01
%41 = tail call double @exp(double %40)
%42 = fmul double %41, %31
ret double %42
}