#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 */
typedef int /*<<< orphan*/ uint64_t;
typedef scalar_t__ n;

/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void print64(uint64_t n) {
  for (size_t bit = 1; bit <= 64; bit++) {
    char c = ((n) & (1ULL << (64 - (bit)))) ? '1' : '0';
    putchar(c);
    if (bit % 8 == 0)
      putchar(' ');
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<print64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x1,-0x10(%rbp)
cmpq   $0x40,-0x10(%rbp)
ja     1195 <print64+0x85>
movslq -0x4(%rbp),%rdx
mov    $0x40,%ecx
sub    -0x10(%rbp),%rcx
mov    $0x1,%eax
shl    %cl,%rax
and    %rax,%rdx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
and    $0x7,%rax
cmp    $0x0,%rax
jne    117f <print64+0x6f>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1184 <print64+0x74>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1123 <print64+0x13>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print64>:
push   %r15
push   %r14
push   %rbx
movslq %edi,%r14
mov    $0x1,%r15d
mov    $0x3f,%ebx
jmp    113a <print64+0x2a>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15
add    $0xffffffffffffffff,%rbx
jae    115d <print64+0x4d>
bt     %rbx,%r14
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
test   $0x7,%r15b
jne    1130 <print64+0x20>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1130 <print64+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @print64(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i8
store i32 %0, i32* %2
store i64 1, i64* %3
br label %5
5: ; preds = %27, %1
%6 = load i64, i64* %3
%7 = icmp ule i64 %6, 64
br i1 %7, label %8, label %30
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = load i64, i64* %3
%12 = sub i64 64, %11
%13 = shl i64 1, %12
%14 = and i64 %10, %13
%15 = icmp ne i64 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 49, i32 48
%18 = trunc i32 %17 to i8
store i8 %18, i8* %4
%19 = load i8, i8* %4
%20 = call i32 @putchar(i8 signext %19)
%21 = load i64, i64* %3
%22 = urem i64 %21, 8
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %8
%25 = call i32 @putchar(i8 signext 32)
br label %26
26: ; preds = %24, %8
br label %27
27: ; preds = %26
%28 = load i64, i64* %3
%29 = add i64 %28, 1
store i64 %29, i64* %3
br label %5
30: ; preds = %5
%31 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @print64(i32 %0) {
%2 = sext i32 %0 to i64
br label %5
3: ; preds = %17
%4 = tail call i32 @putchar(i8 signext 10)
ret void
5: ; preds = %1, %17
%6 = phi i64 [ 1, %1 ], [ %18, %17 ]
%7 = sub nuw nsw i64 64, %6
%8 = shl nuw i64 1, %7
%9 = and i64 %8, %2
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8 48, i8 49
%12 = tail call i32 @putchar(i8 signext %11)
%13 = and i64 %6, 7
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %5
%16 = tail call i32 @putchar(i8 signext 32)
br label %17
17: ; preds = %15, %5
%18 = add nuw nsw i64 %6, 1
%19 = icmp eq i64 %18, 65
br i1 %19, label %3, label %5
}