#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 BLAST_Log1p(double);
double BLAST_KarlinPtoE(double p) {
  if (p < 0.0 || p > 1.0) {
    return (-2147483647 - 1);
  }
  if (p == 1.0)
    return 2147483647;
  return -BLAST_Log1p(-p);
}


x86 assembly (clang, -O0):
<BLAST_KarlinPtoE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
ja     1142 <BLAST_KarlinPtoE+0x32>
movsd  -0x10(%rbp),%xmm0
movsd  0xec8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1154 <BLAST_KarlinPtoE+0x44>
movsd  0xec6(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c0 <BLAST_KarlinPtoE+0xb0>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9f(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1183 <BLAST_KarlinPtoE+0x73>
jp     1183 <BLAST_KarlinPtoE+0x73>
movsd  0xe8f(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c0 <BLAST_KarlinPtoE+0xb0>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <BLAST_Log1p@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BLAST_KarlinPtoE>:
push   %rax
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
movsd  0xedb(%rip),%xmm0
ja     1158 <BLAST_KarlinPtoE+0x48>
ucomisd 0xed9(%rip),%xmm1
ja     1158 <BLAST_KarlinPtoE+0x48>
jne    113f <BLAST_KarlinPtoE+0x2f>
jp     113f <BLAST_KarlinPtoE+0x2f>
movsd  0xed3(%rip),%xmm0
pop    %rax
ret
xorpd  0xed9(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <BLAST_Log1p@plt>
xorpd  0xec8(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @BLAST_KarlinPtoE(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load double, double* %3
%8 = fcmp ogt double %7, 1.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store double 0xC1E0000000000000, double* %2
br label %19
10: ; preds = %6
%11 = load double, double* %3
%12 = fcmp oeq double %11, 1.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %10
store double 0x41DFFFFFFFC00000, double* %2
br label %19
14: ; preds = %10
%15 = load double, double* %3
%16 = fneg double %15
%17 = call double @BLAST_Log1p(double %16)
%18 = fneg double %17
store double %18, double* %2
br label %19
19: ; preds = %14, %13, %9
%20 = load double, double* %2
ret double %20
}

LLVM IR (-O2):
define double @BLAST_KarlinPtoE(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp ogt double %0, 1.000000e+00
%4 = or i1 %2, %3
br i1 %4, label %11, label %5
5: ; preds = %1
%6 = fcmp oeq double %0, 1.000000e+00
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = fneg double %0
%9 = tail call double @BLAST_Log1p(double %8)
%10 = fneg double %9
br label %11
11: ; preds = %5, %1, %7
%12 = phi double [ %10, %7 ], [ 0xC1E0000000000000, %1 ], [ 0x41DFFFFFFFC00000, %5 ]
ret double %12
}