#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 FP_INFINITE;
int FP_NAN;
int fpclassify(long double);
long double __fdiml(long double x, long double y) {
  int clsx = fpclassify(x);
  int clsy = fpclassify(y);
  if (clsx == FP_NAN || clsy == FP_NAN ||
      (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
    return x - y;
  return x <= y ? 0 : x - y;
}


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)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <fpclassify@plt>
mov    %eax,-0x34(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <fpclassify@plt>
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    0x2e9a(%rip),%rcx
cmp    (%rcx),%eax
je     11a0 <__fdiml+0x90>
mov    -0x38(%rbp),%eax
mov    0x2e88(%rip),%rcx
cmp    (%rcx),%eax
je     11a0 <__fdiml+0x90>
fldt   -0x30(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jbe    11b0 <__fdiml+0xa0>
jmp    117c <__fdiml+0x6c>
mov    -0x34(%rbp),%eax
mov    0x2e5a(%rip),%rcx
cmp    (%rcx),%eax
jne    11b0 <__fdiml+0xa0>
mov    -0x38(%rbp),%eax
mov    0x2e48(%rip),%rcx
cmp    (%rcx),%eax
jne    11b0 <__fdiml+0xa0>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fsubrp %st,%st(1)
fstpt  -0x10(%rbp)
jmp    11e0 <__fdiml+0xd0>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fucomip %st(1),%st
fstp   %st(0)
jb     11cf <__fdiml+0xbf>
jmp    11c5 <__fdiml+0xb5>
fldz
fstpt  -0x44(%rbp)
jmp    11da <__fdiml+0xca>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fsubrp %st,%st(1)
fstpt  -0x44(%rbp)
fldt   -0x44(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fdiml>:
push   %rbx
sub    $0x30,%rsp
fldt   0x50(%rsp)
fstpt  0x24(%rsp)
fldt   0x40(%rsp)
fld    %st(0)
fstpt  0x18(%rsp)
fstpt  (%rsp)
call   1030 <fpclassify@plt>
mov    %eax,%ebx
fldt   0x24(%rsp)
fstpt  (%rsp)
call   1030 <fpclassify@plt>
fldt   0x24(%rsp)
mov    0x2ea0(%rip),%rcx
mov    (%rcx),%ecx
cmp    %ecx,%ebx
fldz
je     1171 <__fdiml+0x61>
fstp   %st(0)
cmp    %ecx,%eax
fldz
je     1171 <__fdiml+0x61>
fstp   %st(0)
fldz
fucomi %st(1),%st
jbe    117b <__fdiml+0x6b>
mov    0x2e79(%rip),%rcx
mov    (%rcx),%ecx
cmp    %ecx,%ebx
jne    117b <__fdiml+0x6b>
cmp    %ecx,%eax
jne    117b <__fdiml+0x6b>
fstp   %st(0)
fldt   0x18(%rsp)
fsubp  %st,%st(1)
jmp    118b <__fdiml+0x7b>
fldt   0x18(%rsp)
fxch   %st(2)
fucomi %st(2),%st
fsubrp %st,%st(2)
fxch   %st(1)
fcmovnb %st(1),%st
fstp   %st(1)
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@FP_NAN = global i32 0
@FP_INFINITE = 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 i32
%7 = alloca i32
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
%8 = load x86_fp80, x86_fp80* %4
%9 = call i32 @fpclassify(x86_fp80 %8)
store i32 %9, i32* %6
%10 = load x86_fp80, x86_fp80* %5
%11 = call i32 @fpclassify(x86_fp80 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* @FP_NAN
%14 = icmp eq i32 %12, %13
br i1 %14, label %30, label %15
15: ; preds = %2
%16 = load i32, i32* %7
%17 = load i32, i32* @FP_NAN
%18 = icmp eq i32 %16, %17
br i1 %18, label %30, label %19
19: ; preds = %15
%20 = load x86_fp80, x86_fp80* %5
%21 = fcmp olt x86_fp80 %20, 0xK00000000000000000000
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = load i32, i32* %6
%24 = load i32, i32* @FP_INFINITE
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = load i32, i32* %7
%28 = load i32, i32* @FP_INFINITE
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %34
30: ; preds = %26, %15, %2
%31 = load x86_fp80, x86_fp80* %4
%32 = load x86_fp80, x86_fp80* %5
%33 = fsub x86_fp80 %31, %32
store x86_fp80 %33, x86_fp80* %3
br label %45
34: ; preds = %26, %22, %19
%35 = load x86_fp80, x86_fp80* %4
%36 = load x86_fp80, x86_fp80* %5
%37 = fcmp ole x86_fp80 %35, %36
br i1 %37, label %38, label %39
38: ; preds = %34
br label %43
39: ; preds = %34
%40 = load x86_fp80, x86_fp80* %4
%41 = load x86_fp80, x86_fp80* %5
%42 = fsub x86_fp80 %40, %41
br label %43
43: ; preds = %39, %38
%44 = phi x86_fp80 [ 0xK00000000000000000000, %38 ], [ %42, %39 ]
store x86_fp80 %44, x86_fp80* %3
br label %45
45: ; preds = %43, %30
%46 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %46
}

LLVM IR (-O2):
@FP_NAN = global i32 0
@FP_INFINITE = global i32 0
define x86_fp80 @__fdiml(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call i32 @fpclassify(x86_fp80 %0)
%4 = tail call i32 @fpclassify(x86_fp80 %1)
%5 = load i32, i32* @FP_NAN
%6 = icmp eq i32 %3, %5
%7 = icmp eq i32 %4, %5
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %16, label %9
9: ; preds = %2
%10 = fcmp olt x86_fp80 %1, 0xK00000000000000000000
br i1 %10, label %11, label %18
11: ; preds = %9
%12 = load i32, i32* @FP_INFINITE
%13 = icmp eq i32 %3, %12
%14 = icmp eq i32 %4, %12
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %16, label %18
16: ; preds = %11, %2
%17 = fsub x86_fp80 %0, %1
br label %22
18: ; preds = %11, %9
%19 = fcmp ole x86_fp80 %0, %1
%20 = fsub x86_fp80 %0, %1
%21 = select i1 %19, x86_fp80 0xK00000000000000000000, x86_fp80 %20
br label %22
22: ; preds = %18, %16
%23 = phi x86_fp80 [ %17, %16 ], [ %21, %18 ]
ret x86_fp80 %23
}