#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 *__print_binary(unsigned data) {
  int i;
  int bit_size = sizeof(unsigned) * 8;
  char *str = (char *)malloc(bit_size + 1);
  char *p = str;
  for (i = bit_size - 1; i >= 0; i--) {
    if (data & (1 << i))
      *p++ = '1';
    else
      *p++ = '0';
  }
  *p = '\0';
  return str;
}


x86 assembly (clang, -O0):
<__print_binary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x20,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11a2 <__print_binary+0x92>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     117d <__print_binary+0x6d>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x31,(%rax)
jmp    118f <__print_binary+0x7f>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x30,(%rax)
jmp    1194 <__print_binary+0x84>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <__print_binary+0x32>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__print_binary>:
push   %rbx
mov    %edi,%ebx
mov    $0x21,%edi
call   1030 <malloc@plt>
movd   %ebx,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqa 0xed2(%rip),%xmm2
pand   %xmm0,%xmm2
movdqa 0xed6(%rip),%xmm3
pand   %xmm0,%xmm3
movdqa 0xeda(%rip),%xmm4
pand   %xmm0,%xmm4
movdqa 0xede(%rip),%xmm5
pand   %xmm0,%xmm5
pxor   %xmm1,%xmm1
pcmpeqd %xmm1,%xmm5
pcmpeqd %xmm1,%xmm4
packssdw %xmm5,%xmm4
pcmpeqd %xmm1,%xmm3
pcmpeqd %xmm1,%xmm2
packssdw %xmm3,%xmm2
packsswb %xmm4,%xmm2
movdqa 0xec2(%rip),%xmm3
paddb  %xmm3,%xmm2
movdqu %xmm2,(%rax)
movdqa 0xec2(%rip),%xmm2
pand   %xmm0,%xmm2
movdqa 0xec6(%rip),%xmm4
pand   %xmm0,%xmm4
movdqa 0xeca(%rip),%xmm5
pand   %xmm0,%xmm5
pand   0xece(%rip),%xmm0
pcmpeqd %xmm1,%xmm0
pcmpeqd %xmm1,%xmm5
packssdw %xmm0,%xmm5
pcmpeqd %xmm1,%xmm4
pcmpeqd %xmm1,%xmm2
packssdw %xmm4,%xmm2
packsswb %xmm5,%xmm2
paddb  %xmm3,%xmm2
movdqu %xmm2,0x10(%rax)
movb   $0x0,0x20(%rax)
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @__print_binary(i32 %0) {
%2 = tail call i64 @malloc(i32 33)
%3 = inttoptr i64 %2 to i8*
%4 = insertelement <16 x i32> poison, i32 %0, i64 0
%5 = shufflevector <16 x i32> %4, <16 x i32> poison, <16 x i32> zeroinitializer
%6 = and <16 x i32> %5, <i32 -2147483648, i32 1073741824, i32 536870912, i32 268435456, i32 134217728, i32 67108864, i32 33554432, i32 16777216, i32 8388608, i32 4194304, i32 2097152, i32 1048576, i32 524288, i32 262144, i32 131072, i32 65536>
%7 = icmp eq <16 x i32> %6, zeroinitializer
%8 = select <16 x i1> %7, <16 x i8> <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>, <16 x i8> <i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49>
%9 = inttoptr i64 %2 to <16 x i8>*
store <16 x i8> %8, <16 x i8>* %9
%10 = getelementptr i8, i8* %3, i64 16
%11 = and <16 x i32> %5, <i32 32768, i32 16384, i32 8192, i32 4096, i32 2048, i32 1024, i32 512, i32 256, i32 128, i32 64, i32 32, i32 16, i32 8, i32 4, i32 2, i32 1>
%12 = icmp eq <16 x i32> %11, zeroinitializer
%13 = select <16 x i1> %12, <16 x i8> <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>, <16 x i8> <i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49, i8 49>
%14 = bitcast i8* %10 to <16 x i8>*
store <16 x i8> %13, <16 x i8>* %14
%15 = getelementptr i8, i8* %3, i64 32
store i8 0, i8* %15
ret i8* %3
}