#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);
double sqrt(double);
double phi2(double z1, double z2, double rh) {
  double r1, tem;
  r1 = 1. - rh * rh;
  tem = (z1 * z1 + z2 * z2 - 2. * rh * z1 * z2) / r1;
  return (0.1591549430918953 * exp(-.5 * tem) / sqrt(r1));
}


x86 assembly (clang, -O0):
<phi2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xeb4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe7f(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe37(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe1a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<phi2>:
push   %rax
movapd %xmm2,%xmm3
mulsd  %xmm2,%xmm3
movsd  0xecf(%rip),%xmm4
subsd  %xmm3,%xmm4
movsd  %xmm4,(%rsp)
movapd %xmm0,%xmm3
mulsd  0xec2(%rip),%xmm2
mulsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm1
mulsd  %xmm3,%xmm3
addsd  %xmm1,%xmm3
addsd  %xmm3,%xmm0
divsd  %xmm4,%xmm0
mulsd  0xea6(%rip),%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm2
mulsd  0xe9d(%rip),%xmm2
xorpd  %xmm0,%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jb     1194 <phi2+0x74>
sqrtsd %xmm0,%xmm0
jmp    11a3 <phi2+0x83>
movsd  %xmm2,(%rsp)
call   1040 <sqrt@plt>
movsd  (%rsp),%xmm2
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @phi2(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%9 = load double, double* %6
%10 = load double, double* %6
%11 = fneg double %9
%12 = call double @llvm.fmuladd.f64(double %11, double %10, double 1.000000e+00)
store double %12, double* %7
%13 = load double, double* %4
%14 = load double, double* %4
%15 = load double, double* %5
%16 = load double, double* %5
%17 = fmul double %15, %16
%18 = call double @llvm.fmuladd.f64(double %13, double %14, double %17)
%19 = load double, double* %6
%20 = fmul double 2.000000e+00, %19
%21 = load double, double* %4
%22 = fmul double %20, %21
%23 = load double, double* %5
%24 = fneg double %22
%25 = call double @llvm.fmuladd.f64(double %24, double %23, double %18)
%26 = load double, double* %7
%27 = fdiv double %25, %26
store double %27, double* %8
%28 = load double, double* %8
%29 = fmul double -5.000000e-01, %28
%30 = call double @exp(double %29)
%31 = fmul double 0x3FC45F306DC9C881, %30
%32 = load double, double* %7
%33 = call double @sqrt(double %32)
%34 = fdiv double %31, %33
ret double %34
}

LLVM IR (-O2):
define double @phi2(double %0, double %1, double %2) {
%4 = fneg double %2
%5 = tail call double @llvm.fmuladd.f64(double %4, double %2, double 1.000000e+00)
%6 = fmul double %1, %1
%7 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %6)
%8 = fmul double %2, -2.000000e+00
%9 = fmul double %8, %0
%10 = tail call double @llvm.fmuladd.f64(double %9, double %1, double %7)
%11 = fdiv double %10, %5
%12 = fmul double %11, -5.000000e-01
%13 = tail call double @exp(double %12)
%14 = fmul double %13, 0x3FC45F306DC9C881
%15 = tail call double @sqrt(double %5)
%16 = fdiv double %14, %15
ret double %16
}