#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 *);
void BitMatPrint(unsigned long long x) {
  unsigned long long mask = 0x8000000000000000LL;
  int i, j;
  for (i = 0; i < 8; i++) {
    for (j = 0; j < 8; j++) {
      if (x & mask) {
        printf("1");
      } else {
        printf("0");
      }
      mask >>= 1;
    }
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<BitMatPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movabs $0x8000000000000000,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    11af <BitMatPrint+0x9f>
movl   $0x0,-0x18(%rbp)
cmpl   $0x8,-0x18(%rbp)
jge    1195 <BitMatPrint+0x85>
mov    -0x8(%rbp),%rax
and    -0x10(%rbp),%rax
cmp    $0x0,%rax
je     116f <BitMatPrint+0x5f>
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    117b <BitMatPrint+0x6b>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1142 <BitMatPrint+0x32>
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1131 <BitMatPrint+0x21>
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BitMatPrint>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
movabs $0x8000000000000000,%rbx
mov    $0x8,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rax
and    %r14,%rax
cmp    $0x1,%rax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %rbx,%rax
shr    %rax
and    %r14,%rax
cmp    $0x1,%rax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %rbx,%rax
shr    $0x2,%rax
and    %r14,%rax
cmp    $0x1,%rax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %rbx,%rax
shr    $0x3,%rax
and    %r14,%rax
cmp    $0x1,%rax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %rbx,%rax
shr    $0x4,%rax
and    %r14,%rax
cmp    $0x1,%rax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %rbx,%rax
shr    $0x5,%rax
and    %r14,%rax
cmp    $0x1,%rax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %rbx,%rax
shr    $0x6,%rax
and    %r14,%rax
cmp    $0x1,%rax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %rbx,%rax
shr    $0x7,%rax
and    %r14,%rax
cmp    $0x1,%rax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
shr    $0x8,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1130 <BitMatPrint+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @BitMatPrint(i64 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 0, %1 ], [ %46, %2 ]
%4 = phi i64 [ -9223372036854775808, %1 ], [ %44, %2 ]
%5 = and i64 %4, %0
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i32 48, i32 49
%8 = tail call i32 @putchar(i32 %7)
%9 = lshr i64 %4, 1
%10 = and i64 %9, %0
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i32 48, i32 49
%13 = tail call i32 @putchar(i32 %12)
%14 = lshr i64 %4, 2
%15 = and i64 %14, %0
%16 = icmp eq i64 %15, 0
%17 = select i1 %16, i32 48, i32 49
%18 = tail call i32 @putchar(i32 %17)
%19 = lshr i64 %4, 3
%20 = and i64 %19, %0
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i32 48, i32 49
%23 = tail call i32 @putchar(i32 %22)
%24 = lshr i64 %4, 4
%25 = and i64 %24, %0
%26 = icmp eq i64 %25, 0
%27 = select i1 %26, i32 48, i32 49
%28 = tail call i32 @putchar(i32 %27)
%29 = lshr i64 %4, 5
%30 = and i64 %29, %0
%31 = icmp eq i64 %30, 0
%32 = select i1 %31, i32 48, i32 49
%33 = tail call i32 @putchar(i32 %32)
%34 = lshr i64 %4, 6
%35 = and i64 %34, %0
%36 = icmp eq i64 %35, 0
%37 = select i1 %36, i32 48, i32 49
%38 = tail call i32 @putchar(i32 %37)
%39 = lshr i64 %4, 7
%40 = and i64 %39, %0
%41 = icmp eq i64 %40, 0
%42 = select i1 %41, i32 48, i32 49
%43 = tail call i32 @putchar(i32 %42)
%44 = lshr i64 %4, 8
%45 = tail call i32 @putchar(i32 10)
%46 = add nuw nsw i32 %3, 1
%47 = icmp eq i32 %46, 8
br i1 %47, label %48, label %2
48: ; preds = %2
%49 = tail call i32 @putchar(i32 10)
ret void
}