#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(float);
scalar_t__ signbit(float);
float fmaxf(float x, float 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):
<fmaxf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     1155 <fmaxf+0x35>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1212 <fmaxf+0xf2>
movss  -0xc(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     1178 <fmaxf+0x58>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1212 <fmaxf+0xf2>
movss  -0x8(%rbp),%xmm0
call   1040 <signbit@plt>
mov    %rax,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <signbit@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
je     11dc <fmaxf+0xbc>
movss  -0x8(%rbp),%xmm0
call   1040 <signbit@plt>
cmp    $0x0,%rax
je     11c3 <fmaxf+0xa3>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    11cd <fmaxf+0xad>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1212 <fmaxf+0xf2>
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    11fe <fmaxf+0xde>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    1208 <fmaxf+0xe8>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmaxf>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
call   1030 <isnan@plt>
test   %rax,%rax
je     1143 <fmaxf+0x23>
movss  0xc(%rsp),%xmm0
jmp    119d <fmaxf+0x7d>
movss  0xc(%rsp),%xmm0
call   1030 <isnan@plt>
test   %rax,%rax
je     115b <fmaxf+0x3b>
movss  0x8(%rsp),%xmm0
jmp    119d <fmaxf+0x7d>
movss  0x8(%rsp),%xmm0
call   1040 <signbit@plt>
mov    %rax,%rbx
movss  0xc(%rsp),%xmm0
call   1040 <signbit@plt>
cmp    %rax,%rbx
jne    1187 <fmaxf+0x67>
movss  0xc(%rsp),%xmm0
maxss  0x8(%rsp),%xmm0
jmp    119d <fmaxf+0x7d>
movss  0x8(%rsp),%xmm0
call   1040 <signbit@plt>
test   %rax,%rax
movss  0x8(%rsp),%xmm0
jne    113b <fmaxf+0x1b>
add    $0x10,%rsp
pop    %rbx
ret

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

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