#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*/ ERANGE;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
scalar_t__ isinf(long double);
scalar_t__ islessequal(long double, long double);
long double __fdiml(long double x, long double y) {
  if (islessequal(x, y))
    return 0.0f;
  long double r = x - y;
  if (isinf(r) && !isinf(x) && !isinf(y))
    __set_errno(ERANGE);
  return r;
}


x86 assembly (clang, -O0):
<__fdiml>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1040 <islessequal@plt>
cmp    $0x0,%rax
je     116b <__fdiml+0x3b>
fldz
fstpt  -0x10(%rbp)
jmp    11cf <__fdiml+0x9f>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fsubrp %st,%st(1)
fstpt  -0x40(%rbp)
fldt   -0x40(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <isinf@plt>
cmp    $0x0,%rax
je     11c9 <__fdiml+0x99>
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <isinf@plt>
cmp    $0x0,%rax
jne    11c9 <__fdiml+0x99>
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <isinf@plt>
cmp    $0x0,%rax
jne    11c9 <__fdiml+0x99>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
fldt   -0x40(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fdiml>:
sub    $0x48,%rsp
fldt   0x60(%rsp)
fldt   0x50(%rsp)
fld    %st(1)
fstpt  0x30(%rsp)
fxch   %st(1)
fstpt  0x10(%rsp)
fld    %st(0)
fstpt  0x3c(%rsp)
fstpt  (%rsp)
call   1040 <islessequal@plt>
fldz
test   %rax,%rax
je     1162 <__fdiml+0x32>
add    $0x48,%rsp
ret
fstp   %st(0)
fldt   0x30(%rsp)
fldt   0x3c(%rsp)
fsubp  %st,%st(1)
fld    %st(0)
fstpt  0x24(%rsp)
fstpt  (%rsp)
call   1050 <isinf@plt>
test   %rax,%rax
je     11b1 <__fdiml+0x81>
fldt   0x3c(%rsp)
fstpt  (%rsp)
call   1050 <isinf@plt>
test   %rax,%rax
jne    11b1 <__fdiml+0x81>
fldt   0x30(%rsp)
fstpt  (%rsp)
call   1050 <isinf@plt>
test   %rax,%rax
jne    11b1 <__fdiml+0x81>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
fldt   0x24(%rsp)
add    $0x48,%rsp
ret

LLVM IR (-O0):
@ERANGE = global i32 0
define x86_fp80 @__fdiml(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
%7 = load x86_fp80, x86_fp80* %4
%8 = load x86_fp80, x86_fp80* %5
%9 = call i64 @islessequal(x86_fp80 %7, x86_fp80 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store x86_fp80 0xK00000000000000000000, x86_fp80* %3
br label %32
12: ; preds = %2
%13 = load x86_fp80, x86_fp80* %4
%14 = load x86_fp80, x86_fp80* %5
%15 = fsub x86_fp80 %13, %14
store x86_fp80 %15, x86_fp80* %6
%16 = load x86_fp80, x86_fp80* %6
%17 = call i64 @isinf(x86_fp80 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %12
%20 = load x86_fp80, x86_fp80* %4
%21 = call i64 @isinf(x86_fp80 %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %30, label %23
23: ; preds = %19
%24 = load x86_fp80, x86_fp80* %5
%25 = call i64 @isinf(x86_fp80 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %23
%28 = load i32, i32* @ERANGE
%29 = call i32 @__set_errno(i32 %28)
br label %30
30: ; preds = %27, %23, %19, %12
%31 = load x86_fp80, x86_fp80* %6
store x86_fp80 %31, x86_fp80* %3
br label %32
32: ; preds = %30, %11
%33 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %33
}

LLVM IR (-O2):
@ERANGE = global i32 0
define x86_fp80 @__fdiml(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call i64 @islessequal(x86_fp80 %0, x86_fp80 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %18
5: ; preds = %2
%6 = fsub x86_fp80 %0, %1
%7 = tail call i64 @isinf(x86_fp80 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %5
%10 = tail call i64 @isinf(x86_fp80 %0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = tail call i64 @isinf(x86_fp80 %1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* @ERANGE
%17 = tail call i32 @__set_errno(i32 %16)
br label %18
18: ; preds = %5, %9, %12, %15, %2
%19 = phi x86_fp80 [ 0xK00000000000000000000, %2 ], [ %6, %15 ], [ %6, %12 ], [ %6, %9 ], [ %6, %5 ]
ret x86_fp80 %19
}