#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 */
int FP_INFINITE;
int FP_NAN;
int fpclassify(float);
float __fdimf(float x, float y) {
  int clsx = fpclassify(x);
  int clsy = fpclassify(y);
  if (clsx == FP_NAN || clsy == FP_NAN ||
      (y < 0 && clsx == FP_INFINITE && clsy == FP_INFINITE))
    return x - y;
  return x <= y ? 0 : x - y;
}


x86 assembly (clang, -O0):
<__fdimf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <fpclassify@plt>
mov    %eax,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <fpclassify@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%eax
je     1191 <__fdimf+0x81>
mov    -0x14(%rbp),%eax
mov    0x2e90(%rip),%rcx
cmp    (%rcx),%eax
je     1191 <__fdimf+0x81>
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    11a5 <__fdimf+0x95>
mov    -0x10(%rbp),%eax
mov    0x2e69(%rip),%rcx
cmp    (%rcx),%eax
jne    11a5 <__fdimf+0x95>
mov    -0x14(%rbp),%eax
mov    0x2e57(%rip),%rcx
cmp    (%rcx),%eax
jne    11a5 <__fdimf+0x95>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11de <__fdimf+0xce>
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     11c5 <__fdimf+0xb5>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    11d4 <__fdimf+0xc4>
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fdimf>:
push   %rbx
sub    $0x20,%rsp
movss  %xmm1,0xc(%rsp)
movaps %xmm0,0x10(%rsp)
call   1030 <fpclassify@plt>
mov    %eax,%ebx
movss  0xc(%rsp),%xmm0
call   1030 <fpclassify@plt>
movss  0xc(%rsp),%xmm2
mov    0x2ea9(%rip),%rcx
mov    (%rcx),%ecx
cmp    %ecx,%ebx
je     1162 <__fdimf+0x52>
cmp    %ecx,%eax
je     1162 <__fdimf+0x52>
xorps  %xmm0,%xmm0
ucomiss %xmm2,%xmm0
jbe    116d <__fdimf+0x5d>
mov    0x2e88(%rip),%rcx
mov    (%rcx),%ecx
cmp    %ecx,%ebx
jne    116d <__fdimf+0x5d>
cmp    %ecx,%eax
jne    116d <__fdimf+0x5d>
movaps 0x10(%rsp),%xmm0
subss  %xmm2,%xmm0
jmp    1181 <__fdimf+0x71>
movaps 0x10(%rsp),%xmm0
movaps %xmm0,%xmm1
subss  %xmm2,%xmm1
cmpless %xmm2,%xmm0
andnps %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@FP_NAN = global i32 0
@FP_INFINITE = global i32 0
define float @__fdimf(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
store float %0, float* %4
store float %1, float* %5
%8 = load float, float* %4
%9 = call i32 @fpclassify(float %8)
store i32 %9, i32* %6
%10 = load float, float* %5
%11 = call i32 @fpclassify(float %10)
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = load i32, i32* @FP_NAN
%14 = icmp eq i32 %12, %13
br i1 %14, label %30, label %15
15: ; preds = %2
%16 = load i32, i32* %7
%17 = load i32, i32* @FP_NAN
%18 = icmp eq i32 %16, %17
br i1 %18, label %30, label %19
19: ; preds = %15
%20 = load float, float* %5
%21 = fcmp olt float %20, 0.000000e+00
br i1 %21, label %22, label %34
22: ; preds = %19
%23 = load i32, i32* %6
%24 = load i32, i32* @FP_INFINITE
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = load i32, i32* %7
%28 = load i32, i32* @FP_INFINITE
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %34
30: ; preds = %26, %15, %2
%31 = load float, float* %4
%32 = load float, float* %5
%33 = fsub float %31, %32
store float %33, float* %3
br label %45
34: ; preds = %26, %22, %19
%35 = load float, float* %4
%36 = load float, float* %5
%37 = fcmp ole float %35, %36
br i1 %37, label %38, label %39
38: ; preds = %34
br label %43
39: ; preds = %34
%40 = load float, float* %4
%41 = load float, float* %5
%42 = fsub float %40, %41
br label %43
43: ; preds = %39, %38
%44 = phi float [ 0.000000e+00, %38 ], [ %42, %39 ]
store float %44, float* %3
br label %45
45: ; preds = %43, %30
%46 = load float, float* %3
ret float %46
}

LLVM IR (-O2):
@FP_NAN = global i32 0
@FP_INFINITE = global i32 0
define float @__fdimf(float %0, float %1) {
%3 = tail call i32 @fpclassify(float %0)
%4 = tail call i32 @fpclassify(float %1)
%5 = load i32, i32* @FP_NAN
%6 = icmp eq i32 %3, %5
%7 = icmp eq i32 %4, %5
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %16, label %9
9: ; preds = %2
%10 = fcmp olt float %1, 0.000000e+00
br i1 %10, label %11, label %18
11: ; preds = %9
%12 = load i32, i32* @FP_INFINITE
%13 = icmp eq i32 %3, %12
%14 = icmp eq i32 %4, %12
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %16, label %18
16: ; preds = %11, %2
%17 = fsub float %0, %1
br label %22
18: ; preds = %11, %9
%19 = fcmp ole float %0, %1
%20 = fsub float %0, %1
%21 = select i1 %19, float 0.000000e+00, float %20
br label %22
22: ; preds = %18, %16
%23 = phi float [ %17, %16 ], [ %21, %18 ]
ret float %23
}