#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 */
int exp(double);
double log(double);
double rand_double();
double sqrt(double);
double _normal_01_bili() {
  const double M_exp1 = exp(1.0);
  double u, v, x, x2;
  const double c1 = sqrt(8.0 / M_exp1);
  const double c2 = exp(0.25) * 4;
  const double c3 = exp(-1.35) * 4;
  while (1) {
    do {
      u = rand_double();
    } while (u == 0.0);
    v = rand_double();
    x = c1 * (v - 0.5) / u;
    x2 = x * x;
    if (x2 <= 5.0 - c2 * u)
      break;
    if (x2 >= c3 / u + 1.4)
      continue;
    if (x2 <= -4.8 * log(u))
      break;
  }
  return x;
}


x86 assembly (clang, -O0):
<_normal_01_bili>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  0xec8(%rip),%xmm0
call   1040 <exp@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xeaa(%rip),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xe8b(%rip),%xmm0
call   1040 <exp@plt>
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xe6a(%rip),%xmm0
call   1040 <exp@plt>
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11ac <_normal_01_bili+0x6c>
mov    $0x0,%al
call   1030 <rand_double@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11d5 <_normal_01_bili+0x95>
jp     11d5 <_normal_01_bili+0x95>
jmp    11ac <_normal_01_bili+0x6c>
mov    $0x0,%al
call   1030 <rand_double@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe35(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
movsd  0xdda(%rip),%xmm2
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     1259 <_normal_01_bili+0x119>
jmp    12bf <_normal_01_bili+0x17f>
movsd  -0x28(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
divsd  -0x10(%rbp),%xmm1
movsd  0xdc0(%rip),%xmm2
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jb     1283 <_normal_01_bili+0x143>
jmp    11a7 <_normal_01_bili+0x67>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
movsd  -0x48(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  0xd91(%rip),%xmm0
mulsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     12ba <_normal_01_bili+0x17a>
jmp    12bf <_normal_01_bili+0x17f>
jmp    11a7 <_normal_01_bili+0x67>
movsd  -0x20(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_normal_01_bili>:
sub    $0x38,%rsp
movsd  0xeb4(%rip),%xmm0
call   1040 <exp@plt>
cvtsi2sd %eax,%xmm1
movsd  0xeab(%rip),%xmm0
divsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1171 <_normal_01_bili+0x31>
sqrtsd %xmm0,%xmm0
jmp    1176 <_normal_01_bili+0x36>
call   1060 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
movsd  0xe8c(%rip),%xmm0
call   1040 <exp@plt>
shl    $0x2,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd %xmm0,0x10(%rsp)
movsd  0xe77(%rip),%xmm0
call   1040 <exp@plt>
shl    $0x2,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x30(%rsp)
movapd 0x10(%rsp),%xmm0
xorpd  0xe8c(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand_double@plt>
ucomisd 0xe61(%rip),%xmm0
jne    11e3 <_normal_01_bili+0xa3>
jnp    11d0 <_normal_01_bili+0x90>
xor    %eax,%eax
movsd  %xmm0,(%rsp)
call   1030 <rand_double@plt>
movsd  (%rsp),%xmm1
movapd %xmm0,%xmm2
addsd  0xe20(%rip),%xmm2
mulsd  0x8(%rsp),%xmm2
divsd  %xmm1,%xmm2
movapd %xmm2,%xmm3
mulsd  %xmm2,%xmm3
movapd 0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xe04(%rip),%xmm0
ucomisd %xmm3,%xmm0
jae    126f <_normal_01_bili+0x12f>
movsd  0x30(%rsp),%xmm0
divsd  %xmm1,%xmm0
addsd  0xdf4(%rip),%xmm0
ucomisd %xmm0,%xmm3
jae    11d0 <_normal_01_bili+0x90>
movapd %xmm1,%xmm0
movsd  %xmm2,(%rsp)
movsd  %xmm3,0x28(%rsp)
call   1050 <log@plt>
movsd  (%rsp),%xmm2
mulsd  0xdd5(%rip),%xmm0
ucomisd 0x28(%rsp),%xmm0
jb     11d0 <_normal_01_bili+0x90>
movapd %xmm2,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @_normal_01_bili() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = call i32 @exp(double 1.000000e+00)
%10 = sitofp i32 %9 to double
store double %10, double* %1
%11 = load double, double* %1
%12 = fdiv double 8.000000e+00, %11
%13 = call double @sqrt(double %12)
store double %13, double* %6
%14 = call i32 @exp(double 2.500000e-01)
%15 = mul nsw i32 %14, 4
%16 = sitofp i32 %15 to double
store double %16, double* %7
%17 = call i32 @exp(double -1.350000e+00)
%18 = mul nsw i32 %17, 4
%19 = sitofp i32 %18 to double
store double %19, double* %8
br label %20
20: ; preds = %0, %51, %59
br label %21
21: ; preds = %23, %20
%22 = call double (...) @rand_double()
store double %22, double* %2
br label %23
23: ; preds = %21
%24 = load double, double* %2
%25 = fcmp oeq double %24, 0.000000e+00
br i1 %25, label %21, label %26
26: ; preds = %23
%27 = call double (...) @rand_double()
store double %27, double* %3
%28 = load double, double* %6
%29 = load double, double* %3
%30 = fsub double %29, 5.000000e-01
%31 = fmul double %28, %30
%32 = load double, double* %2
%33 = fdiv double %31, %32
store double %33, double* %4
%34 = load double, double* %4
%35 = load double, double* %4
%36 = fmul double %34, %35
store double %36, double* %5
%37 = load double, double* %5
%38 = load double, double* %7
%39 = load double, double* %2
%40 = fneg double %38
%41 = call double @llvm.fmuladd.f64(double %40, double %39, double 5.000000e+00)
%42 = fcmp ole double %37, %41
br i1 %42, label %43, label %44
43: ; preds = %26
br label %60
44: ; preds = %26
%45 = load double, double* %5
%46 = load double, double* %8
%47 = load double, double* %2
%48 = fdiv double %46, %47
%49 = fadd double %48, 1.400000e+00
%50 = fcmp oge double %45, %49
br i1 %50, label %51, label %52
51: ; preds = %44
br label %20
52: ; preds = %44
%53 = load double, double* %5
%54 = load double, double* %2
%55 = call double @log(double %54)
%56 = fmul double -4.800000e+00, %55
%57 = fcmp ole double %53, %56
br i1 %57, label %58, label %59
58: ; preds = %52
br label %60
59: ; preds = %52
br label %20
60: ; preds = %58, %43
%61 = load double, double* %4
ret double %61
}

LLVM IR (-O2):
define double @_normal_01_bili() {
%1 = tail call i32 @exp(double 1.000000e+00)
%2 = sitofp i32 %1 to double
%3 = fdiv double 8.000000e+00, %2
%4 = tail call double @sqrt(double %3)
%5 = tail call i32 @exp(double 2.500000e-01)
%6 = shl nsw i32 %5, 2
%7 = sitofp i32 %6 to double
%8 = tail call i32 @exp(double -1.350000e+00)
%9 = shl nsw i32 %8, 2
%10 = sitofp i32 %9 to double
%11 = fneg double %7
br label %12
12: ; preds = %15, %0
%13 = tail call double (...) @rand_double()
%14 = fcmp oeq double %13, 0.000000e+00
br i1 %14, label %15, label %16
15: ; preds = %12, %24, %28
br label %12
16: ; preds = %12
%17 = tail call double (...) @rand_double()
%18 = fadd double %17, -5.000000e-01
%19 = fmul double %4, %18
%20 = fdiv double %19, %13
%21 = fmul double %20, %20
%22 = tail call double @llvm.fmuladd.f64(double %11, double %13, double 5.000000e+00)
%23 = fcmp ugt double %21, %22
br i1 %23, label %24, label %32
24: ; preds = %16
%25 = fdiv double %10, %13
%26 = fadd double %25, 1.400000e+00
%27 = fcmp ult double %21, %26
br i1 %27, label %28, label %15
28: ; preds = %24
%29 = tail call double @log(double %13)
%30 = fmul double %29, -4.800000e+00
%31 = fcmp ugt double %21, %30
br i1 %31, label %15, label %32
32: ; preds = %28, %16
ret double %20
}