#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 binprint(const void *_str, size_t len) {
  size_t i;
  const char *str = _str;
  printf("\t;; ");
  for (i = 0; i < len; i++) {
    printf("%d%d%d%d%d%d%d%d ", (str[i] & 0xFF) & 0x80 ? 1 : 0,
           (str[i] & 0xFF) & 0x40 ? 1 : 0, (str[i] & 0xFF) & 0x20 ? 1 : 0,
           (str[i] & 0xFF) & 0x10 ? 1 : 0, (str[i] & 0xFF) & 0x08 ? 1 : 0,
           (str[i] & 0xFF) & 0x04 ? 1 : 0, (str[i] & 0xFF) & 0x02 ? 1 : 0,
           (str[i] & 0xFF) & 0x01 ? 1 : 0);
    if ((i + 1) % 3 == 0)
      printf(" ");
    if ((i + 1) % 6 == 0 && i + 1 < len)
      printf("\n\t;; ");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<binprint>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x38,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    12ff <binprint+0x1ef>
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
and    $0xff,%ecx
and    $0x80,%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
and    $0xff,%ecx
and    $0x40,%ecx
xor    %edx,%edx
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
and    $0xff,%edi
and    $0x20,%edi
xor    %ecx,%ecx
mov    $0x1,%eax
cmp    $0x0,%edi
cmovne %eax,%ecx
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rdi
movsbl (%rax,%rdi,1),%edi
and    $0xff,%edi
and    $0x10,%edi
xor    %r8d,%r8d
mov    $0x1,%eax
cmp    $0x0,%edi
cmovne %eax,%r8d
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rdi
movsbl (%rax,%rdi,1),%edi
and    $0xff,%edi
and    $0x8,%edi
xor    %r9d,%r9d
mov    $0x1,%eax
cmp    $0x0,%edi
cmovne %eax,%r9d
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rdi
movsbl (%rax,%rdi,1),%edi
and    $0xff,%edi
and    $0x4,%edi
xor    %r11d,%r11d
mov    $0x1,%eax
cmp    $0x0,%edi
cmovne %eax,%r11d
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rdi
movsbl (%rax,%rdi,1),%edi
and    $0xff,%edi
and    $0x2,%edi
xor    %r10d,%r10d
mov    $0x1,%eax
cmp    $0x0,%edi
cmovne %eax,%r10d
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rdi
movsbl (%rax,%rdi,1),%ebx
and    $0xff,%ebx
and    $0x1,%ebx
xor    %eax,%eax
mov    $0x1,%edi
cmp    $0x0,%ebx
cmovne %edi,%eax
lea    0xd91(%rip),%rdi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    $0x3,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    12ad <binprint+0x19d>
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    $0x6,%ecx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    12e9 <binprint+0x1d9>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
cmp    -0x18(%rbp),%rax
jae    12e9 <binprint+0x1d9>
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12ee <binprint+0x1de>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113f <binprint+0x2f>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<binprint>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,0x10(%rsp)
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,0x8(%rsp)
test   %rbx,%rbx
je     124f <binprint+0x12f>
mov    0x8(%rsp),%r15
neg    %r15
mov    $0x1,%r13d
jmp    1186 <binprint+0x66>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    (%r15,%r13,1),%rax
add    $0x1,%rax
add    $0x1,%r13
cmp    $0x1,%rax
je     124f <binprint+0x12f>
mov    %r13,%rax
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mul    %rcx
mov    %rdx,%r14
shr    %r14
lea    (%r14,%r14,2),%r12
mov    0x10(%rsp),%rax
movzbl -0x1(%rax,%r13,1),%ebp
mov    %ebp,%esi
shr    $0x7,%esi
mov    %ebp,%edx
shr    $0x6,%edx
and    $0x1,%edx
mov    %ebp,%ecx
shr    $0x5,%ecx
and    $0x1,%ecx
mov    %ebp,%r8d
shr    $0x4,%r8d
and    $0x1,%r8d
mov    %ebp,%r9d
shr    $0x3,%r9d
and    $0x1,%r9d
mov    %ebp,%r10d
shr    $0x2,%r10d
and    $0x1,%r10d
mov    %ebp,%ebx
shr    %ebx
and    $0x1,%ebx
and    $0x1,%ebp
sub    $0x8,%rsp
lea    0xe0a(%rip),%rdi
xor    %eax,%eax
push   %rbp
push   %rbx
push   %r10
call   1040 <printf@plt>
add    $0x20,%rsp
cmp    %r12,%r13
jne    1214 <binprint+0xf4>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmp    0x8(%rsp),%r13
jae    1170 <binprint+0x50>
and    $0xfffffffffffffffe,%r14
lea    (%r14,%r14,2),%rax
mov    $0x1,%ecx
sub    %rax,%rcx
add    %r13,%rcx
cmp    $0x1,%rcx
jne    1170 <binprint+0x50>
lea    0xdcf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <binprint+0x50>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\09;; \00"
@.str.1 = [18 x i8] c"%d%d%d%d%d%d%d%d \00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [6 x i8] c"\0A\09;; \00"
@.str.4 = [2 x i8] c"\0A\00"
define void @binprint(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = load i8*, i8** %3
store i8* %7, i8** %6
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %5
br label %9
9: ; preds = %114, %2
%10 = load i64, i64* %5
%11 = load i64, i64* %4
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %117
13: ; preds = %9
%14 = load i8*, i8** %6
%15 = load i64, i64* %5
%16 = getelementptr inbounds i8, i8* %14, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = and i32 %18, 255
%20 = and i32 %19, 128
%21 = icmp ne i32 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i32 1, i32 0
%24 = load i8*, i8** %6
%25 = load i64, i64* %5
%26 = getelementptr inbounds i8, i8* %24, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = and i32 %28, 255
%30 = and i32 %29, 64
%31 = icmp ne i32 %30, 0
%32 = zext i1 %31 to i64
%33 = select i1 %31, i32 1, i32 0
%34 = load i8*, i8** %6
%35 = load i64, i64* %5
%36 = getelementptr inbounds i8, i8* %34, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = and i32 %38, 255
%40 = and i32 %39, 32
%41 = icmp ne i32 %40, 0
%42 = zext i1 %41 to i64
%43 = select i1 %41, i32 1, i32 0
%44 = load i8*, i8** %6
%45 = load i64, i64* %5
%46 = getelementptr inbounds i8, i8* %44, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = and i32 %48, 255
%50 = and i32 %49, 16
%51 = icmp ne i32 %50, 0
%52 = zext i1 %51 to i64
%53 = select i1 %51, i32 1, i32 0
%54 = load i8*, i8** %6
%55 = load i64, i64* %5
%56 = getelementptr inbounds i8, i8* %54, i64 %55
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = and i32 %58, 255
%60 = and i32 %59, 8
%61 = icmp ne i32 %60, 0
%62 = zext i1 %61 to i64
%63 = select i1 %61, i32 1, i32 0
%64 = load i8*, i8** %6
%65 = load i64, i64* %5
%66 = getelementptr inbounds i8, i8* %64, i64 %65
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = and i32 %68, 255
%70 = and i32 %69, 4
%71 = icmp ne i32 %70, 0
%72 = zext i1 %71 to i64
%73 = select i1 %71, i32 1, i32 0
%74 = load i8*, i8** %6
%75 = load i64, i64* %5
%76 = getelementptr inbounds i8, i8* %74, i64 %75
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = and i32 %78, 255
%80 = and i32 %79, 2
%81 = icmp ne i32 %80, 0
%82 = zext i1 %81 to i64
%83 = select i1 %81, i32 1, i32 0
%84 = load i8*, i8** %6
%85 = load i64, i64* %5
%86 = getelementptr inbounds i8, i8* %84, i64 %85
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = and i32 %88, 255
%90 = and i32 %89, 1
%91 = icmp ne i32 %90, 0
%92 = zext i1 %91 to i64
%93 = select i1 %91, i32 1, i32 0
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %33, i32 %43, i32 %53, i32 %63, i32 %73, i32 %83, i32 %93)
%95 = load i64, i64* %5
%96 = add i64 %95, 1
%97 = urem i64 %96, 3
%98 = icmp eq i64 %97, 0
br i1 %98, label %99, label %101
99: ; preds = %13
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %101
101: ; preds = %99, %13
%102 = load i64, i64* %5
%103 = add i64 %102, 1
%104 = urem i64 %103, 6
%105 = icmp eq i64 %104, 0
br i1 %105, label %106, label %113
106: ; preds = %101
%107 = load i64, i64* %5
%108 = add i64 %107, 1
%109 = load i64, i64* %4
%110 = icmp ult i64 %108, %109
br i1 %110, label %111, label %113
111: ; preds = %106
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %113
113: ; preds = %111, %106, %101
br label %114
114: ; preds = %113
%115 = load i64, i64* %5
%116 = add i64 %115, 1
store i64 %116, i64* %5
br label %9
117: ; preds = %9
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\09;; \00"
@.str.1 = [18 x i8] c"%d%d%d%d%d%d%d%d \00"
@.str.3 = [6 x i8] c"\0A\09;; \00"
define void @binprint(i8* nocapture %0, i64 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %1, 0
br i1 %4, label %39, label %5
5: ; preds = %2, %37
%6 = phi i64 [ %25, %37 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = lshr i32 %9, 7
%11 = lshr i32 %9, 6
%12 = and i32 %11, 1
%13 = lshr i32 %9, 5
%14 = and i32 %13, 1
%15 = lshr i32 %9, 4
%16 = and i32 %15, 1
%17 = lshr i32 %9, 3
%18 = and i32 %17, 1
%19 = lshr i32 %9, 2
%20 = and i32 %19, 1
%21 = lshr i32 %9, 1
%22 = and i32 %21, 1
%23 = and i32 %9, 1
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %12, i32 %14, i32 %16, i32 %18, i32 %20, i32 %22, i32 %23)
%25 = add nuw i64 %6, 1
%26 = urem i64 %25, 3
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %5
%29 = tail call i32 @putchar(i32 32)
br label %30
30: ; preds = %28, %5
%31 = urem i64 %25, 6
%32 = icmp eq i64 %31, 0
%33 = icmp ult i64 %25, %1
%34 = and i1 %33, %32
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %30, %35
%38 = icmp eq i64 %25, %1
br i1 %38, label %39, label %5
39: ; preds = %37, %2
%40 = tail call i32 @putchar(i32 10)
ret void
}