#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 log(float);
float rnd();
float sin(double);
float sqrt(int);
double normal(double av, double st) {
  float r1, r2, z1, z2;
  r1 = rnd();
  r2 = rnd();
  z1 = sqrt(-2. * log(r1));
  z2 = sin(6.283185307179586 * r2);
  return st * z1 * z2 + av;
}


x86 assembly (clang, -O0):
<normal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rnd@plt>
movss  %xmm0,-0x14(%rbp)
mov    $0x0,%al
call   1030 <rnd@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
call   1050 <log@plt>
cvtsi2sd %eax,%xmm1
movsd  0xe88(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe5d(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <sin@plt>
movss  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normal>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <rnd@plt>
movss  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rnd@plt>
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1050 <log@plt>
lea    (%rax,%rax,1),%edi
neg    %edi
call   1060 <sqrt@plt>
movss  %xmm0,(%rsp)
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe6c(%rip),%xmm0
call   1040 <sin@plt>
movss  (%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0x8(%rsp),%xmm1
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @normal(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store double %0, double* %3
store double %1, double* %4
%9 = call float (...) @rnd()
store float %9, float* %5
%10 = call float (...) @rnd()
store float %10, float* %6
%11 = load float, float* %5
%12 = call i32 @log(float %11)
%13 = sitofp i32 %12 to double
%14 = fmul double -2.000000e+00, %13
%15 = fptosi double %14 to i32
%16 = call float @sqrt(i32 %15)
store float %16, float* %7
%17 = load float, float* %6
%18 = fpext float %17 to double
%19 = fmul double 0x401921FB54442D18, %18
%20 = call float @sin(double %19)
store float %20, float* %8
%21 = load double, double* %4
%22 = load float, float* %7
%23 = fpext float %22 to double
%24 = fmul double %21, %23
%25 = load float, float* %8
%26 = fpext float %25 to double
%27 = load double, double* %3
%28 = call double @llvm.fmuladd.f64(double %24, double %26, double %27)
ret double %28
}

LLVM IR (-O2):
define double @normal(double %0, double %1) {
%3 = tail call float (...) @rnd()
%4 = tail call float (...) @rnd()
%5 = tail call i32 @log(float %3)
%6 = mul i32 %5, -2
%7 = tail call float @sqrt(i32 %6)
%8 = fpext float %4 to double
%9 = fmul double %8, 0x401921FB54442D18
%10 = tail call float @sin(double %9)
%11 = fpext float %7 to double
%12 = fmul double %11, %1
%13 = fpext float %10 to double
%14 = tail call double @llvm.fmuladd.f64(double %12, double %13, double %0)
ret double %14
}