#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 fabsf(int);
bool fcloseulps(float a, float b, int ulps) {
  if ((a < 0.0f) != (b < 0.0f)) {
    if (a == b) {
      return true;
    }
    return false;
  }
  int ia = *((int *)&a);
  int ib = *((int *)&b);
  return fabsf(ia - ib) <= ulps;
}


x86 assembly (clang, -O0):
<fcloseulps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
xorps  %xmm0,%xmm0
ucomiss -0xc(%rbp),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
cmp    %ecx,%eax
je     1179 <fcloseulps+0x69>
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jne    116d <fcloseulps+0x5d>
jp     116d <fcloseulps+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    119e <fcloseulps+0x8e>
movl   $0x0,-0x4(%rbp)
jmp    119e <fcloseulps+0x8e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
sub    -0x18(%rbp),%edi
call   1030 <fabsf@plt>
cmp    -0x10(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcloseulps>:
xorps  %xmm2,%xmm2
ucomiss %xmm0,%xmm2
setbe  %al
ucomiss %xmm1,%xmm2
seta   %cl
xor    %al,%cl
je     113f <fcloseulps+0x2f>
push   %rbx
mov    %edi,%ebx
movd   %xmm0,%edi
movd   %xmm1,%eax
sub    %eax,%edi
call   1030 <fabsf@plt>
cmp    %ebx,%eax
setle  %al
pop    %rbx
movzbl %al,%eax
ret
cmpeqss %xmm1,%xmm0
movd   %xmm0,%eax
and    $0x1,%eax
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @fcloseulps(float %0, float %1, i32 %2) {
%4 = alloca i32
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store float %0, float* %5
store float %1, float* %6
store i32 %2, i32* %7
%10 = load float, float* %5
%11 = fcmp olt float %10, 0.000000e+00
%12 = zext i1 %11 to i32
%13 = load float, float* %6
%14 = fcmp olt float %13, 0.000000e+00
%15 = zext i1 %14 to i32
%16 = icmp ne i32 %12, %15
br i1 %16, label %17, label %23
17: ; preds = %3
%18 = load float, float* %5
%19 = load float, float* %6
%20 = fcmp oeq float %18, %19
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 1, i32* %4
br label %35
22: ; preds = %17
store i32 0, i32* %4
br label %35
23: ; preds = %3
%24 = bitcast float* %5 to i32*
%25 = load i32, i32* %24
store i32 %25, i32* %8
%26 = bitcast float* %6 to i32*
%27 = load i32, i32* %26
store i32 %27, i32* %9
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = sub nsw i32 %28, %29
%31 = call i32 @fabsf(i32 %30)
%32 = load i32, i32* %7
%33 = icmp sle i32 %31, %32
%34 = zext i1 %33 to i32
store i32 %34, i32* %4
br label %35
35: ; preds = %23, %22, %21
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
define i32 @fcloseulps(float %0, float %1, i32 %2) {
%4 = fcmp uge float %0, 0.000000e+00
%5 = fcmp olt float %1, 0.000000e+00
%6 = xor i1 %4, %5
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = fcmp oeq float %0, %1
br label %15
9: ; preds = %3
%10 = bitcast float %0 to i32
%11 = bitcast float %1 to i32
%12 = sub nsw i32 %10, %11
%13 = tail call i32 @fabsf(i32 %12)
%14 = icmp sle i32 %13, %2
br label %15
15: ; preds = %7, %9
%16 = phi i1 [ %14, %9 ], [ %8, %7 ]
%17 = zext i1 %16 to i32
ret i32 %17
}