#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*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print2(int a) {
  int i, j;
  for (i = sizeof(a) - 1; i >= 0; i--) {
    for (j = 7; j >= 0; j--) {
      if (a & (1 << (8 * i + j)))
        printf("1");
      else
        printf("0");
    }
    printf(" ");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11a7 <print2+0x97>
movl   $0x7,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     118d <print2+0x7d>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x3,%ecx
add    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     116e <print2+0x5e>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
jmp    117a <print2+0x6a>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
jmp    117f <print2+0x6f>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <print2+0x23>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <print2+0x12>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print2>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x18,%ebx
nopw   0x0(%rax,%rax,1)
lea    0x7(%rbx),%eax
movzbl %al,%eax
bt     %eax,%ebp
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
lea    0x6(%rbx),%eax
movzbl %al,%eax
bt     %eax,%ebp
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
lea    0x5(%rbx),%eax
movzbl %al,%eax
bt     %eax,%ebp
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
lea    0x4(%rbx),%eax
movzbl %al,%eax
bt     %eax,%ebp
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
lea    0x3(%rbx),%eax
movzbl %al,%eax
bt     %eax,%ebp
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
lea    0x2(%rbx),%eax
movzbl %al,%eax
bt     %eax,%ebp
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
movzbl %al,%eax
bt     %eax,%ebp
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
bt     %ebx,%ebp
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xfffffff8,%ebx
cmp    $0xfffffff8,%ebx
jne    1120 <print2+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
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 @print2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 3, i32* %3
br label %5
5: ; preds = %31, %1
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %34
8: ; preds = %5
store i32 7, i32* %4
br label %9
9: ; preds = %26, %8
%10 = load i32, i32* %4
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %9
%13 = load i32, i32* %2
%14 = load i32, i32* %3
%15 = mul nsw i32 8, %14
%16 = load i32, i32* %4
%17 = add nsw i32 %15, %16
%18 = shl i32 1, %17
%19 = and i32 %13, %18
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %12
%22 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %25
23: ; preds = %12
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, -1
store i32 %28, i32* %4
br label %9
29: ; preds = %9
%30 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29
%32 = load i32, i32* %3
%33 = add nsw i32 %32, -1
store i32 %33, i32* %3
br label %5
34: ; preds = %5
%35 = 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 @print2(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 3, %1 ], [ %53, %2 ]
%4 = shl nsw i32 %3, 3
%5 = or i32 %4, 7
%6 = shl nuw i32 1, %5
%7 = and i32 %6, %0
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i32 48, i32 49
%10 = tail call i32 @putchar(i32 %9)
%11 = or i32 %4, 6
%12 = shl nuw i32 1, %11
%13 = and i32 %12, %0
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i32 48, i32 49
%16 = tail call i32 @putchar(i32 %15)
%17 = or i32 %4, 5
%18 = shl nuw i32 1, %17
%19 = and i32 %18, %0
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i32 48, i32 49
%22 = tail call i32 @putchar(i32 %21)
%23 = or i32 %4, 4
%24 = shl nuw i32 1, %23
%25 = and i32 %24, %0
%26 = icmp eq i32 %25, 0
%27 = select i1 %26, i32 48, i32 49
%28 = tail call i32 @putchar(i32 %27)
%29 = or i32 %4, 3
%30 = shl nuw i32 1, %29
%31 = and i32 %30, %0
%32 = icmp eq i32 %31, 0
%33 = select i1 %32, i32 48, i32 49
%34 = tail call i32 @putchar(i32 %33)
%35 = or i32 %4, 2
%36 = shl nuw i32 1, %35
%37 = and i32 %36, %0
%38 = icmp eq i32 %37, 0
%39 = select i1 %38, i32 48, i32 49
%40 = tail call i32 @putchar(i32 %39)
%41 = or i32 %4, 1
%42 = shl nuw i32 1, %41
%43 = and i32 %42, %0
%44 = icmp eq i32 %43, 0
%45 = select i1 %44, i32 48, i32 49
%46 = tail call i32 @putchar(i32 %45)
%47 = shl nuw i32 1, %4
%48 = and i32 %47, %0
%49 = icmp eq i32 %48, 0
%50 = select i1 %49, i32 48, i32 49
%51 = tail call i32 @putchar(i32 %50)
%52 = tail call i32 @putchar(i32 32)
%53 = add nsw i32 %3, -1
%54 = icmp eq i32 %3, 0
br i1 %54, label %55, label %2
55: ; preds = %2
%56 = tail call i32 @putchar(i32 10)
ret void
}