#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__ FP_NAN;
scalar_t__ fpclassify(float);
float fmaxf(float x, float y) {
  if (fpclassify(x) == FP_NAN)
    return y;
  if (fpclassify(y) == FP_NAN)
    return x;
  return x > y ? x : y;
}


x86 assembly (clang, -O0):
<fmaxf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <fpclassify@plt>
mov    0x2eb5(%rip),%rcx
cmp    (%rcx),%rax
jne    114b <fmaxf+0x3b>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a6 <fmaxf+0x96>
movss  -0xc(%rbp),%xmm0
call   1030 <fpclassify@plt>
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%rax
jne    1174 <fmaxf+0x64>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a6 <fmaxf+0x96>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1192 <fmaxf+0x82>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    119c <fmaxf+0x8c>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmaxf>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm1,0x8(%rsp)
movss  %xmm0,0xc(%rsp)
call   1030 <fpclassify@plt>
mov    0x2ebb(%rip),%rbx
cmp    (%rbx),%rax
jne    113a <fmaxf+0x2a>
movss  0x8(%rsp),%xmm0
jmp    115e <fmaxf+0x4e>
movss  0x8(%rsp),%xmm0
call   1030 <fpclassify@plt>
cmp    (%rbx),%rax
jne    1152 <fmaxf+0x42>
movss  0xc(%rsp),%xmm0
jmp    115e <fmaxf+0x4e>
movss  0xc(%rsp),%xmm0
maxss  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@FP_NAN = global i64 0
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 @fpclassify(float %6)
%8 = load i64, i64* @FP_NAN
%9 = icmp eq i64 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load float, float* %5
store float %11, float* %3
br label %29
12: ; preds = %2
%13 = load float, float* %5
%14 = call i64 @fpclassify(float %13)
%15 = load i64, i64* @FP_NAN
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = load float, float* %4
store float %18, float* %3
br label %29
19: ; preds = %12
%20 = load float, float* %4
%21 = load float, float* %5
%22 = fcmp ogt float %20, %21
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = load float, float* %4
br label %27
25: ; preds = %19
%26 = load float, float* %5
br label %27
27: ; preds = %25, %23
%28 = phi float [ %24, %23 ], [ %26, %25 ]
store float %28, float* %3
br label %29
29: ; preds = %27, %17, %10
%30 = load float, float* %3
ret float %30
}

LLVM IR (-O2):
@FP_NAN = global i64 0
define float @fmaxf(float %0, float %1) {
%3 = tail call i64 @fpclassify(float %0)
%4 = load i64, i64* @FP_NAN
%5 = icmp eq i64 %3, %4
br i1 %5, label %13, label %6
6: ; preds = %2
%7 = tail call i64 @fpclassify(float %1)
%8 = load i64, i64* @FP_NAN
%9 = icmp eq i64 %7, %8
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = fcmp ogt float %0, %1
%12 = select i1 %11, float %0, float %1
br label %13
13: ; preds = %6, %2, %10
%14 = phi float [ %12, %10 ], [ %1, %2 ], [ %0, %6 ]
ret float %14
}