#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 */
float fminf(float, float);
scalar_t__ isnan(float);
float flex_clampMax(float value, float maxValue) {
  if (isnan(value)) {
    return value;
  }
  if (isnan(maxValue)) {
    return value;
  } else {
    return fminf(value, maxValue);
  }
}


x86 assembly (clang, -O0):
<flex_clampMax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     1145 <flex_clampMax+0x35>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1195 <flex_clampMax+0x85>
movss  -0xc(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     1168 <flex_clampMax+0x58>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1195 <flex_clampMax+0x85>
movss  -0x8(%rbp),%xmm3
movss  -0xc(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordss %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
minss  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flex_clampMax>:
sub    $0x28,%rsp
movaps %xmm1,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
call   1030 <isnan@plt>
test   %rax,%rax
jne    1138 <flex_clampMax+0x28>
movaps 0x10(%rsp),%xmm0
call   1030 <isnan@plt>
test   %rax,%rax
je     1143 <flex_clampMax+0x33>
movss  0xc(%rsp),%xmm0
add    $0x28,%rsp
ret
movss  0xc(%rsp),%xmm3
movaps %xmm3,%xmm0
cmpunordss %xmm3,%xmm0
movaps %xmm0,%xmm1
movaps 0x10(%rsp),%xmm2
andps  %xmm2,%xmm1
minss  %xmm3,%xmm2
andnps %xmm2,%xmm0
orps   %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @flex_clampMax(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* %4
store float %10, float* %3
br label %21
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 %21
17: ; preds = %11
%18 = load float, float* %4
%19 = load float, float* %5
%20 = call float @llvm.minnum.f32(float %18, float %19)
store float %20, float* %3
br label %21
21: ; preds = %17, %15, %9
%22 = load float, float* %3
ret float %22
}

LLVM IR (-O2):
define float @flex_clampMax(float %0, float %1) {
%3 = tail call i64 @isnan(float %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = tail call i64 @isnan(float %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call float @llvm.minnum.f32(float %0, float %1)
br label %10
10: ; preds = %5, %2, %8
%11 = phi float [ %9, %8 ], [ %0, %2 ], [ %0, %5 ]
ret float %11
}