#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 /*<<< orphan*/ INT_MAX;
int INT_MIN;
unsigned int float_f2i(int);
int /*<<< orphan*/ printf(char *, int, unsigned int, unsigned int);
float u2f(int);
int main(void) {
  float f;
  unsigned u, t;
  int i = INT_MIN;
  do {
    u = float_f2i(i);
    f = u2f(i);
    t = (int)f;
    if (u != t)
      printf("0x%08X: [GOOD: 0x%08X] [BAD: 0x%08X]\n", i, t, u);
  } while (i++ != INT_MAX);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <float_f2i@plt>
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <u2f@plt>
movss  %xmm0,-0x8(%rbp)
cvttss2si -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     118c <main+0x5c>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
jmp    1191 <main+0x61>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
mov    0x2e45(%rip),%rcx
cmp    (%rcx),%eax
jne    114b <main+0x1b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2ea2(%rip),%rax
mov    (%rax),%ebx
mov    0x2ea1(%rip),%r15
lea    0xeb2(%rip),%r14
jmp    115a <main+0x2a>
lea    0x1(%rbx),%eax
cmp    (%r15),%ebx
mov    %eax,%ebx
je     1180 <main+0x50>
mov    %ebx,%edi
call   1050 <float_f2i@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <u2f@plt>
cvttss2si %xmm0,%edx
cmp    %edx,%ebp
je     1150 <main+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%ecx
call   1030 <printf@plt>
jmp    1150 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
@.str = [38 x i8] c"0x%08X: [GOOD: 0x%08X] [BAD: 0x%08X]\0A\00"
@INT_MAX = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = load i32, i32* @INT_MIN
store i32 %6, i32* %5
br label %7
7: ; preds = %23, %0
%8 = load i32, i32* %5
%9 = call i32 @float_f2i(i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %5
%11 = call float @u2f(i32 %10)
store float %11, float* %2
%12 = load float, float* %2
%13 = fptosi float %12 to i32
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %22
17: ; preds = %7
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = load i32, i32* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %19, i32 %20)
br label %22
22: ; preds = %17, %7
br label %23
23: ; preds = %22
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
%26 = load i32, i32* @INT_MAX
%27 = icmp ne i32 %24, %26
br i1 %27, label %7, label %28
28: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
@INT_MIN = global i32 0
@.str = [38 x i8] c"0x%08X: [GOOD: 0x%08X] [BAD: 0x%08X]\0A\00"
@INT_MAX = global i32 0
define i32 @main() {
%1 = load i32, i32* @INT_MIN
br label %2
2: ; preds = %10, %0
%3 = phi i32 [ %1, %0 ], [ %11, %10 ]
%4 = tail call i32 @float_f2i(i32 %3)
%5 = tail call float @u2f(i32 %3)
%6 = fptosi float %5 to i32
%7 = icmp eq i32 %4, %6
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %6, i32 %4)
br label %10
10: ; preds = %2, %8
%11 = add nsw i32 %3, 1
%12 = load i32, i32* @INT_MAX
%13 = icmp eq i32 %3, %12
br i1 %13, label %14, label %2
14: ; preds = %10
ret i32 0
}