#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 log(double);
double pow(double, double);
double twdensx(double tw) {
  double bot, lbot, ltop, y1, y2;
  if (tw <= 0.0)
    return 0.0;
  bot = ((1.0 / 0.5641895835477562869480795)) * 4.0;
  lbot = log(bot);
  y1 = -0.25 * log(tw);
  y2 = -2.0 * pow(tw, 1.5) / 3.0;
  ltop = y1 + y2;
  return exp(ltop - lbot);
}


x86 assembly (clang, -O0):
<twdensx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1158 <twdensx+0x28>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e7 <twdensx+0xb7>
movsd  0xec0(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <log@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe8f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe71(%rip),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe59(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe45(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<twdensx>:
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    118d <twdensx+0x5d>
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
call   1040 <log@plt>
mulsd  0xeaf(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xea9(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1050 <pow@plt>
addsd  %xmm0,%xmm0
divsd  0xe9a(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
addsd  0xe94(%rip),%xmm0
add    $0x18,%rsp
jmp    1030 <exp@plt>
xorpd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @twdensx(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %3
%9 = load double, double* %3
%10 = fcmp ole double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %1
store double 0.000000e+00, double* %2
br label %29
12: ; preds = %1
store double 0x401C5BF891B4EF6B, double* %4
%13 = load double, double* %4
%14 = call double @log(double %13)
store double %14, double* %5
%15 = load double, double* %3
%16 = call double @log(double %15)
%17 = fmul double -2.500000e-01, %16
store double %17, double* %7
%18 = load double, double* %3
%19 = call double @pow(double %18, double 1.500000e+00)
%20 = fmul double -2.000000e+00, %19
%21 = fdiv double %20, 3.000000e+00
store double %21, double* %8
%22 = load double, double* %7
%23 = load double, double* %8
%24 = fadd double %22, %23
store double %24, double* %6
%25 = load double, double* %6
%26 = load double, double* %5
%27 = fsub double %25, %26
%28 = call double @exp(double %27)
store double %28, double* %2
br label %29
29: ; preds = %12, %11
%30 = load double, double* %2
ret double %30
}

LLVM IR (-O2):
define double @twdensx(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
br i1 %2, label %3, label %12
3: ; preds = %1
%4 = tail call double @log(double %0)
%5 = fmul double %4, -2.500000e-01
%6 = tail call double @pow(double %0, double 1.500000e+00)
%7 = fmul double %6, 2.000000e+00
%8 = fdiv double %7, 3.000000e+00
%9 = fsub double %5, %8
%10 = fadd double %9, 0xBFFF56AB236E0ACE
%11 = tail call double @exp(double %10)
br label %12
12: ; preds = %1, %3
%13 = phi double [ %11, %3 ], [ 0.000000e+00, %1 ]
ret double %13
}