#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 rndNormal();
double rndu();
double sqrt(int);
double rnd2NormalSym(double m) {
  double z = m + rndNormal() * sqrt(1 - m * m);
  if (rndu() < 0.5)
    z = -z;
  return (z);
}


x86 assembly (clang, -O0):
<rnd2NormalSym>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1040 <rndNormal@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe88(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1050 <sqrt@plt>
movsd  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rndu@plt>
movaps %xmm0,%xmm1
movsd  0xe47(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11e4 <rnd2NormalSym+0xb4>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd2NormalSym>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1040 <rndNormal@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0xea9(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1050 <sqrt@plt>
mulsd  0x10(%rsp),%xmm0
addsd  (%rsp),%xmm0
movapd %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rndu@plt>
movapd 0xe8d(%rip),%xmm1
cmpltsd 0xe7c(%rip),%xmm0
movapd (%rsp),%xmm2
xorpd  %xmm2,%xmm1
andpd  %xmm0,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @rnd2NormalSym(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double (...) @rndNormal()
%6 = load double, double* %2
%7 = load double, double* %2
%8 = fneg double %6
%9 = call double @llvm.fmuladd.f64(double %8, double %7, double 1.000000e+00)
%10 = fptosi double %9 to i32
%11 = call double @sqrt(i32 %10)
%12 = call double @llvm.fmuladd.f64(double %5, double %11, double %4)
store double %12, double* %3
%13 = call double (...) @rndu()
%14 = fcmp olt double %13, 5.000000e-01
br i1 %14, label %15, label %18
15: ; preds = %1
%16 = load double, double* %3
%17 = fneg double %16
store double %17, double* %3
br label %18
18: ; preds = %15, %1
%19 = load double, double* %3
ret double %19
}

LLVM IR (-O2):
define double @rnd2NormalSym(double %0) {
%2 = tail call double (...) @rndNormal()
%3 = fneg double %0
%4 = tail call double @llvm.fmuladd.f64(double %3, double %0, double 1.000000e+00)
%5 = fptosi double %4 to i32
%6 = tail call double @sqrt(i32 %5)
%7 = tail call double @llvm.fmuladd.f64(double %2, double %6, double %0)
%8 = tail call double (...) @rndu()
%9 = fcmp olt double %8, 5.000000e-01
%10 = fneg double %7
%11 = select i1 %9, double %10, double %7
ret double %11
}