#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 F_JKISS();
double cos(int);
int log(double);
double sin(int);
double sqrt(int);
double gaussBM() {
  static double U, V;
  static int phase = 0;
  double Z;
  if (phase == 0) {
    U = F_JKISS() + 1. / (9007199254740992.0);
    V = F_JKISS();
    Z = sqrt(-2 * log(U)) * sin(2 * 3.141592654 * V);
  } else
    Z = sqrt(-2 * log(U)) * cos(2 * 3.141592654 * V);
  phase = 1 - phase;
  return Z;
}


x86 assembly (clang, -O0):
<gaussBM>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
cmpl   $0x0,0x2f01(%rip)
jne    11e3 <gaussBM+0x93>
mov    $0x0,%al
call   1070 <F_JKISS@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe90(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x2ecc(%rip)
mov    $0x0,%al
call   1070 <F_JKISS@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2ec1(%rip)
movsd  0x2eb1(%rip),%xmm0
call   1050 <log@plt>
imul   $0xfffffffe,%eax,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xe44(%rip),%xmm0
mulsd  0x2e94(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    122a <gaussBM+0xda>
movsd  0x2e65(%rip),%xmm0
call   1050 <log@plt>
imul   $0xfffffffe,%eax,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xdf8(%rip),%xmm0
mulsd  0x2e48(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    $0x1,%eax
sub    0x2e2b(%rip),%eax
mov    %eax,0x2e25(%rip)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gaussBM>:
push   %rax
cmpl   $0x0,0x2f08(%rip)
je     1191 <gaussBM+0x41>
movsd  0x2eee(%rip),%xmm0
call   1050 <log@plt>
lea    (%rax,%rax,1),%edi
neg    %edi
call   1060 <sqrt@plt>
movsd  %xmm0,(%rsp)
movsd  0x2eda(%rip),%xmm0
mulsd  0xe7a(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <cos@plt>
jmp    11f7 <gaussBM+0xa7>
xor    %eax,%eax
call   1070 <F_JKISS@plt>
cvtsi2sd %eax,%xmm0
addsd  0xe64(%rip),%xmm0
movsd  %xmm0,0x2ea4(%rip)
xor    %eax,%eax
call   1070 <F_JKISS@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x2e96(%rip)
movsd  0x2e86(%rip),%xmm0
call   1050 <log@plt>
lea    (%rax,%rax,1),%edi
neg    %edi
call   1060 <sqrt@plt>
movsd  %xmm0,(%rsp)
movsd  0x2e72(%rip),%xmm0
mulsd  0xe12(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
mov    $0x1,%eax
sub    0x2e59(%rip),%eax
mov    %eax,0x2e53(%rip)
pop    %rax
ret

LLVM IR (-O0):
@gaussBM.U = internal global double 0.000000e+00
@gaussBM.V = internal global double 0.000000e+00
@gaussBM.phase = internal global i32 0
define double @gaussBM() {
%1 = alloca double
%2 = load i32, i32* @gaussBM.phase
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %19
4: ; preds = %0
%5 = call i32 (...) @F_JKISS()
%6 = sitofp i32 %5 to double
%7 = fadd double %6, 0x3CA0000000000000
store double %7, double* @gaussBM.U
%8 = call i32 (...) @F_JKISS()
%9 = sitofp i32 %8 to double
store double %9, double* @gaussBM.V
%10 = load double, double* @gaussBM.U
%11 = call i32 @log(double %10)
%12 = mul nsw i32 -2, %11
%13 = call double @sqrt(i32 %12)
%14 = load double, double* @gaussBM.V
%15 = fmul double 0x401921FB54524550, %14
%16 = fptosi double %15 to i32
%17 = call double @sin(i32 %16)
%18 = fmul double %13, %17
store double %18, double* %1
br label %29
19: ; preds = %0
%20 = load double, double* @gaussBM.U
%21 = call i32 @log(double %20)
%22 = mul nsw i32 -2, %21
%23 = call double @sqrt(i32 %22)
%24 = load double, double* @gaussBM.V
%25 = fmul double 0x401921FB54524550, %24
%26 = fptosi double %25 to i32
%27 = call double @cos(i32 %26)
%28 = fmul double %23, %27
store double %28, double* %1
br label %29
29: ; preds = %19, %4
%30 = load i32, i32* @gaussBM.phase
%31 = sub nsw i32 1, %30
store i32 %31, i32* @gaussBM.phase
%32 = load double, double* %1
ret double %32
}

LLVM IR (-O2):
@gaussBM.U = internal unnamed_addr global double 0.000000e+00
@gaussBM.V = internal unnamed_addr global double 0.000000e+00
@gaussBM.phase = internal unnamed_addr global i32 0
define double @gaussBM() {
%1 = load i32, i32* @gaussBM.phase
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %18
3: ; preds = %0
%4 = tail call i32 (...) @F_JKISS()
%5 = sitofp i32 %4 to double
%6 = fadd double %5, 0x3CA0000000000000
store double %6, double* @gaussBM.U
%7 = tail call i32 (...) @F_JKISS()
%8 = sitofp i32 %7 to double
store double %8, double* @gaussBM.V
%9 = load double, double* @gaussBM.U
%10 = tail call i32 @log(double %9)
%11 = mul nsw i32 %10, -2
%12 = tail call double @sqrt(i32 %11)
%13 = load double, double* @gaussBM.V
%14 = fmul double %13, 0x401921FB54524550
%15 = fptosi double %14 to i32
%16 = tail call double @sin(i32 %15)
%17 = fmul double %12, %16
br label %28
18: ; preds = %0
%19 = load double, double* @gaussBM.U
%20 = tail call i32 @log(double %19)
%21 = mul nsw i32 %20, -2
%22 = tail call double @sqrt(i32 %21)
%23 = load double, double* @gaussBM.V
%24 = fmul double %23, 0x401921FB54524550
%25 = fptosi double %24 to i32
%26 = tail call double @cos(i32 %25)
%27 = fmul double %22, %26
br label %28
28: ; preds = %18, %3
%29 = phi double [ %17, %3 ], [ %27, %18 ]
%30 = load i32, i32* @gaussBM.phase
%31 = sub nsw i32 1, %30
store i32 %31, i32* @gaussBM.phase
ret double %29
}