#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 */
typedef int uint32_t;

/* Variables and functions */
int toRep32(float);
int compareResultF(float result, uint32_t expected) {
  uint32_t rep = toRep32(result);
  if (rep == expected) {
    return 0;
  } else if (expected == 0x7fc00000U) {
    if ((rep & 0x7f800000U) == 0x7f800000U && (rep & 0x7fffffU) > 0) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<compareResultF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <toRep32@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1145 <compareResultF+0x35>
movl   $0x0,-0x4(%rbp)
jmp    1193 <compareResultF+0x83>
cmpl   $0x7fc00000,-0xc(%rbp)
jne    1187 <compareResultF+0x77>
mov    -0x10(%rbp),%eax
and    $0x7f800000,%eax
cmp    $0x7f800000,%eax
jne    1182 <compareResultF+0x72>
mov    -0x10(%rbp),%eax
and    $0x7fffff,%eax
cmp    $0x0,%eax
jbe    1182 <compareResultF+0x72>
movl   $0x0,-0x4(%rbp)
jmp    1193 <compareResultF+0x83>
jmp    1187 <compareResultF+0x77>
jmp    118c <compareResultF+0x7c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareResultF>:
push   %rbx
mov    %edi,%ebx
call   1030 <toRep32@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
je     1140 <compareResultF+0x30>
xor    $0x7fc00000,%ebx
mov    %eax,%ecx
not    %ecx
and    $0x7f800000,%ecx
or     %ebx,%ecx
setne  %cl
test   $0x7fffff,%eax
sete   %al
or     %cl,%al
movzbl %al,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @compareResultF(float %0, i32 %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
store float %0, float* %4
store i32 %1, i32* %5
%7 = load float, float* %4
%8 = call i32 @toRep32(float %7)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = load i32, i32* %5
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %28
13: ; preds = %2
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 2143289344
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = load i32, i32* %6
%18 = and i32 %17, 2139095040
%19 = icmp eq i32 %18, 2139095040
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = load i32, i32* %6
%22 = and i32 %21, 8388607
%23 = icmp ugt i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 0, i32* %3
br label %28
25: ; preds = %20, %16
br label %26
26: ; preds = %25, %13
br label %27
27: ; preds = %26
store i32 1, i32* %3
br label %28
28: ; preds = %27, %24, %12
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @compareResultF(float %0, i32 %1) {
%3 = tail call i32 @toRep32(float %0)
%4 = icmp eq i32 %3, %1
br i1 %4, label %14, label %5
5: ; preds = %2
%6 = icmp ne i32 %1, 2143289344
%7 = and i32 %3, 2139095040
%8 = icmp ne i32 %7, 2139095040
%9 = select i1 %6, i1 true, i1 %8
%10 = and i32 %3, 8388607
%11 = icmp eq i32 %10, 0
%12 = select i1 %9, i1 true, i1 %11
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %5, %2
%15 = phi i32 [ 0, %2 ], [ %13, %5 ]
ret i32 %15
}