#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 /*<<< orphan*/ assert(int);
scalar_t__ expf(float);
float logf(scalar_t__);
float my_logsubf(float x, float y) {
  float diff = y - x;
  assert(diff <= 0.0);
  if (x < 0.5 * -1.0e10 || diff > -1.192093e-7)
    return -1.0e10;
  if (diff < -15.942385065)
    return x;
  return x + logf(1.0 - expf(diff));
}


x86 assembly (clang, -O0):
<my_logsubf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe81(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     11a4 <my_logsubf+0x74>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe6e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11b6 <my_logsubf+0x86>
movss  0xe74(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1220 <my_logsubf+0xf0>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe49(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11e0 <my_logsubf+0xb0>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1220 <my_logsubf+0xf0>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
call   1040 <expf@plt>
cvtsi2sd %rax,%xmm1
movsd  0xe17(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <logf@plt>
movaps %xmm0,%xmm1
movss  -0x14(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_logsubf>:
push   %rax
movss  %xmm0,(%rsp)
subss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
xor    %edi,%edi
movss  %xmm1,0x4(%rsp)
ucomiss %xmm1,%xmm0
setae  %dil
call   1050 <assert@plt>
movss  0xea7(%rip),%xmm0
ucomiss (%rsp),%xmm0
movss  0xe9f(%rip),%xmm0
ja     11be <my_logsubf+0x8e>
movss  0x4(%rsp),%xmm2
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
ucomisd 0xe8c(%rip),%xmm1
ja     11be <my_logsubf+0x8e>
movsd  0xe8a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1193 <my_logsubf+0x63>
movss  (%rsp),%xmm0
pop    %rax
ret
movaps %xmm2,%xmm0
call   1040 <expf@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0xe6d(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1030 <logf@plt>
addss  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @my_logsubf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
%7 = load float, float* %5
%8 = load float, float* %4
%9 = fsub float %7, %8
store float %9, float* %6
%10 = load float, float* %6
%11 = fpext float %10 to double
%12 = fcmp ole double %11, 0.000000e+00
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load float, float* %4
%16 = fpext float %15 to double
%17 = fcmp olt double %16, -5.000000e+09
br i1 %17, label %22, label %18
18: ; preds = %2
%19 = load float, float* %6
%20 = fpext float %19 to double
%21 = fcmp ogt double %20, 0xBE80000017879083
br i1 %21, label %22, label %23
22: ; preds = %18, %2
store float -1.000000e+10, float* %3
br label %38
23: ; preds = %18
%24 = load float, float* %6
%25 = fpext float %24 to double
%26 = fcmp olt double %25, 0xC02FE2804B94D3E2
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = load float, float* %4
store float %28, float* %3
br label %38
29: ; preds = %23
%30 = load float, float* %4
%31 = load float, float* %6
%32 = call i64 @expf(float %31)
%33 = sitofp i64 %32 to double
%34 = fsub double 1.000000e+00, %33
%35 = fptosi double %34 to i64
%36 = call float @logf(i64 %35)
%37 = fadd float %30, %36
store float %37, float* %3
br label %38
38: ; preds = %29, %27, %22
%39 = load float, float* %3
ret float %39
}

LLVM IR (-O2):
define float @my_logsubf(float %0, float %1) {
%3 = fsub float %1, %0
%4 = fpext float %3 to double
%5 = fcmp ole float %3, 0.000000e+00
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = fcmp olt float %0, -5.000000e+09
%9 = fcmp ogt double %4, 0xBE80000017879083
%10 = or i1 %8, %9
br i1 %10, label %20, label %11
11: ; preds = %2
%12 = fcmp olt double %4, 0xC02FE2804B94D3E2
br i1 %12, label %20, label %13
13: ; preds = %11
%14 = tail call i64 @expf(float %3)
%15 = sitofp i64 %14 to double
%16 = fsub double 1.000000e+00, %15
%17 = fptosi double %16 to i64
%18 = tail call float @logf(i64 %17)
%19 = fadd float %18, %0
br label %20
20: ; preds = %11, %2, %13
%21 = phi float [ %19, %13 ], [ -1.000000e+10, %2 ], [ %0, %11 ]
ret float %21
}