#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 *gk_vector_display_binary(unsigned int dna) {
  unsigned int chromosome = dna;
  char *buffer =
      (char *)malloc(sizeof(char) * ((sizeof(unsigned int) * 8) + 1));
  int c;
  for (c = ((sizeof(unsigned int) * 8) - 1); c >= 0; c--) {
    buffer[c] = (chromosome & 1) + '0';
    chromosome >>= 1;
  }
  buffer[(sizeof(unsigned int) * 8)] = '\0';
  return buffer;
}


x86 assembly (clang, -O0):
<gk_vector_display_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x21,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x1f,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     116d <gk_vector_display_binary+0x5d>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
add    $0x30,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <gk_vector_display_binary+0x26>
mov    -0x10(%rbp),%rax
movb   $0x0,0x20(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gk_vector_display_binary>:
push   %rbx
mov    %edi,%ebx
mov    $0x21,%edi
call   1030 <malloc@plt>
mov    $0x20,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edx
and    $0x1,%dl
or     $0x30,%dl
mov    %dl,-0x1(%rax,%rcx,1)
mov    %ebx,%edx
shr    %dl
and    $0x1,%dl
or     $0x30,%dl
mov    %dl,-0x2(%rax,%rcx,1)
mov    %ebx,%edx
shr    $0x2,%dl
and    $0x1,%dl
or     $0x30,%dl
mov    %dl,-0x3(%rax,%rcx,1)
mov    %ebx,%edx
shr    $0x3,%dl
and    $0x1,%dl
or     $0x30,%dl
mov    %dl,-0x4(%rax,%rcx,1)
shr    $0x4,%ebx
add    $0xfffffffffffffffc,%rcx
jne    1130 <gk_vector_display_binary+0x20>
movb   $0x0,0x20(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i8* @gk_vector_display_binary(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
store i32 %6, i32* %3
%7 = call i64 @malloc(i32 33)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %4
store i32 31, i32* %5
br label %9
9: ; preds = %23, %1
%10 = load i32, i32* %5
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %26
12: ; preds = %9
%13 = load i32, i32* %3
%14 = and i32 %13, 1
%15 = add i32 %14, 48
%16 = trunc i32 %15 to i8
%17 = load i8*, i8** %4
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
store i8 %16, i8* %20
%21 = load i32, i32* %3
%22 = lshr i32 %21, 1
store i32 %22, i32* %3
br label %23
23: ; preds = %12
%24 = load i32, i32* %5
%25 = add nsw i32 %24, -1
store i32 %25, i32* %5
br label %9
26: ; preds = %9
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 32
store i8 0, i8* %28
%29 = load i8*, i8** %4
ret i8* %29
}

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