#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 *, unsigned int);
void print_bits(unsigned long a) {
  unsigned int bits[64];
  for (unsigned int i = 0; i < 64; ++i)
    bits[i] = (a >> i) & 1U;
  for (int i = 63; i >= 0; --i)
    printf("%d", bits[i]);
}


x86 assembly (clang, -O0):
<print_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x114(%rbp)
cmpl   $0x40,-0x114(%rbp)
jae    116a <print_bits+0x5a>
mov    -0x8(%rbp),%rax
mov    -0x114(%rbp),%ecx
shr    %cl,%rax
and    $0x1,%rax
mov    %eax,%ecx
mov    -0x114(%rbp),%eax
mov    %ecx,-0x110(%rbp,%rax,4)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    1129 <print_bits+0x19>
movl   $0x3f,-0x118(%rbp)
cmpl   $0x0,-0x118(%rbp)
jl     11af <print_bits+0x9f>
movslq -0x118(%rbp),%rax
mov    -0x110(%rbp,%rax,4),%esi
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x118(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x118(%rbp)
jmp    1174 <print_bits+0x64>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bits>:
push   %r14
push   %rbx
sub    $0x108,%rsp
movq   %rdi,%xmm1
pshufd $0x44,%xmm1,%xmm0
movdqa %xmm1,%xmm2
psrlq  $0x2,%xmm2
movdqa %xmm0,%xmm3
psrlq  $0x3,%xmm3
movsd  %xmm2,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x1,%xmm4
movsd  %xmm1,%xmm4
shufps $0x88,%xmm3,%xmm4
movaps 0xeae(%rip),%xmm2
andps  %xmm2,%xmm4
movaps %xmm4,(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x6,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x7,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x4,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x5,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0x10(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0xa,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0xb,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x8,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x9,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0x20(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0xe,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0xf,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0xc,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0xd,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0x30(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x12,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x13,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x10,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x11,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0x40(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x16,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x17,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x14,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x15,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0x50(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x1a,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x1b,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x18,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x19,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0x60(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x1e,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x1f,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x1c,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x1d,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0x70(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x22,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x23,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x20,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x21,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0x80(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x26,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x27,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x24,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x25,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0x90(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x2a,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x2b,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x28,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x29,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0xa0(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x2e,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x2f,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x2c,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x2d,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0xb0(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x32,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x33,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x30,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x31,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0xc0(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x36,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x37,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x34,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x35,%xmm5
movsd  %xmm3,%xmm5
shufps $0x88,%xmm4,%xmm5
andps  %xmm2,%xmm5
movaps %xmm5,0xd0(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x3a,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x3b,%xmm4
movsd  %xmm3,%xmm4
movdqa %xmm1,%xmm3
psrlq  $0x38,%xmm3
movdqa %xmm0,%xmm5
psrlq  $0x39,%xmm5
movsd  %xmm3,%xmm5
packuswb %xmm4,%xmm5
pand   %xmm2,%xmm5
movdqa %xmm5,0xe0(%rsp)
movdqa %xmm1,%xmm3
psrlq  $0x3e,%xmm3
movdqa %xmm0,%xmm4
psrlq  $0x3f,%xmm4
movsd  %xmm3,%xmm4
psrlq  $0x3c,%xmm1
psrlq  $0x3d,%xmm0
movsd  %xmm1,%xmm0
packuswb %xmm4,%xmm0
pand   %xmm2,%xmm0
movdqa %xmm0,0xf0(%rsp)
mov    $0x3f,%ebx
lea    0xb4f(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffffffffffff,%rbx
jb     14d0 <print_bits+0x3c0>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @print_bits(i64 %0) {
%2 = alloca i64
%3 = alloca [64 x i32]
%4 = alloca i32
%5 = alloca i32
store i64 %0, i64* %2
store i32 0, i32* %4
br label %6
6: ; preds = %19, %1
%7 = load i32, i32* %4
%8 = icmp ult i32 %7, 64
br i1 %8, label %9, label %22
9: ; preds = %6
%10 = load i64, i64* %2
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = lshr i64 %10, %12
%14 = and i64 %13, 1
%15 = trunc i64 %14 to i32
%16 = load i32, i32* %4
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 %17
store i32 %15, i32* %18
br label %19
19: ; preds = %9
%20 = load i32, i32* %4
%21 = add i32 %20, 1
store i32 %21, i32* %4
br label %6
22: ; preds = %6
store i32 63, i32* %5
br label %23
23: ; preds = %32, %22
%24 = load i32, i32* %5
%25 = icmp sge i32 %24, 0
br i1 %25, label %26, label %35
26: ; preds = %23
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %26
%33 = load i32, i32* %5
%34 = add nsw i32 %33, -1
store i32 %34, i32* %5
br label %23
35: ; preds = %23
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @print_bits(i64 %0) {
%2 = alloca [64 x i32]
%3 = bitcast [64 x i32]* %2 to i8*
%4 = insertelement <4 x i64> poison, i64 %0, i64 0
%5 = shufflevector <4 x i64> %4, <4 x i64> poison, <4 x i32> zeroinitializer
%6 = lshr <4 x i64> %5, <i64 0, i64 1, i64 2, i64 3>
%7 = trunc <4 x i64> %6 to <4 x i32>
%8 = and <4 x i32> %7, <i32 1, i32 1, i32 1, i32 1>
%9 = bitcast [64 x i32]* %2 to <4 x i32>*
store <4 x i32> %8, <4 x i32>* %9
%10 = lshr <4 x i64> %5, <i64 4, i64 5, i64 6, i64 7>
%11 = trunc <4 x i64> %10 to <4 x i32>
%12 = and <4 x i32> %11, <i32 1, i32 1, i32 1, i32 1>
%13 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 4
%14 = bitcast i32* %13 to <4 x i32>*
store <4 x i32> %12, <4 x i32>* %14
%15 = lshr <4 x i64> %5, <i64 8, i64 9, i64 10, i64 11>
%16 = trunc <4 x i64> %15 to <4 x i32>
%17 = and <4 x i32> %16, <i32 1, i32 1, i32 1, i32 1>
%18 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 8
%19 = bitcast i32* %18 to <4 x i32>*
store <4 x i32> %17, <4 x i32>* %19
%20 = lshr <4 x i64> %5, <i64 12, i64 13, i64 14, i64 15>
%21 = trunc <4 x i64> %20 to <4 x i32>
%22 = and <4 x i32> %21, <i32 1, i32 1, i32 1, i32 1>
%23 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 12
%24 = bitcast i32* %23 to <4 x i32>*
store <4 x i32> %22, <4 x i32>* %24
%25 = lshr <4 x i64> %5, <i64 16, i64 17, i64 18, i64 19>
%26 = trunc <4 x i64> %25 to <4 x i32>
%27 = and <4 x i32> %26, <i32 1, i32 1, i32 1, i32 1>
%28 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 16
%29 = bitcast i32* %28 to <4 x i32>*
store <4 x i32> %27, <4 x i32>* %29
%30 = lshr <4 x i64> %5, <i64 20, i64 21, i64 22, i64 23>
%31 = trunc <4 x i64> %30 to <4 x i32>
%32 = and <4 x i32> %31, <i32 1, i32 1, i32 1, i32 1>
%33 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 20
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> %32, <4 x i32>* %34
%35 = lshr <4 x i64> %5, <i64 24, i64 25, i64 26, i64 27>
%36 = trunc <4 x i64> %35 to <4 x i32>
%37 = and <4 x i32> %36, <i32 1, i32 1, i32 1, i32 1>
%38 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 24
%39 = bitcast i32* %38 to <4 x i32>*
store <4 x i32> %37, <4 x i32>* %39
%40 = lshr <4 x i64> %5, <i64 28, i64 29, i64 30, i64 31>
%41 = trunc <4 x i64> %40 to <4 x i32>
%42 = and <4 x i32> %41, <i32 1, i32 1, i32 1, i32 1>
%43 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 28
%44 = bitcast i32* %43 to <4 x i32>*
store <4 x i32> %42, <4 x i32>* %44
%45 = lshr <4 x i64> %5, <i64 32, i64 33, i64 34, i64 35>
%46 = trunc <4 x i64> %45 to <4 x i32>
%47 = and <4 x i32> %46, <i32 1, i32 1, i32 1, i32 1>
%48 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 32
%49 = bitcast i32* %48 to <4 x i32>*
store <4 x i32> %47, <4 x i32>* %49
%50 = lshr <4 x i64> %5, <i64 36, i64 37, i64 38, i64 39>
%51 = trunc <4 x i64> %50 to <4 x i32>
%52 = and <4 x i32> %51, <i32 1, i32 1, i32 1, i32 1>
%53 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 36
%54 = bitcast i32* %53 to <4 x i32>*
store <4 x i32> %52, <4 x i32>* %54
%55 = lshr <4 x i64> %5, <i64 40, i64 41, i64 42, i64 43>
%56 = trunc <4 x i64> %55 to <4 x i32>
%57 = and <4 x i32> %56, <i32 1, i32 1, i32 1, i32 1>
%58 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 40
%59 = bitcast i32* %58 to <4 x i32>*
store <4 x i32> %57, <4 x i32>* %59
%60 = lshr <4 x i64> %5, <i64 44, i64 45, i64 46, i64 47>
%61 = trunc <4 x i64> %60 to <4 x i32>
%62 = and <4 x i32> %61, <i32 1, i32 1, i32 1, i32 1>
%63 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 44
%64 = bitcast i32* %63 to <4 x i32>*
store <4 x i32> %62, <4 x i32>* %64
%65 = lshr <4 x i64> %5, <i64 48, i64 49, i64 50, i64 51>
%66 = trunc <4 x i64> %65 to <4 x i32>
%67 = and <4 x i32> %66, <i32 1, i32 1, i32 1, i32 1>
%68 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 48
%69 = bitcast i32* %68 to <4 x i32>*
store <4 x i32> %67, <4 x i32>* %69
%70 = lshr <4 x i64> %5, <i64 52, i64 53, i64 54, i64 55>
%71 = trunc <4 x i64> %70 to <4 x i32>
%72 = and <4 x i32> %71, <i32 1, i32 1, i32 1, i32 1>
%73 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 52
%74 = bitcast i32* %73 to <4 x i32>*
store <4 x i32> %72, <4 x i32>* %74
%75 = lshr <4 x i64> %5, <i64 56, i64 57, i64 58, i64 59>
%76 = trunc <4 x i64> %75 to <4 x i32>
%77 = and <4 x i32> %76, <i32 1, i32 1, i32 1, i32 1>
%78 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 56
%79 = bitcast i32* %78 to <4 x i32>*
store <4 x i32> %77, <4 x i32>* %79
%80 = lshr <4 x i64> %5, <i64 60, i64 61, i64 62, i64 63>
%81 = trunc <4 x i64> %80 to <4 x i32>
%82 = and <4 x i32> %81, <i32 1, i32 1, i32 1, i32 1>
%83 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 60
%84 = bitcast i32* %83 to <4 x i32>*
store <4 x i32> %82, <4 x i32>* %84
br label %86
85: ; preds = %86
ret void
86: ; preds = %1, %86
%87 = phi i64 [ %91, %86 ], [ 63, %1 ]
%88 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 %87
%89 = load i32, i32* %88
%90 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %89)
%91 = add nsw i64 %87, -1
%92 = icmp eq i64 %87, 0
br i1 %92, label %85, label %86
}