#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 exp(double);
double sqrt(double);
double inverseGaussian(double x, double mu, double lambda) {
  double exponent = -lambda * (x - mu) * (x - mu) / (2 * mu * mu * x);
  double factor = sqrt(lambda / (2 * 3.14159265358979323846 * x * x * x));
  return factor * exp(exponent);
}


x86 assembly (clang, -O0):
<inverseGaussian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe91(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe64(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inverseGaussian>:
sub    $0x28,%rsp
movapd 0xed4(%rip),%xmm4
xorpd  %xmm2,%xmm4
movapd %xmm0,%xmm3
subsd  %xmm1,%xmm3
unpcklpd %xmm1,%xmm3
shufpd $0x2,0xecb(%rip),%xmm4
mulpd  %xmm3,%xmm4
mulpd  %xmm3,%xmm4
movapd %xmm4,%xmm1
unpckhpd %xmm4,%xmm1
mulsd  %xmm0,%xmm1
divsd  %xmm1,%xmm4
movsd  0xebb(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jb     1188 <inverseGaussian+0x68>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
jmp    119d <inverseGaussian+0x7d>
movapd %xmm2,%xmm0
movapd %xmm4,0x10(%rsp)
call   1040 <sqrt@plt>
movapd 0x10(%rsp),%xmm4
movsd  %xmm0,0x8(%rsp)
movapd %xmm4,%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @inverseGaussian(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%9 = load double, double* %6
%10 = fneg double %9
%11 = load double, double* %4
%12 = load double, double* %5
%13 = fsub double %11, %12
%14 = fmul double %10, %13
%15 = load double, double* %4
%16 = load double, double* %5
%17 = fsub double %15, %16
%18 = fmul double %14, %17
%19 = load double, double* %5
%20 = fmul double 2.000000e+00, %19
%21 = load double, double* %5
%22 = fmul double %20, %21
%23 = load double, double* %4
%24 = fmul double %22, %23
%25 = fdiv double %18, %24
store double %25, double* %7
%26 = load double, double* %6
%27 = load double, double* %4
%28 = fmul double 0x401921FB54442D18, %27
%29 = load double, double* %4
%30 = fmul double %28, %29
%31 = load double, double* %4
%32 = fmul double %30, %31
%33 = fdiv double %26, %32
%34 = call double @sqrt(double %33)
store double %34, double* %8
%35 = load double, double* %8
%36 = load double, double* %7
%37 = call double @exp(double %36)
%38 = fmul double %35, %37
ret double %38
}

LLVM IR (-O2):
define double @inverseGaussian(double %0, double %1, double %2) {
%4 = fneg double %2
%5 = fsub double %0, %1
%6 = insertelement <2 x double> poison, double %1, i64 1
%7 = insertelement <2 x double> %6, double %5, i64 0
%8 = insertelement <2 x double> <double poison, double 2.000000e+00>, double %4, i64 0
%9 = fmul <2 x double> %7, %8
%10 = fmul <2 x double> %9, %7
%11 = extractelement <2 x double> %10, i64 1
%12 = fmul double %11, %0
%13 = extractelement <2 x double> %10, i64 0
%14 = fdiv double %13, %12
%15 = fmul double %0, 0x401921FB54442D18
%16 = fmul double %15, %0
%17 = fmul double %16, %0
%18 = fdiv double %2, %17
%19 = tail call double @sqrt(double %18)
%20 = tail call double @exp(double %14)
%21 = fmul double %19, %20
ret double %21
}