#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);
scalar_t__ signbit(long double);
long double fmaxl(long double x, long double y) {
  if (isnan(x))
    return y;
  if (isnan(y))
    return x;
  if (signbit(x) != signbit(y))
    return signbit(x) ? y : x;
  return x < y ? y : x;
}


x86 assembly (clang, -O0):
<fmaxl>:
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 <isnan@plt>
cmp    $0x0,%rax
je     1156 <fmaxl+0x36>
fldt   -0x30(%rbp)
fstpt  -0x10(%rbp)
jmp    1205 <fmaxl+0xe5>
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     1178 <fmaxl+0x58>
fldt   -0x20(%rbp)
fstpt  -0x10(%rbp)
jmp    1205 <fmaxl+0xe5>
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <signbit@plt>
mov    %rax,-0x38(%rbp)
fldt   -0x30(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <signbit@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
je     11d9 <fmaxl+0xb9>
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <signbit@plt>
cmp    $0x0,%rax
je     11c8 <fmaxl+0xa8>
fldt   -0x30(%rbp)
fstpt  -0x44(%rbp)
jmp    11ce <fmaxl+0xae>
fldt   -0x20(%rbp)
fstpt  -0x44(%rbp)
fldt   -0x44(%rbp)
fstpt  -0x10(%rbp)
jmp    1205 <fmaxl+0xe5>
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fucomip %st(1),%st
fstp   %st(0)
jbe    11f9 <fmaxl+0xd9>
jmp    11ee <fmaxl+0xce>
fldt   -0x30(%rbp)
fstpt  -0x50(%rbp)
jmp    11ff <fmaxl+0xdf>
fldt   -0x20(%rbp)
fstpt  -0x50(%rbp)
fldt   -0x50(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmaxl>:
push   %rbx
sub    $0x30,%rsp
fldt   0x50(%rsp)
fstpt  0x24(%rsp)
fldt   0x40(%rsp)
fld    %st(0)
fstpt  0x18(%rsp)
fstpt  (%rsp)
call   1030 <isnan@plt>
test   %rax,%rax
je     114a <fmaxl+0x2a>
fldt   0x24(%rsp)
jmp    11b0 <fmaxl+0x90>
fldt   0x18(%rsp)
fstp   %st(0)
fldt   0x24(%rsp)
fstpt  (%rsp)
call   1030 <isnan@plt>
test   %rax,%rax
je     1167 <fmaxl+0x47>
fldt   0x18(%rsp)
jmp    11b0 <fmaxl+0x90>
fldt   0x18(%rsp)
fstpt  (%rsp)
call   1040 <signbit@plt>
mov    %rax,%rbx
fldt   0x24(%rsp)
fstpt  (%rsp)
call   1040 <signbit@plt>
fldt   0x18(%rsp)
cmp    %rax,%rbx
jne    1197 <fmaxl+0x77>
fldt   0x24(%rsp)
fucomi %st(1),%st
fxch   %st(1)
fcmovnbe %st(1),%st
jmp    11ae <fmaxl+0x8e>
fstpt  (%rsp)
call   1040 <signbit@plt>
test   %rax,%rax
fldt   0x24(%rsp)
fldt   0x18(%rsp)
fxch   %st(1)
fcmove %st(1),%st
fstp   %st(1)
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define x86_fp80 @fmaxl(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* %5
store x86_fp80 %10, x86_fp80* %3
br label %43
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* %4
store x86_fp80 %16, x86_fp80* %3
br label %43
17: ; preds = %11
%18 = load x86_fp80, x86_fp80* %4
%19 = call i64 @signbit(x86_fp80 %18)
%20 = load x86_fp80, x86_fp80* %5
%21 = call i64 @signbit(x86_fp80 %20)
%22 = icmp ne i64 %19, %21
br i1 %22, label %23, label %33
23: ; preds = %17
%24 = load x86_fp80, x86_fp80* %4
%25 = call i64 @signbit(x86_fp80 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = load x86_fp80, x86_fp80* %5
br label %31
29: ; preds = %23
%30 = load x86_fp80, x86_fp80* %4
br label %31
31: ; preds = %29, %27
%32 = phi x86_fp80 [ %28, %27 ], [ %30, %29 ]
store x86_fp80 %32, x86_fp80* %3
br label %43
33: ; preds = %17
%34 = load x86_fp80, x86_fp80* %4
%35 = load x86_fp80, x86_fp80* %5
%36 = fcmp olt x86_fp80 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = load x86_fp80, x86_fp80* %5
br label %41
39: ; preds = %33
%40 = load x86_fp80, x86_fp80* %4
br label %41
41: ; preds = %39, %37
%42 = phi x86_fp80 [ %38, %37 ], [ %40, %39 ]
store x86_fp80 %42, x86_fp80* %3
br label %43
43: ; preds = %41, %31, %15, %9
%44 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %44
}

LLVM IR (-O2):
define x86_fp80 @fmaxl(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 %19
5: ; preds = %2
%6 = tail call i64 @isnan(x86_fp80 %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = tail call i64 @signbit(x86_fp80 %0)
%10 = tail call i64 @signbit(x86_fp80 %1)
%11 = icmp eq i64 %9, %10
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = tail call i64 @signbit(x86_fp80 %0)
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, x86_fp80 %0, x86_fp80 %1
br label %19
16: ; preds = %8
%17 = fcmp olt x86_fp80 %0, %1
%18 = select i1 %17, x86_fp80 %1, x86_fp80 %0
br label %19
19: ; preds = %5, %2, %16, %12
%20 = phi x86_fp80 [ %15, %12 ], [ %18, %16 ], [ %1, %2 ], [ %0, %5 ]
ret x86_fp80 %20
}