#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 size_t uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ putchar(char);
void print_bits(const uint8_t byte) {
  size_t j = 0;
  for (; j < 4; ++j)
    printf("%c", (byte << j) & 0x80 ? '1' : '0');
  putchar(' ');
  for (; j < 8; ++j)
    printf("%c", (byte << j) & 0x80 ? '1' : '0');
}


x86 assembly (clang, -O0):
<print_bits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x4,-0x10(%rbp)
jae    1182 <print_bits+0x62>
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
shl    %cl,%rdx
and    $0x80,%rdx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
lea    0xe97(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <print_bits+0x14>
mov    $0x20,%edi
call   1030 <putchar@plt>
cmpq   $0x8,-0x10(%rbp)
jae    11da <print_bits+0xba>
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
shl    %cl,%rdx
and    $0x80,%rdx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
lea    0xe3f(%rip),%rdi
movsbl %al,%esi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    118c <print_bits+0x6c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bits>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    %ebx,%eax
and    $0x80,%eax
cmp    $0x1,%rax
mov    $0x31,%ebp
mov    $0x31,%esi
sbb    $0x0,%esi
lea    0xeba(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %ebx,%eax
and    $0x40,%eax
cmp    $0x1,%rax
mov    $0x31,%esi
sbb    $0x0,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %ebx,%eax
and    $0x20,%eax
cmp    $0x1,%rax
mov    $0x31,%esi
sbb    $0x0,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %ebx,%eax
and    $0x10,%eax
cmp    $0x1,%rax
mov    $0x31,%esi
sbb    $0x0,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
and    $0x8,%eax
cmp    $0x1,%rax
mov    $0x31,%esi
sbb    $0x0,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %ebx,%eax
and    $0x4,%eax
cmp    $0x1,%rax
mov    $0x31,%esi
sbb    $0x0,%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    %ebx,%eax
and    $0x2,%eax
cmp    $0x1,%rax
sbb    $0x0,%ebp
mov    %r14,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
and    $0x1,%ebx
or     $0x30,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @print_bits(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
store i64 0, i64* %3
br label %4
4: ; preds = %17, %1
%5 = load i64, i64* %3
%6 = icmp ult i64 %5, 4
br i1 %6, label %7, label %20
7: ; preds = %4
%8 = load i64, i64* %2
%9 = load i64, i64* %3
%10 = shl i64 %8, %9
%11 = and i64 %10, 128
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 49, i32 48
%15 = trunc i32 %14 to i8
%16 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %15)
br label %17
17: ; preds = %7
%18 = load i64, i64* %3
%19 = add i64 %18, 1
store i64 %19, i64* %3
br label %4
20: ; preds = %4
%21 = call i32 @putchar(i8 signext 32)
br label %22
22: ; preds = %35, %20
%23 = load i64, i64* %3
%24 = icmp ult i64 %23, 8
br i1 %24, label %25, label %38
25: ; preds = %22
%26 = load i64, i64* %2
%27 = load i64, i64* %3
%28 = shl i64 %26, %27
%29 = and i64 %28, 128
%30 = icmp ne i64 %29, 0
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 49, i32 48
%33 = trunc i32 %32 to i8
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %33)
br label %35
35: ; preds = %25
%36 = load i64, i64* %3
%37 = add i64 %36, 1
store i64 %37, i64* %3
br label %22
38: ; preds = %22
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @print_bits(i64 %0) {
%2 = and i64 %0, 128
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i8 48, i8 49
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %4)
%6 = and i64 %0, 64
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i8 48, i8 49
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %8)
%10 = and i64 %0, 32
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8 48, i8 49
%13 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %12)
%14 = and i64 %0, 16
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8 48, i8 49
%17 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %16)
%18 = tail call i32 @putchar(i8 signext 32)
%19 = and i64 %0, 8
%20 = icmp eq i64 %19, 0
%21 = select i1 %20, i8 48, i8 49
%22 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %21)
%23 = and i64 %0, 4
%24 = icmp eq i64 %23, 0
%25 = select i1 %24, i8 48, i8 49
%26 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %25)
%27 = and i64 %0, 2
%28 = icmp eq i64 %27, 0
%29 = select i1 %28, i8 48, i8 49
%30 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %29)
%31 = and i64 %0, 1
%32 = icmp eq i64 %31, 0
%33 = select i1 %32, i8 48, i8 49
%34 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %33)
ret void
}