#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 f2u(float);
unsigned int float_i2f(int);
int /*<<< orphan*/ printf(char *, unsigned int, int, unsigned int);
int main(void) {
  float f;
  unsigned u, t;
  int i = INT_MIN;
  do {
    f = (float)i;
    u = f2u(f);
    t = float_i2f(i);
    if (u != t)
      printf("BAD: 0x%X, 0x%X, 0x%X\n", t, i, 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)
cvtsi2ssl -0x14(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <f2u@plt>
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <float_i2f@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     118e <main+0x5e>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
jmp    1193 <main+0x63>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
mov    0x2e43(%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     1183 <main+0x53>
xorps  %xmm0,%xmm0
cvtsi2ss %ebx,%xmm0
call   1040 <f2u@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1050 <float_i2f@plt>
cmp    %eax,%ebp
je     1150 <main+0x20>
mov    %r14,%rdi
mov    %eax,%esi
mov    %ebx,%edx
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 = [23 x i8] c"BAD: 0x%X, 0x%X, 0x%X\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 = sitofp i32 %8 to float
store float %9, float* %2
%10 = load float, float* %2
%11 = call i32 @f2u(float %10)
store i32 %11, i32* %3
%12 = load i32, i32* %5
%13 = call i32 @float_i2f(i32 %12)
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* %4
%19 = load i32, i32* %5
%20 = load i32, i32* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 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 = [23 x i8] c"BAD: 0x%X, 0x%X, 0x%X\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 = sitofp i32 %3 to float
%5 = tail call i32 @f2u(float %4)
%6 = tail call i32 @float_i2f(i32 %3)
%7 = icmp eq i32 %5, %6
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %3, i32 %5)
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
}