#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 M_PI;
double exp(double);
double pow(double, int);
double sqrt(double);
double normdist(double x, double mean, double stdev) {
  double p = pow((x - mean) / stdev, 2);
  return (1.0 / (stdev * sqrt(2.0 * M_PI))) * exp(-0.5 * p);
}


x86 assembly (clang, -O0):
<normdist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe99(%rip),%xmm0
mov    0x2e6a(%rip),%rax
mulsd  (%rax),%xmm0
call   1050 <sqrt@plt>
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe70(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe57(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normdist>:
sub    $0x18,%rsp
subsd  %xmm1,%xmm0
movsd  %xmm2,0x8(%rsp)
divsd  %xmm2,%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movapd %xmm0,%xmm2
mov    0x2e91(%rip),%rax
movsd  (%rax),%xmm0
addsd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     116f <normdist+0x3f>
sqrtsd %xmm0,%xmm0
jmp    1180 <normdist+0x50>
movsd  %xmm2,0x10(%rsp)
call   1050 <sqrt@plt>
movsd  0x10(%rsp),%xmm2
mulsd  0x8(%rsp),%xmm0
movsd  0xe72(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mulsd  0xe68(%rip),%xmm2
movapd %xmm2,%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @normdist(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %4
%9 = load double, double* %5
%10 = fsub double %8, %9
%11 = load double, double* %6
%12 = fdiv double %10, %11
%13 = call double @pow(double %12, i32 2)
store double %13, double* %7
%14 = load double, double* %6
%15 = load double, double* @M_PI
%16 = fmul double 2.000000e+00, %15
%17 = call double @sqrt(double %16)
%18 = fmul double %14, %17
%19 = fdiv double 1.000000e+00, %18
%20 = load double, double* %7
%21 = fmul double -5.000000e-01, %20
%22 = call double @exp(double %21)
%23 = fmul double %19, %22
ret double %23
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @normdist(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = fdiv double %4, %2
%6 = tail call double @pow(double %5, i32 2)
%7 = load double, double* @M_PI
%8 = fmul double %7, 2.000000e+00
%9 = tail call double @sqrt(double %8)
%10 = fmul double %9, %2
%11 = fdiv double 1.000000e+00, %10
%12 = fmul double %6, -5.000000e-01
%13 = tail call double @exp(double %12)
%14 = fmul double %13, %11
ret double %14
}