#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 print2v(void *a, int size) {
  int i, j;
  char c;
  char *p = (char *)a;
  for (i = size - 1; i >= 0; i--) {
    c = p[i];
    for (j = 7; j >= 0; j--) {
      if (c & (1 << j))
        printf("1");
      else
        printf("0");
    }
    printf(" ");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print2v>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     11be <print2v+0xae>
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x15(%rbp)
movl   $0x7,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11a4 <print2v+0x94>
movsbl -0x15(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1185 <print2v+0x75>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
jmp    1191 <print2v+0x81>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
jmp    1196 <print2v+0x86>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    114f <print2v+0x3f>
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <print2v+0x20>
lea    0xe41(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print2v>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    11f0 <print2v+0xe0>
mov    %rdi,%r14
mov    %esi,%ebx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x2(%rbx),%eax
movzbl (%r14,%rax,1),%ebp
mov    %ebp,%eax
and    $0xffffff80,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebp,%eax
and    $0x40,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebp,%eax
and    $0x20,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebp,%eax
and    $0x10,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebp,%eax
and    $0x8,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebp,%eax
and    $0x4,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebp,%eax
and    $0x2,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
and    $0x1,%ebp
or     $0x30,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbx
ja     1130 <print2v+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" \00"
@.str.3 = [2 x i8] c"\0A\00"
define void @print2v(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = load i8*, i8** %3
store i8* %9, i8** %8
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 1
store i32 %11, i32* %5
br label %12
12: ; preds = %41, %2
%13 = load i32, i32* %5
%14 = icmp sge i32 %13, 0
br i1 %14, label %15, label %44
15: ; preds = %12
%16 = load i8*, i8** %8
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
%20 = load i8, i8* %19
store i8 %20, i8* %7
store i32 7, i32* %6
br label %21
21: ; preds = %36, %15
%22 = load i32, i32* %6
%23 = icmp sge i32 %22, 0
br i1 %23, label %24, label %39
24: ; preds = %21
%25 = load i8, i8* %7
%26 = sext i8 %25 to i32
%27 = load i32, i32* %6
%28 = shl i32 1, %27
%29 = and i32 %26, %28
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %24
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %35
33: ; preds = %24
%34 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %33, %31
br label %36
36: ; preds = %35
%37 = load i32, i32* %6
%38 = add nsw i32 %37, -1
store i32 %38, i32* %6
br label %21
39: ; preds = %21
%40 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %41
41: ; preds = %39
%42 = load i32, i32* %5
%43 = add nsw i32 %42, -1
store i32 %43, i32* %5
br label %12
44: ; preds = %12
%45 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

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