#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 */
typedef scalar_t__ RAND_MAX;

/* Variables and functions */
double log(float);
scalar_t__ rand();
float sqrt(double);
float parcels_normalvariate(float loc, float scale) {
  float x1, x2, w, y1;
  do {
    x1 = 2.0 * (float)rand() / (float)(RAND_MAX)-1.0;
    x2 = 2.0 * (float)rand() / (float)(RAND_MAX)-1.0;
    w = x1 * x1 + x2 * x2;
  } while (w >= 1.0);
  w = sqrt((-2.0 * log(w)) / w);
  y1 = x1 * w;
  return (loc + y1 * scale);
}


x86 assembly (clang, -O0):
<parcels_normalvariate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xeae(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe9a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe7d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe69(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe3a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jae    1142 <parcels_normalvariate+0x12>
movss  -0x14(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe23(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parcels_normalvariate>:
sub    $0x18,%rsp
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0xc(%rsp)
xor    %eax,%eax
call   1050 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
movss  0xea9(%rip),%xmm0
mulss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
xor    %eax,%eax
call   1050 <rand@plt>
xorps  %xmm1,%xmm1
cvtsi2ss %rax,%xmm1
mulss  0xe88(%rip),%xmm1
mulss  %xmm1,%xmm1
movss  0x4(%rsp),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
ucomiss 0xe73(%rip),%xmm0
jae    1140 <parcels_normalvariate+0x10>
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
call   1030 <log@plt>
mulsd  0xe5b(%rip),%xmm0
divsd  0x10(%rsp),%xmm0
call   1040 <sqrt@plt>
mulss  0x4(%rsp),%xmm0
mulss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @parcels_normalvariate(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %3
store float %1, float* %4
br label %9
9: ; preds = %28, %2
%10 = call i64 (...) @rand()
%11 = sitofp i64 %10 to float
%12 = fpext float %11 to double
%13 = fmul double 2.000000e+00, %12
%14 = fdiv double %13, -1.000000e+00
%15 = fptrunc double %14 to float
store float %15, float* %5
%16 = call i64 (...) @rand()
%17 = sitofp i64 %16 to float
%18 = fpext float %17 to double
%19 = fmul double 2.000000e+00, %18
%20 = fdiv double %19, -1.000000e+00
%21 = fptrunc double %20 to float
store float %21, float* %6
%22 = load float, float* %5
%23 = load float, float* %5
%24 = load float, float* %6
%25 = load float, float* %6
%26 = fmul float %24, %25
%27 = call float @llvm.fmuladd.f32(float %22, float %23, float %26)
store float %27, float* %7
br label %28
28: ; preds = %9
%29 = load float, float* %7
%30 = fpext float %29 to double
%31 = fcmp oge double %30, 1.000000e+00
br i1 %31, label %9, label %32
32: ; preds = %28
%33 = load float, float* %7
%34 = call double @log(float %33)
%35 = fmul double -2.000000e+00, %34
%36 = load float, float* %7
%37 = fpext float %36 to double
%38 = fdiv double %35, %37
%39 = call float @sqrt(double %38)
store float %39, float* %7
%40 = load float, float* %5
%41 = load float, float* %7
%42 = fmul float %40, %41
store float %42, float* %8
%43 = load float, float* %3
%44 = load float, float* %8
%45 = load float, float* %4
%46 = call float @llvm.fmuladd.f32(float %44, float %45, float %43)
ret float %46
}

LLVM IR (-O2):
define float @parcels_normalvariate(float %0, float %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i64 (...) @rand()
%5 = sitofp i64 %4 to float
%6 = fmul float %5, -2.000000e+00
%7 = tail call i64 (...) @rand()
%8 = sitofp i64 %7 to float
%9 = fmul float %8, -2.000000e+00
%10 = fmul float %9, %9
%11 = tail call float @llvm.fmuladd.f32(float %6, float %6, float %10)
%12 = fcmp ult float %11, 1.000000e+00
br i1 %12, label %13, label %3
13: ; preds = %3
%14 = fpext float %11 to double
%15 = tail call double @log(float %11)
%16 = fmul double %15, -2.000000e+00
%17 = fdiv double %16, %14
%18 = tail call float @sqrt(double %17)
%19 = fmul float %6, %18
%20 = tail call float @llvm.fmuladd.f32(float %19, float %1, float %0)
ret float %20
}