#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(double);
scalar_t__ __isnanf(double);
scalar_t__ __isnanl(double);
scalar_t__ __signbit(double);
scalar_t__ __signbitf(double);
scalar_t__ __signbitl(double);
double fmax(double x, double y) {
  if (((sizeof(x) == sizeof(float))    ? __isnanf(x)
       : (sizeof(x) == sizeof(double)) ? __isnan(x)
                                       : __isnanl(x)))
    return (y);
  if (((sizeof(y) == sizeof(float))    ? __isnanf(y)
       : (sizeof(y) == sizeof(double)) ? __isnan(y)
                                       : __isnanl(y)))
    return (x);
  if (((sizeof(x) == sizeof(float))    ? __signbitf(x)
       : (sizeof(x) == sizeof(double)) ? __signbit(x)
                                       : __signbitl(x)) !=
      ((sizeof(y) == sizeof(float))    ? __signbitf(y)
       : (sizeof(y) == sizeof(double)) ? __signbit(y)
                                       : __signbitl(y)))
    if (((sizeof(x) == sizeof(float))    ? __signbitf(x)
         : (sizeof(x) == sizeof(double)) ? __signbit(x)
                                         : __signbitl(x)))
      return (y);
    else
      return (x);
  return (x > y ? x : y);
}


x86 assembly (clang, -O0):
<fmax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    1181 <fmax+0x21>
jmp    119a <fmax+0x3a>
movsd  -0x10(%rbp),%xmm0
call   1060 <__isnanf@plt>
cmp    $0x0,%rax
jne    11d6 <fmax+0x76>
jmp    11e5 <fmax+0x85>
mov    $0x1,%al
test   $0x1,%al
jne    11a9 <fmax+0x49>
jmp    11c2 <fmax+0x62>
movsd  -0x10(%rbp),%xmm0
call   1030 <__isnan@plt>
cmp    $0x0,%rax
jne    11d6 <fmax+0x76>
jmp    11e5 <fmax+0x85>
movsd  -0x10(%rbp),%xmm0
call   1050 <__isnanl@plt>
cmp    $0x0,%rax
je     11e5 <fmax+0x85>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1335 <fmax+0x1d5>
xor    %eax,%eax
test   $0x1,%al
jne    11f4 <fmax+0x94>
jmp    120d <fmax+0xad>
movsd  -0x18(%rbp),%xmm0
call   1060 <__isnanf@plt>
cmp    $0x0,%rax
jne    1249 <fmax+0xe9>
jmp    1258 <fmax+0xf8>
mov    $0x1,%al
test   $0x1,%al
jne    121c <fmax+0xbc>
jmp    1235 <fmax+0xd5>
movsd  -0x18(%rbp),%xmm0
call   1030 <__isnan@plt>
cmp    $0x0,%rax
jne    1249 <fmax+0xe9>
jmp    1258 <fmax+0xf8>
movsd  -0x18(%rbp),%xmm0
call   1050 <__isnanl@plt>
cmp    $0x0,%rax
je     1258 <fmax+0xf8>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1335 <fmax+0x1d5>
movsd  -0x10(%rbp),%xmm0
call   1070 <__signbit@plt>
mov    %rax,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1070 <__signbit@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
je     1302 <fmax+0x1a2>
xor    %eax,%eax
test   $0x1,%al
jne    128f <fmax+0x12f>
jmp    12a8 <fmax+0x148>
movsd  -0x10(%rbp),%xmm0
call   1080 <__signbitf@plt>
cmp    $0x0,%rax
jne    12e4 <fmax+0x184>
jmp    12f3 <fmax+0x193>
mov    $0x1,%al
test   $0x1,%al
jne    12b7 <fmax+0x157>
jmp    12d0 <fmax+0x170>
movsd  -0x10(%rbp),%xmm0
call   1070 <__signbit@plt>
cmp    $0x0,%rax
jne    12e4 <fmax+0x184>
jmp    12f3 <fmax+0x193>
movsd  -0x10(%rbp),%xmm0
call   1040 <__signbitl@plt>
cmp    $0x0,%rax
je     12f3 <fmax+0x193>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1335 <fmax+0x1d5>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1335 <fmax+0x1d5>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1321 <fmax+0x1c1>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    132b <fmax+0x1cb>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmax>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
call   1030 <__isnan@plt>
test   %rax,%rax
je     1142 <fmax+0x22>
movsd  0x8(%rsp),%xmm0
jmp    1197 <fmax+0x77>
movsd  0x8(%rsp),%xmm0
call   1030 <__isnan@plt>
test   %rax,%rax
je     1159 <fmax+0x39>
movsd  (%rsp),%xmm0
jmp    1197 <fmax+0x77>
movsd  (%rsp),%xmm0
call   1040 <__signbit@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1040 <__signbit@plt>
cmp    %rax,%rbx
jne    1183 <fmax+0x63>
movsd  (%rsp),%xmm0
maxsd  0x8(%rsp),%xmm0
jmp    1197 <fmax+0x77>
movsd  (%rsp),%xmm0
call   1040 <__signbit@plt>
test   %rax,%rax
movsd  (%rsp),%xmm0
jne    113a <fmax+0x1a>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @fmax(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
br i1 false, label %6, label %10
6: ; preds = %2
%7 = load double, double* %4
%8 = call i64 @__isnanf(double %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %19, label %21
10: ; preds = %2
br i1 true, label %11, label %15
11: ; preds = %10
%12 = load double, double* %4
%13 = call i64 @__isnan(double %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %19, label %21
15: ; preds = %10
%16 = load double, double* %4
%17 = call i64 @__isnanl(double %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15, %11, %6
%20 = load double, double* %5
store double %20, double* %3
br label %71
21: ; preds = %15, %11, %6
br i1 false, label %22, label %26
22: ; preds = %21
%23 = load double, double* %5
%24 = call i64 @__isnanf(double %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %35, label %37
26: ; preds = %21
br i1 true, label %27, label %31
27: ; preds = %26
%28 = load double, double* %5
%29 = call i64 @__isnan(double %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %35, label %37
31: ; preds = %26
%32 = load double, double* %5
%33 = call i64 @__isnanl(double %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %31, %27, %22
%36 = load double, double* %4
store double %36, double* %3
br label %71
37: ; preds = %31, %27, %22
%38 = load double, double* %4
%39 = call i64 @__signbit(double %38)
%40 = load double, double* %5
%41 = call i64 @__signbit(double %40)
%42 = icmp ne i64 %39, %41
br i1 %42, label %43, label %61
43: ; preds = %37
br i1 false, label %44, label %48
44: ; preds = %43
%45 = load double, double* %4
%46 = call i64 @__signbitf(double %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %57, label %59
48: ; preds = %43
br i1 true, label %49, label %53
49: ; preds = %48
%50 = load double, double* %4
%51 = call i64 @__signbit(double %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %57, label %59
53: ; preds = %48
%54 = load double, double* %4
%55 = call i64 @__signbitl(double %54)
%56 = icmp ne i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %53, %49, %44
%58 = load double, double* %5
store double %58, double* %3
br label %71
59: ; preds = %53, %49, %44
%60 = load double, double* %4
store double %60, double* %3
br label %71
61: ; preds = %37
%62 = load double, double* %4
%63 = load double, double* %5
%64 = fcmp ogt double %62, %63
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = load double, double* %4
br label %69
67: ; preds = %61
%68 = load double, double* %5
br label %69
69: ; preds = %67, %65
%70 = phi double [ %66, %65 ], [ %68, %67 ]
store double %70, double* %3
br label %71
71: ; preds = %69, %59, %57, %35, %19
%72 = load double, double* %3
ret double %72
}

LLVM IR (-O2):
define double @fmax(double %0, double %1) {
%3 = tail call i64 @__isnan(double %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %19
5: ; preds = %2
%6 = tail call i64 @__isnan(double %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = tail call i64 @__signbit(double %0)
%10 = tail call i64 @__signbit(double %1)
%11 = icmp eq i64 %9, %10
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = tail call i64 @__signbit(double %0)
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, double %0, double %1
br label %19
16: ; preds = %8
%17 = fcmp ogt double %0, %1
%18 = select i1 %17, double %0, double %1
br label %19
19: ; preds = %12, %5, %2, %16
%20 = phi double [ %18, %16 ], [ %1, %2 ], [ %0, %5 ], [ %15, %12 ]
ret double %20
}