#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 */
float cos(double);
double log(float);
float random2();
float sqrt(double);
float proc_normal(void *data) {
  float mu = ((float *)data)[0];
  float sigma = ((float *)data)[1];
  float x = random2();
  float y = random2();
  float z = sqrt(-2.0 * log(x)) * cos(2.0 * (3.14159265359) * y);
  return mu + sigma * z;
}


x86 assembly (clang, -O0):
<proc_normal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <random2@plt>
movss  %xmm0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <random2@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe74(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe4d(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x20(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc_normal>:
sub    $0x18,%rsp
movss  (%rdi),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0x4(%rdi),%xmm0
movss  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <random2@plt>
movss  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <random2@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
call   1050 <log@plt>
mulsd  0xe7a(%rip),%xmm0
call   1060 <sqrt@plt>
movss  %xmm0,0x8(%rsp)
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe65(%rip),%xmm0
call   1040 <cos@plt>
mulss  0x8(%rsp),%xmm0
mulss  0x10(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @proc_normal(i8* %0) {
%2 = alloca i8*
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to float*
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
store float %11, float* %3
%12 = load i8*, i8** %2
%13 = bitcast i8* %12 to float*
%14 = getelementptr inbounds float, float* %13, i64 1
%15 = load float, float* %14
store float %15, float* %4
%16 = call float (...) @random2()
store float %16, float* %5
%17 = call float (...) @random2()
store float %17, float* %6
%18 = load float, float* %5
%19 = call double @log(float %18)
%20 = fmul double -2.000000e+00, %19
%21 = call float @sqrt(double %20)
%22 = load float, float* %6
%23 = fpext float %22 to double
%24 = fmul double 0x401921FB54442EEA, %23
%25 = call float @cos(double %24)
%26 = fmul float %21, %25
store float %26, float* %7
%27 = load float, float* %3
%28 = load float, float* %4
%29 = load float, float* %7
%30 = call float @llvm.fmuladd.f32(float %28, float %29, float %27)
ret float %30
}

LLVM IR (-O2):
define float @proc_normal(i8* nocapture %0) {
%2 = bitcast i8* %0 to float*
%3 = load float, float* %2
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = bitcast i8* %4 to float*
%6 = load float, float* %5
%7 = tail call float (...) @random2()
%8 = tail call float (...) @random2()
%9 = tail call double @log(float %7)
%10 = fmul double %9, -2.000000e+00
%11 = tail call float @sqrt(double %10)
%12 = fpext float %8 to double
%13 = fmul double %12, 0x401921FB54442EEA
%14 = tail call float @cos(double %13)
%15 = fmul float %11, %14
%16 = tail call float @llvm.fmuladd.f32(float %6, float %15, float %3)
ret float %16
}