#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 unsigned int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void print_float_in_bin(float printee) {
  uint32_t exploree = *((uint32_t *)&printee);
  for (int bit = (32) - 1; bit >= 0; --bit) {
    char *color = "";
    switch (bit) {
    case 31:
      color = "\E[41m";
      break;
      ;
    case 30:
      color = "\E[44m";
      break;
      ;
    case 22:
      color = "\E[45m";
      break;
      ;
    }
    fprintf(stdout, "%s%u", color, (exploree & (1U << bit)) > 0);
  }
  fprintf(stdout, "\E[m\n");
}


x86 assembly (clang, -O0):
<print_float_in_bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x1f,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     11e5 <print_float_in_bin+0xd5>
lea    0xee0(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x16,%eax
je     1195 <print_float_in_bin+0x85>
jmp    1153 <print_float_in_bin+0x43>
mov    -0x1c(%rbp),%eax
sub    $0x1e,%eax
je     1185 <print_float_in_bin+0x75>
jmp    1164 <print_float_in_bin+0x54>
mov    -0x1c(%rbp),%eax
sub    $0x1f,%eax
jne    11a0 <print_float_in_bin+0x90>
jmp    1175 <print_float_in_bin+0x65>
lea    0xe84(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11a0 <print_float_in_bin+0x90>
lea    0xe7a(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11a0 <print_float_in_bin+0x90>
lea    0xe70(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%esi
shl    %cl,%esi
mov    %esi,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
seta   %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xe42(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <print_float_in_bin+0x1a>
mov    0x2df4(%rip),%rax
mov    (%rax),%edi
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_float_in_bin>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movd   %xmm0,%ebp
mov    $0x1f,%ebx
lea    0xef0(%rip),%r15
mov    0x2eae(%rip),%r12
lea    0xed9(%rip),%r14
lea    0xec6(%rip),%r13
jmp    1171 <print_float_in_bin+0x61>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdx
mov    (%r12),%edi
mov    %ebp,%eax
mov    %ebx,%ecx
shr    %cl,%eax
and    $0x1,%eax
mov    %r14,%rsi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0xffffffff,%ebx
jae    1199 <print_float_in_bin+0x89>
cmp    $0x16,%ebx
je     1190 <print_float_in_bin+0x80>
cmp    $0x1e,%ebx
je     1150 <print_float_in_bin+0x40>
mov    %r15,%rdx
cmp    $0x1f,%ebx
jne    1153 <print_float_in_bin+0x43>
lea    0xe76(%rip),%rdx
jmp    1153 <print_float_in_bin+0x43>
nopl   0x0(%rax)
lea    0xe75(%rip),%rdx
jmp    1153 <print_float_in_bin+0x43>
mov    (%r12),%edi
lea    0xe73(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [6 x i8] c"\1B[41m\00"
@.str.2 = [6 x i8] c"\1B[44m\00"
@.str.3 = [6 x i8] c"\1B[45m\00"
@stdout = global i32 0
@.str.4 = [5 x i8] c"%s%u\00"
@.str.5 = [5 x i8] c"\1B[m\0A\00"
define void @print_float_in_bin(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store float %0, float* %2
%6 = bitcast float* %2 to i32*
%7 = load i32, i32* %6
store i32 %7, i32* %3
store i32 31, i32* %4
br label %8
8: ; preds = %26, %1
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %29
11: ; preds = %8
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %5
%12 = load i32, i32* %4
switch i32 %12, label %16 [
i32 31, label %13
i32 30, label %14
i32 22, label %15
]
13: ; preds = %11
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %16
14: ; preds = %11
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %5
br label %16
15: ; preds = %11
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %5
br label %16
16: ; preds = %11, %15, %14, %13
%17 = load i32, i32* @stdout
%18 = load i8*, i8** %5
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = shl i32 1, %20
%22 = and i32 %19, %21
%23 = icmp ugt i32 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %18, i32 %24)
br label %26
26: ; preds = %16
%27 = load i32, i32* %4
%28 = add nsw i32 %27, -1
store i32 %28, i32* %4
br label %8
29: ; preds = %8
%30 = load i32, i32* @stdout
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [6 x i8] c"\1B[41m\00"
@.str.2 = [6 x i8] c"\1B[44m\00"
@.str.3 = [6 x i8] c"\1B[45m\00"
@stdout = global i32 0
@.str.4 = [5 x i8] c"%s%u\00"
@.str.5 = [5 x i8] c"\1B[m\0A\00"
define void @print_float_in_bin(float %0) {
%2 = bitcast float %0 to i32
br label %6
3: ; preds = %11
%4 = load i32, i32* @stdout
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
ret void
6: ; preds = %1, %11
%7 = phi i32 [ 31, %1 ], [ %17, %11 ]
switch i32 %7, label %11 [
i32 31, label %8
i32 30, label %9
i32 22, label %10
]
8: ; preds = %6
br label %11
9: ; preds = %6
br label %11
10: ; preds = %6
br label %11
11: ; preds = %6, %10, %9, %8
%12 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %6 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %10 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %9 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %8 ]
%13 = load i32, i32* @stdout
%14 = lshr i32 %2, %7
%15 = and i32 %14, 1
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8* %12, i32 %15)
%17 = add nsw i32 %7, -1
%18 = icmp eq i32 %7, 0
br i1 %18, label %3, label %6
}