#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 factln(double);
double log(double);
double ldf_Poi(int normalize, int x, double la) {
  return (((-factln((double)x) - ((double)x) * log(la) - la) < -300)
              ? (-300)
              : ((((-factln((double)x) - ((double)x) * log(la) - la) > 300)
                      ? (300)
                      : (-factln((double)x) - ((double)x) * log(la) - la))));
}


x86 assembly (clang, -O0):
<ldf_Poi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
call   1030 <factln@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
movsd  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xe5a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c2 <ldf_Poi+0xa2>
movsd  0xe48(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    12cb <ldf_Poi+0x1ab>
cvtsi2sdl -0x8(%rbp),%xmm0
call   1030 <factln@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xdd3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1251 <ldf_Poi+0x131>
movsd  0xdc1(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    12c1 <ldf_Poi+0x1a1>
cvtsi2sdl -0x8(%rbp),%xmm0
call   1030 <factln@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <log@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldf_Poi>:
sub    $0x38,%rsp
movsd  %xmm0,(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %esi,%xmm0
movapd %xmm0,0x10(%rsp)
call   1030 <factln@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1040 <log@plt>
movapd %xmm0,%xmm1
movapd 0xea9(%rip),%xmm2
xorpd  0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm1
subsd  0x8(%rsp),%xmm1
subsd  (%rsp),%xmm1
movsd  0xe9c(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     11f4 <ldf_Poi+0xd4>
movaps 0x10(%rsp),%xmm0
movapd %xmm2,0x20(%rsp)
call   1030 <factln@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1040 <log@plt>
movapd 0x20(%rsp),%xmm2
movapd %xmm0,%xmm1
mulsd  %xmm2,%xmm1
subsd  0x8(%rsp),%xmm1
subsd  (%rsp),%xmm1
movsd  0xe5d(%rip),%xmm0
ucomisd %xmm0,%xmm1
ja     11f4 <ldf_Poi+0xd4>
movaps 0x10(%rsp),%xmm0
call   1030 <factln@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1040 <log@plt>
movapd 0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
subsd  0x10(%rsp),%xmm1
subsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @ldf_Poi(i32 %0, i32 %1, double %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store double %2, double* %6
%7 = load i32, i32* %5
%8 = sitofp i32 %7 to double
%9 = call double @factln(double %8)
%10 = fneg double %9
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to double
%13 = load double, double* %6
%14 = call double @log(double %13)
%15 = fneg double %12
%16 = call double @llvm.fmuladd.f64(double %15, double %14, double %10)
%17 = load double, double* %6
%18 = fsub double %16, %17
%19 = fcmp olt double %18, -3.000000e+02
br i1 %19, label %20, label %21
20: ; preds = %3
br label %51
21: ; preds = %3
%22 = load i32, i32* %5
%23 = sitofp i32 %22 to double
%24 = call double @factln(double %23)
%25 = fneg double %24
%26 = load i32, i32* %5
%27 = sitofp i32 %26 to double
%28 = load double, double* %6
%29 = call double @log(double %28)
%30 = fneg double %27
%31 = call double @llvm.fmuladd.f64(double %30, double %29, double %25)
%32 = load double, double* %6
%33 = fsub double %31, %32
%34 = fcmp ogt double %33, 3.000000e+02
br i1 %34, label %35, label %36
35: ; preds = %21
br label %49
36: ; preds = %21
%37 = load i32, i32* %5
%38 = sitofp i32 %37 to double
%39 = call double @factln(double %38)
%40 = fneg double %39
%41 = load i32, i32* %5
%42 = sitofp i32 %41 to double
%43 = load double, double* %6
%44 = call double @log(double %43)
%45 = fneg double %42
%46 = call double @llvm.fmuladd.f64(double %45, double %44, double %40)
%47 = load double, double* %6
%48 = fsub double %46, %47
br label %49
49: ; preds = %36, %35
%50 = phi double [ 3.000000e+02, %35 ], [ %48, %36 ]
br label %51
51: ; preds = %49, %20
%52 = phi double [ -3.000000e+02, %20 ], [ %50, %49 ]
ret double %52
}

LLVM IR (-O2):
define double @ldf_Poi(i32 %0, i32 %1, double %2) {
%4 = sitofp i32 %1 to double
%5 = tail call double @factln(double %4)
%6 = fneg double %5
%7 = tail call double @log(double %2)
%8 = fneg double %4
%9 = tail call double @llvm.fmuladd.f64(double %8, double %7, double %6)
%10 = fsub double %9, %2
%11 = fcmp olt double %10, -3.000000e+02
br i1 %11, label %25, label %12
12: ; preds = %3
%13 = tail call double @factln(double %4)
%14 = fneg double %13
%15 = tail call double @log(double %2)
%16 = tail call double @llvm.fmuladd.f64(double %8, double %15, double %14)
%17 = fsub double %16, %2
%18 = fcmp ogt double %17, 3.000000e+02
br i1 %18, label %25, label %19
19: ; preds = %12
%20 = tail call double @factln(double %4)
%21 = fneg double %20
%22 = tail call double @log(double %2)
%23 = tail call double @llvm.fmuladd.f64(double %8, double %22, double %21)
%24 = fsub double %23, %2
br label %25
25: ; preds = %19, %12, %3
%26 = phi double [ -3.000000e+02, %3 ], [ %24, %19 ], [ 3.000000e+02, %12 ]
ret double %26
}