#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 *, ...);
int 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,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    119f <print_bit+0x8f>
mov    -0x1c(%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,-0xc(%rbp)
je     117a <print_bit+0x6a>
cmpl   $0x8,-0xc(%rbp)
jne    1188 <print_bit+0x78>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <print_bit+0x25>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
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 i32 @print_bit(float %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store float %0, float* %3
%7 = bitcast float* %3 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
store i32 %9, i32* %6
store i32 0, i32* %4
br label %10
10: ; preds = %30, %1
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 32
br i1 %12, label %13, label %33
13: ; preds = %10
%14 = load i32, i32* %6
%15 = and i32 -2147483648, %14
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 49, i32 48
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %13
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 8
br i1 %24, label %25, label %27
25: ; preds = %22, %13
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
%28 = load i32, i32* %6
%29 = shl i32 %28, 1
store i32 %29, i32* %6
br label %30
30: ; preds = %27
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %10
33: ; preds = %10
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @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 i32 undef
}