#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 cos(double);
scalar_t__ log(double);
double rand();
double sqrt(double);
double box_mueller(double std_var, double value) {
  double temp;
  double temp1;
  double random;
  random = rand();
  temp = sqrt((double)(-2.00 * (double)log(random)));
  random = rand();
  temp1 = cos(2.00 * 3.14159265358979323846 * random);
  return (temp * temp1 * std_var * value);
}


x86 assembly (clang, -O0):
<box_mueller>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
call   1040 <log@plt>
cvtsi2sd %rax,%xmm1
movsd  0xe93(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  0xe69(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1030 <cos@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<box_mueller>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
call   1040 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
mulsd  0xe94(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     117c <box_mueller+0x3c>
sqrtsd %xmm0,%xmm0
jmp    1181 <box_mueller+0x41>
call   1050 <sqrt@plt>
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1060 <rand@plt>
mulsd  0xe73(%rip),%xmm0
call   1030 <cos@plt>
mulsd  (%rsp),%xmm0
mulsd  0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @box_mueller(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %3
store double %1, double* %4
%8 = call double (...) @rand()
store double %8, double* %7
%9 = load double, double* %7
%10 = call i64 @log(double %9)
%11 = sitofp i64 %10 to double
%12 = fmul double -2.000000e+00, %11
%13 = call double @sqrt(double %12)
store double %13, double* %5
%14 = call double (...) @rand()
store double %14, double* %7
%15 = load double, double* %7
%16 = fmul double 0x401921FB54442D18, %15
%17 = call double @cos(double %16)
store double %17, double* %6
%18 = load double, double* %5
%19 = load double, double* %6
%20 = fmul double %18, %19
%21 = load double, double* %3
%22 = fmul double %20, %21
%23 = load double, double* %4
%24 = fmul double %22, %23
ret double %24
}

LLVM IR (-O2):
define double @box_mueller(double %0, double %1) {
%3 = tail call double (...) @rand()
%4 = tail call i64 @log(double %3)
%5 = sitofp i64 %4 to double
%6 = fmul double %5, -2.000000e+00
%7 = tail call double @sqrt(double %6)
%8 = tail call double (...) @rand()
%9 = fmul double %8, 0x401921FB54442D18
%10 = tail call double @cos(double %9)
%11 = fmul double %7, %10
%12 = fmul double %11, %0
%13 = fmul double %12, %1
ret double %13
}