#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 pow(double, double);
int sqrt(int);
double normdistribution(double x, void *param) {
  int u = 1;
  int s = 1;
  double coef = 1 / (sqrt(2 * 3.14159265358979323846264338327950 * s * s));
  double exp = -1 * (x - u) * (x - u) / (2 * s * s);
  return coef *
         pow(2.718281828459045235360287471352662497757247093699959574966, exp);
}


x86 assembly (clang, -O0):
<normdistribution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
cvtsi2sdl -0x18(%rbp),%xmm1
movsd  0xec4(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe7d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
imul   -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  0xe31(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normdistribution>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
mov    $0x6,%edi
call   1040 <sqrt@plt>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x3,%ecx
cmovb  %eax,%edx
xorps  %xmm0,%xmm0
cvtsi2sd %edx,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm1
addsd  0xea6(%rip),%xmm1
mulsd  %xmm1,%xmm1
mulsd  0xea2(%rip),%xmm1
movsd  0xea2(%rip),%xmm0
call   1030 <pow@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @normdistribution(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store double %0, double* %3
store i8* %1, i8** %4
store i32 1, i32* %5
store i32 1, i32* %6
%9 = load i32, i32* %6
%10 = sitofp i32 %9 to double
%11 = fmul double 0x401921FB54442D18, %10
%12 = load i32, i32* %6
%13 = sitofp i32 %12 to double
%14 = fmul double %11, %13
%15 = fptosi double %14 to i32
%16 = call i32 @sqrt(i32 %15)
%17 = sdiv i32 1, %16
%18 = sitofp i32 %17 to double
store double %18, double* %7
%19 = load double, double* %3
%20 = load i32, i32* %5
%21 = sitofp i32 %20 to double
%22 = fsub double %19, %21
%23 = fmul double -1.000000e+00, %22
%24 = load double, double* %3
%25 = load i32, i32* %5
%26 = sitofp i32 %25 to double
%27 = fsub double %24, %26
%28 = fmul double %23, %27
%29 = load i32, i32* %6
%30 = mul nsw i32 2, %29
%31 = load i32, i32* %6
%32 = mul nsw i32 %30, %31
%33 = sitofp i32 %32 to double
%34 = fdiv double %28, %33
store double %34, double* %8
%35 = load double, double* %7
%36 = load double, double* %8
%37 = call double @pow(double 0x4005BF0A8B145769, double %36)
%38 = fmul double %35, %37
ret double %38
}

LLVM IR (-O2):
define double @normdistribution(double %0, i8* nocapture readnone %1) {
%3 = tail call i32 @sqrt(i32 6)
%4 = add i32 %3, 1
%5 = icmp ult i32 %4, 3
%6 = select i1 %5, i32 %3, i32 0
%7 = sitofp i32 %6 to double
%8 = fadd double %0, -1.000000e+00
%9 = fneg double %8
%10 = fmul double %8, %9
%11 = fmul double %10, 5.000000e-01
%12 = tail call double @pow(double 0x4005BF0A8B145769, double %11)
%13 = fmul double %12, %7
ret double %13
}