#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 log(int);
double logCDFNormal(double);
double logPDFSkewN(double x, double loc, double scale, double shape) {
  double z = (x - loc) / scale, lnpdf = 2 / scale;
  lnpdf = 0.5 * log(2 / (3.1415926535897932384626433832795 * scale * scale)) -
          z * z / 2 + logCDFNormal(shape * z);
  return lnpdf;
}


x86 assembly (clang, -O0):
<logPDFSkewN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb0(%rip),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xea6(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xe8c(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  0xe6d(%rip),%xmm2
divsd  %xmm2,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe42(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1040 <logCDFNormal@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logPDFSkewN>:
sub    $0x18,%rsp
movsd  %xmm3,0x10(%rsp)
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xec0(%rip),%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm2,%xmm0
movsd  0xeb8(%rip),%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <log@plt>
movsd  0x8(%rsp),%xmm1
movapd %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  0xe9d(%rip),%xmm2
mulsd  0xe9d(%rip),%xmm0
addsd  %xmm2,%xmm0
movsd  %xmm0,(%rsp)
mulsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
call   1040 <logCDFNormal@plt>
addsd  (%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @logPDFSkewN(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%11 = load double, double* %5
%12 = load double, double* %6
%13 = fsub double %11, %12
%14 = load double, double* %7
%15 = fdiv double %13, %14
store double %15, double* %9
%16 = load double, double* %7
%17 = fdiv double 2.000000e+00, %16
store double %17, double* %10
%18 = load double, double* %7
%19 = fmul double 0x400921FB54442D18, %18
%20 = load double, double* %7
%21 = fmul double %19, %20
%22 = fdiv double 2.000000e+00, %21
%23 = fptosi double %22 to i32
%24 = call double @log(i32 %23)
%25 = load double, double* %9
%26 = load double, double* %9
%27 = fmul double %25, %26
%28 = fdiv double %27, 2.000000e+00
%29 = fneg double %28
%30 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %24, double %29)
%31 = load double, double* %8
%32 = load double, double* %9
%33 = fmul double %31, %32
%34 = call double @logCDFNormal(double %33)
%35 = fadd double %30, %34
store double %35, double* %10
%36 = load double, double* %10
ret double %36
}

LLVM IR (-O2):
define double @logPDFSkewN(double %0, double %1, double %2, double %3) {
%5 = fsub double %0, %1
%6 = fdiv double %5, %2
%7 = fmul double %2, 0x400921FB54442D18
%8 = fmul double %7, %2
%9 = fdiv double 2.000000e+00, %8
%10 = fptosi double %9 to i32
%11 = tail call double @log(i32 %10)
%12 = fmul double %6, %6
%13 = fmul double %12, -5.000000e-01
%14 = tail call double @llvm.fmuladd.f64(double %11, double 5.000000e-01, double %13)
%15 = fmul double %6, %3
%16 = tail call double @logCDFNormal(double %15)
%17 = fadd double %14, %16
ret double %17
}