#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 */
typedef int /*<<< orphan*/ y;
typedef int /*<<< orphan*/ x;

/* Variables and functions */
scalar_t__ __isnan(long double);
scalar_t__ __isnanf(long double);
scalar_t__ __isnanl(long double);
long double fdiml(long double x, long double y) {
  if (((sizeof(x) == sizeof(float))    ? __isnanf(x)
       : (sizeof(x) == sizeof(double)) ? __isnan(x)
                                       : __isnanl(x)))
    return (x);
  if (((sizeof(y) == sizeof(float))    ? __isnanf(y)
       : (sizeof(y) == sizeof(double)) ? __isnan(y)
                                       : __isnanl(y)))
    return (y);
  return (x > y ? x - y : 0.0);
}


x86 assembly (clang, -O0):
<fdiml>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    1153 <fdiml+0x23>
jmp    116f <fdiml+0x3f>
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <__isnanf@plt>
cmp    $0x0,%rax
jne    11b1 <fdiml+0x81>
jmp    11bc <fdiml+0x8c>
xor    %eax,%eax
test   $0x1,%al
jne    117e <fdiml+0x4e>
jmp    119a <fdiml+0x6a>
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <__isnan@plt>
cmp    $0x0,%rax
jne    11b1 <fdiml+0x81>
jmp    11bc <fdiml+0x8c>
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <__isnanl@plt>
cmp    $0x0,%rax
je     11bc <fdiml+0x8c>
fldt   -0x20(%rbp)
fstpt  -0x10(%rbp)
jmp    126b <fdiml+0x13b>
xor    %eax,%eax
test   $0x1,%al
jne    11cb <fdiml+0x9b>
jmp    11e7 <fdiml+0xb7>
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <__isnanf@plt>
cmp    $0x0,%rax
jne    1229 <fdiml+0xf9>
jmp    1234 <fdiml+0x104>
xor    %eax,%eax
test   $0x1,%al
jne    11f6 <fdiml+0xc6>
jmp    1212 <fdiml+0xe2>
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <__isnan@plt>
cmp    $0x0,%rax
jne    1229 <fdiml+0xf9>
jmp    1234 <fdiml+0x104>
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <__isnanl@plt>
cmp    $0x0,%rax
je     1234 <fdiml+0x104>
fldt   -0x30(%rbp)
fstpt  -0x10(%rbp)
jmp    126b <fdiml+0x13b>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    125b <fdiml+0x12b>
jmp    124b <fdiml+0x11b>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fsubrp %st,%st(1)
fstpt  -0x3c(%rbp)
jmp    1265 <fdiml+0x135>
fldz
fstpt  -0x3c(%rbp)
jmp    1265 <fdiml+0x135>
fldt   -0x3c(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdiml>:
sub    $0x28,%rsp
fldt   0x40(%rsp)
fstpt  0x10(%rsp)
fldt   0x30(%rsp)
fld    %st(0)
fstpt  0x1c(%rsp)
fstpt  (%rsp)
call   1030 <__isnanl@plt>
test   %rax,%rax
je     113c <fdiml+0x2c>
fldt   0x1c(%rsp)
add    $0x28,%rsp
ret
fldt   0x10(%rsp)
fstpt  (%rsp)
call   1030 <__isnanl@plt>
test   %rax,%rax
je     1156 <fdiml+0x46>
fldt   0x10(%rsp)
add    $0x28,%rsp
ret
fldt   0x1c(%rsp)
fldt   0x10(%rsp)
fxch   %st(1)
fucomi %st(1),%st
fsubp  %st,%st(1)
fldz
fcmovnbe %st(1),%st
fstp   %st(1)
add    $0x28,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @fdiml(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
br i1 false, label %6, label %10
6: ; preds = %2
%7 = load x86_fp80, x86_fp80* %4
%8 = call i64 @__isnanf(x86_fp80 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %19, label %21
10: ; preds = %2
br i1 false, label %11, label %15
11: ; preds = %10
%12 = load x86_fp80, x86_fp80* %4
%13 = call i64 @__isnan(x86_fp80 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %19, label %21
15: ; preds = %10
%16 = load x86_fp80, x86_fp80* %4
%17 = call i64 @__isnanl(x86_fp80 %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15, %11, %6
%20 = load x86_fp80, x86_fp80* %4
store x86_fp80 %20, x86_fp80* %3
br label %48
21: ; preds = %15, %11, %6
br i1 false, label %22, label %26
22: ; preds = %21
%23 = load x86_fp80, x86_fp80* %5
%24 = call i64 @__isnanf(x86_fp80 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %35, label %37
26: ; preds = %21
br i1 false, label %27, label %31
27: ; preds = %26
%28 = load x86_fp80, x86_fp80* %5
%29 = call i64 @__isnan(x86_fp80 %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %35, label %37
31: ; preds = %26
%32 = load x86_fp80, x86_fp80* %5
%33 = call i64 @__isnanl(x86_fp80 %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %31, %27, %22
%36 = load x86_fp80, x86_fp80* %5
store x86_fp80 %36, x86_fp80* %3
br label %48
37: ; preds = %31, %27, %22
%38 = load x86_fp80, x86_fp80* %4
%39 = load x86_fp80, x86_fp80* %5
%40 = fcmp ogt x86_fp80 %38, %39
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load x86_fp80, x86_fp80* %4
%43 = load x86_fp80, x86_fp80* %5
%44 = fsub x86_fp80 %42, %43
br label %46
45: ; preds = %37
br label %46
46: ; preds = %45, %41
%47 = phi x86_fp80 [ %44, %41 ], [ 0xK00000000000000000000, %45 ]
store x86_fp80 %47, x86_fp80* %3
br label %48
48: ; preds = %46, %35, %19
%49 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %49
}

LLVM IR (-O2):
define x86_fp80 @fdiml(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call i64 @__isnanl(x86_fp80 %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = tail call i64 @__isnanl(x86_fp80 %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = fcmp ogt x86_fp80 %0, %1
%10 = fsub x86_fp80 %0, %1
%11 = select i1 %9, x86_fp80 %10, x86_fp80 0xK00000000000000000000
br label %12
12: ; preds = %5, %2, %8
%13 = phi x86_fp80 [ %11, %8 ], [ %0, %2 ], [ %1, %5 ]
ret x86_fp80 %13
}