#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 /*<<< orphan*/ scanf(char *, float *);
void floatToBinaryPrint() {
  int i;
  union {
    char imu[4];
    float output;
  } u;
  printf("Enter a float Value: ");
  scanf("%f", &u.output);
  for (i = 0; i < 32; i++) {
    if (u.imu[i / 8] & 0x80) {
      printf("1");
    } else {
      printf("0");
    }
    u.imu[i / 8] = u.imu[i / 8] << 1;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<floatToBinaryPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rsi
lea    0xed7(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jge    11c8 <floatToBinaryPrint+0xa8>
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cltq
movsbl -0x8(%rbp,%rax,1),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1186 <floatToBinaryPrint+0x66>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
jmp    1192 <floatToBinaryPrint+0x72>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cltq
movsbl -0x8(%rbp,%rax,1),%eax
shl    $0x1,%eax
mov    %al,%cl
mov    -0x4(%rbp),%eax
mov    $0x8,%esi
cltd
idiv   %esi
cltq
mov    %cl,-0x8(%rbp,%rax,1)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114b <floatToBinaryPrint+0x2b>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<floatToBinaryPrint>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
lea    0xecf(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%r14d
shr    $0x3,%r14
xor    %edi,%edi
cmpb   $0x0,(%rsp,%r14,1)
setns  %dil
xor    $0x31,%edi
call   1030 <putchar@plt>
shlb   (%rsp,%r14,1)
add    $0x1,%ebx
cmp    $0x20,%ebx
jne    1160 <floatToBinaryPrint+0x30>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%union.anon = type { float }
@.str = [22 x i8] c"Enter a float Value: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @floatToBinaryPrint() {
%1 = alloca i32
%2 = alloca %union.anon
%3 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = bitcast %union.anon* %2 to float*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
store i32 0, i32* %1
br label %6
6: ; preds = %38, %0
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 32
br i1 %8, label %9, label %41
9: ; preds = %6
%10 = bitcast %union.anon* %2 to [4 x i8]*
%11 = load i32, i32* %1
%12 = sdiv i32 %11, 8
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = and i32 %16, 128
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %9
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %23
21: ; preds = %9
%22 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
%24 = bitcast %union.anon* %2 to [4 x i8]*
%25 = load i32, i32* %1
%26 = sdiv i32 %25, 8
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %24, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = shl i32 %30, 1
%32 = trunc i32 %31 to i8
%33 = bitcast %union.anon* %2 to [4 x i8]*
%34 = load i32, i32* %1
%35 = sdiv i32 %34, 8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [4 x i8], [4 x i8]* %33, i64 0, i64 %36
store i8 %32, i8* %37
br label %38
38: ; preds = %23
%39 = load i32, i32* %1
%40 = add nsw i32 %39, 1
store i32 %40, i32* %1
br label %6
41: ; preds = %6
%42 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%union.anon = type { float }
@.str = [22 x i8] c"Enter a float Value: \00"
@.str.1 = [3 x i8] c"%f\00"
define void @floatToBinaryPrint() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds %union.anon, %union.anon* %1, i64 0, i32 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%6 = bitcast %union.anon* %1 to [4 x i8]*
br label %7
7: ; preds = %0, %7
%8 = phi i32 [ 0, %0 ], [ %18, %7 ]
%9 = lshr i32 %8, 3
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = icmp sgt i8 %12, -1
%14 = select i1 %13, i32 48, i32 49
%15 = call i32 @putchar(i32 %14)
%16 = load i8, i8* %11
%17 = shl i8 %16, 1
store i8 %17, i8* %11
%18 = add nuw nsw i32 %8, 1
%19 = icmp eq i32 %18, 32
br i1 %19, label %20, label %7
20: ; preds = %7
%21 = call i32 @putchar(i32 10)
ret void
}