#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 */
int log(int);
int pow(double, int);
double psih2(double L) {
  if (L < 0) {
    double x2 = pow((1 - 16 * 2 / L), 0.25);
    return (2 * log((1 + pow(x2, 2)) / 2));
  } else {
    return (-5 * 2 / L);
  }
}


x86 assembly (clang, -O0):
<psih2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1196 <psih2+0x76>
movsd  0xecd(%rip),%xmm1
divsd  -0x10(%rbp),%xmm1
movsd  0xeb8(%rip),%xmm0
subsd  %xmm1,%xmm0
xor    %edi,%edi
call   1040 <pow@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <log@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11a8 <psih2+0x88>
movsd  0xe62(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psih2>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    117b <psih2+0x5b>
movsd  0xed5(%rip),%xmm1
divsd  %xmm0,%xmm1
addsd  0xed1(%rip),%xmm1
movapd %xmm1,%xmm0
xor    %edi,%edi
call   1040 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
add    $0x1,%ecx
shr    $0x1f,%ecx
lea    (%rax,%rcx,1),%edi
add    $0x1,%edi
sar    %edi
call   1030 <log@plt>
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
jmp    1187 <psih2+0x67>
movsd  0xe7d(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @psih2(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %20
7: ; preds = %1
%8 = load double, double* %3
%9 = fdiv double 3.200000e+01, %8
%10 = fsub double 1.000000e+00, %9
%11 = call i32 @pow(double %10, i32 0)
%12 = sitofp i32 %11 to double
store double %12, double* %4
%13 = load double, double* %4
%14 = call i32 @pow(double %13, i32 2)
%15 = add nsw i32 1, %14
%16 = sdiv i32 %15, 2
%17 = call i32 @log(i32 %16)
%18 = mul nsw i32 2, %17
%19 = sitofp i32 %18 to double
store double %19, double* %2
br label %23
20: ; preds = %1
%21 = load double, double* %3
%22 = fdiv double -1.000000e+01, %21
store double %22, double* %2
br label %23
23: ; preds = %20, %7
%24 = load double, double* %2
ret double %24
}

LLVM IR (-O2):
define double @psih2(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
br i1 %2, label %3, label %14
3: ; preds = %1
%4 = fdiv double 3.200000e+01, %0
%5 = fsub double 1.000000e+00, %4
%6 = tail call i32 @pow(double %5, i32 0)
%7 = sitofp i32 %6 to double
%8 = tail call i32 @pow(double %7, i32 2)
%9 = add nsw i32 %8, 1
%10 = sdiv i32 %9, 2
%11 = tail call i32 @log(i32 %10)
%12 = shl nsw i32 %11, 1
%13 = sitofp i32 %12 to double
br label %16
14: ; preds = %1
%15 = fdiv double -1.000000e+01, %0
br label %16
16: ; preds = %14, %3
%17 = phi double [ %13, %3 ], [ %15, %14 ]
ret double %17
}