#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 */
scalar_t__ malloc(int);
char *get_bits_float(float f) {
  int num_of_bits = sizeof(float) * 8;
  char *bits_of_numbers = (char *)malloc(num_of_bits + 1);
  int p = *((int *)(&f));
  short bit;
  int i;
  for (i = 0; i < sizeof(float) * 8; i++) {
    bit = p & 1;
    bits_of_numbers[num_of_bits - i - 1] = '0' + bit;
    p = p >> 1;
  }
  bits_of_numbers[num_of_bits] = '\0';
  return bits_of_numbers;
}


x86 assembly (clang, -O0):
<get_bits_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movl   $0x20,-0x8(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x20,%rax
jae    118b <get_bits_float+0x7b>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
mov    %ax,-0x16(%rbp)
movswl -0x16(%rbp),%eax
add    $0x30,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1140 <get_bits_float+0x30>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bits_float>:
push   %rax
movss  %xmm0,0x4(%rsp)
mov    $0x21,%edi
call   1030 <malloc@plt>
movd   0x4(%rsp),%xmm0
movd   %xmm0,%esi
mov    $0x20,%edx
mov    %esi,%ecx
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,-0x1(%rax,%rdx,1)
mov    %esi,%ecx
shr    %cl
and    $0x1,%cl
or     $0x30,%cl
mov    %cl,-0x2(%rax,%rdx,1)
sar    $0x2,%esi
add    $0xfffffffffffffffe,%rdx
jne    1130 <get_bits_float+0x20>
movb   $0x0,0x20(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define i8* @get_bits_float(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i16
%7 = alloca i32
store float %0, float* %2
store i32 32, i32* %3
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %4
%12 = bitcast float* %2 to i32*
%13 = load i32, i32* %12
store i32 %13, i32* %5
store i32 0, i32* %7
br label %14
14: ; preds = %35, %1
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = icmp ult i64 %16, 32
br i1 %17, label %18, label %38
18: ; preds = %14
%19 = load i32, i32* %5
%20 = and i32 %19, 1
%21 = trunc i32 %20 to i16
store i16 %21, i16* %6
%22 = load i16, i16* %6
%23 = sext i16 %22 to i32
%24 = add nsw i32 48, %23
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %4
%27 = load i32, i32* %3
%28 = load i32, i32* %7
%29 = sub nsw i32 %27, %28
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %26, i64 %31
store i8 %25, i8* %32
%33 = load i32, i32* %5
%34 = ashr i32 %33, 1
store i32 %34, i32* %5
br label %35
35: ; preds = %18
%36 = load i32, i32* %7
%37 = add nsw i32 %36, 1
store i32 %37, i32* %7
br label %14
38: ; preds = %14
%39 = load i8*, i8** %4
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
store i8 0, i8* %42
%43 = load i8*, i8** %4
ret i8* %43
}

LLVM IR (-O2):
define i8* @get_bits_float(float %0) {
%2 = tail call i64 @malloc(i32 33)
%3 = inttoptr i64 %2 to i8*
%4 = bitcast float %0 to i32
br label %5
5: ; preds = %5, %1
%6 = phi i64 [ 0, %1 ], [ %20, %5 ]
%7 = phi i32 [ %4, %1 ], [ %19, %5 ]
%8 = trunc i32 %7 to i8
%9 = and i8 %8, 1
%10 = or i8 %9, 48
%11 = sub nuw nsw i64 31, %6
%12 = getelementptr inbounds i8, i8* %3, i64 %11
store i8 %10, i8* %12
%13 = trunc i32 %7 to i8
%14 = lshr i8 %13, 1
%15 = and i8 %14, 1
%16 = or i8 %15, 48
%17 = sub nsw i64 30, %6
%18 = getelementptr inbounds i8, i8* %3, i64 %17
store i8 %16, i8* %18
%19 = ashr i32 %7, 2
%20 = add nuw nsw i64 %6, 2
%21 = icmp eq i64 %20, 32
br i1 %21, label %22, label %5
22: ; preds = %5
%23 = getelementptr inbounds i8, i8* %3, i64 32
store i8 0, i8* %23
ret i8* %3
}