#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 log(double);
double sin(double);
double sqrt(double);
double monte_normal_df(double x1, double x2) {
  double a, b;
  if (x1 < 1e-7) {
    x1 = 1e-7;
  }
  a = -2.0 * log(x1);
  b = sin(2.0 * 3.1415926535897932384626433832795029L * x2);
  if (a < 0) {
    a = 0;
  }
  return (sqrt(a) * b);
}


x86 assembly (clang, -O0):
<monte_normal_df>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xeb6(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1162 <monte_normal_df+0x32>
movsd  0xea3(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <log@plt>
movsd  0xe94(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
fldl   -0x10(%rbp)
fldt   0xe8a(%rip)
fmulp  %st,%st(1)
fstpl  -0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    11b0 <monte_normal_df+0x80>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1050 <sqrt@plt>
mulsd  -0x20(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<monte_normal_df>:
sub    $0x28,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  0xebe(%rip),%xmm1
maxsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <log@plt>
mulsd  0xeb1(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
fldt   0xea1(%rip)
fmull  0x20(%rsp)
fstpl  0x18(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <sin@plt>
movapd %xmm0,%xmm2
xorpd  %xmm1,%xmm1
xorpd  %xmm0,%xmm0
maxsd  0x8(%rsp),%xmm0
ucomisd %xmm1,%xmm0
jb     11a0 <monte_normal_df+0x70>
sqrtsd %xmm0,%xmm0
jmp    11b1 <monte_normal_df+0x81>
movsd  %xmm2,0x8(%rsp)
call   1050 <sqrt@plt>
movsd  0x8(%rsp),%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @monte_normal_df(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
%8 = fcmp olt double %7, 0x3E7AD7F29ABCAF48
br i1 %8, label %9, label %10
9: ; preds = %2
store double 0x3E7AD7F29ABCAF48, double* %3
br label %10
10: ; preds = %9, %2
%11 = load double, double* %3
%12 = call double @log(double %11)
%13 = fmul double -2.000000e+00, %12
store double %13, double* %5
%14 = load double, double* %4
%15 = fpext double %14 to x86_fp80
%16 = fmul x86_fp80 0xK4001C90FDAA22168C235, %15
%17 = fptrunc x86_fp80 %16 to double
%18 = call double @sin(double %17)
store double %18, double* %6
%19 = load double, double* %5
%20 = fcmp olt double %19, 0.000000e+00
br i1 %20, label %21, label %22
21: ; preds = %10
store double 0.000000e+00, double* %5
br label %22
22: ; preds = %21, %10
%23 = load double, double* %5
%24 = call double @sqrt(double %23)
%25 = load double, double* %6
%26 = fmul double %24, %25
ret double %26
}

LLVM IR (-O2):
define double @monte_normal_df(double %0, double %1) {
%3 = fcmp olt double %0, 0x3E7AD7F29ABCAF48
%4 = select i1 %3, double 0x3E7AD7F29ABCAF48, double %0
%5 = tail call double @log(double %4)
%6 = fmul double %5, -2.000000e+00
%7 = fpext double %1 to x86_fp80
%8 = fmul x86_fp80 %7, 0xK4001C90FDAA22168C235
%9 = fptrunc x86_fp80 %8 to double
%10 = tail call double @sin(double %9)
%11 = fcmp olt double %6, 0.000000e+00
%12 = select i1 %11, double 0.000000e+00, double %6
%13 = tail call double @sqrt(double %12)
%14 = fmul double %10, %13
ret double %14
}