#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);
float fdimf(float x, float y) {
  if (isnan(x))
    return x;
  if (isnan(y))
    return y;
  return x > y ? x - y : 0;
}


x86 assembly (clang, -O0):
<fdimf>:
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 <fdimf+0x35>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a2 <fdimf+0x92>
movss  -0xc(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     1168 <fdimf+0x58>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a2 <fdimf+0x92>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    118b <fdimf+0x7b>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1198 <fdimf+0x88>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1198 <fdimf+0x88>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fdimf>:
sub    $0x28,%rsp
movaps %xmm1,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
call   1030 <isnan@plt>
test   %rax,%rax
je     1134 <fdimf+0x24>
movss  0xc(%rsp),%xmm0
add    $0x28,%rsp
ret
movaps 0x10(%rsp),%xmm0
call   1030 <isnan@plt>
test   %rax,%rax
je     114d <fdimf+0x3d>
movaps 0x10(%rsp),%xmm0
add    $0x28,%rsp
ret
movss  0xc(%rsp),%xmm1
movaps %xmm1,%xmm0
movaps 0x10(%rsp),%xmm2
subss  %xmm2,%xmm0
cmpltss %xmm1,%xmm2
andps  %xmm0,%xmm2
movaps %xmm2,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define float @fdimf(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 %28
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* %5
store float %16, float* %3
br label %28
17: ; preds = %11
%18 = load float, float* %4
%19 = load float, float* %5
%20 = fcmp ogt float %18, %19
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load float, float* %4
%23 = load float, float* %5
%24 = fsub float %22, %23
br label %26
25: ; preds = %17
br label %26
26: ; preds = %25, %21
%27 = phi float [ %24, %21 ], [ 0.000000e+00, %25 ]
store float %27, float* %3
br label %28
28: ; preds = %26, %15, %9
%29 = load float, float* %3
ret float %29
}

LLVM IR (-O2):
define float @fdimf(float %0, float %1) {
%3 = tail call i64 @isnan(float %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = tail call i64 @isnan(float %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = fcmp ogt float %0, %1
%10 = fsub float %0, %1
%11 = select i1 %9, float %10, float 0.000000e+00
br label %12
12: ; preds = %5, %2, %8
%13 = phi float [ %11, %8 ], [ %0, %2 ], [ %1, %5 ]
ret float %13
}