#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 */
long double KM(long double, long double);
long double logl(long double);
long double log_igf(long double S, long double Z) {
  if (Z < 0.0) {
    return 0.0;
  }
  long double Sc, K;
  Sc = (logl(Z) * S) - Z - logl(S);
  K = KM(S, Z);
  return logl(K) + Sc;
}


x86 assembly (clang, -O0):
<log_igf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jbe    1155 <log_igf+0x35>
jmp    114b <log_igf+0x2b>
fldz
fstpt  -0x10(%rbp)
jmp    11b0 <log_igf+0x90>
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <logl@plt>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fxch   %st(2)
fmul   %st(1),%st
fsubp  %st,%st(2)
fxch   %st(1)
fstpt  -0x5c(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <logl@plt>
fldt   -0x5c(%rbp)
fsubp  %st,%st(1)
fstpt  -0x40(%rbp)
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1040 <KM@plt>
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <logl@plt>
fldt   -0x40(%rbp)
faddp  %st,%st(1)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_igf>:
sub    $0x48,%rsp
fldt   0x60(%rsp)
fldt   0x50(%rsp)
fldz
fucomi %st(2),%st
ja     1192 <log_igf+0x72>
fstp   %st(0)
fld    %st(1)
fstpt  (%rsp)
fstpt  0x30(%rsp)
fstpt  0x3c(%rsp)
call   1030 <logl@plt>
fldt   0x30(%rsp)
fmul   %st,%st(1)
fldt   0x3c(%rsp)
fsubrp %st,%st(2)
fxch   %st(1)
fstpt  0x24(%rsp)
fstpt  (%rsp)
call   1030 <logl@plt>
fldt   0x24(%rsp)
fsubp  %st,%st(1)
fstpt  0x24(%rsp)
fldt   0x3c(%rsp)
fstpt  0x10(%rsp)
fldt   0x30(%rsp)
fstpt  (%rsp)
call   1040 <KM@plt>
fstpt  (%rsp)
call   1030 <logl@plt>
fldt   0x24(%rsp)
faddp  %st,%st(1)
fldz
fldz
fxch   %st(2)
fstp   %st(1)
fstp   %st(1)
add    $0x48,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @log_igf(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
%8 = load x86_fp80, x86_fp80* %5
%9 = fcmp olt x86_fp80 %8, 0xK00000000000000000000
br i1 %9, label %10, label %11
10: ; preds = %2
store x86_fp80 0xK00000000000000000000, x86_fp80* %3
br label %28
11: ; preds = %2
%12 = load x86_fp80, x86_fp80* %5
%13 = call x86_fp80 @logl(x86_fp80 %12)
%14 = load x86_fp80, x86_fp80* %4
%15 = load x86_fp80, x86_fp80* %5
%16 = fneg x86_fp80 %15
%17 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %13, x86_fp80 %14, x86_fp80 %16)
%18 = load x86_fp80, x86_fp80* %4
%19 = call x86_fp80 @logl(x86_fp80 %18)
%20 = fsub x86_fp80 %17, %19
store x86_fp80 %20, x86_fp80* %6
%21 = load x86_fp80, x86_fp80* %4
%22 = load x86_fp80, x86_fp80* %5
%23 = call x86_fp80 @KM(x86_fp80 %21, x86_fp80 %22)
store x86_fp80 %23, x86_fp80* %7
%24 = load x86_fp80, x86_fp80* %7
%25 = call x86_fp80 @logl(x86_fp80 %24)
%26 = load x86_fp80, x86_fp80* %6
%27 = fadd x86_fp80 %25, %26
store x86_fp80 %27, x86_fp80* %3
br label %28
28: ; preds = %11, %10
%29 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %29
}

LLVM IR (-O2):
define x86_fp80 @log_igf(x86_fp80 %0, x86_fp80 %1) {
%3 = fcmp olt x86_fp80 %1, 0xK00000000000000000000
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = tail call x86_fp80 @logl(x86_fp80 %1)
%6 = fneg x86_fp80 %1
%7 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %5, x86_fp80 %0, x86_fp80 %6)
%8 = tail call x86_fp80 @logl(x86_fp80 %0)
%9 = fsub x86_fp80 %7, %8
%10 = tail call x86_fp80 @KM(x86_fp80 %0, x86_fp80 %1)
%11 = tail call x86_fp80 @logl(x86_fp80 %10)
%12 = fadd x86_fp80 %9, %11
br label %13
13: ; preds = %2, %4
%14 = phi x86_fp80 [ %12, %4 ], [ 0xK00000000000000000000, %2 ]
ret x86_fp80 %14
}