#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 *, char *);
void print_winbits(unsigned char player[9]) {
  char out[2 + (8 * 9) + 9 + 1];
  out[0] = '0';
  out[1] = 'b';
  int offset = 2;
  for (int i = 0; i < 8 * 9; i++) {
    unsigned char target_byte = (unsigned char)i / 8;
    int target_bit = i % 8;
    if (i % 8 == 0 && i > 0) {
      out[offset + i] = '-';
      offset++;
    }
    out[offset + i] = (player[target_byte] >> (7 - target_bit)) & 1 ? '1' : '0';
  }
  out[82] = '\0';
  printf("%s\n", out);
}


x86 assembly (clang, -O0):
<print_winbits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x30,-0x60(%rbp)
movb   $0x62,-0x5f(%rbp)
movl   $0x2,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
cmpl   $0x48,-0x68(%rbp)
jge    11d4 <print_winbits+0xc4>
mov    -0x68(%rbp),%eax
movzbl %al,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %al,-0x69(%rbp)
mov    -0x68(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x70(%rbp)
mov    -0x68(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    118f <print_winbits+0x7f>
cmpl   $0x0,-0x68(%rbp)
jle    118f <print_winbits+0x7f>
mov    -0x64(%rbp),%eax
add    -0x68(%rbp),%eax
cltq
movb   $0x2d,-0x60(%rbp,%rax,1)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x8(%rbp),%rax
movzbl -0x69(%rbp),%ecx
movzbl (%rax,%rcx,1),%edx
mov    $0x7,%ecx
sub    -0x70(%rbp),%ecx
sar    %cl,%edx
and    $0x1,%edx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,%cl
mov    -0x64(%rbp),%eax
add    -0x68(%rbp),%eax
cltq
mov    %cl,-0x60(%rbp,%rax,1)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1132 <print_winbits+0x22>
movb   $0x0,-0xe(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_winbits>:
sub    $0x58,%rsp
movw   $0x6230,(%rsp)
mov    $0x2,%r8d
xor    %ecx,%ecx
jmp    1155 <print_winbits+0x45>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rdi,%rdx,1),%eax
xor    $0x7,%sil
movzbl %sil,%edx
bt     %edx,%eax
mov    $0x31,%al
adc    $0xff,%al
movslq %r8d,%rdx
add    %rsp,%rdx
mov    %al,(%rcx,%rdx,1)
add    $0x1,%rcx
cmp    $0x48,%ecx
je     1178 <print_winbits+0x68>
mov    %ecx,%edx
shr    $0x3,%rdx
mov    %ecx,%esi
and    $0x7,%esi
test   %ecx,%ecx
je     1130 <print_winbits+0x20>
test   %esi,%esi
jne    1130 <print_winbits+0x20>
lea    (%rcx,%r8,1),%eax
cltq
movb   $0x2d,(%rsp,%rax,1)
add    $0x1,%r8d
jmp    1130 <print_winbits+0x20>
movb   $0x0,0x52(%rsp)
lea    0xe7c(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
add    $0x58,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @print_winbits(i8* %0) {
%2 = alloca i8*
%3 = alloca [84 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
store i8* %0, i8** %2
%8 = getelementptr inbounds [84 x i8], [84 x i8]* %3, i64 0, i64 0
store i8 48, i8* %8
%9 = getelementptr inbounds [84 x i8], [84 x i8]* %3, i64 0, i64 1
store i8 98, i8* %9
store i32 2, i32* %4
store i32 0, i32* %5
br label %10
10: ; preds = %55, %1
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 72
br i1 %12, label %13, label %58
13: ; preds = %10
%14 = load i32, i32* %5
%15 = trunc i32 %14 to i8
%16 = zext i8 %15 to i32
%17 = sdiv i32 %16, 8
%18 = trunc i32 %17 to i8
store i8 %18, i8* %6
%19 = load i32, i32* %5
%20 = srem i32 %19, 8
store i32 %20, i32* %7
%21 = load i32, i32* %5
%22 = srem i32 %21, 8
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %35
24: ; preds = %13
%25 = load i32, i32* %5
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %24
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = add nsw i32 %28, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [84 x i8], [84 x i8]* %3, i64 0, i64 %31
store i8 45, i8* %32
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 1
store i32 %34, i32* %4
br label %35
35: ; preds = %27, %24, %13
%36 = load i8*, i8** %2
%37 = load i8, i8* %6
%38 = zext i8 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = load i32, i32* %7
%43 = sub nsw i32 7, %42
%44 = ashr i32 %41, %43
%45 = and i32 %44, 1
%46 = icmp ne i32 %45, 0
%47 = zext i1 %46 to i64
%48 = select i1 %46, i32 49, i32 48
%49 = trunc i32 %48 to i8
%50 = load i32, i32* %4
%51 = load i32, i32* %5
%52 = add nsw i32 %50, %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [84 x i8], [84 x i8]* %3, i64 0, i64 %53
store i8 %49, i8* %54
br label %55
55: ; preds = %35
%56 = load i32, i32* %5
%57 = add nsw i32 %56, 1
store i32 %57, i32* %5
br label %10
58: ; preds = %10
%59 = getelementptr inbounds [84 x i8], [84 x i8]* %3, i64 0, i64 82
store i8 0, i8* %59
%60 = getelementptr inbounds [84 x i8], [84 x i8]* %3, i64 0, i64 0
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %60)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @print_winbits(i8* nocapture %0) {
%2 = alloca [84 x i8]
%3 = getelementptr inbounds [84 x i8], [84 x i8]* %2, i64 0, i64 0
store i8 48, i8* %3
%4 = getelementptr inbounds [84 x i8], [84 x i8]* %2, i64 0, i64 1
store i8 98, i8* %4
br label %8
5: ; preds = %21
%6 = getelementptr inbounds [84 x i8], [84 x i8]* %2, i64 0, i64 82
store i8 0, i8* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
8: ; preds = %1, %21
%9 = phi i32 [ 2, %1 ], [ %22, %21 ]
%10 = phi i32 [ 0, %1 ], [ %35, %21 ]
%11 = lshr i32 %10, 3
%12 = and i32 %10, 7
%13 = icmp eq i32 %12, 0
%14 = icmp ne i32 %10, 0
%15 = and i1 %14, %13
br i1 %15, label %16, label %21
16: ; preds = %8
%17 = add nsw i32 %9, %10
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [84 x i8], [84 x i8]* %2, i64 0, i64 %18
store i8 45, i8* %19
%20 = add nsw i32 %9, 1
br label %21
21: ; preds = %16, %8
%22 = phi i32 [ %20, %16 ], [ %9, %8 ]
%23 = zext i32 %11 to i64
%24 = getelementptr inbounds i8, i8* %0, i64 %23
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = xor i32 %12, 7
%28 = shl nuw i32 1, %27
%29 = and i32 %28, %26
%30 = icmp eq i32 %29, 0
%31 = select i1 %30, i8 48, i8 49
%32 = add nsw i32 %22, %10
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [84 x i8], [84 x i8]* %2, i64 0, i64 %33
store i8 %31, i8* %34
%35 = add nuw nsw i32 %10, 1
%36 = icmp eq i32 %35, 72
br i1 %36, label %5, label %8
}