#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 pbivnorm1(double, double, double);
double pbivnorm(double lower1, double lower2, double upper1, double upper2,
                double cor) {
  double p1 = pbivnorm1(upper1, upper2, cor);
  double p2 = -pbivnorm1(lower1, upper2, cor);
  double p3 = -pbivnorm1(upper1, lower2, cor);
  double p4 = pbivnorm1(lower1, lower2, cor);
  return p1 + p2 + p3 + p4;
}


x86 assembly (clang, -O0):
<pbivnorm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1030 <pbivnorm1@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1030 <pbivnorm1@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1030 <pbivnorm1@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
call   1030 <pbivnorm1@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pbivnorm>:
sub    $0x38,%rsp
movsd  %xmm4,0x18(%rsp)
movsd  %xmm3,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x28(%rsp)
movsd  %xmm0,0x20(%rsp)
movaps %xmm2,%xmm0
movaps %xmm3,%xmm1
movaps %xmm4,%xmm2
call   1030 <pbivnorm1@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
call   1030 <pbivnorm1@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
call   1030 <pbivnorm1@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
call   1030 <pbivnorm1@plt>
movsd  0x30(%rsp),%xmm1
subsd  0x10(%rsp),%xmm1
subsd  0x8(%rsp),%xmm1
addsd  %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @pbivnorm(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
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
%15 = load double, double* %8
%16 = load double, double* %9
%17 = load double, double* %10
%18 = call double @pbivnorm1(double %15, double %16, double %17)
store double %18, double* %11
%19 = load double, double* %6
%20 = load double, double* %9
%21 = load double, double* %10
%22 = call double @pbivnorm1(double %19, double %20, double %21)
%23 = fneg double %22
store double %23, double* %12
%24 = load double, double* %8
%25 = load double, double* %7
%26 = load double, double* %10
%27 = call double @pbivnorm1(double %24, double %25, double %26)
%28 = fneg double %27
store double %28, double* %13
%29 = load double, double* %6
%30 = load double, double* %7
%31 = load double, double* %10
%32 = call double @pbivnorm1(double %29, double %30, double %31)
store double %32, double* %14
%33 = load double, double* %11
%34 = load double, double* %12
%35 = fadd double %33, %34
%36 = load double, double* %13
%37 = fadd double %35, %36
%38 = load double, double* %14
%39 = fadd double %37, %38
ret double %39
}

LLVM IR (-O2):
define double @pbivnorm(double %0, double %1, double %2, double %3, double %4) {
%6 = tail call double @pbivnorm1(double %2, double %3, double %4)
%7 = tail call double @pbivnorm1(double %0, double %3, double %4)
%8 = tail call double @pbivnorm1(double %2, double %1, double %4)
%9 = tail call double @pbivnorm1(double %0, double %1, double %4)
%10 = fsub double %6, %7
%11 = fsub double %10, %8
%12 = fadd double %11, %9
ret double %12
}