#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 */
scalar_t__ isnan(long double);
long double fdiml(long double x, long double y) {
  if (isnan(x))
    return (x);
  if (isnan(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)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     1146 <fdiml+0x36>
fldt   -0x20(%rbp)
fstpt  -0x10(%rbp)
jmp    119f <fdiml+0x8f>
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     1168 <fdiml+0x58>
fldt   -0x30(%rbp)
fstpt  -0x10(%rbp)
jmp    119f <fdiml+0x8f>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    118f <fdiml+0x7f>
jmp    117f <fdiml+0x6f>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fsubrp %st,%st(1)
fstpt  -0x3c(%rbp)
jmp    1199 <fdiml+0x89>
fldz
fstpt  -0x3c(%rbp)
jmp    1199 <fdiml+0x89>
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 <isnan@plt>
test   %rax,%rax
je     113c <fdiml+0x2c>
fldt   0x1c(%rsp)
add    $0x28,%rsp
ret
fldt   0x10(%rsp)
fstpt  (%rsp)
call   1030 <isnan@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
%6 = load x86_fp80, x86_fp80* %4
%7 = call i64 @isnan(x86_fp80 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load x86_fp80, x86_fp80* %4
store x86_fp80 %10, x86_fp80* %3
br label %28
11: ; preds = %2
%12 = load x86_fp80, x86_fp80* %5
%13 = call i64 @isnan(x86_fp80 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = load x86_fp80, x86_fp80* %5
store x86_fp80 %16, x86_fp80* %3
br label %28
17: ; preds = %11
%18 = load x86_fp80, x86_fp80* %4
%19 = load x86_fp80, x86_fp80* %5
%20 = fcmp ogt x86_fp80 %18, %19
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load x86_fp80, x86_fp80* %4
%23 = load x86_fp80, x86_fp80* %5
%24 = fsub x86_fp80 %22, %23
br label %26
25: ; preds = %17
br label %26
26: ; preds = %25, %21
%27 = phi x86_fp80 [ %24, %21 ], [ 0xK00000000000000000000, %25 ]
store x86_fp80 %27, x86_fp80* %3
br label %28
28: ; preds = %26, %15, %9
%29 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %29
}

LLVM IR (-O2):
define x86_fp80 @fdiml(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call i64 @isnan(x86_fp80 %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = tail call i64 @isnan(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
}