#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*/ printf(char *, ...);
void print_bit(float f) {
  int i;
  unsigned int *j = ((unsigned int *)&f);
  unsigned int s = *j;
  for (i = 0; i < 32; i++) {
    printf("%c", ((0x80000000) & s) ? '1' : '0');
    if (i == 0 || i == 8)
      printf(" ");
    s = s << 1;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    119f <print_bit+0x8f>
mov    -0x14(%rbp),%ecx
and    $0x80000000,%ecx
mov    $0x30,%esi
mov    $0x31,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     117a <print_bit+0x6a>
cmpl   $0x8,-0x8(%rbp)
jne    1188 <print_bit+0x78>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <print_bit+0x25>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bit>:
push   %rbp
push   %rbx
push   %rax
movd   %xmm0,%ebx
xor    %ebp,%ebp
jmp    112a <print_bit+0x1a>
nopl   0x0(%rax,%rax,1)
add    %ebx,%ebx
add    $0x1,%ebp
cmp    $0x20,%ebp
je     114b <print_bit+0x3b>
mov    %ebx,%edi
shr    $0x1f,%edi
or     $0x30,%edi
call   1030 <putchar@plt>
test   $0x7ffffff7,%ebp
jne    1120 <print_bit+0x10>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1120 <print_bit+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @print_bit(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store float %0, float* %2
%6 = bitcast float* %2 to i32*
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
store i32 %8, i32* %5
store i32 0, i32* %3
br label %9
9: ; preds = %29, %1
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 32
br i1 %11, label %12, label %32
12: ; preds = %9
%13 = load i32, i32* %5
%14 = and i32 -2147483648, %13
%15 = icmp ne i32 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 49, i32 48
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %12
%22 = load i32, i32* %3
%23 = icmp eq i32 %22, 8
br i1 %23, label %24, label %26
24: ; preds = %21, %12
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %21
%27 = load i32, i32* %5
%28 = shl i32 %27, 1
store i32 %28, i32* %5
br label %29
29: ; preds = %26
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %9
32: ; preds = %9
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @print_bit(float %0) {
%2 = bitcast float %0 to i32
br label %3
3: ; preds = %1, %13
%4 = phi i32 [ %2, %1 ], [ %14, %13 ]
%5 = phi i32 [ 0, %1 ], [ %15, %13 ]
%6 = icmp sgt i32 %4, -1
%7 = select i1 %6, i32 48, i32 49
%8 = tail call i32 @putchar(i32 %7)
%9 = and i32 %5, 2147483639
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = tail call i32 @putchar(i32 32)
br label %13
13: ; preds = %3, %11
%14 = shl i32 %4, 1
%15 = add nuw nsw i32 %5, 1
%16 = icmp eq i32 %15, 32
br i1 %16, label %17, label %3
17: ; preds = %13
%18 = tail call i32 @putchar(i32 10)
ret void
}